1
0
mirror of git://f0xx.org/ac/ac-be-hub synced 2026-08-09 20:59:23 +03:00

fix(globe3d=11): pe uses disk rim distance; default pp=0.2

pe was keyed on geographic lon (date line), invisible at view limb.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Anton Afanasyeu
2026-08-05 22:15:21 +02:00
parent 0c447728d4
commit 2d31fa4f46
2 changed files with 7 additions and 6 deletions

View File

@@ -31,7 +31,7 @@ const CONTINENT_INNER_SY = 1.2408477842003853;
/** Map plate center longitude (extract_red_polygons.py CENTER_LON). */
const MERCATOR_LON_CENTER = (12 * Math.PI) / 180;
/** Default land-plate zoom (?latf / ?lngf / ?zy / ?zx on globe3d=11). */
const LAND_ZOOM_DEFAULT = { latf: 1.25, lngf: 1, zy: 1, zx: 1, pp: 0, pe: 0 };
const LAND_ZOOM_DEFAULT = { latf: 1.25, lngf: 1, zy: 1, zx: 1, pp: 0.2, pe: 0 };
function clampZoomNum(v, min, max, fallback) {
if (typeof v !== 'number' || !isFinite(v)) {
@@ -56,15 +56,16 @@ function resolveLandZoom(raw) {
* Land plate sample remap (globe3d=11 URL tunables):
* latf/lngf — linear zoom; zy/zx — equator/prime-meridian mag (1 = uniform).
* pp — pole lens pinch (0 = off): pulls N/S sample toward equator near poles.
* pe — limb lens pinch (0 = off): pulls E/W sample toward center near disk edges.
* pe — disk limb pinch (0 = off): uses radial distance on ortho disk, not geo lon.
*/
function landZoomLonLat(lon, lat, zoom) {
function landZoomLonLat(lon, lat, zoom, tex) {
const latT = Math.min(1, Math.abs(lat) / (Math.PI / 2));
const lonT = Math.min(1, Math.abs(lon) / Math.PI);
const rimT = Math.min(1, Math.sqrt(tex.x * tex.x + tex.y * tex.y));
const latMul = zoom.latf * (zoom.zy * (1 - latT * latT) + latT * latT);
const lonMul = zoom.lngf * (zoom.zx * (1 - lonT * lonT) + lonT * lonT);
const poleLens = 1 - zoom.pp * latT * latT;
const edgeLens = 1 - zoom.pe * lonT * lonT;
const edgeLens = 1 - zoom.pe * rimT * rimT;
return {
lon: wrapLon(lon * lonMul * edgeLens + MERCATOR_LON_CENTER),
lat: Math.max(-1.52, Math.min(1.52, lat * latMul * poleLens)),
@@ -994,7 +995,7 @@ function sampleFlatPlateFromHub(mercFlat, hpX, hpY) {
/** Sphere tex → mercator-flat plate (lon center + inverse Mercator Y). */
function sampleMercFlatFromTex(mercFlat, tex, landZoom) {
const ll = texLonLat(tex);
const mapped = landZoomLonLat(ll.lon, ll.lat, landZoom);
const mapped = landZoomLonLat(ll.lon, ll.lat, landZoom, tex);
return sampleMercFlat(mercFlat, mapped.lon, mapped.lat);
}