principal_curvature.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef PRINCIPAL_CURVATURE_H
  2. #define PRINCIPAL_CURVATURE_H
  3. #include <Eigen/Geometry>
  4. #include <Eigen/Dense>
  5. #include <vector>
  6. #include <stdio.h>
  7. #include <map>
  8. #define IGL_HEADER_ONLY
  9. #include <igl/igl_inline.h>
  10. #include <igl/cotmatrix.h>
  11. #include <igl/writeOFF.h>
  12. using std::vector;
  13. namespace igl
  14. {
  15. // Compute the principal curvature directions and magnitude of the given triangle mesh
  16. // DerivedV derived from vertex positions matrix type: i.e. MatrixXd
  17. // DerivedF derived from face indices matrix type: i.e. MatrixXi
  18. // Inputs:
  19. // V eigen matrix #V by 3
  20. // F #F by 3 list of mesh faces (must be triangles)
  21. // radius controls the size of the neighbourhood used, 1 = average edge lenght
  22. //
  23. // Outputs:
  24. // PD1 #V by 3 maximal curvature direction for each vertex.
  25. // PD2 #V by 3 minimal curvature direction for each vertex.
  26. // Note that to maximal/minimal curvature value is the rowise norm of PD1/PD2
  27. //
  28. // See also: moveVF, moveFV
  29. //
  30. // This function has been developed by: Nikolas De Giorgis, Luigi Rocca and Enrico Puppo.
  31. // The algorithm is based on:
  32. // Efficient Multi-scale Curvature and Crease Estimation
  33. // Daniele Panozzo, Enrico Puppo, Luigi Rocca
  34. // GraVisMa, 2010
  35. template <typename DerivedV, typename DerivedF>
  36. IGL_INLINE void principal_curvature(
  37. const Eigen::PlainObjectBase<DerivedV>& V,
  38. const Eigen::PlainObjectBase<DerivedF>& F,
  39. Eigen::PlainObjectBase<DerivedV>& PD1,
  40. Eigen::PlainObjectBase<DerivedV>& PD2,
  41. unsigned radius = 5
  42. );
  43. }
  44. #ifdef IGL_HEADER_ONLY
  45. #include "principal_curvature.cpp"
  46. #endif
  47. #endif