exact_geodesic.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2017 Zhongshi Jiang <[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_EXACT_GEODESIC_H
  9. #define IGL_EXACT_GEODESIC_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Exact geodesic algorithm for triangular mesh with the implementation from https://code.google.com/archive/p/geodesic/,
  15. /// and the algorithm first described by Mitchell, Mount and Papadimitriou in 1987
  16. ///
  17. /// @param[in] V #V by 3 list of 3D vertex positions
  18. /// @param[in] F #F by 3 list of mesh faces
  19. /// @param[in] VS #VS by 1 vector specifying indices of source vertices
  20. /// @param[in] FS #FS by 1 vector specifying indices of source faces
  21. /// @param[in] VT #VT by 1 vector specifying indices of target vertices
  22. /// @param[in] FT #FT by 1 vector specifying indices of target faces
  23. /// @param[out] D #VT+#FT by 1 vector of geodesic distances of each target w.r.t. the nearest one in the source set
  24. ///
  25. /// \note specifying a face as target/source means its center.
  26. ///
  27. template <
  28. typename DerivedV,
  29. typename DerivedF,
  30. typename DerivedVS,
  31. typename DerivedFS,
  32. typename DerivedVT,
  33. typename DerivedFT,
  34. typename DerivedD>
  35. IGL_INLINE void exact_geodesic(
  36. const Eigen::MatrixBase<DerivedV> &V,
  37. const Eigen::MatrixBase<DerivedF> &F,
  38. const Eigen::MatrixBase<DerivedVS> &VS,
  39. const Eigen::MatrixBase<DerivedFS> &FS,
  40. const Eigen::MatrixBase<DerivedVT> &VT,
  41. const Eigen::MatrixBase<DerivedFT> &FT,
  42. Eigen::PlainObjectBase<DerivedD> &D);
  43. }
  44. #ifndef IGL_STATIC_LIBRARY
  45. # include "exact_geodesic.cpp"
  46. #endif
  47. #endif