refactor(camera,data): take vector maths from src/geo

Move the Cartesian3/Cartographic/Matrix/Quaternion/Transforms/Math calls of
the first batch (src/data motion, anchor, tracked-camera and icon helpers;
the root camera, locations, HUD, share-link, world-focus, ground-guard,
orbit and cloud modules; services/groundSnap) to src/geo. Behaviour is
unchanged: same argument order, same `result` semantics.

Kept on Cesium: out-of-scope classes (JulianDate, Axis, HeadingPitchRange,
BoundingSphere, Rectangle, EasingFunction, EllipsoidalOccluder with its
WGS84 and seed vector, SceneTransforms) and Matrix4.IDENTITY wherever it is
handed straight to a Cesium camera call (locations.test pins its identity).

synthesizeForwardKinematicsFix now returns a plain position, so the two
snapshot renderers clone it with the static Cesium.Cartesian3.clone instead
of the instance method. The package-boundary groups that reach these
modules now own the src/geo files.
This commit is contained in:
German Khokhlov committed 2026-10-15 00:15:59 +04:00
1 parent 4a92ed8377
commit d886be68a8
17 files changed
+481 -285

No files matched your search

+4 -3
View File
@@ -2,6 +2,7 @@
* One-click camera transfer for layer-owned world targets.
*/
import * as Cesium from 'cesium';
import * as geo from './geo/index.js';
export const WORLD_FOCUS_REQUEST_EVENT = 'gev:world-request-focus';
export const WORLD_CLICK_FOCUS_DURATION_SEC = 1.9;
@@ -26,10 +27,10 @@ export function isValidWorldFocusTarget(detail) {
// Vessel and fire targets are surface-anchored Earth positions. Merely
// finite coordinates near the ECEF origin cannot be flown to, and must be
// rejected before the camera policy releases a current follow owner.
const magnitude = Cesium.Cartesian3.magnitude(position);
const magnitude = geo.cartesian3.magnitude(position);
return (
Number.isFinite(magnitude) &&
magnitude >= Cesium.Ellipsoid.WGS84.minimumRadius * 0.95
magnitude >= geo.ellipsoid.WGS84.minimumRadius * 0.95
);
}
@@ -85,7 +86,7 @@ export function flyToWorldTarget(viewer, target = {}) {
{
offset: new Cesium.HeadingPitchRange(
heading,
Cesium.Math.toRadians(framing.pitchDeg),
geo.math.toRadians(framing.pitchDeg),
framing.rangeM,
),
duration,