in_element.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <[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_IN_ELEMENT_H
  9. #define IGL_IN_ELEMENT_H
  10. #include "igl_inline.h"
  11. #include "AABB.h"
  12. #include <Eigen/Core>
  13. #include <Eigen/Sparse>
  14. namespace igl
  15. {
  16. /// Determine whether each point in a list of points is in the elements of a
  17. /// mesh.
  18. ///
  19. /// @tparam DIM dimension of vertices in V (# of columns)
  20. /// @param[in] V #V by dim list of mesh vertex positions.
  21. /// @param[in] Ele #Ele by dim+1 list of mesh indices into #V.
  22. /// @param[in] Q #Q by dim list of query point positions
  23. /// @param[in] aabb axis-aligned bounding box tree object (see AABB.h)
  24. /// @param[out] I #Q list of indices into Ele of first containing element (-1 means no
  25. /// containing element)
  26. template <
  27. typename DerivedV,
  28. typename DerivedEle,
  29. typename DerivedQ,
  30. int DIM,
  31. typename DerivedI>
  32. IGL_INLINE void in_element(
  33. const Eigen::MatrixBase<DerivedV> & V,
  34. const Eigen::MatrixBase<DerivedEle> & Ele,
  35. const Eigen::MatrixBase<DerivedQ> & Q,
  36. const AABB<DerivedV,DIM> & aabb,
  37. Eigen::PlainObjectBase<DerivedI> & I);
  38. /// \overload
  39. ///
  40. /// @param[out] I #Q by #Ele sparse matrix revealing whether each element contains each
  41. /// point: I(q,e) means point q is in element e
  42. template <
  43. typename DerivedV,
  44. typename DerivedEle,
  45. typename DerivedQ,
  46. int DIM,
  47. typename Scalar>
  48. IGL_INLINE void in_element(
  49. const Eigen::MatrixBase<DerivedV> & V,
  50. const Eigen::MatrixBase<DerivedEle> & Ele,
  51. const Eigen::MatrixBase<DerivedQ> & Q,
  52. const AABB<DerivedV,DIM> & aabb,
  53. Eigen::SparseMatrix<Scalar> & I);
  54. };
  55. #ifndef IGL_STATIC_LIBRARY
  56. #include "in_element.cpp"
  57. #endif
  58. #endif