3D Rotation Theory

SkillDev tools

Abstract math for 3D rotation representations and conversions. USE FOR: understanding axis-angle representation; Euler angles (yaw/pitch/roll, convention choices); rotation matrices (SO(3)); quaternion-based rotation; converting between representations; identifying and avoiding gimbal lock; composing rotations; half-angle formula; right-hand rule. DO NOT USE FOR: quaternion arithmetic details (use quaternion-algebra); slerp/lerp interpolation (use interpolation-on-manifolds); coordinate system definitions (use coordinate-system-conversions).

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the 3D Rotation Theory skill

What this skill tells your AI

The instructions your AI receives, as published by netfabric/netfabric.numerics in .agents/skills/3d-rotation-theory/SKILL.md and read by ahel’s review.

SO(3) = group of 3×3 orthogonal matrices with det = +1. Every rotation has an inverse (transpose).

Representations

RepresentationParametersStrengthsWeaknesses
Axis-angleaxis + angle θIntuitive, minimalNot closed under composition
Rotation matrix3×3, 9 numbersFast multi-vector transform9 params, orthogonality drift
Euler angles3 angles (many conventions)Human-readableGimbal lock, convention ambiguity
Quaternion4 numbers, unitStable interpolation, fast composeDouble-cover ambiguity

Axis-Angle (Rodrigues Formula)

Rotation by θ around unit = (nₓ, nᵧ, n_z):

v' = v cos θ + (n̂ × v) sin θ + n̂(n̂·v)(1 − cos θ)

Right-hand rule: thumb along , fingers curl in positive rotation direction.

Euler Angles (ZYX Intrinsic = Yaw-Pitch-Roll)

Yaw ψ (Z), Pitch φ (Y), Roll ρ (X) — most common aerospace/robotics convention:

R = Rz(ψ) · Ry(φ) · Rx(ρ)        applied right-to-left: roll first, yaw last

Gimbal Lock

When pitch = ±90° (second rotation hits a pole), yaw and roll become degenerate — one degree of freedom is lost. Avoid for systems requiring full orientation control.

Quaternions and rotation matrices do NOT suffer gimbal lock.

Quaternion ↔ Axis-Angle

Axis-angle → quaternion (load quaternion-algebra):

q = (sin(θ/2)·nₓ, sin(θ/2)·nᵧ, sin(θ/2)·n_z, cos(θ/2))

Quaternion → axis-angle:

θ = 2 arccos(w)
n̂ = (x, y, z) / sin(θ/2)        (undefined when θ = 0; use n̂ = (0,0,1) by convention)

Composition Order (Right-to-Left)

R_total = R_second · R_first applies R_first first, then R_second. For quaternions: q_total = q_second · q_first (same convention).

Reference Files

FileLoad When
references/formulas.mdFull rotation matrix for each Euler sequence, Rodrigues formula expansion, quaternion↔matrix conversion
references/numerical-stability.mdOrthogonality drift, gimbal lock detection, near-zero axis extraction

Signals

GitHub stars
36
Forks
1
Last commit
Aug 2026
Advanced
Catalog kind
skill
Gateway key
x-3d-rotation-theory
Source
github.com/netfabric/netfabric.numerics