reorient_facets_raycast.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  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. // Inputs:
  22. // V #V by 3 list of vertex positions
  23. // F #F by 3 list of triangle indices
  24. // rays_total Total number of rays that will be shot
  25. // rays_minimum Minimum number of rays that each patch should receive
  26. // facet_wise Decision made for each face independently, no use of patches
  27. // (i.e., each face is treated as a patch)
  28. // use_parity Use parity mode
  29. // is_verbose Verbose output to cout
  30. // Outputs:
  31. // I #F list of whether face has been flipped
  32. // C #F list of patch ID (output of bfs_orient > manifold patches)
  33. template <
  34. typename DerivedV,
  35. typename DerivedF,
  36. typename DerivedI,
  37. typename DerivedC>
  38. IGL_INLINE void reorient_facets_raycast(
  39. const Eigen::PlainObjectBase<DerivedV> & V,
  40. const Eigen::PlainObjectBase<DerivedF> & F,
  41. int rays_total,
  42. int rays_minimum,
  43. bool facet_wise,
  44. bool use_parity,
  45. bool is_verbose,
  46. Eigen::PlainObjectBase<DerivedI> & I,
  47. Eigen::PlainObjectBase<DerivedC> & C);
  48. // Outputs:
  49. // FF #F by 3 list of reoriented faces
  50. // Defaults:
  51. // rays_total = F.rows()*100;
  52. // rays_minimum = 10;
  53. // facet_wise = false;
  54. // use_parity = false;
  55. // is_verbose = false;
  56. template <
  57. typename DerivedV,
  58. typename DerivedF,
  59. typename DerivedFF,
  60. typename DerivedI>
  61. IGL_INLINE void reorient_facets_raycast(
  62. const Eigen::PlainObjectBase<DerivedV> & V,
  63. const Eigen::PlainObjectBase<DerivedF> & F,
  64. Eigen::PlainObjectBase<DerivedFF> & FF,
  65. Eigen::PlainObjectBase<DerivedI> & I);
  66. }
  67. };
  68. #ifndef IGL_STATIC_LIBRARY
  69. # include "reorient_facets_raycast.cpp"
  70. #endif
  71. #endif