Search code examples
pythonopen3d

How to update a cylinder height in open3D


I want to change the height of a cylinder in open3D. Is it possible? If yes, how can I proceed? I'm using open3d-python==0.7.0.0.

import open3d as o3d
cylinder = o3d.geometry.create_mesh_cylinder()
# ...
# doing something and then update here:

Thanks!


Solution

  • There is no direct solution, the idea is to use scaling. However the provided scaling function open3d.geometry.Geometry3D.scale, scale the object along the 3 axis. Fortunately, we can update vertices as suggested here:

    cylinder.vertices = o3d.utility.Vector3dVector(
    np.asarray(mesh.vertices) * np.array([1., 1., 2.]) )