component_inside_component.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Qingnan Zhou <qnzhou@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_COPYLEFT_CGAL_COMONENT_INSIDE_COMPONENT
  9. #define IGL_COPYLEFT_CGAL_COMONENT_INSIDE_COMPONENT
  10. #include "../../igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl {
  14. namespace copyleft
  15. {
  16. namespace cgal {
  17. // Determine if connected facet component (V1, F1, I1) is inside of
  18. // connected facet component (V2, F2, I2).
  19. //
  20. // Precondition:
  21. // Both components must represent closed, self-intersection free,
  22. // non-degenerated surfaces that are the boundary of 3D volumes. In
  23. // addition, (V1, F1, I1) must not intersect with (V2, F2, I2).
  24. //
  25. // Inputs:
  26. // V1 #V1 by 3 list of vertex position of mesh 1
  27. // F1 #F1 by 3 list of triangles indices into V1
  28. // I1 #I1 list of indices into F1, indicate the facets of component
  29. // V2 #V2 by 3 list of vertex position of mesh 2
  30. // F2 #F2 by 3 list of triangles indices into V2
  31. // I2 #I2 list of indices into F2, indicate the facets of component
  32. //
  33. // Outputs:
  34. // return true iff (V1, F1, I1) is entirely inside of (V2, F2, I2).
  35. template<typename DerivedV, typename DerivedF, typename DerivedI>
  36. IGL_INLINE bool component_inside_component(
  37. const Eigen::PlainObjectBase<DerivedV>& V1,
  38. const Eigen::PlainObjectBase<DerivedF>& F1,
  39. const Eigen::PlainObjectBase<DerivedI>& I1,
  40. const Eigen::PlainObjectBase<DerivedV>& V2,
  41. const Eigen::PlainObjectBase<DerivedF>& F2,
  42. const Eigen::PlainObjectBase<DerivedI>& I2);
  43. // Determine if mesh (V1, F1) is inside of mesh (V2, F2).
  44. //
  45. // Precondition:
  46. // Both meshes must be closed, self-intersection free, non-degenerated
  47. // surfaces that are the boundary of 3D volumes. They should not
  48. // intersect each other.
  49. //
  50. // Inputs:
  51. // V1 #V1 by 3 list of vertex position of mesh 1
  52. // F1 #F1 by 3 list of triangles indices into V1
  53. // V2 #V2 by 3 list of vertex position of mesh 2
  54. // F2 #F2 by 3 list of triangles indices into V2
  55. //
  56. // Outputs:
  57. // return true iff (V1, F1) is entirely inside of (V2, F2).
  58. template<typename DerivedV, typename DerivedF>
  59. IGL_INLINE bool component_inside_component(
  60. const Eigen::PlainObjectBase<DerivedV>& V1,
  61. const Eigen::PlainObjectBase<DerivedF>& F1,
  62. const Eigen::PlainObjectBase<DerivedV>& V2,
  63. const Eigen::PlainObjectBase<DerivedF>& F2);
  64. }
  65. }
  66. }
  67. #ifndef IGL_STATIC_LIBRARY
  68. #include "component_inside_component.cpp"
  69. #endif
  70. #endif