compassDegrees

function compassDegrees
observer.ts:408
compassDegrees(radians: number) → number

An azimuth as a compass bearing: whole degrees in [0, 360).

A readout, and it is here rather than in the panel that draws it because the thing it has to get right is a property of azimuth itself. Azimuth is unbounded and signed — applyDrag subtracts and never wraps, exactly as shortestAngle above describes — and JavaScript's % is a remainder rather than a modulo, so it keeps the sign. Math.round(deg) % 360 therefore printed -23° az for a rightward drag from the opening state, and -327° for a heading of 33°: a bearing swinging between −359 and 359 rather than reading like a compass.

radiansnumber
Undocumented
Returnsnumber