Points equal but distance is not larger or less?
-
` pt1 = Geom::Point3d.new(-1473.34, -1459.58, 803.961)
pt3 = Geom::Point3d.new(-1473.34, -1459.58, 803.96)pt1 == pt3
truept1.distance(pt3)
0.000999999999976353pt1.distance(pt3) > 0.001
falsept1.distance(pt3) < 0.001
false`

-
Ah! Because it was comparing Length classes - which has SU's tolerance builtin.
This works as expected:
pt1.distance(pt3).to_f < 0.001 true pt1.distance(pt3).to_f > 0.001 falseI wanted to compare to point with a higher tolerance than SU's tolerance.
So either I must convert to float - yet another operation, or I do:
pt1.distance(pt3) <= 0.002 -
Sure you know this, but if you're comparing distances rather than interested in the absolute distance, the fastest way will be to project a vector onto itself using scalar product.
p1.dot(p1) < p2.dot(p2)Adam
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement