VTKCutter leaves gaps, does not return the every point it intersects

153 views Asked by At

I have an STL file, I'm working on it a while to collect xyz data through the line drawn on its surface(red line).here

I wrote a function using VTKCutter and believed that the class was collecting each point its implicit function(plane in this case) intersects. But it turns out, it leaves many points not included and I checked it that there are many more using polydata.GetPoints() and with little manipulation. Problems like that must have been encountered for sure(for example in here) but I though searched a lot,could not find a solution that uses solely vtkCutter(I know I can use other methods like vtkBox and clipping but this way I prefer). I believe it is a simple tolerance problem but in class' reference page there is no such method that I can adjust with it. I appreciate any help. Thank you.

def set_cutter(self):
    
    global OutLinePts
    plane = vtkPlane()
    plane.SetOrigin(self.center)
    plane.SetNormal(self.normal)
    polydata = copydeep(self.actorMain)
    cutter = vtkCutter()#cutter class extract the data that intersects with the given function
    cutter.SetCutFunction(plane)
    cutter.SetInputData(polydata)
    cutter.Update()

    cutterMapper = vtkPolyDataMapper()
    cutterMapper.SetInputConnection(cutter.GetOutputPort())                
    actor_cutter = vtkActor()
    actor_cutter.SetMapper(cutterMapper)
    actor_cutter.GetProperty().SetColor(colors.GetColor3d('red'))

*The red line is the actor of vtkCutter with function plane.

1

There are 1 answers

0
slefsmteem On BEST ANSWER

The answer is simple: the STL is not sufficient enough to collect more. enter image description here

As you can see from the image, the collected data are the intersection points with polygon edges which gives us the most possible correct result because polygons are just planes. And the resulting plot is only interpolation of the collected data.