PIXELBANKv8.2.1
Menu

Rodrigues Rotation Formula

Implement Rodrigues' rotation formula to rotate a 3D point around an arbitrary axis.

Given axis k\mathbf{k} (unit vector) and angle θ\theta, the rotated point is:

vrot=vcosθ+(k×v)sinθ+k(kv)(1cosθ)\mathbf{v}_{rot} = \mathbf{v}\cos\theta + (\mathbf{k} \times \mathbf{v})\sin\theta + \mathbf{k}(\mathbf{k} \cdot \mathbf{v})(1 - \cos\theta)

This decomposes as:

  1. Component parallel to axis (unchanged by rotation)
  2. 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

Test Results

0/0
Run code to see test results.