Points and Vectors equality test

Recently I had the problem testing a set of points and now I´m having the same case with vectors. It consists in the equality operator == for both. I´m comparing a a couple of sets whose numbers of decimals are 6. I can see in the screen the same values of theirs components (x,y,z - points and vectors) but the “==” test result is “false”. I solved this with Math.Round to 4 decimals for each component value and “and - &&” operator for those values.

There is a straight way? seems this is a very simple operation of comparing numbers but… thank you

Hi @jptrujillol,

The joys of floating point programming…

You might considering using Point3d.EpsilonEquals. There is an equivalent method on Vector3d.

Use your favorite epsilon, RhinoMath.ZeroTolerance would be a good start.

– Dale

1 Like

Until now, I didn´t know the mathematical concept of espsilon. Thank you.
My favorite epsilon for now is the only I know.
Works good.