ExtractEnclosedPoints giving additional points outside the mesh

Hi, I am new to using more advanced features in VTK. I’m using PyVsta to generate a voxel grid then looking at extracting enclosed points from an STL or mesh. I’ve tried multiple geometries and had the filter return a lot of wrong point points outside the mesh. Some resolutions work okay, while others have a large error. I attached two examples of different mesh resolution. I’ve tried using the same filter in Paraview and obtain very similar results. Has anyone had this issue before or have any suggestions on what to try?

Thank you,

That’s an interesting effect. It could be a weird numerical issue, or maybe something strange with the data like “cracks/gaps” in the mesh. Can you provide access to the data and a test demonstrating this behavior so I can take a deeper look?

Hi Will,

I attached the grid, PyVista results, and the STL file below. I tried a few other different geometries, and they all seemed to work okay. I tried to flip this geometry by 180 degrees, and it seemed to mesh okay as well. It seems to only have issues on this particular design and some variations of it.


Thank you very much!

Very strange indeed! I’ve got some deliverables this week so I’ll try and look over the weekend.


Can you send me a vtk python script that demonstrates the problem. I’m not sure what the data you sent me is all about, and what exactly you are doing.

Hi Shawn,

vtkEnclosedPoints use cell locator to find whether a point is inside or outside of the surface. Here, they use a statistical approach. They will fire some random rays and check if these rays are intersecting with any surface. If more than 3 rays interact with a surface, then those points are considered inside. Since these rays are random, there are chances of getting such weird results. You can check the source code for mode clarity.