在open3d中沿单个轴缩放 [英] Scaling along a single axis in open3d

查看:65
本文介绍了在open3d中沿单个轴缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个函数可以在网格创建后仅(左)沿 y 轴 缩放网格?

Is there a function to scale a mesh along y-axis only (left) after its creation?

我尝试了 open3d.geometry.Geometry3D.scale 函数,但它沿 3 轴(右)缩放.

I tried the open3d.geometry.Geometry3D.scale function, but it scales along the 3-axis (right).

import open3d as o3d
cylinder = o3d.geometry.create_mesh_cylinder(radius=1, height=3)
cylinder_scaled.scale(2) # I got the cylinder on the left.

提前致谢!

推荐答案

首先将网格顶点转换为 numpy 数组.缩放后转换回来.

Convert mesh vertices to numpy array first. Convert back after scaling.

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

这篇关于在open3d中沿单个轴缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆