<div dir="ltr">Hi,<br>
I am trying to find if a point lies inside a closed surface. I have a closed<br>
STL file and i want to find if a point lies inside the surface defined by<br>
the STL file. I am using a vtkSelectEnclosedPoints filter of VTK-5.10 and<br>
calling isInside method of the filter. I have checked that my STL file is a<br>
closed file by using a vtkFeatureEdges filter.<br>
However, I notice that if I run a loop for the same point I get inconsistent<br>
output.<br>
<br>
Python Code:<br>
<br>
reader = vtk.vtkSTLReader()<br>
reader.SetFileName("/path/to/<div id=":28a" class="">my/file/")<br>
<br>
featureEdge = vtk.vtkFeatureEdges()<br>
featureEdge.FeatureEdgesOff()<br>
featureEdge.BoundaryEdgesOn()<br>
featureEdge.NonManifoldEdgesOn()<br>
featureEdge.SetInput(reader.GetOutput())<br>
featureEdge.Update()<br>
openEdges = featureEdge.GetOutput().GetNumberOfCells()<br>
<br>
if openEdges != 0:<br>
    print " the stl file is not closed"<br>
<br>
<br>
filter = vtk.vtkSelectEnclosedPoints()<br>
<br>
filter.SetSurface(reader.GetOutput())<br>
<br>
# create input polydata<br>
pts = vtk.vtkPoints()<br>
pts.InsertNextPoint(0.1,0,0.1)<br>
pts_pd = vtk.vtkPolyData()<br>
pts_pd.SetPoints(pts)<br>
<br>
for i in range(100):<br>
    filter.SetInput(pts_pd)<br>
    filter.Update()<br>
    print filter.IsInside(0)<br>
<br>
This code gives me an output like this (formatted for posting here):<br>
<br>
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,<br>
1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,<br>
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1,<br>
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1<br>
<br>
Why is the filter behaving inconsistently for the same point ? Any<br>
suggestions ?<br>
Thanks,<br>
Santosh</div></div>