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?
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?
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.
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.
I imported the Grid.vtk and pyramid.stl file into ParaView then applied the ExstractEnclosedPoints filter. I also tried it on PyVista and have the lines of Python code below. For the project I am working on, it is important to have an accurate representation of the geometry. Is there another way I can apply a filter to increase the accuracy of the results?