per_corner_normals.h 1.7 KB

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