-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement open3d::t::geometry::TriangleMesh::SelectByIndex
The method takes a list of indices and returns a new mesh built with the selected vertices and triangles formed by these vertices. The indices type can be any integral type. The algorithm is implemented on CPU only. The implementation is inspired by open3d::geometry::TriangleMesh::SelectByIndex. and by open3d::t::geometry::TriangleMesh::SelectFacesByMask. We first compute a mask of vertices to be selected. If the input index exceeds the maximum number of vertices or is negative, we ignore the index and print a warning. If the mesh has triangles, we build tringle mask and select needed triangles. The next step is to update triangle indices to a new ones. It is similar to SelectFacesByMask, so I introduced a static helper to do that. Based on the vertex mask we build a mapping index vector using inclusive prefix sum algorithm and use it as a map between old and new indices. We select the vertices by mask and build the resulting mesh from the selected vertices and triangles. Copying the mesh attributes is again similar to SelectFacesByMask, so I put it to a separate static function.
- Loading branch information
Showing
5 changed files
with
481 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.