isl-org / isl-org/Open3D

additional crop and merge functionality

Open
#2,570 2 comments 2 reactions 1 assignee Claimed by @reyanshsolis View on GitHub
crop geometry pointcloud
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

I'm currently trying to cut out a piece of a mesh, do some computation on that cut out submesh via and then put it back in.
The current TriangleMesh.crop() implementation doesn't give much options for such a procedure.
Currently, to get both the cutout submesh as well as the rest of the initial mesh I use the following - quite hacky - code:
```
cropmesh = combinedmesh.crop(bounding_box)
if cropmesh.has_triangles():
croppcd = o3d.geometry.PointCloud(points=o3d.utility.Vector3dVector(np.asarray(cropmesh.vertices)))
duplicatedpcd = o3d.geometry.PointCloud(points=o3d.utility.Vector3dVector(np.asarray(combinedmesh.vertices))) + croppcd
nnd = duplicatedpcd.compute_nearest_neighbor_distance()
mask = np.asarray(nnd) < 0.0001
rest = copy.deepcopy(combinedmesh)
rest.remove_vertices_by_mask(mask[:len(rest.vertices)])
#vis.draw_result(True, [cropmesh, rest])
```
This simply gets the combined point clouds of the initial mesh and the cropped mesh, tests which vertices are at same location (or rather a near enough location) creates a new mesh of the remaining points by copying the initial mesh and removing those vertices.

Let the crop() method return both cropped out and remaining mesh, or give it an additional bool argument to reverse the selection made by the bounding box.
Additionally merging two meshes into one by automatically connecting their vertices would be nice, although I realize, that this would be quite a complicated task (to find which out, where exactly to connect two meshes).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.