per_vertex_normals.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef IGL_PER_VERTEX_NORMALS_H
  2. #define IGL_PER_VERTEX_NORMALS_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. // Note: So for this only computes normals per vertex as uniformly weighted
  6. // averages of incident triangle normals. It would be nice to support more or
  7. // all of the methods here:
  8. // "A comparison of algorithms for vertex normal computation"
  9. namespace igl
  10. {
  11. // Compute vertex normals via vertex position list, face list
  12. // Inputs:
  13. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  14. // F #F by 3 eigne Matrix of face (triangle) indices
  15. // Output:
  16. // N #V by 3 eigen Matrix of mesh vertex 3D normals
  17. template <typename DerivedV, typename DerivedF>
  18. IGL_INLINE void per_vertex_normals(
  19. const Eigen::PlainObjectBase<DerivedV>& V,
  20. const Eigen::PlainObjectBase<DerivedF>& F,
  21. Eigen::PlainObjectBase<DerivedV> & N);
  22. template <typename DerivedV, typename DerivedF>
  23. IGL_INLINE void per_vertex_normals(
  24. const Eigen::PlainObjectBase<DerivedV>& V,
  25. const Eigen::PlainObjectBase<DerivedF>& F,
  26. const Eigen::PlainObjectBase<DerivedV>& FN,
  27. Eigen::PlainObjectBase<DerivedV> & N);
  28. }
  29. #ifdef IGL_HEADER_ONLY
  30. # include "per_vertex_normals.cpp"
  31. #endif
  32. #endif