i have a problem slicing vtkPolyData, and i am stuck there for days now.
I tried the following two pipelines.
first with vtkContourTriangulator:
vtkCleanPolyData
vtkCutter
vtkStripper
vtkContourTriangulator
vtkFeatureEdges
vtkStripper
vtkPolyDataNormals
second with vtkContourLoopExtraction:
vtkCleanPolyData
vtkCutter
vtkStripper
vtkContourLoopExtraction
vtkStripper
vtkPolyDataNormals
Problem with the vtkContourTriangulator is, that it produce errors on some layers. Even when changing the tolerance of the vtkCleanPolyData then on other layers errors appear.
I also looked at the points from the vtkStripper output and they are definitely on the same layer.
So i dont know what to do? I also could check if the vtkContourTriangulator had an error, if so change the polygon minimal until it didnt has any error, but i dont know if this is a good solution, such an iterative try and error thing…
The problem with the vtkContourLoopExtraction is, that sometimes when more than one, lets say polygons are resulted from a cut, the orientation of them is sometimes wrong.
Hello,
after some more try & error i got the vtkContourTriangulator working in a way, where it is triangulating all my layers.
I want to share my code, even there are probably muuuch better approaches :-).
Steps are:
vktCleanPolyData with minimal tolerance
vtkCutter with vtkPlane on the layerHeight
vtkStripper
vtkContourTriangulator
check if it has errors
if so: rotate around zAxis and triangulate again until no errors or until 360°
- if rotation > 360° use vtkCleanPolyData again with a higher tolerance
- rotate and triangulate again => if still errors until rotation > 360 => exception
Some years ago I’ve faced such issues.
I was using vtkClipClosedSurface to make slices of 3D solids, and to display the cut face with some colors.
The way vtkClipClosedSurface works is almost the same as you do :
cut the solids
rebuild closed loops from cut faces
triangulate closed loops
After hours of headache, I found that vtkClipClosedSurface was using vtkContourTriangulator for the 3rd step, and that this tool was far from stable when input geometry was “not simple” (eg. face with many complex holes).