Skip to content

0.2.2 (polar fix) - #21

Merged
Fil merged 2 commits into
mainfrom
fil/polar
Nov 26, 2026
Merged

Fil merged 2 commits into
mainfrom
fil/polar

Conversation

@Fil

@Fil Fil commented Nov 26, 2026

Copy link
Copy Markdown
Member

I went too fast.

Fil and others added 2 commits November 26, 2026 18:41
versor.rotation computed λ and γ with atan2 of two values that both vanish at
the poles (gimbal lock), so near φ = ±90° it returned angles for a rotation up
to 180° away from the versor. Dragging a globe rotated to [0, ±90] jumped
(d3/d3-geo#194).

The half-sum and half-difference of λ and γ are now computed separately,
each with atan2 of two components that only vanish at the pole where that
half-angle has no effect on the rotation; φ comes from the ratio of their
magnitudes. At a pole, where λ and γ are not independent, γ is set to 0, so
rotation(versor([λ, ±90])) returns [λ, ±90, 0]. Away from the poles the
results are unchanged (within 1e-11°).

Fixes #11.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Fil
Fil merged commit 1b1b99d into main Nov 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant