principal_curvature.h 1.8 KB

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