[vtkusers] vtkSelectEnclosedPoints filter inconsistent output of IsInside method

Santosh Biradar scbiradar at gmail.com
Fri Sep 5 15:23:38 EDT 2014


Hi,
I am trying to find if a point lies inside a closed surface. I have a closed
STL file and i want to find if a point lies inside the surface defined by
the STL file. I am using a vtkSelectEnclosedPoints filter of VTK-5.10 and
calling isInside method of the filter. I have checked that my STL file is a
closed file by using a vtkFeatureEdges filter.
However, I notice that if I run a loop for the same point I get inconsistent
output.

Python Code:

reader = vtk.vtkSTLReader()
reader.SetFileName("/path/to/
my/file/")

featureEdge = vtk.vtkFeatureEdges()
featureEdge.FeatureEdgesOff()
featureEdge.BoundaryEdgesOn()
featureEdge.NonManifoldEdgesOn()
featureEdge.SetInput(reader.GetOutput())
featureEdge.Update()
openEdges = featureEdge.GetOutput().GetNumberOfCells()

if openEdges != 0:
    print " the stl file is not closed"


filter = vtk.vtkSelectEnclosedPoints()

filter.SetSurface(reader.GetOutput())

# create input polydata
pts = vtk.vtkPoints()
pts.InsertNextPoint(0.1,0,0.1)
pts_pd = vtk.vtkPolyData()
pts_pd.SetPoints(pts)

for i in range(100):
    filter.SetInput(pts_pd)
    filter.Update()
    print filter.IsInside(0)

This code gives me an output like this (formatted for posting here):

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,
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,
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,
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

Why is the filter behaving inconsistently for the same point ? Any
suggestions ?
Thanks,
Santosh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140906/a086e4e5/attachment.html>


More information about the vtkusers mailing list