Input: (n,3), Output: (n,3)
(points, rotation_matrix=None)
| 74 | |
| 75 | |
| 76 | def 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 | |
| 90 | def rotate_pc_along_y(pc, rot_angle): |
nothing calls this directly
no outgoing calls
no test coverage detected