isl-org / isl-org/Open3D

mesh.select_by_index returns fewer vertices than called.

Open
#6,540 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 `main` branch).

### Describe the issue

mesh.select_by_index returns fewer points than if i slice the point cloud myself.
I would like to get the border of my open mesh. However, when i select my indices i get no error, but a mesh with 1 fewer points than i indices i provide. I suspect it is because there are two points that are in exactly the same position and somehow it messes up. But i'm not sure.

### Steps to reproduce the bug

```python
mesh = o3d.io.read_triangle_mesh(path_to_attached_mesh)
vertex_indices_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 2063, 16, 2064, 19, 20, 21, 22, 32, 33, 34, 35, 36, 37, 38, 39, 40, 44, 46, 49, 50, 51, 55, 56, 2108, 65, 66, 67, 73, 74, 75, 76, 77, 83, 84, 91, 96, 103, 104, 105, 115, 126, 127, 128, 129, 130, 131, 2181, 2182, 140, 151, 152, 153, 2218, 2219, 2220, 2221, 174, 175, 176, 177, 178, 2222, 2223, 187, 189, 190, 191, 192, 198, 200, 2257, 2258, 211, 2259, 2260, 2261, 221, 222, 223, 224, 225, 2280, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 259, 260, 261, 262, 263, 264, 265, 2314, 269, 270, 286, 287, 288, 289, 290, 291, 2348, 2349, 2350, 303, 304, 305, 306, 2351, 2352, 2354, 2355, 313, 314, 325, 326, 327, 335, 336, 337, 2391, 348, 349, 350, 355, 356, 368, 372, 373, 374, 375, 2420, 2421, 2422, 2423, 384, 385, 386, 387, 388, 389, 399, 400, 401, 402, 414, 415, 416, 417, 425, 426, 2484, 437, 438, 439, 440, 441, 2485, 445, 462, 463, 464, 2511, 2512, 2513, 468, 469, 470, 471, 472, 473, 2514, 490, 2542, 498, 499, 500, 501, 502, 503, 504, 515, 2569, 2570, 2571, 525, 545, 546, 547, 548, 556, 557, 2605, 2606, 2607, 2608, 2609, 568, 575, 579, 580, 2639, 2640, 600, 606, 620, 621, 622, 623, 624, 2668, 2691, 657, 658, 659, 660, 661, 674, 675, 676, 2731, 2732, 699, 707, 2759, 2760, 2761, 725, 734, 735, 2789, 2790, 755, 756, 767, 768, 2818, 787, 788, 789, 802, 823, 824, 825, 830, 831, 832, 834, 837, 2894, 2895, 2897, 2898, 2899, 859, 860, 2920, 2921, 2922, 882, 889, 894, 899, 900, 901, 902, 903, 2947, 928, 929, 942, 943, 944, 945, 958, 974, 975, 976, 977, 3034, 989, 990, 991, 992, 993, 3050, 1013, 3068, 1027, 1047, 1048, 1049, 1050, 1081, 1082, 1150, 1158, 1159, 1160, 1161, 1233, 1235, 1267, 1269, 1270, 1271, 1272, 1350, 1388, 1389, 1390, 1417, 1418, 1419, 1472, 1502, 1543, 1544, 1545, 1579, 1580, 1581, 1582, 1615, 1616, 1654, 1695, 1725, 1726, 1727, 1728, 1729, 1811, 1843, 1844, 1845, 1884, 1885, 1915, 1959, 1960, 1973, 1999, 2000, 2032]
border_mesh = mesh.select_by_index(vertex_indices_list)
assert len(vertex_indices_list) == np.asarray(border_mesh.vertices).shape[0]
```

### Error message

No error message, it returns less without complaints

### Expected behavior

Returning equal amount of points

### Open3D, Python and System information

```markdown
- Operating system: Ubuntu 22.04
- Python version: Python 3.9.17
- Open3D version: 0.17.0
- System architecture: x86
- Is this a remote workstation?: yes
- How did you install Open3D?: pip
- Compiler version (if built from source): not sure
```

### Additional information

https://www.dropbox.com/scl/fi/dj0e5igx1ooi9rzvx9z50/00052_3_1750.ply?rlkey=kdu4vqhjcm9nfpwh7p72g8hg8&dl=0

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Python reproduction using mesh.select_by_index and the supplied vertex_indices_list, then compare the input count with the returned mesh vertices. Trace the select_by_index entry point to determine why one selected vertex is omitted, and consider the duplicate-position case described in the report. Done means the reported case is explained and the selected vertex count follows the documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.