principal_curvature.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 "igl_inline.h"
  13. //#include <igl/cotmatrix.h>
  14. //#include <igl/writeOFF.h>
  15. namespace igl
  16. {
  17. // Compute the principal curvature directions and magnitude of the given triangle mesh
  18. // DerivedV derived from vertex positions matrix type: i.e. MatrixXd
  19. // DerivedF derived from face indices matrix type: i.e. MatrixXi
  20. // Inputs:
  21. // V eigen matrix #V by 3
  22. // F #F by 3 list of mesh faces (must be triangles)
  23. // radius controls the size of the neighbourhood used, 1 = average edge lenght
  24. //
  25. // Outputs:
  26. // PD1 #V by 3 maximal curvature direction for each vertex.
  27. // PD2 #V by 3 minimal curvature direction for each vertex.
  28. // PV1 #V by 1 maximal curvature value for each vertex.
  29. // PV2 #V by 1 minimal curvature value for each vertex.
  30. //
  31. // See also: average_onto_faces, average_onto_vertices
  32. //
  33. // This function has been developed by: Nikolas De Giorgis, Luigi Rocca and Enrico Puppo.
  34. // The algorithm is based on:
  35. // Efficient Multi-scale Curvature and Crease Estimation
  36. // Daniele Panozzo, Enrico Puppo, Luigi Rocca
  37. // GraVisMa, 2010
  38. template <
  39. typename DerivedV,
  40. typename DerivedF,
  41. typename DerivedPD1,
  42. typename DerivedPD2,
  43. typename DerivedPV1,
  44. typename DerivedPV2>
  45. IGL_INLINE void principal_curvature(
  46. const Eigen::PlainObjectBase<DerivedV>& V,
  47. const Eigen::PlainObjectBase<DerivedF>& F,
  48. Eigen::PlainObjectBase<DerivedPD1>& PD1,
  49. Eigen::PlainObjectBase<DerivedPD2>& PD2,
  50. Eigen::PlainObjectBase<DerivedPV1>& PV1,
  51. Eigen::PlainObjectBase<DerivedPV2>& PV2,
  52. unsigned radius = 5,
  53. bool useKring = true);
  54. }
  55. #ifndef IGL_STATIC_LIBRARY
  56. #include "principal_curvature.cpp"
  57. #endif
  58. #endif