# Consistency of face orientation in vtkCell3D

**URL:** https://discourse.vtk.org/t/consistency-of-face-orientation-in-vtkcell3d/2253
**Category:** Development
**Created:** [December 10, 2019, 6:22pm UTC](https://discourse.vtk.org/t/consistency-of-face-orientation-in-vtkcell3d/2253 "2019-12-10T18:22:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Yohann\_Bearzi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yohann_bearzi/32/671_2.png) [@Yohann\_Bearzi](https://discourse.vtk.org/u/Yohann_Bearzi)
#### Post date: [December 10, 2019, 6:22pm UTC](https://discourse.vtk.org/t/consistency-of-face-orientation-in-vtkcell3d/2253/1 "2019-12-10T18:22:18Z")

</div>

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:

```auto
3 ___ 2
 \ /
   X
 /___\
1 0

```

instead of

```auto
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.

---

<div class="post-metadata">

### Author: ![acbauer](https://discourse.vtk.org/user_avatar/discourse.vtk.org/acbauer/32/320_2.png) [@acbauer](https://discourse.vtk.org/u/acbauer)
#### Post date: [December 11, 2019, 2:32pm UTC](https://discourse.vtk.org/t/consistency-of-face-orientation-in-vtkcell3d/2253/2 "2019-12-11T14:32:50Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Yohann\_Bearzi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yohann_bearzi/32/671_2.png) [@Yohann\_Bearzi](https://discourse.vtk.org/u/Yohann_Bearzi)
#### Post date: [December 11, 2019, 3:33pm UTC](https://discourse.vtk.org/t/consistency-of-face-orientation-in-vtkcell3d/2253/3 "2019-12-11T15:33:33Z")

</div>

I just checked `vtkPyramid` and `vtkWedge`, they have consistent face orientation, so good news 🙂
