per_edge_normals.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Alec Jacobson <[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_PER_EDGE_NORMALS_H
  9. #define IGL_PER_EDGE_NORMALS_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Weighting schemes for per edge normals
  15. enum PerEdgeNormalsWeightingType
  16. {
  17. /// Incident face normals have uniform influence on edge normal
  18. PER_EDGE_NORMALS_WEIGHTING_TYPE_UNIFORM = 0,
  19. /// Incident face normals are averaged weighted by area
  20. PER_EDGE_NORMALS_WEIGHTING_TYPE_AREA = 1,
  21. /// Area weights
  22. PER_EDGE_NORMALS_WEIGHTING_TYPE_DEFAULT = 2,
  23. /// Total number of weighting types
  24. NUM_PER_EDGE_NORMALS_WEIGHTING_TYPE = 3
  25. };
  26. /// Compute face normals via vertex position list, face list
  27. ///
  28. /// @param[in] V #V by 3 eigen Matrix of mesh vertex 3D positions
  29. /// @param[in] F #F by 3 eigen Matrix of face (triangle) indices
  30. /// @param[in] weight weighting type
  31. /// @param[in] FN #F by 3 matrix of 3D face normals per face
  32. /// @param[out] N #2 by 3 matrix of mesh edge 3D normals per row
  33. /// @param[out] E #E by 2 matrix of edge indices per row
  34. /// @param[out] EMAP #E by 1 matrix of indices from all edges to E
  35. ///
  36. template <
  37. typename DerivedV,
  38. typename DerivedF,
  39. typename DerivedFN,
  40. typename DerivedN,
  41. typename DerivedE,
  42. typename DerivedEMAP>
  43. IGL_INLINE void per_edge_normals(
  44. const Eigen::MatrixBase<DerivedV>& V,
  45. const Eigen::MatrixBase<DerivedF>& F,
  46. const PerEdgeNormalsWeightingType weight,
  47. const Eigen::MatrixBase<DerivedFN>& FN,
  48. Eigen::PlainObjectBase<DerivedN> & N,
  49. Eigen::PlainObjectBase<DerivedE> & E,
  50. Eigen::PlainObjectBase<DerivedEMAP> & EMAP);
  51. /// \overload
  52. template <
  53. typename DerivedV,
  54. typename DerivedF,
  55. typename DerivedN,
  56. typename DerivedE,
  57. typename DerivedEMAP>
  58. IGL_INLINE void per_edge_normals(
  59. const Eigen::MatrixBase<DerivedV>& V,
  60. const Eigen::MatrixBase<DerivedF>& F,
  61. const PerEdgeNormalsWeightingType weight,
  62. Eigen::PlainObjectBase<DerivedN> & N,
  63. Eigen::PlainObjectBase<DerivedE> & E,
  64. Eigen::PlainObjectBase<DerivedEMAP> & EMAP);
  65. /// \overload
  66. template <
  67. typename DerivedV,
  68. typename DerivedF,
  69. typename DerivedN,
  70. typename DerivedE,
  71. typename DerivedEMAP>
  72. IGL_INLINE void per_edge_normals(
  73. const Eigen::MatrixBase<DerivedV>& V,
  74. const Eigen::MatrixBase<DerivedF>& F,
  75. Eigen::PlainObjectBase<DerivedN> & N,
  76. Eigen::PlainObjectBase<DerivedE> & E,
  77. Eigen::PlainObjectBase<DerivedEMAP> & EMAP);
  78. }
  79. #ifndef IGL_STATIC_LIBRARY
  80. # include "per_edge_normals.cpp"
  81. #endif
  82. #endif