o3d.geometry.TriangleMesh.crop result in empty mesh
- Dominant language
- C++
- Stars
- 14k
- Forks
- 2.6k
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 6
Description
### Checklist
- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](https://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](https://www.open3d.org/docs/release/) and the [latest documentation](https://www.open3d.org/docs/latest/) (for `main` branch).
### Describe the issue
o3d.geometry.TriangleMesh.crop result in empty mesh
### Steps to reproduce the bug
```python
import open3d as o3d
import numpy as np
# Get the centroid
cen = [1,1,1]
# Create the outer cylinder
outer_cyl = o3d.geometry.TriangleMesh.create_cylinder(radius=1, height=0.2, resolution=20, split=4, create_uv_map=False)
# Define the bounding box around the centroid
bbox = [
[cen[0]-0.2, cen[1]-0.2, cen[2]-0.2],
[cen[0]+0.2, cen[1]-0.2, cen[2]-0.2],
[cen[0]-0.2, cen[1]+0.2, cen[2]-0.2],
[cen[0]-0.2, cen[1]-0.2, cen[2]+0.2],
[cen[0]+0.2, cen[1]+0.2, cen[2]-0.2],
[cen[0]+0.2, cen[1]-0.2, cen[2]+0.2],
[cen[0]-0.2, cen[1]+0.2, cen[2]+0.2],
[cen[0]+0.2, cen[1]+0.2, cen[2]+0.2]
]
bbox_points = o3d.utility.Vector3dVector(bbox)
inner_box = o3d.geometry.AxisAlignedBoundingBox.create_from_points(bbox_points)
# Translate the cylinder to the centroid
outer_cyl.translate(cen)
o3d.visualization.draw_geometries([outer_cyl,inner_box])
# Crop the outer cylinder with the inner cylinder
cropped_outer_cyl = outer_cyl.crop(inner_box)
# Check if the cropped mesh has any vertices and faces
if len(cropped_outer_cyl.vertices) == 0 or len(cropped_outer_cyl.triangles) == 0:
print("The cropped mesh is empty.")
else:
print("The cropped mesh has vertices and faces.")
```
### Error message
The cropped mesh is empty.
### Expected behavior
The cropped mesh has vertices and faces.
### Open3D, Python and System information
```markdown
- Operating system: Ubuntu 20.04 (WSL on Windows 10 64-bit)
- Python version: Python 3.11.10
- Open3D version: '0.18.0+f4e1fa9'
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip
```
### Additional information
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.