isl-org / isl-org/Open3D

bug in open3d's algorithm for determining self-intersection of triangular mesh

Open
#6,462 1 comment 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](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### Describe the issue

I used "**is_self_intersecting()**" function to check if the input triangular mesh has self-intersection, getting a return value of "True". However, when I exported these "intersecting" triangles (here I call it _mesh1_, for distinction) by "**get_self_intersecting_triangles()**" function and visualized them, I found that they don't actually intersect but seem to lie in the same plane. I did another test by customizing a mesh (_mesh2_) which only consists of 2 non-intersecting triangles but sharing the same plane, this time the function worked normally. I'm confused now, wondering why the pair of triangles in _mesh1_ are considered intersecting by open3d.

### Steps to reproduce the bug

```python
import open3d as o3d
import numpy as np

""" the example mesh1, by which I found the bug"""
v1_array = np.load('v_array.npy') # url: https://github.com/Amble12345/123/blob/main/v_array.npy
t1_array = np.load('t_array.npy') # url: https://github.com/Amble12345/123/blob/main/t_array.npy
mesh1 = o3d.geometry.TriangleMesh()
mesh1.vertices = o3d.utility.Vector3dVector(v1_array)
mesh1.triangles = o3d.utility.Vector3iVector(t1_array)
print(mesh1.is_self_intersecting()) # True
print(np.asarray(mesh1.get_self_intersecting_triangles())) # [[0 1]]

# ************************** #

""" the example mesh2, for test """
v2_array = np.array([[0, 1, 1],
[1, 1, 1],
[1, 0, 1],
[2, 0, 1],
[2, 1, 1],
[3, 1, 1]], dtype=np.float64)

t2_array = np.array([[0, 1, 2],
[3, 4, 5]]) # a pair of non-intersecting triangles but sharing the same plane

mesh2 = o3d.geometry.TriangleMesh()
mesh2.vertices = o3d.utility.Vector3dVector(v2_array)
mesh2.triangles = o3d.utility.Vector3iVector(t2_array)
print(mesh2.is_self_intersecting()) # False
print(np.asarray(mesh2.get_self_intersecting_triangles())) # [[]]

""" Visualization of mesh1 """
mesh1.paint_uniform_color([1.0, 0.0, 0.0])
o3d.visualization.draw_geometries([mesh1])
```

### Error message

_No response_

### Expected behavior

_No response_

### Open3D, Python and System information

```markdown
- Operating system: Windows 11 64-bit
- Python version: Python 3.9
- Open3D version: 0.17.0
- VTK version: 9.1.0
- System architecture: x64
- Is this a remote workstation?: no
- How did you install Open3D?: pip
```

### Additional information

![image](https://github.com/isl-org/Open3D/assets/57221930/ef19028f-ef3c-46e5-ab45-e116608da5e8)
![image](https://github.com/isl-org/Open3D/assets/57221930/f6d60bab-c4fe-479c-89fe-f9609d540afc)

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.