orient_outward.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef IGL_ORIENT_OUTWARD_H
  2. #define IGL_ORIENT_OUTWARD_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. // Orient each component (identified by C) of a mesh (V,F) so the normals on
  8. // average point away from the patch's centroid.
  9. //
  10. // Inputs:
  11. // V #V by 3 list of vertex positions
  12. // F #F by 3 list of triangle indices
  13. // C #F list of components
  14. // Outputs:
  15. // FF #F by 3 list of new triangle indices such that FF(~I,:) = F(~I,:) and
  16. // FF(I,:) = fliplr(F(I,:)) (OK if &FF = &F)
  17. // I max(C)+1 list of whether face has been flipped
  18. template <
  19. typename DerivedV,
  20. typename DerivedF,
  21. typename DerivedC,
  22. typename DerivedFF,
  23. typename DerivedI>
  24. IGL_INLINE void orient_outward(
  25. const Eigen::PlainObjectBase<DerivedV> & V,
  26. const Eigen::PlainObjectBase<DerivedF> & F,
  27. const Eigen::PlainObjectBase<DerivedC> & C,
  28. Eigen::PlainObjectBase<DerivedFF> & FF,
  29. Eigen::PlainObjectBase<DerivedI> & I);
  30. };
  31. #ifdef IGL_HEADER_ONLY
  32. # include "orient_outward.cpp"
  33. #endif
  34. #endif