瀏覽代碼

Fixed initialization of N matrix

Former-commit-id: 4a7c6743bceee532204b18b59f2a56ad420e524c
schuellc 12 年之前
父節點
當前提交
2f5daa0888
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      include/igl/per_vertex_normals.cpp

+ 3 - 2
include/igl/per_vertex_normals.cpp

@@ -37,8 +37,8 @@ IGL_INLINE void igl::per_vertex_normals(
   Eigen::PlainObjectBase<DerivedV> & N)
 {
   // Resize for output
-  N.resize(V.rows(),3);
-  
+  N.setZero(V.rows(),3);
+
   // loop over faces
   int Frows = F.rows();
 #pragma omp parallel for
@@ -50,6 +50,7 @@ IGL_INLINE void igl::per_vertex_normals(
       N.row(F(i,j)) += FN.row(i);
     }
   }
+  cout << "N.row()" << N.row(0) << endl;
   // normalize each row
   igl::normalize_row_lengths(N,N);
 }