Skip to content

Conversation

@benjaminum
Copy link
Contributor

Type

  • Bug fix (non-breaking change which fixes an issue): Fixes #
  • New feature (non-breaking change which adds functionality). Resolves #
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) Resolves #

Motivation and Context

Fixes #6848 which describes a bug if computing vertex normals that are already initialized.

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description

Before and after applying the bugfix

image image

@update-docs
Copy link

update-docs bot commented Jul 16, 2024

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

vertex_normals_.resize(vertices_.size(), Eigen::Vector3d::Zero());
vertex_normals_.resize(vertices_.size());
std::fill(vertex_normals_.begin(), vertex_normals_.end(),
Eigen::Vector3d::Zero());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch for this subtle bug: resize(size, val) only initializes additional copies to val and will not change existing data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benjaminum benjaminum merged commit 1f66cb0 into main Jul 17, 2024
@benjaminum benjaminum deleted the benjaminum/fix_init_compute_normals branch July 17, 2024 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compute_vertex_normals produces wrong results when mesh previous has incorrect normals

3 participants