-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement t::geometry::TriangleMesh::RemoveUnreferencedVertices #6640
Implement t::geometry::TriangleMesh::RemoveUnreferencedVertices #6640
Conversation
Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes. |
eee30b6
to
28aeb0f
Compare
In the last push I also added "device" argument to tensor initialization in cpp tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Some minor comments.
def test_remove_unreferenced_vertices(device): | ||
for int_t in [o3c.int32, o3c.int64]: | ||
for float_t in [o3c.float32, o3c.float64]: | ||
check_no_unreferenced_vertices(device, int_t, float_t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use nested parametrize in pytest. No need for the two for loops.
@pytest.mark.parametrize("device", list_devices())
@pytest.mark.parametrize("int_t", (o3c.int32, o3c.int64))
@pytest.mark.parametrize("float_t", (o3c.float32, o3c.float64))
for (auto item : GetVertexAttr()) { | ||
SetVertexAttr(item.first, item.second.IndexGet({vertex_mask})); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Add LogDebug
message about how many vertices were removed.
|
||
if (!HasTriangleIndices() || GetTriangleIndices().GetLength() == 0) { | ||
utility::LogWarning( | ||
"[RemoveUnreferencedVertices] TriangleMesh has no triangles."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"[RemoveUnreferencedVertices] TriangleMesh has no triangles. Removing all vertices."
e60a07a
to
664ef13
Compare
The algorithm mimics the one in geometry::TriangleMesh::RemoveUnreferencedVertices. We first build a mask of vertices and then update all vertex attributes by that mask. Triangles are left untouched.
664ef13
to
d477ab8
Compare
The algorithm mimics the one in
geometry::TriangleMesh::RemoveUnreferencedVertices. We first build a mask of vertices and then update all vertex attributes by that mask. Triangles are left untouched.
Type
Motivation and Context
Implement missing method t::geometry::TriangleMesh::RemoveUnreferencedVertices. The method is defined in the legacy API.
Checklist:
python util/check_style.py --apply
to apply Open3D code styleto my code.
updated accordingly.
results (e.g. screenshots or numbers) here.
Description