points_inside_component.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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_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. // Precondition:
  23. // The input mesh must be a closed, self-intersection free,
  24. // non-degenerated surface. Queries points must be either inside or
  25. // outside of the mesh (i.e. not on the surface of the mesh).
  26. //
  27. // Inputs:
  28. // V #V by 3 array of vertex positions.
  29. // F #F by 3 array of triangles.
  30. // I #I list of triangle indices to consider.
  31. // P #P by 3 array of query points.
  32. //
  33. // Outputs:
  34. // inside #P list of booleans that is true iff the corresponding
  35. // query point is inside of the mesh.
  36. template<
  37. typename DerivedV,
  38. typename DerivedF,
  39. typename DerivedI,
  40. typename DerivedP,
  41. typename DerivedB>
  42. IGL_INLINE void points_inside_component(
  43. const Eigen::PlainObjectBase<DerivedV>& V,
  44. const Eigen::PlainObjectBase<DerivedF>& F,
  45. const Eigen::PlainObjectBase<DerivedI>& I,
  46. const Eigen::PlainObjectBase<DerivedP>& P,
  47. Eigen::PlainObjectBase<DerivedB>& inside);
  48. // Determine if query points P is inside of the mesh (V, F).
  49. // See above for precondition and I/O specs.
  50. template<
  51. typename DerivedV,
  52. typename DerivedF,
  53. typename DerivedP,
  54. typename DerivedB>
  55. IGL_INLINE void points_inside_component(
  56. const Eigen::PlainObjectBase<DerivedV>& V,
  57. const Eigen::PlainObjectBase<DerivedF>& F,
  58. const Eigen::PlainObjectBase<DerivedP>& P,
  59. Eigen::PlainObjectBase<DerivedB>& inside);
  60. }
  61. }
  62. }
  63. #ifndef IGL_STATIC_LIBRARY
  64. #include "points_inside_component.cpp"
  65. #endif
  66. #endif