orient_outward_ao.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 Scalar,
  10. typename Index>
  11. class EmbreeIntersector;
  12. // Orient each component (identified by C) of a mesh (V,F) using ambient occlusion
  13. // such that the front side is less occluded than back side
  14. //
  15. // Inputs:
  16. // V #V by 3 list of vertex positions
  17. // F #F by 3 list of triangle indices
  18. // C #F list of components
  19. // ei EmbreeIntersector containing (V,F)
  20. // num_samples total number of rays to be shot
  21. // Outputs:
  22. // FF #F by 3 list of new triangle indices such that FF(~I,:) = F(~I,:) and
  23. // FF(I,:) = fliplr(F(I,:)) (OK if &FF = &F)
  24. // I max(C)+1 list of whether face has been flipped
  25. template <
  26. typename DerivedV,
  27. typename DerivedF,
  28. typename DerivedC,
  29. typename Scalar,
  30. typename Index,
  31. typename DerivedFF,
  32. typename DerivedI>
  33. IGL_INLINE void orient_outward_ao(
  34. const Eigen::PlainObjectBase<DerivedV> & V,
  35. const Eigen::PlainObjectBase<DerivedF> & F,
  36. const Eigen::PlainObjectBase<DerivedC> & C,
  37. const igl::EmbreeIntersector<Scalar,Index> & ei,
  38. const int num_samples,
  39. Eigen::PlainObjectBase<DerivedFF> & FF,
  40. Eigen::PlainObjectBase<DerivedI> & I);
  41. // EmbreeIntersector generated on the fly
  42. template <
  43. typename DerivedV,
  44. typename DerivedF,
  45. typename DerivedC,
  46. typename DerivedFF,
  47. typename DerivedI>
  48. IGL_INLINE void orient_outward_ao(
  49. const Eigen::PlainObjectBase<DerivedV> & V,
  50. const Eigen::PlainObjectBase<DerivedF> & F,
  51. const Eigen::PlainObjectBase<DerivedC> & C,
  52. const int num_samples,
  53. Eigen::PlainObjectBase<DerivedFF> & FF,
  54. Eigen::PlainObjectBase<DerivedI> & I);
  55. };
  56. #ifdef IGL_HEADER_ONLY
  57. # include "orient_outward_ao.cpp"
  58. #endif
  59. #endif