Genome
RSS< Twitter< etc

<< Back to FAQ Index

Why Is The Distance Signed?

 

When using the NeatestPoint and IntersectRay operators from the Objects category, the Distance output can sometimes produce a negative sign. 

This is not a bug, but a feature - the Distance is actually a SignedDistance value which uses the sign to denote whether the Nearest/Intersection Point is being "seen" from the front (positive) or the back side (negative) from the Lookup Point. 

This can be used as a quick way to determine to a certain extent whether the Lookup Point is inside or outside the mesh (at least for convex meshes). A dedicated InVolume operator is provided to perform a more precise test using more than one lookup which works better with complex and concave meshes.

Additionally, the Distance output of an IntersectRay will be scaled by the length of the Ray Direction input vector. If you want to acquire the unscaled Distance value, be sure to apply a Normalize operator to the Ray Direction vector before using it in IntersectRay.