Skip to content

Commit

Permalink
add missing initialization for compute_vertex_normals (#6873)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminum authored Jul 17, 2024
1 parent c9f6713 commit 1f66cb0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cpp/open3d/geometry/TriangleMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ TriangleMesh &TriangleMesh::ComputeTriangleNormals(

TriangleMesh &TriangleMesh::ComputeVertexNormals(bool normalized /* = true*/) {
ComputeTriangleNormals(false);
vertex_normals_.resize(vertices_.size(), Eigen::Vector3d::Zero());
vertex_normals_.resize(vertices_.size());
std::fill(vertex_normals_.begin(), vertex_normals_.end(),
Eigen::Vector3d::Zero());
for (size_t i = 0; i < triangles_.size(); i++) {
auto &triangle = triangles_[i];
vertex_normals_[triangle(0)] += triangle_normals_[i];
Expand Down

0 comments on commit 1f66cb0

Please sign in to comment.