isl-org / isl-org/Open3D

Boolean intersection fails when one mesh encapsulates the other

Open
#6,710 0 comments 0 reactions 0 assignees View on GitHub
bug
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

When doing a boolean_intersection on 2 meshes where one mesh completely encapsulates the other mesh, the result is completely empty:

### Steps to reproduce the bug

```python
box1 = o3d.t.geometry.TriangleMesh.create_box()
box2 = o3d.t.geometry.TriangleMesh.create_box()

shifted_coords = box1.vertex.positions.numpy() - 0.5 # box coords with centerpoint of box to (0,0,0)

box1.vertex.positions = shifted_coords
box2.vertex.positions = shifted_coords * 10

# box2 now completely encapsulates box1

o3d.t.io.write_triangle_mesh('box1.obj', box1)
o3d.t.io.write_triangle_mesh('box2.obj', box2)

diff = box1.boolean_intersection(box2)

# diff is trianglemesh with zero vertices
```
```

### Error message

_No response_

### Expected behavior

I would expect the result to be equal to box1 (the smaller box).

### Open3D, Python and System information

```markdown
- Operating system: macOS
- Python version: Python 3.10
- Open3D version: output from python: 0.18
- System architecture: apple-silicon
```

### Additional information

_No response_

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.