principal_curvature.h 2.1 KB

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