0 not similar to 0

As image shown below,
I’m using Dot Product to check if curves are parallel to XY plane.
The index 69 is 0 but the similarity check is False, any idea?

Thanks.

00.gh (15.9 KB)

First of all there is a simpler way to check if vectors are not parallel to xy.
Second it must be a rounding error. You might have a non zero value in the 12th decimal so the number is not zero but it appears so in the panel.


erase.gh (13.8 KB)

@anikolo
What I’m curious is even I use “similarity” and threshold to 0.1 it still appears as s false.

What’s 0.1 % of 0 ???

I would calculate the dot product and verify if a vector is parallel to another vector.

15 % of 1 includes 0.853377

00.gh (19.2 KB)

1 Like

Dot product should be the used method. Agree 100%

1 Like

Rather than calculating if a vector is parallel to a direction, it should calculate if it is perpendicular to the the plane.

1 Like

A solution that gives a truer result and only measures 0 or 1 of the dot product. If parallel, dot product is 0, if not parallel dot product is 1. The reason the similar method doesn’t work 100% of the time has to do with document tolerance I believe.

Use the ceiling function. However, when testing this with your curves, 69 is still showing wrong.

You should try to figure out why your curve is truly not parallel to the plane. Are they reference curves? I baked the curves and set the points of that curve to be of equidistance from the plane then tried the solution again and this time without error with 100% of the parallel curves testing as parallel.

That curve has more than two control points.

Didn’t check that, but they should still be set to be the same distance at the source if possible.