IsPointInside - bug

Dear McNeel,

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:

and I want to check for the inclusion.
It gives this:

I’v try by GH component and by pure C# method Mesh.IsPointInside. Either strict true nor false with any tolerance help.

But if I will move the mesh or little scale it, its give correct result:

So strange… Could you help me to solve that problem?
I’m using Rhino SR12 (5.12.50810.13095, 08/10/2015) with the newest GH…

Can you post your geometry and some sample source that, that I can run here, that is not working for you?

Hey Dale. Here are my files:

IsPointInsideBug.3dm (30.9 KB) (17.2 KB)

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);

Dear Dale.

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:

If i rotate point grid and mesh just by 0.00001 of radians I’m getting this:

Which is correct, but I don’t want to rotate my geometry!

I’m also attaching GH file with mesh (16.8 KB)

Thank you for help

I also am having these issues. In fact, both the Brep.IsPointInside and Mesh.IsPointInside give me the same issues… Updates from the development team?

Hi @gruedisueli,

Can you post the geometry you are having issues with?

– Dale

Hi @dale

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.


When I use “Brep.IsPointInside” in if statement it causes a problem. I attach the .gh file. (68.6 KB)

For Breps, your function should probably look more like this:

  private void RunScript(Brep Brep, List<Point3d> Points, ref object A)
    if (
         null != Brep
      && Brep.IsSolid
      && Brep.IsManifold
      && null != Points
      && Points.Count > 0
      var rc = new List<bool>(Points.Count);
      var tol = RhinoDocument.ModelAbsoluteTolerance;
      foreach (var p in Points)
        rc.Add(Brep.IsPointInside(p, tol, true));
      A = rc;

– Dale

1 Like

Hi everyone

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:

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)

any idea of how to solve it?

pls find example file attached
Uploading: ptinsideTest.3dm… (7.5 KB)

thanks a lot!

Hi @Maximilian,

I doubt the internal function was written with disjoint Breps in mind.

– Dale