pseudonormal_test.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <alecjacobson@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_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. // Inputs:
  20. // V #V by 3 list of vertex positions
  21. // F #F by 3 list of triangle indices
  22. // FN #F by 3 list of triangle normals
  23. // VN #V by 3 list of vertex normals (ANGLE WEIGHTING)
  24. // EN #E by 3 list of edge normals (UNIFORM WEIGHTING)
  25. // EMAP #F*3 mapping edges in F to E
  26. // q Query point
  27. // f index into F to face to which c belongs
  28. // c Point on (V,F)
  29. // Outputs:
  30. // s sign
  31. // n normal
  32. template <
  33. typename DerivedV,
  34. typename DerivedF,
  35. typename DerivedFN,
  36. typename DerivedVN,
  37. typename DerivedEN,
  38. typename DerivedEMAP,
  39. typename Derivedq,
  40. typename Derivedc,
  41. typename Scalar,
  42. typename Derivedn>
  43. IGL_INLINE void pseudonormal_test(
  44. const Eigen::MatrixBase<DerivedV> & V,
  45. const Eigen::MatrixBase<DerivedF> & F,
  46. const Eigen::MatrixBase<DerivedFN> & FN,
  47. const Eigen::MatrixBase<DerivedVN> & VN,
  48. const Eigen::MatrixBase<DerivedEN> & EN,
  49. const Eigen::MatrixBase<DerivedEMAP> & EMAP,
  50. const Eigen::MatrixBase<Derivedq> & q,
  51. const int f,
  52. Eigen::PlainObjectBase<Derivedc> & c,
  53. Scalar & s,
  54. Eigen::PlainObjectBase<Derivedn> & n);
  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