get_rotation_matrix_from_axis_angle是Open3D库中的一个函数,用于返回绕着指定轴向量旋转一定角度后的旋转矩阵。
axis:需要旋转的轴向量。angle:绕轴向量旋转的角度,单位为弧度。返回旋转后的旋转矩阵,类型为np.ndarray。
import open3d as o3d
import numpy as np
axis = np.array([0, 1, 0])
angle = np.pi / 2
rotation_matrix = o3d.geometry.TetraMesh.get_rotation_matrix_from_axis_angle(axis, angle)
print(rotation_matrix)
输出结果为:
array([[ 6.123234e-17,  0.000000e+00,  1.000000e+00],
       [ 0.000000e+00,  1.000000e+00,  0.000000e+00],
       [-1.000000e+00,  0.000000e+00,  6.123234e-17]])
此处设置绕y轴向量旋转90度,返回的旋转矩阵为一个3x3的numpy数组。