Skip to content

Fix 3d cell conversion to polyhedron in vtkCellValidator::Convex

Florian Maurin requested to merge florian360/vtk:FixCellValidatorIsConvex into master

The first commit fix this issue #17841 (closed) for hex, but also for wedge and tetra.

Let take an example for the explanation of the bug with a cell containing 3 points, even if this is not possible in 3d. Let assume also that a point has only one coordinate instead of three.

Let assume that the input in vtkCellValidator::Convex is:

      input_grid_ids      10      11     12
      input_grid_points   (0.0)   (0.1)  (0.2)

      cell_ids      11      12     10
      cell_points   (0.1)  (0.2)   (0.0)

The output before the bug was

      new_grid_ids       0      1     2       ( grid ids cannot be set)
      new_grid_points   (0.1)  (0.2)   (0.0)  ( set with cell>GetPoints())
      polygon_cell_id    11      12      10

whereas it should be

      new_grid_ids       0      1     2       ( grid ids cannot be set)
      new_grid_points   (0.1)  (0.2)   (0.0)  ( set with cell>GetPoints())
      polygon_cell_id    0      1      2

Conclusion, a mapping from the old grid ids to the new node ids was missing. This mapping should be used as well to update the node ids of the polyhedron faces.

The second commit of this MR fix a second bug in vtkPolyhedron::IsConvex(), where the definition of the vertical plane was wrongly defined. This fix this second reported issue #17673 (closed)

Backport: release

Edited by Florian Maurin

Merge request reports