per_corner_normals.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef IGL_PER_CORNER_NORMALS_H
  2. #define IGL_PER_CORNER_NORMALS_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. #include <vector>
  6. namespace igl
  7. {
  8. // Compute vertex normals via vertex position list, face list
  9. // Inputs:
  10. // V #V by 3 eigen Matrix of mesh vertex 3D positions
  11. // F #F by 3 eigne Matrix of face (triangle) indices
  12. // corner_threshold threshold in degrees on sharp angles
  13. // Output:
  14. // CN #F*3 by 3 eigen Matrix of mesh vertex 3D normals, where the normal
  15. // for corner F(i,j) is at CN(i*3+j,:)
  16. template <typename DerivedV, typename DerivedF>
  17. IGL_INLINE void per_corner_normals(
  18. const Eigen::PlainObjectBase<DerivedV>& V,
  19. const Eigen::PlainObjectBase<DerivedF>& F,
  20. const double corner_threshold,
  21. Eigen::PlainObjectBase<DerivedV> & CN);
  22. // Other Inputs:
  23. // FN #F by 3 eigen Matrix of face normals
  24. // VF map from vertices to list of incident faces
  25. template <typename DerivedV, typename DerivedF, typename IndexType>
  26. IGL_INLINE void per_corner_normals(
  27. const Eigen::PlainObjectBase<DerivedV>& V,
  28. const Eigen::PlainObjectBase<DerivedF>& F,
  29. const Eigen::PlainObjectBase<DerivedV>& FN,
  30. const std::vector<std::vector<IndexType> >& VF,
  31. const double corner_threshold,
  32. Eigen::PlainObjectBase<DerivedV> & CN);
  33. }
  34. #ifdef IGL_HEADER_ONLY
  35. # include "per_corner_normals.cpp"
  36. #endif
  37. #endif