Error in finding the closest point to a curve

In the example file attached here, my workflow finds point 590 to be the one closest to the curve, which should be point 595, as shown below.

May I ask what is the source of error in my workflow? or, how to adjust this workflow to find the closest point to a curve correctly?

Thanks.

error_finding_the_cloesest_point_to_a_curve.gh (58.2 KB)

1 Like

It would only be 595, if the points were first projected to the XY plane. 595 is further away because of its Z value.

Thanks, @Adam_M I didn’t notice that the points are not on the same plane.