how can i test if a point is on a plane, is it with a distance equal to 0?
Python Script please…

rs.IsPointOnPlane not exist?

Edit: Adding tolerance as @Jess explained:

DistanceToPlane(plane, point) Returns the distance from a 3D point to a plane.

import rhinoscriptsyntax as rs
point = rs.GetPoint("Point to test")
if point:
    plane = rs.WorldXYPlane()
    distance = rs.DistanceToPlane(plane, point)
    if abs(distance) <= rs.UnitAbsoluteTolerance():
        print "Your point is on WorldXY plane"
        print "Distance to WorldXY plane: ", distance

I would use this:

(not fast enough…)

I would use some tolerance, otherwise the point test may always fail

tolerance =0.00001
if abs(distance) <= tolerance :

1 Like

Thank you, but why there is:
but no IsPointOnPlane?

it’s strange, no?

Yeah, it’s not in vb Rhinoscript either. I guess since a RhinoCommon method exists for simple stuff like this, that they haven’t made implementing it a priority.

Yep -

import rhinoscriptsyntax as rs
import Rhino

#use whatever tolerance you want
if abs(wxy_plane.DistanceTo(pt))<tol:
    print "Point is on World XY plane"
    print "Point is NOT on World XY plane"

One important point to note is that with this function, the distance is signed relative to the plane normal - so it could be negative if the point is “behind” the plane. This is unusual for distance functions in Rhino which are most often unsigned (always positive)

1 Like