points_inside_component.h 2.4 KB

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