winding_number.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_WINDING_NUMBER_H
  9. #define IGL_WINDING_NUMBER_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. // Minimum number of iterms per openmp thread
  13. #ifndef IGL_WINDING_NUMBER_OMP_MIN_VALUE
  14. # define IGL_WINDING_NUMBER_OMP_MIN_VALUE 1000
  15. #endif
  16. namespace igl
  17. {
  18. // WINDING_NUMBER Compute the sum of solid angles of a triangle/tetrahedron
  19. // described by points (vectors) V
  20. //
  21. // Templates:
  22. // dim dimension of input
  23. // Inputs:
  24. // V n by 3 list of vertex positions
  25. // F #F by 3 list of triangle indices, minimum index is 0
  26. // O no by 3 list of origin positions
  27. // Outputs:
  28. // S no by 1 list of winding numbers
  29. //
  30. template <
  31. typename DerivedV,
  32. typename DerivedF,
  33. typename DerivedO,
  34. typename DerivedW>
  35. IGL_INLINE void winding_number(
  36. const Eigen::MatrixBase<DerivedV> & V,
  37. const Eigen::MatrixBase<DerivedF> & F,
  38. const Eigen::MatrixBase<DerivedO> & O,
  39. Eigen::PlainObjectBase<DerivedW> & W);
  40. // Compute winding number of a single point
  41. //
  42. // Inputs:
  43. // V n by dim list of vertex positions
  44. // F #F by dim list of triangle indices, minimum index is 0
  45. // p single origin position
  46. // Outputs:
  47. // w winding number of this point
  48. //
  49. template <
  50. typename DerivedV,
  51. typename DerivedF,
  52. typename Derivedp>
  53. IGL_INLINE typename DerivedV::Scalar winding_number(
  54. const Eigen::MatrixBase<DerivedV> & V,
  55. const Eigen::MatrixBase<DerivedF> & F,
  56. const Eigen::MatrixBase<Derivedp> & p);
  57. }
  58. #ifndef IGL_STATIC_LIBRARY
  59. # include "winding_number.cpp"
  60. #endif
  61. #endif