distance from point to surface with sign

Which is the simplest way to have the distance from a surface with sign depending on the normals of the surface?

I tried the "surface closest point" node but it doesn't have the sign.

  • up

    Daniel González Abalde

    Being 'N' as the normal at 'cPt' on surface and 'V' the vector from cPt to Pt, if the dot product of N and V is positive, then Pt is above, if not is below the surface.

    If N·V>0 then Distance * 1 else Distance * -1

    1
    • up

      Joseph Oster

      Make and post a GH model!  ALWAYS.

      Measure the angle between the normal vector and the 'Vec2Pt'.  If it's at (or near) zero, the sign is positive.  If it's at (or near) Pi, the sign is negative.

      P.S.  What Daniel said works too; I don't remember what 'Dot Product' means, but it works.