rotate
方法rotate
方法旋转三角网格模型。
def rotate(self, R: np.ndarray, center: Optional[np.ndarray] = None) -> None
参数:
R
:旋转矩阵,可以是 $3\times3$ 的 numpy数组。center
:可选的旋转中心,可以是 $3$ 元素的 numpy数组。如果不指定,则会自动计算模型的几何中心。返回值:无。
import numpy as np
import open3d as o3d
mesh = o3d.geometry.create_mesh_sphere()
# 构造旋转矩阵
theta = np.pi / 4
cos_t, sin_t = np.cos(theta), np.sin(theta)
R = np.array([[cos_t, 0, -sin_t],
[0, 1, 0],
[sin_t, 0, cos_t]])
# 对模型进行旋转
mesh.rotate(R)
# 可视化结果
o3d.visualization.draw_geometries([mesh])