release: bump version to 0.37.0

This commit is contained in:
rayd1o
2026-04-23 07:56:10 +08:00
parent abe04030fb
commit 67f82dc41c
22 changed files with 1417 additions and 226 deletions

View File

@@ -4,6 +4,10 @@ import * as THREE from "three";
import { CONFIG } from "./constants.js";
function clamp(value, min, max) {
return Math.min(max, Math.max(min, value));
}
// Convert latitude/longitude to 3D vector
export function latLonToVector3(lat, lon, radius = CONFIG.earthRadius) {
const phi = (90 - lat) * (Math.PI / 180);
@@ -90,3 +94,31 @@ export function calculateDistance(
return radius * c;
}
export function getSurfaceMarkerCameraScale(camera, options = {}) {
if (!camera) return 1;
const {
altitudeOffset = 0,
referenceFov = 75,
min = 0.12,
max = 3.0,
} = options;
const cameraDistanceFromCenter = camera.position.length();
const surfaceDistance = Math.max(
1,
cameraDistanceFromCenter - (CONFIG.earthRadius + altitudeOffset),
);
const referenceSurfaceDistance = Math.max(
1,
CONFIG.defaultCameraZ - (CONFIG.earthRadius + altitudeOffset),
);
const cameraFovRad = (((camera.fov || referenceFov)) * Math.PI) / 180;
const referenceFovRad = (referenceFov * Math.PI) / 180;
const worldPerPixel = surfaceDistance * Math.tan(cameraFovRad / 2);
const referenceWorldPerPixel =
referenceSurfaceDistance * Math.tan(referenceFovRad / 2);
return clamp(worldPerPixel / referenceWorldPerPixel, min, max);
}