Too large bounds in "create_from_triangle_mesh_within_bounds"
- 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 just updated to Open3D 0.17.0 and I suspect that this version has an issue in the function "VoxelGrid.create_from_triangle_mesh_within_bounds". When I use the function and define the min_bound, max_bound and voxel_size, the created voxel grid frequently extends beyond the specified boundaries by exactly one voxel_size. It does however not necessarilly extend beyond the boundaries in all directions but in seemingly random ones.
I read in the changelog of v0.17 that there was a Fix "Fixed wrong voxel center calculation in CreateFromTriangleMeshWithinBounds()." by @plusk01 . Maybe this is a related issue? I have not had the issue with the previous version of Open3D.
### Steps to reproduce the bug
```python
import numpy as np
import open3d as o3d
voxel_size = 0.1
# load a mesh that extends to min_bound & max_bound
mesh = o3d.io.read_triangle_mesh('test_mesh.stl')
voxels = o3d.geometry.VoxelGrid.create_from_triangle_mesh_within_bounds(
input=mesh, voxel_size=voxel_size,
min_bound=np.array([0, 0, 0]),
max_bound=np.array([10, 10, 10]))
print(voxels.get_max_bound())
# >>> [10. 10. 6.6]
# ... no problem here
print(voxels.get_min_bound())
# >>> [ 0. -0.1 3.4]
# ... here the voxels should not extend beyond [0., 0., 3.4]
```
### Error message
_No response_
### Expected behavior
I expect that the created voxel grid is confined by the provided boundaries.
### Open3D, Python and System information
```markdown
- Operating system: Windows 10 64-bit
- Python version: Python 3.10
- Open3D version: 0.17.0
- System architecture: x64
- Is this a remote workstation?: no
- How did you install Open3D?: pip
```
### Additional information
The above given code example + an exemplary mesh to reproduce the problem.
[code&mesh.zip](https://github.com/isl-org/Open3D/files/11142433/code.mesh.zip)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.