is_inside.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef IS_INSIDE
  2. #define IS_INSIDE
  3. #include "../igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl {
  6. namespace cgal {
  7. // Determine if mesh (V1, F1) is inside of mesh (V2, F2).
  8. //
  9. // Precondition:
  10. // Both mesh must represent closed, self-intersection free,
  11. // non-degenerated surfaces that
  12. // are the boundary of 3D volumes. In addition, (V1, F1) must not
  13. // intersect with (V2, F2).
  14. //
  15. // Inputs:
  16. // V1 #V1 by 3 list of vertex position of mesh 1
  17. // F1 #F1 by 3 list of triangles indices into V1
  18. // I1 #I1 list of indices into F1, faces to consider.
  19. // V2 #V2 by 3 list of vertex position of mesh 2
  20. // F2 #F2 by 3 list of triangles indices into V2
  21. // I2 #I2 list of indices into F2, faces to consider.
  22. //
  23. // Outputs:
  24. // return true iff (V1, F1) is entirely inside of (V2, F2).
  25. template<typename DerivedV, typename DerivedF, typename DerivedI>
  26. IGL_INLINE bool is_inside(
  27. const Eigen::PlainObjectBase<DerivedV>& V1,
  28. const Eigen::PlainObjectBase<DerivedF>& F1,
  29. const Eigen::PlainObjectBase<DerivedI>& I1,
  30. const Eigen::PlainObjectBase<DerivedV>& V2,
  31. const Eigen::PlainObjectBase<DerivedF>& F2,
  32. const Eigen::PlainObjectBase<DerivedI>& I2);
  33. template<typename DerivedV, typename DerivedF>
  34. IGL_INLINE bool is_inside(
  35. const Eigen::PlainObjectBase<DerivedV>& V1,
  36. const Eigen::PlainObjectBase<DerivedF>& F1,
  37. const Eigen::PlainObjectBase<DerivedV>& V2,
  38. const Eigen::PlainObjectBase<DerivedF>& F2);
  39. // Determine if queries points are inside of mesh (V, F).
  40. //
  41. // Precondition:
  42. // The input mesh must be a closed, self-intersection free,
  43. // non-degenerated surface. Queries points must be either inside or
  44. // outside of the mesh.
  45. //
  46. // Inputs:
  47. // V #V by 3 array of vertex positions.
  48. // F #F by 3 array of triangles.
  49. // I #I list of triangle indices to consider.
  50. // P #P by 3 array of query points.
  51. //
  52. // Outputs:
  53. // inside #P list of booleans that is true iff the corresponding
  54. // query point is inside of the mesh.
  55. template<typename DerivedV, typename DerivedF, typename DerivedI,
  56. typename DerivedP, typename DerivedB>
  57. IGL_INLINE void is_inside(
  58. const Eigen::PlainObjectBase<DerivedV>& V,
  59. const Eigen::PlainObjectBase<DerivedF>& F,
  60. const Eigen::PlainObjectBase<DerivedI>& I,
  61. const Eigen::PlainObjectBase<DerivedP>& P,
  62. Eigen::PlainObjectBase<DerivedB>& inside);
  63. template<typename DerivedV, typename DerivedF, typename DerivedP,
  64. typename DerivedB>
  65. IGL_INLINE void is_inside(
  66. const Eigen::PlainObjectBase<DerivedV>& V,
  67. const Eigen::PlainObjectBase<DerivedF>& F,
  68. const Eigen::PlainObjectBase<DerivedP>& P,
  69. Eigen::PlainObjectBase<DerivedB>& inside);
  70. }
  71. }
  72. #ifndef IGL_STATIC_LIBRARY
  73. #include "is_inside.cpp"
  74. #endif
  75. #endif