pseudonormal_test.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_PSEUDONORMAL_TEST_H
  9. #define IGL_PSEUDONORMAL_TEST_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Given a mesh (V,F), a query point q, and a point on (V,F) c, determine
  15. /// whether q is inside (V,F) --> s=-1 or outside (V,F) s=1, based on the
  16. /// sign of the dot product between (q-c) and n, where n is the normal _at c_,
  17. /// carefully chosen according to [Bærentzen & Aanæs 2005]
  18. ///
  19. /// @param[in] V #V by 3 list of vertex positions
  20. /// @param[in] F #F by 3 list of triangle indices
  21. /// @param[in] FN #F by 3 list of triangle normals
  22. /// @param[in] VN #V by 3 list of vertex normals (ANGLE WEIGHTING)
  23. /// @param[in] EN #E by 3 list of edge normals (UNIFORM WEIGHTING)
  24. /// @param[in] EMAP #F*3 mapping edges in F to E
  25. /// @param[in] q Query point
  26. /// @param[in] f index into F to face to which c belongs
  27. /// @param[in] c Point on (V,F)
  28. /// @param[out] s sign
  29. /// @param[out] n normal
  30. template <
  31. typename DerivedV,
  32. typename DerivedF,
  33. typename DerivedFN,
  34. typename DerivedVN,
  35. typename DerivedEN,
  36. typename DerivedEMAP,
  37. typename Derivedq,
  38. typename Derivedc,
  39. typename Scalar,
  40. typename Derivedn>
  41. IGL_INLINE void pseudonormal_test(
  42. const Eigen::MatrixBase<DerivedV> & V,
  43. const Eigen::MatrixBase<DerivedF> & F,
  44. const Eigen::MatrixBase<DerivedFN> & FN,
  45. const Eigen::MatrixBase<DerivedVN> & VN,
  46. const Eigen::MatrixBase<DerivedEN> & EN,
  47. const Eigen::MatrixBase<DerivedEMAP> & EMAP,
  48. const Eigen::MatrixBase<Derivedq> & q,
  49. const int f,
  50. Eigen::PlainObjectBase<Derivedc> & c,
  51. Scalar & s,
  52. Eigen::PlainObjectBase<Derivedn> & n);
  53. /// \overload
  54. /// \brief 2D version.
  55. template <
  56. typename DerivedV,
  57. typename DerivedF,
  58. typename DerivedEN,
  59. typename DerivedVN,
  60. typename Derivedq,
  61. typename Derivedc,
  62. typename Scalar,
  63. typename Derivedn>
  64. IGL_INLINE void pseudonormal_test(
  65. const Eigen::MatrixBase<DerivedV> & V,
  66. const Eigen::MatrixBase<DerivedF> & E,
  67. const Eigen::MatrixBase<DerivedEN> & EN,
  68. const Eigen::MatrixBase<DerivedVN> & VN,
  69. const Eigen::MatrixBase<Derivedq> & q,
  70. const int e,
  71. Eigen::PlainObjectBase<Derivedc> & c,
  72. Scalar & s,
  73. Eigen::PlainObjectBase<Derivedn> & n);
  74. }
  75. #ifndef IGL_STATIC_LIBRARY
  76. # include "pseudonormal_test.cpp"
  77. #endif
  78. #endif