3.2.17 · D2Orbital Mechanics & Astrodynamics

Visual walkthrough — Converting between orbital elements and state vectors (r, v)

3,107 words14 min readBack to topic

Before we start: a vector is just an arrow with a length and a direction. We write it . Its length we write (no arrow = just the number). A frame is a set of three arrows at right angles — like the corner of a room — that we measure everything against. Keep those two ideas; we earn everything else.


Step 1 — Draw the orbit flat, where it is simplest

WHAT. We put the ellipse on a flat table so that its closest point to the planet (periapsis) lies straight along one chosen arrow. That arrow we call ("p-hat", the little hat means "arrow of length 1, just a direction"). The arrow at to it, in the plane of the table, we call . Together (and a third, , poking straight up out of the table) form the perifocal frame — the frame made for this one orbit.

WHY here. In any other frame the ellipse is tilted and swivelled and hard to write. In the perifocal frame periapsis is nailed to , so the position of the body is described by a single angle (true anomaly) measured from that axis. One angle instead of a tangle — that is why we start here.

PICTURE. The planet sits at the focus (the black dot). The red arrow aims at periapsis. The body sits at angle swept off .

Figure — Converting between orbital elements and state vectors (r, v)

Step 2 — How far out is the body? The orbit equation

WHAT. We need the distance from the focus to the body as the angle changes. The conic equation delivers it:

Term by term: is a fixed length (the orbit's "width parameter") — built from (the size number from the definition box) and , or equivalently from (sweep rate) and (pull strength); squashes the ellipse; swings from at periapsis () to at apoapsis ().

WHY this shape. At : , so — the smallest distance. At : , so — the largest. The two extremes average to , confirming really is the half-length of the long axis. The formula automatically breathes in and out exactly once per orbit. That is why we trust it for every .

PICTURE. Watch shrink and grow as the body walks around; red marks the near point.

Figure — Converting between orbital elements and state vectors (r, v)

Step 3 — How fast, and which way? The perifocal velocity

WHAT. Velocity is how the position arrow changes each second, . We differentiate . Two things change with time here: the length and the angle . So by the chain rule (differentiate each piece, keep the other) each component splits into a " changed" part and a " changed" part: Here and (a dot on top means "rate per second").

WHY the area law enters. We now need and as functions of only — no messy time. The area law (constant sweep, from Angular momentum conservation in orbits) gives directly. For , differentiate the orbit equation using the chain rule and then substitute : Also . Substitute both back into the split above: Expand the first component: . Second component: . The cross terms cancel — that is why the tidy form appears. Finally because , so . Result:

Term by term: is a fixed speed scale (bigger pull or tighter orbit → faster); is the radial (in/out) part; is the tangential (sideways) part.

PICTURE. The two arrows of the split — one along the position ("length grew"), one perpendicular ("angle swept") — add to the total velocity. At periapsis () the radial part : velocity is purely sideways, the body is neither climbing nor falling. That is the fastest point on the orbit.

Figure — Converting between orbital elements and state vectors (r, v)
Recall Check the periapsis case

At : — all tangential. ✓ At (apoapsis): — still tangential but slower (since is smaller in size than ). Both turning points have zero radial speed, exactly as the vis-viva picture demands.


Step 4 — Now the paper is flat but space is not: three spins

WHAT. Our vectors live on the table (). The real world uses a fixed frame — the ECI frame, with pointing at a fixed star direction and up the planet's spin axis (see Reference frames — perifocal (PQW) vs ECI). We must spin the table until it lines up. Three spins do it, done innermost-first:

  1. Spin the paper about its own axis by — this points periapsis where it belongs inside the plane.
  2. Tilt the paper about the node line by — this lifts the plane off horizontal.
  3. Swivel the whole thing about the fixed by — this points the tilt in the right compass direction.

WHY three and in this order. Each element answers a different "which way?" question: = where is periapsis within the plane, = how steeply is the plane tilted, = which way does the tilt face. You cannot swivel () before you have something tilted () to swivel, and you cannot tilt sensibly before periapsis sits in place (). Order = , then , then — inside out.

PICTURE. The same red periapsis arrow, followed through all three spins; the node line marked where the planes meet.

Figure — Converting between orbital elements and state vectors (r, v)

Step 5 — What and actually are, and why negative angles

WHAT. A rotation matrix is a box of numbers that takes the three components of a vector and hands back its components after a spin. We use two flavours, named by which axis they spin about:

R_1(\theta)=\begin{bmatrix}1 & 0 & 0\\ 0 & \cos\theta & -\sin\theta\\ 0 & \sin\theta & \cos\theta\end{bmatrix}\ \text{(spin about the 1st axis, }\hat x\text{)}$$ Notice the pattern: the axis you spin *about* is the row/column left untouched (its $1$ on the diagonal, zeros beside it); the other two entries mix through $\cos$ and $\sin$. **WHY negative angles.** The parent recipe uses $R_3(-\Omega)\,R_1(-i)\,R_3(-\omega)$ — with **minus** signs. There are two things you can spin: the *arrow* or the *frame it's measured in*. $R_3(+\theta)$ turns the *arrow* by $+\theta$. But we turn the *frame* (perifocal → inertial); the same physical arrow then gets **new numbers** as if it had been turned by $-\theta$. So every angle flips sign. This is the single most common bug in the whole conversion. **PICTURE.** One fixed red arrow, two descriptions: rotate-the-arrow vs rotate-the-frame — mirror images. ![[deepdives/dd-physics-3.2.17-d2-s05.png]] > [!mistake] The sign trap > Writing $R_3(+\omega)$ *feels* right ("I rotated by $\omega$"). But you rotated the **frame**, so the components transform by the inverse: $R_3(-\omega)$. Get this wrong and your orbit comes out mirror-flipped — periapsis on the wrong side. --- ## Step 6 — Assemble the three spins into one matrix **WHAT.** Multiply the three spin-boxes in order — $R_3(-\Omega)$ outermost, then $R_1(-i)$, then $R_3(-\omega)$ innermost — and the product collapses into one matrix $\tilde R$ (with $c\theta=\cos\theta$, $s\theta=\sin\theta$): $$\tilde R=\begin{bmatrix} c\Omega c\omega - s\Omega s\omega c i & -c\Omega s\omega - s\Omega c\omega c i & s\Omega s i\\ s\Omega c\omega + c\Omega s\omega c i & -s\Omega s\omega + c\Omega c\omega c i & -c\Omega s i\\ s\omega s i & c\omega s i & c i \end{bmatrix}$$ **WHERE THE ENTRIES COME FROM.** You don't memorise these — you *watch them assemble* from the three pictures of Step 4: - The **bottom-right $c i$** is pure tilt: it is the only spot untouched by the two $\hat z$-spins ($\Omega$ and $\omega$ leave the up-axis alone), so all that survives there is $\cos i$ from $R_1(-i)$. - The **bottom row** ($s\omega s i,\ c\omega s i,\ c i$) is the image of the orbit's $\hat w$ axis: it only feels the innermost spin $\omega$ and the tilt $i$ — no $\Omega$ — because swivelling the whole tilted plane about $\hat z$ doesn't change how far *out of* the reference plane a vector reaches. - The **top-left block** ($c\Omega c\omega - s\Omega s\omega c i$, etc.) is the two $\hat z$-spins ($\Omega$ and $\omega$) chained together, *linked* by the $c i$ factor that leaks in wherever the tilt sits between them. When $i=0$ (no tilt) these reduce to plain angle-addition $\cos(\Omega+\omega)$ — the two flat swivels simply add. Then the inertial state vectors are simply: $$\vec r = \tilde R\,\vec r_{pqw}, \qquad \vec v = \tilde R\,\vec v_{pqw}$$ **WHY the same $\tilde R$ for both.** Position and velocity are both arrows living on the same flat orbit plane. Spinning the plane spins *both* by the identical rule. One matrix, two multiplies. **PICTURE — worked numbers.** Using the parent's Example 2: $a=8000$, $e=0.1$, $i=30^\circ$, $\Omega=40^\circ$, $\omega=60^\circ$, $\nu=0^\circ$. - $p = a(1-e^2) = 8000(0.99) = 7920$ km. - $r = p/(1+e) = 7920/1.1 = 7200$ km $= a(1-e)$ ✓ (periapsis distance). - $\vec r_{pqw} = (7200, 0, 0)$; $\vec v_{pqw} = \sqrt{\mu/p}\,(0, 1.1, 0)$, and $\sqrt{398600/7920} = 7.094$, so $\vec v_{pqw} = (0, 7.803, 0)$. ![[deepdives/dd-physics-3.2.17-d2-s06.png]] > [!example] The final inertial vectors (Example 2) > Applying $\tilde R$ with $\Omega=40^\circ, i=30^\circ, \omega=60^\circ$ to $\vec r_{pqw}=(7200,0,0)$ and $\vec v_{pqw}=(0,7.803,0)$ gives (rounded): > $$\vec r \approx (-2748,\ 5670,\ 3118)\ \text{km}, \qquad \vec v \approx (-6.290,\ -2.567,\ 3.379)\ \text{km/s}$$ > Sanity: $|\vec r| = 7200$ km (rotation preserves length ✓) and $\vec r \cdot \vec v = 0$ (at periapsis, motion is perpendicular to position ✓). Both are machine-checked in the VERIFY block below. --- ## Step 7 — The full spectrum of conics and degenerate cases **WHAT.** The eccentricity $e$ decides *which conic* the orbit is, and two element *labels* can lose their meaning. Both matter — never assume "ellipse, tilted, non-circular." **By shape ($e$):** - $e = 0$ — **circle**. No closest point exists, so $\hat p$ has nowhere to aim. - $0 < e < 1$ — **ellipse** (the case we drew). $a>0$, closes on itself. - $e = 1$ — **parabola**. The orbit never closes; $a \to \infty$ and $p = h^2/\mu$ stays finite, so we describe it by $p$, not $a$. The perifocal formulas for $\vec r_{pqw},\vec v_{pqw}$ still work using $p$. - $e > 1$ — **hyperbola** (a fly-by/escape). Here $a<0$ (the parent's $a=-\mu/2\varepsilon$ with energy $\varepsilon>0$ gives this automatically). The same perifocal vectors apply, valid only for the angles $\nu$ where $1+e\cos\nu>0$. **By orientation (labels that vanish):** - $e = 0$ (circular) — $\omega$ (measured *from* periapsis) is undefined, because there is no periapsis to measure from. Use the ==argument of latitude== $u = \omega + \nu$ measured straight from the ascending node instead. - $i = 0$ (**prograde equatorial**) — the plane lies flat, the two planes never cross, so the node vector $\vec n = \hat z \times \vec h$ shrinks to zero and $\Omega$ is undefined. Use the true longitude of periapsis instead. - $i = 180^\circ$ (**retrograde equatorial**) — also flat, orbit runs *backwards*; again $\vec n \to 0$ and $\Omega$ is undefined here too, a case people often forget. - $e = 0$ **and** $i = 0$ together — *both* $\omega$ and $\Omega$ vanish; only the true longitude $\ell = \Omega + \omega + \nu$ survives as a single meaningful angle. **WHY the pictures still hold.** In every case the *body has a real position and velocity* — physics is fine. Only chosen *angle labels* lose their reference arrow. The cure is to measure from something that still exists: the argument of latitude, or true longitude — i.e. switch to [[Orbital singularities and equinoctial elements|equinoctial elements]]. **PICTURE.** Left: a circle — no periapsis arrow for $\omega$. Middle: a flat equatorial ellipse — no crossing line for $\Omega$ (holds for $i=0$ **and** $i=180^\circ$). Right: parabola vs hyperbola — open, non-closing conics. ![[deepdives/dd-physics-3.2.17-d2-s07.png]] > [!mistake] "It's a bug!" > A NaN in $\omega$ or $\Omega$ *feels* like broken code. It isn't — the number was never defined for that geometry. Detect $e \approx 0$, $i \approx 0$, or $i \approx 180^\circ$ and swap to the alternate element; don't "patch" the arccos. --- ## The one-picture summary Everything on one canvas: draw the ellipse flat in perifocal coordinates (get $\vec r_{pqw}, \vec v_{pqw}$), then spin $\omega \to i \to \Omega$ with the combined matrix $\tilde R$ to land in the inertial frame. ![[deepdives/dd-physics-3.2.17-d2-s08.png]] > [!recall]- Feynman: the whole walkthrough in plain words > Pretend the orbit is a drawing of a squashed ring on a sheet of paper, with the planet pinned at one focus and the near point of the ring aimed straight to the right. On this easy sheet I can instantly say where the spacecraft is — just walk an angle $\nu$ around from the near point — and how fast, because at the near point it's flying straight sideways at its top speed and I know the area-sweep rate never changes. So I get two arrows on the paper: position and velocity. Now the catch: real space isn't flat like my paper. So I spin the paper three times — first turn it in its own plane so the near point aims the right way ($\omega$), then tip the paper up on an angle about the line where the two planes cross ($i$), then swing the whole tipped thing around like a lazy-Susan to face the right compass direction ($\Omega$). Both arrows ride along with the paper. The one matrix $\tilde R$ does all three spins at once. Two warnings: I spin the *frame*, not the arrows, so every spin angle gets a minus sign; and if the ring is a perfect circle, lies perfectly flat (either forwards or backwards), or is an open parabola/hyperbola, then some of the six labels simply don't apply — I measure from something else instead.