MCPcopy Create free account
hub / github.com/OpenMeshLab/MeshXL / rotate_point_cloud

Function rotate_point_cloud

utils/pc_util.py:76–87  ·  view source on GitHub ↗

Input: (n,3), Output: (n,3)

(points, rotation_matrix=None)

Source from the content-addressed store, hash-verified

74
75
76def rotate_point_cloud(points, rotation_matrix=None):
77 """Input: (n,3), Output: (n,3)"""
78 # Rotate in-place around Z axis.
79 if rotation_matrix is None:
80 rotation_angle = np.random.uniform() * 2 * np.pi
81 sinval, cosval = np.sin(rotation_angle), np.cos(rotation_angle)
82 rotation_matrix = np.array(
83 [[cosval, sinval, 0], [-sinval, cosval, 0], [0, 0, 1]]
84 )
85 ctr = points.mean(axis=0)
86 rotated_data = np.dot(points - ctr, rotation_matrix) + ctr
87 return rotated_data, rotation_matrix
88
89
90def rotate_pc_along_y(pc, rot_angle):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected