NetFabric/NetFabric.Numerics / .agents/skills/3d-rotation-theory
3d-rotation-theory
VerifiedAbstract 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).
3D Rotation Theory
SO(3) = group of 3×3 orthogonal matrices with det = +1. Every rotation has an inverse (transpose).
Representations
| Representation | Parameters | Strengths | Weaknesses |
|---|---|---|---|
| Axis-angle | axis n̂ + angle θ | Intuitive, minimal | Not closed under composition |
| Rotation matrix | 3×3, 9 numbers | Fast multi-vector transform | 9 params, orthogonality drift |
| Euler angles | 3 angles (many conventions) | Human-readable | Gimbal lock, convention ambiguity |
| Quaternion | 4 numbers, unit | Stable interpolation, fast compose | Double-cover ambiguity |
Axis-Angle (Rodrigues Formula)
Rotation by θ around unit n̂ = (nₓ, nᵧ, n_z):
v' = v cos θ + (n̂ × v) sin θ + n̂(n̂·v)(1 − cos θ)
Right-hand rule: thumb along n̂, 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
| File | Load When |
|---|---|
| references/formulas.md | Full rotation matrix for each Euler sequence, Rodrigues formula expansion, quaternion↔matrix conversion |
| references/numerical-stability.md | Orthogonality drift, gimbal lock detection, near-zero axis extraction |
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |