per_edge_normals.h 2.6 KB

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