orient_outward_ao.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. // Orient each component (identified by C) of a mesh (V,F) using ambient occlusion
  8. // such that the front side is less occluded than back side
  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. // min_num_rays_per_component Each component receives at least this number of rays
  15. // total_num_rays Total number of rays that will be shot
  16. // Outputs:
  17. // FF #F by 3 list of new triangle indices such that FF(~I,:) = F(~I,:) and
  18. // FF(I,:) = fliplr(F(I,:)) (OK if &FF = &F)
  19. // I max(C)+1 list of whether face has been flipped
  20. template <
  21. typename DerivedV,
  22. typename DerivedF,
  23. typename DerivedC,
  24. typename DerivedFF,
  25. typename DerivedI>
  26. IGL_INLINE void orient_outward_ao(
  27. const Eigen::PlainObjectBase<DerivedV> & V,
  28. const Eigen::PlainObjectBase<DerivedF> & F,
  29. const Eigen::PlainObjectBase<DerivedC> & C,
  30. const int min_num_rays_per_component,
  31. const int total_num_rays,
  32. Eigen::PlainObjectBase<DerivedFF> & FF,
  33. Eigen::PlainObjectBase<DerivedI> & I);
  34. // Call with default number of rays
  35. template <
  36. typename DerivedV,
  37. typename DerivedF,
  38. typename DerivedC,
  39. typename DerivedFF,
  40. typename DerivedI>
  41. IGL_INLINE void orient_outward_ao(
  42. const Eigen::PlainObjectBase<DerivedV> & V,
  43. const Eigen::PlainObjectBase<DerivedF> & F,
  44. const Eigen::PlainObjectBase<DerivedC> & C,
  45. Eigen::PlainObjectBase<DerivedFF> & FF,
  46. Eigen::PlainObjectBase<DerivedI> & I);
  47. };
  48. #ifdef IGL_HEADER_ONLY
  49. # include "orient_outward_ao.cpp"
  50. #endif
  51. #endif