points_inside_component.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_POINTS_INSIDE_COMPONENTS
  9. #define IGL_COPYLEFT_CGAL_POINTS_INSIDE_COMPONENTS
  10. #include "../../igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl
  14. {
  15. namespace copyleft
  16. {
  17. namespace cgal {
  18. /// Determine if queries points P are inside of connected facet component
  19. /// (V, F, I), where I indicates a subset of facets that forms the
  20. /// component.
  21. ///
  22. /// \pre The input mesh must be a closed, self-intersection free,
  23. /// non-degenerated surface. Queries points must be either inside or
  24. /// outside of the mesh (i.e. not on the surface of the mesh).
  25. ///
  26. /// @param[in] V #V by 3 array of vertex positions.
  27. /// @param[in] F #F by 3 array of triangles.
  28. /// @param[in] I #I list of triangle indices to consider.
  29. /// @param[in] P #P by 3 array of query points.
  30. /// @param[out] inside #P list of booleans that is true iff the
  31. /// corresponding query point is inside of the mesh.
  32. template<
  33. typename DerivedV,
  34. typename DerivedF,
  35. typename DerivedI,
  36. typename DerivedP,
  37. typename DerivedB>
  38. IGL_INLINE void points_inside_component(
  39. const Eigen::MatrixBase<DerivedV>& V,
  40. const Eigen::MatrixBase<DerivedF>& F,
  41. const Eigen::MatrixBase<DerivedI>& I,
  42. const Eigen::MatrixBase<DerivedP>& P,
  43. Eigen::PlainObjectBase<DerivedB>& inside);
  44. /// \overload
  45. template<
  46. typename DerivedV,
  47. typename DerivedF,
  48. typename DerivedP,
  49. typename DerivedB>
  50. IGL_INLINE void points_inside_component(
  51. const Eigen::MatrixBase<DerivedV>& V,
  52. const Eigen::MatrixBase<DerivedF>& F,
  53. const Eigen::MatrixBase<DerivedP>& P,
  54. Eigen::PlainObjectBase<DerivedB>& inside);
  55. }
  56. }
  57. }
  58. #ifndef IGL_STATIC_LIBRARY
  59. #include "points_inside_component.cpp"
  60. #endif
  61. #endif