[python] o3d.io.read_triangle_mesh changes order of faces and vertices
- Dominant language
- C++
- Stars
- 14k
- Forks
- 2.6k
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 6
Description
Hello,
loading an *.obj file what does not start with face[0] = [0,1,2] gets changed on loading.
The mesh is still ok. But the vertex numbers and faces gonna change. This is especially a problem, if working with labeled data.
code to reproduce:
```
path = os.path.normpath('exp.obj')
width = round(np.random.uniform(0.5,1),6)
height = round(np.random.uniform(0.5,1),6)
depth = round(np.random.uniform(0.5,1),6)
mesh_o3d = o3d.geometry.TriangleMesh.create_box(width = width, height = height, depth = depth)
print("after creation")
print(np.array(mesh_o3d.triangles)[:3])
print(np.array(mesh_o3d.vertices)[:3])
o3d.io.write_triangle_mesh(path, mesh_o3d, write_ascii=True, \
compressed=False, write_vertex_normals=False, write_vertex_colors=False, \
write_triangle_uvs=False, print_progress=False)
mesh_o3d = o3d.io.read_triangle_mesh(path)
print("after save and load I")
print(np.array(mesh_o3d.triangles)[:3])
print(np.array(mesh_o3d.vertices)[:3])
o3d.io.write_triangle_mesh(path, mesh_o3d, write_ascii=True, \
compressed=False, write_vertex_normals=False, write_vertex_colors=False, \
write_triangle_uvs=False, print_progress=False)
mesh_o3d = o3d.io.read_triangle_mesh(path)
print("after save and load II")
print(np.array(mesh_o3d.triangles)[:3])
print(np.array(mesh_o3d.vertices)[:3])
```
```
after creation
[[4 7 5]
[4 6 7]
[0 2 4]]
[[0. 0. 0. ]
[0.946121 0. 0. ]
[0. 0. 0.853079]]
after save and load I
[[0 1 2]
[0 3 1]
[4 5 0]]
[[0. 0.64816999 0. ]
[0.94612098 0.64816999 0.85307902]
[0.94612098 0.64816999 0. ]]
after save and load II
[[0 1 2]
[0 3 1]
[4 5 0]]
[[0. 0.64816999 0. ]
[0.94612098 0.64816999 0.85307902]
[0.94612098 0.64816999 0. ]]
```
System:
py38
windows (anaconda)
best regards
mgangl
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.