Closed ennauata closed 3 years ago
Hi @ennauata , I also encounter such problem, how did you solve it? Thanks.
The problem here is that we defined translations
as the global position of the center point of the part. So you need to first put the part into local frame where its center becomes (0, 0, 0). Adding one line to the above code should solve this issue:
# unpack data
parts_voxel = np.array(data_dict['parts_voxel_scaled64'])
translations = np.array(data_dict['translations'])
scales = np.array(data_dict['scales'])
# transform
scene = trimesh.Scene()
for parts, t, s in zip(parts_voxel, translations, scales):
vertices, triangles = mcubes.marching_cubes(parts, 0)
mesh = trimesh.Trimesh(vertices, triangles)
mesh.apply_translation((-32, -32, -32)) # this line moves part so that its center lies in (0, 0, 0)
mesh.apply_scale([s, s, s])
mesh.apply_translation(t)
scene.add_geometry(mesh)
scene.show()
Yes, I solved by translating the center of the of the cuboid to (0, 0, 0).
mesh.apply_translation((-32, -32, -32))
Thank you very much.
Yes, I solved by translating the center of the of the cuboid to (0, 0, 0).
mesh.apply_translation((-32, -32, -32))
Could you please provide the completed code about this problem? thanks
Yes, I solved by translating the center of the of the cuboid to (0, 0, 0).
mesh.apply_translation((-32, -32, -32))
Could you please provide the completed code about this problem? thanks
There is a copy of complete code above. Does that solve your problem?
I divided the data into voxel and bouding-box. Among them, the bounding-box consists of six-dimensional data composed of translation and size*scale. Then I used a unified center point (0,0,0), and then put them together to get this situation.
Hello, I've been trying to add the object parts in a scene one by one using the transformations provided in the .h5 files but I usually get some misplaced parts. I might be missing something, so would appreciate if you could share some thoughts on this. Thanks a lot!
Code I'm using: