component_inside_component.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Qingnan Zhou <[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_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. {
  18. /// Determine if connected facet component (V1, F1, I1) is inside of
  19. /// connected facet component (V2, F2, I2).
  20. ///
  21. /// \pre 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. /// @param[in] V1 #V1 by 3 list of vertex position of mesh 1
  26. /// @param[in] F1 #F1 by 3 list of triangles indices into V1
  27. /// @param[in] I1 #I1 list of indices into F1, indicate the facets of component
  28. /// @param[in] V2 #V2 by 3 list of vertex position of mesh 2
  29. /// @param[in] F2 #F2 by 3 list of triangles indices into V2
  30. /// @param[in] I2 #I2 list of indices into F2, indicate the facets of component
  31. /// @return true iff (V1, F1, I1) is entirely inside of (V2, F2, I2).
  32. template<typename DerivedV, typename DerivedF, typename DerivedI>
  33. IGL_INLINE bool component_inside_component(
  34. const Eigen::PlainObjectBase<DerivedV>& V1,
  35. const Eigen::PlainObjectBase<DerivedF>& F1,
  36. const Eigen::PlainObjectBase<DerivedI>& I1,
  37. const Eigen::PlainObjectBase<DerivedV>& V2,
  38. const Eigen::PlainObjectBase<DerivedF>& F2,
  39. const Eigen::PlainObjectBase<DerivedI>& I2);
  40. /// \overload
  41. template<typename DerivedV, typename DerivedF>
  42. IGL_INLINE bool component_inside_component(
  43. const Eigen::PlainObjectBase<DerivedV>& V1,
  44. const Eigen::PlainObjectBase<DerivedF>& F1,
  45. const Eigen::PlainObjectBase<DerivedV>& V2,
  46. const Eigen::PlainObjectBase<DerivedF>& F2);
  47. }
  48. }
  49. }
  50. #ifndef IGL_STATIC_LIBRARY
  51. #include "component_inside_component.cpp"
  52. #endif
  53. #endif