Consistency of face orientation in vtkCell3D

Hi everyone,

vtkCell class has the method vtkCell::GetFaces, and vtkCell3D class has vtkCell3D::GetFacePoints on top of that. In general, one would want that the orientation of the output face would be consistent, i.e. the points “turn” counter clockwise w.r.t. the normal of the face. It is the case for vtkTetra and vtkHexahedron, which I checked, but it is not the case for vtkVoxel.

Given a normal pointing out from the screen, a face of vtkVoxel has this pattern:

3 ___ 2
 \   /
1     0

instead of

2 __ 3
 |  |
1    0

The reason for this weird layout can be found in vtkVoxel.cxx. Face ids are defined in terms vtkPixel understands.

As a consequence, if one writes an algorithm taking a vtkCell3D* input, one cannot rely on the orientation of the face, nor its ordering, without downcasting, or writing a specific function for vtkVoxel (and maybe other vtkCell3D classes).

So my questions would be the following:

  • Is there a convention for the orientation of faces in vtkCell3D?
  • If there is, should we add this in the documentation as a required convention?
  • Should we fix vtkVoxel so it becomes consistent with other vtkCell3D?
  • Is vtkVoxel the only class not respecting a canonical face orientation convention?

For the moment, I think we should add a warning in the documentation of vtkVoxel so users are aware of its unique face pattern.

If you’re doing this you may want to check out vtkPyramid and/or vtkWedge as well. If I remember correctly, one of them also has a normal that points inward instead of outward for one of the cell faces.

I just checked vtkPyramid and vtkWedge, they have consistent face orientation, so good news :slight_smile: