orient_outward_ao.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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) using ambient occlusion
  14. // such that the front side is less occluded than back side
  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 PointMatrixType,
  31. typename FaceMatrixType,
  32. typename RowVector3,
  33. typename DerivedFF,
  34. typename DerivedI>
  35. IGL_INLINE void orient_outward_ao(
  36. const Eigen::PlainObjectBase<DerivedV> & V,
  37. const Eigen::PlainObjectBase<DerivedF> & F,
  38. const Eigen::PlainObjectBase<DerivedC> & C,
  39. const igl::EmbreeIntersector<PointMatrixType,FaceMatrixType,RowVector3> & ei,
  40. const int num_samples,
  41. Eigen::PlainObjectBase<DerivedFF> & FF,
  42. Eigen::PlainObjectBase<DerivedI> & I);
  43. // EmbreeIntersector generated on the fly
  44. template <
  45. typename DerivedV,
  46. typename DerivedF,
  47. typename DerivedC,
  48. typename DerivedFF,
  49. typename DerivedI>
  50. IGL_INLINE void orient_outward_ao(
  51. const Eigen::PlainObjectBase<DerivedV> & V,
  52. const Eigen::PlainObjectBase<DerivedF> & F,
  53. const Eigen::PlainObjectBase<DerivedC> & C,
  54. const int num_samples,
  55. Eigen::PlainObjectBase<DerivedFF> & FF,
  56. Eigen::PlainObjectBase<DerivedI> & I);
  57. };
  58. #ifdef IGL_HEADER_ONLY
  59. # include "orient_outward_ao.cpp"
  60. #endif
  61. #endif