fix(assets): correct globe renderer east-west mirroring

arctan2(hz, hx) wrapped longitude counter-clockwise, mirroring
east and west on the globe. Changed to arctan2(hx, hz) which
increases eastward (right on screen). Added +0.5 offset to center
the view on 0° longitude, keeping the dateline seam on the back.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-07 22:21:56 +02:00
co-authored by Claude Opus 4.6
parent c605f28328
commit 80916471e7
+4 -1
View File
@@ -189,7 +189,10 @@ def _raytrace(size: int, r: float = 1.0, oblateness: float = 0.0):
nx /= nm; ny /= nm; nz /= nm
# UV from undistorted hit point
u = (np.arctan2(hz, hx) / (2.0 * math.pi)) % 1.0
# arctan2(hx, hz) so longitude increases eastward (right on screen).
# +0.5 offset centers the view on 0° longitude (Greenwich) instead of
# 180° (dateline), keeping the seam on the back of the sphere.
u = (np.arctan2(hx, hz) / (2.0 * math.pi) + 0.5) % 1.0
v = np.arcsin(np.clip(hy / np.where(hit, np.sqrt(hx**2 + hy**2 + hz**2), 1.0), -1.0, 1.0)) / math.pi + 0.5
return hit, nx.astype(np.float32), ny.astype(np.float32), nz.astype(np.float32), u.astype(np.float32), v.astype(np.float32)