Mesh Vertices Shape Inconsistency
- 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
The `Vertices` shape is not consist before and after `o3d.io.write_triangle_mesh`. The original data store in `*.ply`, and after convert to `*.stl`, the `mesh.vertices` shape changed, but `mesh.triangles` remains the same.
### Steps to reproduce the bug
```python
def export(self, pth: str) -> str:
if not os.path.exists(pth):
os.mkdir(pth)
data_in = self.input.data()
data_out = self.output.data()
points_in = np.asarray(data_in.vertices)
points_out = np.asarray(data_out.vertices)
faces_in = np.asarray(data_in.triangles)
faces_out = np.asarray(data_out.triangles)
print(f"Before, <{points_in.shape} - {faces_in.shape}> || <{points_out.shape} - {faces_out.shape}>")
# o3d.io.write_triangle_mesh(os.path.join(pth, "input.ply"), data_in)
# o3d.io.write_triangle_mesh(os.path.join(pth, "output.ply"), data_out)
# data_in = o3d.io.read_triangle_mesh(os.path.join(pth, "input.ply"))
# data_out = o3d.io.read_triangle_mesh(os.path.join(pth, "output.ply"))
o3d.io.write_triangle_mesh(os.path.join(pth, "input.stl"), data_in)
o3d.io.write_triangle_mesh(os.path.join(pth, "output.stl"), data_out)
data_in = o3d.io.read_triangle_mesh(os.path.join(pth, "input.stl"))
data_out = o3d.io.read_triangle_mesh(os.path.join(pth, "output.stl"))
points_in = np.asarray(data_in.vertices)
points_out = np.asarray(data_out.vertices)
faces_in = np.asarray(data_in.triangles)
faces_out = np.asarray(data_out.triangles)
print(f"After, <{points_in.shape} - {faces_in.shape}> || <{points_out.shape} - {faces_out.shape}>")
return pth
```
### Error message
_No response_
### Expected behavior
_No response_
### Open3D, Python and System information
```markdown
- Operating system: Ubuntu 22.04
- Python version: Python 3.12
- Open3D version: `0.18.0+a38ec05`
- System architecture: x86
- Is this a remote workstation?: yes
- How did you install Open3D?: conda
```
### Additional information
For example,
```py
o3d.io.write_triangle_mesh(os.path.join(pth, "input.stl"), data_in)
o3d.io.write_triangle_mesh(os.path.join(pth, "output.stl"), data_out)
data_in = o3d.io.read_triangle_mesh(os.path.join(pth, "input.stl"))
data_out = o3d.io.read_triangle_mesh(os.path.join(pth, "output.stl"))
```
the output is,
```txt
Before, <(512, 3) - (885, 3)> || <(508, 3) - (903, 3)>
After, <(2655, 3) - (885, 3)> || <(2709, 3) - (903, 3)>
```
While,
```py
o3d.io.write_triangle_mesh(os.path.join(pth, "input.ply"), data_in)
o3d.io.write_triangle_mesh(os.path.join(pth, "output.ply"), data_out)
data_in = o3d.io.read_triangle_mesh(os.path.join(pth, "input.ply"))
data_out = o3d.io.read_triangle_mesh(os.path.join(pth, "output.ply"))
```
the output is,
```txt
Before, <(512, 3) - (885, 3)> || <(508, 3) - (903, 3)>
After, <(512, 3) - (885, 3)> || <(508, 3) - (903, 3)>
```
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.