I calculated multiple ray intersection on several surfaces.
Now i want to identify the surfaces/faces where those intersections happened and cull the others that don’t intersect.
For that purpose I’m trying to find the equivalent of rs.isPointOnSurface in Rhinocommon … with no success quite several hours,
I’ll appreciate any help to find this command or other options to achieve the goal.
then test distance from closest point to test point. If it is 0.0 (or might be better to test via tolerance, like if (distance <= tolerance)) then it is on surface.
Today, I learned that you can actually look up the source code of rhinoscriptsyntax functions, which are basically only “wrappers” for rhinocommon. It can be done like this:
import rhinoscriptsyntax as rs import inspect print inspect.getsource(rs.IsPointOnSurface)
In your case, it would be useful to look at the rs.IsPointOnSurface function, and re-engineer it for your own goals.
Here’s what the print statement puts out:
def IsPointOnSurface(object_id, point): """Verifies that a point lies on a surface Parameters: object_id: the object's identifier point: list of three numbers or Point3d. The test, or sampling point Returns: True if successful, otherwise False Example: import rhinoscriptsyntax as rs surf = rs.GetObject("Select a surface") if rs.IsSurface(surf): point = rs.GetPoint("Pick a test point") if point: if rs.IsPointOnSurface(surf, point): print "The point is on the surface." else: print "The point is not on the surface." See Also: IsPointInSurface """ surf = rhutil.coercesurface(object_id, True) point = rhutil.coerce3dpoint(point, True) rc, u, v = surf.ClosestPoint(point) if rc: srf_pt = surf.PointAt(u,v) if srf_pt.DistanceTo(point)>scriptcontext.doc.ModelAbsoluteTolerance: rc = False else: rc = surf.IsPointOnFace(u,v) != Rhino.Geometry.PointFaceRelation.Exterior return rc
I hope this helps!
Well yes, it’s saying the method I mentioned above. Surface closest point and measure distance against tolerance.