Nearest Point operator

Not sure if this is a bug or if I am misunderstanding the function, but the Nearest point operator is sometimes returning negative values for the distance.
This seems like a bug to me.

Nope, it is a feature. Just use Abs if you don’t want the sign.

The Distance output is actually “SignedDistance” (we have that channel in Krakatoa PRT Volume, but we didn’t want a name that long as socket title).
The sign denotes whether the distance was measured to the front or to the back of the face, so it can be used as a cheap way to determine Inside/Outside for convex meshes. If your Lookup Point is inside a mesh, the Distance will be negative. If the point is outside the mesh, the distance will be positive. Note that the InVolume operator performs a much more rigorous test, but it handles concave meshes much better.

Also note that if you are using IntersectRay and the Ray Direction input is NOT normalized, the Distance output will be scaled by the length of the Ray Direction vector. Same rules apply regarding the SignedDistance.

If you are getting a negative Distance and the Lookup Point is positively (pun intended) outside of the mesh, please upload an example.

Thanks for the info Bobo - I figured something like this might be the case.

Added to the FAQ, will illustrate with more examples tomorrow. Thanks for asking! :smiley: