I found very strange behaviour of Mesh.IsPointInside method.
When the Mesh is made precisely on the grid with precise dimension this method gets really wrong result.
Example: I’ve create Mesh by snap to grid, with 5x10x15 on size.
Then, I’ve created regular grid of points:
Mesh is generated based on brep, but replacing it by mesh created in rhino by Mesh Primitives doesn’t change anything.
It is very simple situation. In the GH definition I’ve added rotation of the mesh and moving vector for translate the grid of point. So by just rotating mesh it even just a bit, every think is fine, but if mesh stays in correct place, nicely align to world axes, inclusion test just give mess…
The custom C# component or MeshInclusionTest component return the same result. So I think the Rhionocommon Mesh.IsPointInside() method has error. Changing tolerance doesn’t effect result.
Try using a valid tolerance - something greater than zero.
private void RunScript(Brep B, Point3d P, ref object A)
{
if (null != B && P.IsValid)
{
var tol = Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance;
A = B.IsPointInside(P, tol, false);
}
}
It was while I send you my problem fr the first time. I switch to Rhino6 and problem with IsPointInside function still exist. And it is even worse.
I’ve created mesh which is closed and I think correct, but IsPointInsied still contain the same bug. Playing with the tolerance doesn’t change anything. Just look:
Did you solve this problem???
And just in case, can you also check " Brep.IsPointInside"?
“Mesh.IsPointInside” looks important (I should say “ESSENTIAL”) to deal with point clouds.
I am facing a similar issue.
For a list of points (length = 1500) I want to check wether each point is inside a list of breps (let’s say 500). to speed it up, I want to merge the individual breps so I don’t have to loop through every brep for every point. I do this by merging them into one:
oneSpaceMerged = Rhino.Geometry.Brep() for item in listOfSpaces:
oneSpaceMerged.Append(rs.coercebrep(item))
When I now check wether a testpoint is inside the merged brep, it gives me strange results.
It works well when I test it with the individual spaces.
It works like 90% when I merged the spaces into one. At certain spots, it does not recognize that the pt is inside the merged brep although it is. When I move the point just a little bit, it again returns true. print oneSpaceMerged.IsPointInside(testPt,tol,True)