[vtkusers] vtkCellLocator returns the wrong cell
Dov Grobgeld
dov.grobgeld at gmail.com
Tue Feb 18 08:15:11 EST 2014
I'm using vtkCutter and vtkStripper to cut a 3D STL model into a slice. I
then tried to use vtkLocator to query the original model for the cell
responsible for a given line segment. This is illustrated here:
http://postimg.org/image/o0uoml181/
The green lines are the polygon outputs of vtkCutter and vtkStripper. The
white sphere is the center of an arbitrary line segment on one of the
polygons. The red line is a line from the white sphere to the center of the
cell by vtkCellLocator (see below).
Since the line segments were created by cutting the original STL triangles,
I wanted to use a locator to locate the triangle that contained the white
sphere. I assumed that I could use vtkCellLocator for this and did this as
follows:
locator = vtk.vtkCellLocator()
locator.SetDataSet(Model.GetOutput())
locator.Update()
cid = locator.FindCell(queryCoordinate) # Coordinate of white sphere
cell = Model.GetOutput().GetCell(cid)
The resulting vtkTriangle that was returned by the locator is shown in the
image as the yellow triangle. It may be seen that this is not the triangle
that contains the white sphere! Why? What is wrong?
The documentation for locator.FindCell() sais:
"Returns the Id of the cell containing the point, returns -1 if no
cell found. This interface uses a tolerance of zero"
But this is violated by my example? Is this a bug? Or is the yellow
triangle the first triangle satisfying the FindCell search creterion by
some tolerance?
Thanks in advance!
Dov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140218/8060a296/attachment.html>
More information about the vtkusers
mailing list