extract_feature.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Qingnan Zhou <[email protected]>
  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_COPYLEFT_CGAL_EXTRACT_FEATURE_H
  9. #define IGL_COPYLEFT_CGAL_EXTRACT_FEATURE_H
  10. #include "../../igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl
  14. {
  15. namespace copyleft
  16. {
  17. namespace cgal
  18. {
  19. /// Extract feature edges based on dihedral angle.
  20. /// Here, dihedral angle is defined as the angle between surface
  21. /// __normals__ as described in
  22. /// http://mathworld.wolfram.com/DihedralAngle.html
  23. ///
  24. /// Non-manifold and boundary edges are automatically considered as
  25. /// features.
  26. ///
  27. /// @param[in] V #V by 3 array of vertices.
  28. /// @param[in] F #F by 3 array of faces.
  29. /// @param[in] tol Edges with dihedral angle larger than this are considered
  30. /// as features. Angle is measured in radian.
  31. /// @param[out] feature_edges: #E by 2 array of edges. Each edge satisfies at
  32. /// least one of the following criteria:
  33. /// * Edge has dihedral angle larger than tol.
  34. /// * Edge is boundary.
  35. /// * Edge is non-manifold (i.e. it has more than 2 adjacent
  36. /// faces).
  37. template <
  38. typename DerivedV,
  39. typename DerivedF,
  40. typename Derivedfeature_edges>
  41. IGL_INLINE void extract_feature(
  42. const Eigen::MatrixBase<DerivedV>& V,
  43. const Eigen::MatrixBase<DerivedF>& F,
  44. const double tol,
  45. Eigen::PlainObjectBase<Derivedfeature_edges>& feature_edges);
  46. // \overload
  47. // @param[in] uE #uE by 2 array of undirected edges.
  48. // @param[in] uE2E #uE list of lists mapping undirected edges to all
  49. // corresponding directed edges.
  50. template <
  51. typename DerivedV,
  52. typename DerivedF,
  53. typename DeriveduE,
  54. typename Derivedfeature_edges
  55. >
  56. IGL_INLINE void extract_feature(
  57. const Eigen::MatrixBase<DerivedV>& V,
  58. const Eigen::MatrixBase<DerivedF>& F,
  59. const double tol,
  60. const Eigen::MatrixBase<DeriveduE>& uE,
  61. const std::vector<std::vector<typename DeriveduE::Scalar> >& uE2E,
  62. Eigen::PlainObjectBase<Derivedfeature_edges>& feature_edges);
  63. }
  64. }
  65. }
  66. #ifndef IGL_STATIC_LIBRARY
  67. # include "extract_feature.cpp"
  68. #endif
  69. #endif