problems with vtkContourTriangulator and vtkContourLoopExtration

Hello at all,

i have a problem slicing vtkPolyData, and i am stuck there for days now.

I tried the following two pipelines.

first with vtkContourTriangulator:

  1. vtkCleanPolyData

  2. vtkCutter

  3. vtkStripper

  4. vtkContourTriangulator

  5. vtkFeatureEdges

  6. vtkStripper

  7. vtkPolyDataNormals

second with vtkContourLoopExtraction:

  1. vtkCleanPolyData

  2. vtkCutter

  3. vtkStripper

  4. vtkContourLoopExtraction

  5. vtkStripper

  6. 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…

CPP-File and CMake and vtp-file:
CMakeLists.txt (755 Bytes)
contourTriangulatorTest.cxx (5.6 KB)
bd.vtp (154.0 KB)



CPP-File and CMake and vtp-file:
CMakeLists.txt (830 Bytes)
contourLoopExtractorTest.cxx (5.4 KB)
bd2.vtp (10.1 KB)

Or are there filters which could check the correct winding of a polygon if it is inside another or something like that?

Any help is welcome,

best regards

new pony

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
  • rotate back
  • vtkFeatureEdges

CMakeLists.txt (755 Bytes)
contourTriangulatorTest.cxx (8.7 KB)
bd.vtp (154.0 KB)
PS: the polyData’s 3D file is from Microsoft (Bulldozer.3mf)

regards
philipp