📘
Rodrigues Rotation Formula
HardTransformations
Implement Rodrigues' rotation formula to rotate a 3D point around an arbitrary axis.
Given axis k (unit vector) and angle θ, the rotated point is:
vrot=vcosθ+(k×v)sinθ+k(k⋅v)(1−cosθ)
This decomposes as:
- Component parallel to axis (unchanged by rotation)
- Component perpendicular to axis (rotated in the plane)
Used in camera pose estimation, 3D reconstruction, and robotics.
Example:
Input:
point = [1, 0, 0] axis = [0, 0, 1] # Z-axis angle = 1.5708 # ~90 degrees
Output:
[0.0, 1.0, 0.0]
Reasoning:
Rotating [1,0,0] around Z-axis by 90°:
- k × v = [0,0,1] × [1,0,0] = [0,1,0]
- k · v = 0 (perpendicular)
v_rot = [1,0,0]·cos(90°) + [0,1,0]·sin(90°) + 0 = [0,0,0] + [0,1,0] = [0,1,0]
Constraints:
- point: 3D point [x, y, z]
- axis: Unit vector defining rotation axis
- angle: Rotation angle in radians
- Return: Rotated point, rounded to 4 decimals
Editor
Python 3.13.1
Test Results
0/0Run code to see test results.