<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">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:<br>
<br><a href="http://postimg.org/image/o0uoml181/">http://postimg.org/image/o0uoml181/</a><br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">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).<br>
<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">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:<br>
<br>locator = vtk.vtkCellLocator()<br>locator.SetDataSet(Model.GetOutput())<br>locator.Update()<br><br>cid = locator.FindCell(queryCoordinate) # Coordinate of white sphere<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
cell = Model.GetOutput().GetCell(cid)<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">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?<br>
<br>The documentation for locator.FindCell() sais:<br><br>"Returns the Id of the cell containing the point, returns -1 if no<br>cell found. This interface uses a tolerance of zero"<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
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?<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
Thanks in advance!<br>Dov<br><br></div></div>