Hi,
Thanks for the great library. How can we rotate, translate, scale the meshes from python api. How can we place the sphere at a specific 3D location?
My use case: I need to draw a 3D skeleton with nodes as spheres and edges as cylinders.
Thanks
Hi @iqbalu
According to this tutorial, you can create sphere and cylinder. For example,
mesh_sphere = create_mesh_sphere(radius = 1.0)
mesh_cylinder = create_mesh_cylinder(radius = 0.3, height = 4.0)
Now prepare your 4x4 matrix that includes scale, rotation, and translation. As we shown in this tutorial, you may try the following:
your_transform = np.asarray(
[[0.862, 0.011, -0.507, 0.5],
[-0.139, 0.967, -0.215, 0.7],
[0.487, 0.255, 0.835, -1.4],
[0.0, 0.0, 0.0, 1.0]])
mesh_sphere.transform(your_transform)
mesh_cylinder.transform(your_transform)
draw_geometries([mesh_sphere, mesh_cylinder])
Great! Thank you!
Most helpful comment
Hi @iqbalu
According to this tutorial, you can create sphere and cylinder. For example,
Now prepare your 4x4 matrix that includes scale, rotation, and translation. As we shown in this tutorial, you may try the following: