pseudonormal_test.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. // i index into F to face to which c belongs
  28. // c Point on (V,F)
  29. // Outputs:
  30. // s sign
  31. // n normal
  32. IGL_INLINE void pseudonormal_test(
  33. const Eigen::MatrixXd & V,
  34. const Eigen::MatrixXi & F,
  35. const Eigen::MatrixXd & FN,
  36. const Eigen::MatrixXd & VN,
  37. const Eigen::MatrixXd & EN,
  38. const Eigen::VectorXi & EMAP,
  39. const Eigen::RowVector3d & q,
  40. const int i,
  41. const Eigen::RowVector3d & c,
  42. double & s,
  43. Eigen::RowVector3d & n);
  44. }
  45. #ifndef IGL_STATIC_LIBRARY
  46. # include "pseudonormal_test.cpp"
  47. #endif
  48. #endif