Hi , I really need this guy . isn’t it fixed yet ?
https://mcneel.myjetbrains.com/youtrack/issue/RH-10076
Hi @sagkoyeou,
Looks like it might get some attention in Rhino 7 - sorry.
Just curious, why do you need this?
– Dale
Hi Dale
Just developing something in grasshopper going about meshes and I haven’t found any solution yet
What are you trying to do? It may be fairly easy to cook up a method that should work in the meantime…
If there’s rewritten a code that do the inclusion boolean so that may help me a lot , I just need some mesh point inclusion test as booleans output . just simple
It would be helpful for you to post an example of a mesh and point that is failing…that way I can quickly confirm if the reason for its failure is consistent with what I’ve seen in the past.
isPointInsideBug.gh (12.0 KB)
List<Point3d> includedPts = new List<Point3d>();
foreach(Point3d pt in array)
{
bool gooz = iMesh.IsPointInside(pt, 0.0, true);
//cull pattern
if (gooz) includedPts.Add(pt);
}
The method Rhino uses is intersecting a ray with the mesh and counting number of intersections.
It shoots a diagonal ray, in the direction (1,1,1). If this ray hits an edge of the mesh rather than a face it tends to fail. You can see this happening in your file if you inflate a bit the bounding box (with respect to the mesh) and increase the resolution of the grid.
To make it more robust you can do multiple checks per point, shooting rays in different non obvious directions.
Something quick you could do without making a new IsInside method is just rotate a bit the box and points before checking.
A more robust algorithm for this is:
Would be nice to have it implemented in Rhino.
Attached is your file with the trick of rotating a bit the mesh before checking. You have points coincident with the boundary. I inflated the bbox by the tolerance amount to keep them in.
isPointInsideBug.gh (9.2 KB)
I lifted the code for the winding numbers algorithm from the geometry3sharp library and added it at the bottom of your script.
It even works with open meshes pretty well. I used the simpler method, which is just a few lines of code, but slow. There’s a faster method also implemented in that library.
isPointInsideBug.gh (9.6 KB)