orient_outward_ao.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef IGL_ORIENT_OUTWARD_AO_H
  2. #define IGL_ORIENT_OUTWARD_AO_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. // Forward define
  8. template <
  9. typename PointMatrixType,
  10. typename FaceMatrixType,
  11. typename RowVector3>
  12. class EmbreeIntersector;
  13. // Orient each component (identified by C) of a mesh (V,F) so the normals on
  14. // average point away from the patch's centroid.
  15. //
  16. // Inputs:
  17. // V #V by 3 list of vertex positions
  18. // F #F by 3 list of triangle indices
  19. // C #F list of components
  20. // ei EmbreeIntersector containing (V,F)
  21. // num_samples total number of rays to be shot
  22. // Outputs:
  23. // FF #F by 3 list of new triangle indices such that FF(~I,:) = F(~I,:) and
  24. // FF(I,:) = fliplr(F(I,:)) (OK if &FF = &F)
  25. // I max(C)+1 list of whether face has been flipped
  26. template <
  27. typename DerivedV,
  28. typename DerivedF,
  29. typename DerivedC,
  30. typename DerivedFF,
  31. typename DerivedI>
  32. IGL_INLINE void orient_outward_ao(
  33. const Eigen::PlainObjectBase<DerivedV> & V,
  34. const Eigen::PlainObjectBase<DerivedF> & F,
  35. const Eigen::PlainObjectBase<DerivedC> & C,
  36. const igl::EmbreeIntersector<PointMatrixType,FaceMatrixType,RowVector3> & ei,
  37. const int num_samples,
  38. Eigen::PlainObjectBase<DerivedFF> & FF,
  39. Eigen::PlainObjectBase<DerivedI> & I);
  40. };
  41. #ifdef IGL_HEADER_ONLY
  42. # include "orient_outward_ao.cpp"
  43. #endif
  44. #endif