[BUG] Equality Component when interact with Curve Closest Point Component

Hi there,

I am reporting a bug here although it might not be used very often.

It happens once the Equality Component interacts with Curve Closest Point Component.

I enclose a screenshot and a .gh file for a detailed explanation.


[BUG] Equality Component.gh (19.6 KB)


The following is what this script for.

Objective: Find out the interior curves

Steps:
1#Create the exterior curve
2#Find all the mid points of the curves
3#if the mid points on the curve, then it is curve inside the exterior curve.

BUG:
So to determine if the mid points are on the curve, I can either
a#use the Distance output from Curve Closest Point Component. If it is 0, then cull that curve. The BUG happens here. :x: :x:
b#use Point/Region relationship from Point In Curve. This works. :white_check_mark: :white_check_mark:

Instead of equality, compare distance to a value (like 0.01 for example) and assume “equality” = D < 0.01.

1 Like

IsEqual_2020Oct24a2
IsEqual_2020Oct24a
IsEqual_2020Oct24a.gh (4.5 KB)

1 Like

In case you want to understand why this happens check https://en.wikipedia.org/wiki/Floating-point_arithmetic.

And still my favorite post regarding this topic on this forum is

thx for the solution!

Thanks! I love this explanation behind the scene! thx!!!