I’m using the IsPointInSurface method to check what points are inside a closed surface. Initially it was all good but when I use strictly_in = True and I add a tolerance to the method, I still end up with some points on a few edges and vertices of my geometry, even though they should all be inside by at least the tolerance.
You can try it by creating a box in rhino, let’s say 100x100x100. Then use the PointGrid command to create a volumetric point cloud inside of it. And finaly, run this simple python script:
import rhinoscriptsyntax as rs
polysurface_id = rs.GetObject("Select a polysurface", 56)
point_cloud = rs.GetObject("Select a point cloud")
points = rs.PointCloudPoints(point_cloud)
for point in points:
if rs.IsPointInSurface(polysurface_id, point, True, 10):
rs.AddPoint(point)
You will see you will still have some points on the surface, like the screenshot below:
Am I doing something wrong or is this a bug?
3 posts - 2 participants
