一、代码
Python
import open3d as o3d
import numpy as np
def rotate_pointcloud(pointcloud, degree, axis):
radian = np.radians(degree)
if axis == 0:
restore = pointcloud.get_rotation_matrix_from_xyz((radian, 0, 0))
pointcloud.rotate(restore, center=(0, 0, 0))
elif axis == 1:
restore = pointcloud.get_rotation_matrix_from_xyz((0, radian, 0))
pointcloud.rotate(restore, center=(0, 0, 0))
elif axis == 2:
restore = pointcloud.get_rotation_matrix_from_xyz((0, 0, radian))
pointcloud.rotate(restore, center=(0, 0, 0))
return pointcloud
def translate_pointcloud(pointcloud, translate, axis):
if axis == 0:
pointc