#include "per_vertex_normals.h" #include "per_face_normals.h" #include "normalize_row_lengths.h" template IGL_INLINE void igl::per_vertex_normals( const Eigen::PlainObjectBase& V, const Eigen::PlainObjectBase& F, Eigen::PlainObjectBase & N) { Eigen::PlainObjectBase PFN; igl::per_face_normals(V,F,PFN); return igl::per_vertex_normals(V,F,PFN,N); } template IGL_INLINE void igl::per_vertex_normals( const Eigen::PlainObjectBase& V, const Eigen::PlainObjectBase& F, const Eigen::PlainObjectBase& FN, Eigen::PlainObjectBase & N) { // Resize for output N.setZero(V.rows(),3); // loop over faces int Frows = F.rows(); #pragma omp parallel for for(int i = 0; i < Frows;i++) { // throw normal at each corner for(int j = 0; j < 3;j++) { N.row(F(i,j)) += FN.row(i); } } // normalize each row igl::normalize_row_lengths(N,N); } #ifndef IGL_HEADER_ONLY // Explicit template specialization // generated by autoexplicit.sh template void igl::per_vertex_normals, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&); template void igl::per_vertex_normals, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&); template void igl::per_vertex_normals, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&); #endif