principal_curvature.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Daniele Panozzo <daniele.panozzo@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. // PV1 #V by 1 maximal curvature value for each vertex.
  32. // PV2 #V by 1 minimal curvature value for each vertex.
  33. //
  34. // See also: moveVF, moveFV
  35. //
  36. // This function has been developed by: Nikolas De Giorgis, Luigi Rocca and Enrico Puppo.
  37. // The algorithm is based on:
  38. // Efficient Multi-scale Curvature and Crease Estimation
  39. // Daniele Panozzo, Enrico Puppo, Luigi Rocca
  40. // GraVisMa, 2010
  41. template <typename DerivedV, typename DerivedF>
  42. IGL_INLINE void principal_curvature(
  43. const Eigen::PlainObjectBase<DerivedV>& V,
  44. const Eigen::PlainObjectBase<DerivedF>& F,
  45. Eigen::PlainObjectBase<DerivedV>& PD1,
  46. Eigen::PlainObjectBase<DerivedV>& PD2,
  47. Eigen::PlainObjectBase<DerivedV>& PV1,
  48. Eigen::PlainObjectBase<DerivedV>& PV2,
  49. unsigned radius = 5,
  50. bool useKring = true);
  51. }
  52. #ifdef IGL_HEADER_ONLY
  53. #include "principal_curvature.cpp"
  54. #endif
  55. #endif