per_corner_normals.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. template <
  25. typename DerivedV,
  26. typename DerivedF,
  27. typename DerivedFN,
  28. typename DerivedCN>
  29. IGL_INLINE void per_corner_normals(
  30. const Eigen::PlainObjectBase<DerivedV>& V,
  31. const Eigen::PlainObjectBase<DerivedF>& F,
  32. const Eigen::PlainObjectBase<DerivedFN>& FN,
  33. const double corner_threshold,
  34. Eigen::PlainObjectBase<DerivedCN> & CN);
  35. // Other Inputs:
  36. // VF map from vertices to list of incident faces
  37. template <typename DerivedV, typename DerivedF, typename IndexType>
  38. IGL_INLINE void per_corner_normals(
  39. const Eigen::PlainObjectBase<DerivedV>& V,
  40. const Eigen::PlainObjectBase<DerivedF>& F,
  41. const Eigen::PlainObjectBase<DerivedV>& FN,
  42. const std::vector<std::vector<IndexType> >& VF,
  43. const double corner_threshold,
  44. Eigen::PlainObjectBase<DerivedV> & CN);
  45. }
  46. #ifdef IGL_HEADER_ONLY
  47. # include "per_corner_normals.cpp"
  48. #endif
  49. #endif