reorient_facets_raycast.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <[email protected]>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_EMBREE_REORIENT_FACETS_RAYCAST_H
  9. #define IGL_EMBREE_REORIENT_FACETS_RAYCAST_H
  10. #include "../igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. namespace embree
  15. {
  16. /// Orient each component (identified by C) of a mesh (V,F) using ambient
  17. /// occlusion such that the front side is less occluded than back side, as
  18. /// described in "A Simple Method for Correcting Facet Orientations in
  19. /// Polygon Meshes Based on Ray Casting" [Takayama et al. 2014].
  20. ///
  21. /// @param[in] V #V by 3 list of vertex positions
  22. /// @param[in] F #F by 3 list of triangle indices
  23. /// @param[in] rays_total Total number of rays that will be shot
  24. /// @param[in] rays_minimum Minimum number of rays that each patch should receive
  25. /// @param[in] facet_wise Decision made for each face independently, no use of patches
  26. /// (i.e., each face is treated as a patch)
  27. /// @param[in] use_parity Use parity mode
  28. /// @param[in] is_verbose Verbose output to cout
  29. /// @param[out] I #F list of whether face has been flipped
  30. /// @param[out] C #F list of patch ID (output of bfs_orient > manifold patches)
  31. template <
  32. typename DerivedV,
  33. typename DerivedF,
  34. typename DerivedI,
  35. typename DerivedC>
  36. IGL_INLINE void reorient_facets_raycast(
  37. const Eigen::PlainObjectBase<DerivedV> & V,
  38. const Eigen::PlainObjectBase<DerivedF> & F,
  39. int rays_total,
  40. int rays_minimum,
  41. bool facet_wise,
  42. bool use_parity,
  43. bool is_verbose,
  44. Eigen::PlainObjectBase<DerivedI> & I,
  45. Eigen::PlainObjectBase<DerivedC> & C);
  46. /// @param[out] FF #F by 3 list of reoriented faces
  47. ///
  48. /// #### Defaults:
  49. /// rays_total = F.rows()*100;
  50. /// rays_minimum = 10;
  51. /// facet_wise = false;
  52. /// use_parity = false;
  53. /// is_verbose = false;
  54. template <
  55. typename DerivedV,
  56. typename DerivedF,
  57. typename DerivedFF,
  58. typename DerivedI>
  59. IGL_INLINE void reorient_facets_raycast(
  60. const Eigen::PlainObjectBase<DerivedV> & V,
  61. const Eigen::PlainObjectBase<DerivedF> & F,
  62. Eigen::PlainObjectBase<DerivedFF> & FF,
  63. Eigen::PlainObjectBase<DerivedI> & I);
  64. }
  65. };
  66. #ifndef IGL_STATIC_LIBRARY
  67. # include "reorient_facets_raycast.cpp"
  68. #endif
  69. #endif