@math.gl/geospatial 4.1.0-alpha.9 → 4.2.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts.map +1 -0
- package/dist/ellipsoid-helpers/ellipsoid-transform.js.map +1 -0
- package/dist/ellipsoid-helpers/scale-to-geodetic-surface.d.ts.map +1 -0
- package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js.map +1 -0
- package/dist/ellipsoid-tangent-plane.d.ts +30 -0
- package/dist/ellipsoid-tangent-plane.d.ts.map +1 -0
- package/dist/ellipsoid-tangent-plane.js +75 -0
- package/dist/ellipsoid-tangent-plane.js.map +1 -0
- package/dist/{ellipsoid/ellipsoid.d.ts → ellipsoid.d.ts} +1 -1
- package/dist/ellipsoid.d.ts.map +1 -0
- package/dist/{ellipsoid/ellipsoid.js → ellipsoid.js} +4 -4
- package/dist/ellipsoid.js.map +1 -0
- package/dist/index.cjs +139 -4
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/lng-lat-rectangle.d.ts +27 -0
- package/dist/lng-lat-rectangle.d.ts.map +1 -0
- package/dist/lng-lat-rectangle.js +54 -0
- package/dist/lng-lat-rectangle.js.map +1 -0
- package/dist/make-obb-from-region.d.ts +11 -0
- package/dist/make-obb-from-region.d.ts.map +1 -0
- package/dist/make-obb-from-region.js +173 -0
- package/dist/make-obb-from-region.js.map +1 -0
- package/package.json +5 -4
- package/src/ellipsoid-tangent-plane.ts +98 -0
- package/src/{ellipsoid/ellipsoid.ts → ellipsoid.ts} +5 -5
- package/src/index.ts +3 -1
- package/src/lng-lat-rectangle.ts +67 -0
- package/src/make-obb-from-region.ts +303 -0
- package/dist/ellipsoid/ellipsoid.d.ts.map +0 -1
- package/dist/ellipsoid/ellipsoid.js.map +0 -1
- package/dist/ellipsoid/helpers/ellipsoid-transform.d.ts.map +0 -1
- package/dist/ellipsoid/helpers/ellipsoid-transform.js.map +0 -1
- package/dist/ellipsoid/helpers/scale-to-geodetic-surface.d.ts.map +0 -1
- package/dist/ellipsoid/helpers/scale-to-geodetic-surface.js.map +0 -1
- /package/dist/{ellipsoid/helpers → ellipsoid-helpers}/ellipsoid-transform.d.ts +0 -0
- /package/dist/{ellipsoid/helpers → ellipsoid-helpers}/ellipsoid-transform.js +0 -0
- /package/dist/{ellipsoid/helpers → ellipsoid-helpers}/scale-to-geodetic-surface.d.ts +0 -0
- /package/dist/{ellipsoid/helpers → ellipsoid-helpers}/scale-to-geodetic-surface.js +0 -0
- /package/src/{ellipsoid/helpers → ellipsoid-helpers}/ellipsoid-transform.ts +0 -0
- /package/src/{ellipsoid/helpers → ellipsoid-helpers}/scale-to-geodetic-surface.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ellipsoid-transform.d.ts","sourceRoot":"","sources":["../../src/ellipsoid-helpers/ellipsoid-transform.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAG5C,OAAO,KAAK,EAAC,SAAS,EAAC,wBAAqB;AAM5C,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAsEhF,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,SAAS,EAAE,aAAa,EACxB,eAAe,EAAE,QAAQ,CAAC,YAAY,CAAC,EACvC,MAAM,EAAE,MAAM,EAAE,GACf,MAAM,EAAE,CAuEV"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ellipsoid-transform.js","sourceRoot":"","sources":["../../src/ellipsoid-helpers/ellipsoid-transform.ts"],"names":[],"mappings":"AAAA,UAAU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IACtB,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IACtB,MAAM,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IACjB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scale-to-geodetic-surface.d.ts","sourceRoot":"","sources":["../../src/ellipsoid-helpers/scale-to-geodetic-surface.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,SAAS,EAAC,wBAAqB;AAS5C,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EAAE,EACnB,SAAS,EAAE,SAAS,EACpB,MAAM,GAAE,MAAM,EAAO,GACpB,MAAM,EAAE,CAuFV"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scale-to-geodetic-surface.js","sourceRoot":"","sources":["../../src/ellipsoid-helpers/scale-to-geodetic-surface.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,8CAA8C;AAC9C,oCAAoC;AAEpC,oBAAoB;AACpB,OAAO,EAAC,OAAO,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAGlD,MAAM,aAAa,GAAG,IAAI,OAAO,EAAE,CAAC;AACpC,MAAM,kCAAkC,GAAG,IAAI,OAAO,EAAE,CAAC;AACzD,MAAM,8BAA8B,GAAG,IAAI,OAAO,EAAE,CAAC;AAErD,2EAA2E;AAC3E,sEAAsE;AACtE,mEAAmE;AACnE,MAAM,UAAU,sBAAsB,CACpC,SAAmB,EACnB,SAAoB,EACpB,SAAmB,EAAE;IAErB,MAAM,EAAC,YAAY,EAAE,mBAAmB,EAAE,sBAAsB,EAAC,GAAG,SAAS,CAAC;IAE9E,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAE9B,MAAM,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC;IAClC,MAAM,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC;IAClC,MAAM,SAAS,GAAG,aA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,GAAG,YAAY,GAAG,oBAAoB,CAAC;QAE3C,MAAM,UAAU,GAAG,CAAC,GAAG,GAAG,WAAW,CAAC;QAEtC,UAAU,GAAG,IAAI,GAAG,UAAU,CAAC;IACjC,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,SAAS,EAAE;IAEhD,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Vector2, Vector3 } from '@math.gl/core';
|
|
2
|
+
import { Plane } from '@math.gl/culling';
|
|
3
|
+
/** A plane tangent to the WGS84 ellipsoid at the provided origin */
|
|
4
|
+
export declare class EllipsoidTangentPlane {
|
|
5
|
+
private _origin;
|
|
6
|
+
private _xAxis;
|
|
7
|
+
private _yAxis;
|
|
8
|
+
private _plane;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new plane tangent to the WGS84 ellipsoid at the provided origin.
|
|
11
|
+
* If origin is not on the surface of the ellipsoid, it's surface projection will be used.
|
|
12
|
+
*
|
|
13
|
+
* @param {Cartesian3} origin The point on the surface of the ellipsoid where the tangent plane touches.
|
|
14
|
+
*/
|
|
15
|
+
constructor(origin: number[]);
|
|
16
|
+
/**
|
|
17
|
+
* Computes the projection of the provided 3D position onto the 2D plane, along the plane normal.
|
|
18
|
+
*
|
|
19
|
+
* @param {Vector3} cartesian The point to project.
|
|
20
|
+
* @param {Vector2} [result] The object onto which to store the result.
|
|
21
|
+
* @returns {Vector2} The modified result parameter or a new Cartesian2 instance if none was provided.
|
|
22
|
+
*/
|
|
23
|
+
projectPointToNearestOnPlane(cartesian: Vector3, result?: Vector2): Vector2;
|
|
24
|
+
get plane(): Plane;
|
|
25
|
+
get origin(): Vector3;
|
|
26
|
+
get xAxis(): Vector3;
|
|
27
|
+
get yAxis(): Vector3;
|
|
28
|
+
get zAxis(): Vector3;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ellipsoid-tangent-plane.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ellipsoid-tangent-plane.d.ts","sourceRoot":"","sources":["../src/ellipsoid-tangent-plane.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAU,MAAM,eAAe,CAAC;AACxD,OAAO,EAAC,KAAK,EAAM,MAAM,kBAAkB,CAAC;AAY5C,oEAAoE;AACpE,qBAAa,qBAAqB;IAChC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,MAAM,CAAQ;IAEtB;;;;;OAKG;gBACS,MAAM,EAAE,MAAM,EAAE;IAa5B;;;;;;OAMG;IACH,4BAA4B,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAyB3E,IAAI,KAAK,UAER;IAED,IAAI,MAAM,YAET;IAED,IAAI,KAAK,YAER;IAED,IAAI,KAAK,YAER;IAED,IAAI,KAAK,YAER;CACF"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT and Apache-2.0
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
// This file is derived from the Cesium library under Apache 2 license
|
|
5
|
+
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
|
|
6
|
+
import { Vector2, Vector3, Matrix4 } from '@math.gl/core';
|
|
7
|
+
import { Plane, Ray } from '@math.gl/culling';
|
|
8
|
+
import { Ellipsoid } from "./ellipsoid.js";
|
|
9
|
+
const scratchOrigin = new Vector3();
|
|
10
|
+
const scratchCart3 = new Vector3();
|
|
11
|
+
const scratchEastNorthUp = new Matrix4();
|
|
12
|
+
const scratchPlane = new Plane();
|
|
13
|
+
const scratchProjectPointOntoPlaneRay = new Ray();
|
|
14
|
+
const scratchProjectPointOntoPlaneCartesian3 = new Vector3();
|
|
15
|
+
const scratchDirection = new Vector3();
|
|
16
|
+
/** A plane tangent to the WGS84 ellipsoid at the provided origin */
|
|
17
|
+
export class EllipsoidTangentPlane {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new plane tangent to the WGS84 ellipsoid at the provided origin.
|
|
20
|
+
* If origin is not on the surface of the ellipsoid, it's surface projection will be used.
|
|
21
|
+
*
|
|
22
|
+
* @param {Cartesian3} origin The point on the surface of the ellipsoid where the tangent plane touches.
|
|
23
|
+
*/
|
|
24
|
+
constructor(origin) {
|
|
25
|
+
origin = Ellipsoid.WGS84.scaleToGeodeticSurface(origin, scratchOrigin);
|
|
26
|
+
const eastNorthUp = Ellipsoid.WGS84.eastNorthUpToFixedFrame(origin, scratchEastNorthUp);
|
|
27
|
+
this._origin = origin;
|
|
28
|
+
this._xAxis = new Vector3(scratchCart3.from(eastNorthUp.getColumn(0)));
|
|
29
|
+
this._yAxis = new Vector3(scratchCart3.from(eastNorthUp.getColumn(1)));
|
|
30
|
+
const normal = new Vector3(scratchCart3.from(eastNorthUp.getColumn(2)));
|
|
31
|
+
this._plane = scratchPlane.fromPointNormal(origin, normal);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Computes the projection of the provided 3D position onto the 2D plane, along the plane normal.
|
|
35
|
+
*
|
|
36
|
+
* @param {Vector3} cartesian The point to project.
|
|
37
|
+
* @param {Vector2} [result] The object onto which to store the result.
|
|
38
|
+
* @returns {Vector2} The modified result parameter or a new Cartesian2 instance if none was provided.
|
|
39
|
+
*/
|
|
40
|
+
projectPointToNearestOnPlane(cartesian, result) {
|
|
41
|
+
if (!result)
|
|
42
|
+
result = new Vector2();
|
|
43
|
+
const plane = this._plane;
|
|
44
|
+
const ray = scratchProjectPointOntoPlaneRay;
|
|
45
|
+
scratchProjectPointOntoPlaneRay.origin = cartesian;
|
|
46
|
+
scratchProjectPointOntoPlaneRay.direction = scratchDirection.copy(plane.normal);
|
|
47
|
+
let intersectionPoint = plane.intersectWithRay(ray, scratchProjectPointOntoPlaneCartesian3);
|
|
48
|
+
if (!intersectionPoint) {
|
|
49
|
+
ray.direction = ray.direction.negate();
|
|
50
|
+
intersectionPoint = plane.intersectWithRay(ray, scratchProjectPointOntoPlaneCartesian3);
|
|
51
|
+
}
|
|
52
|
+
const v = intersectionPoint.subtract(this._origin);
|
|
53
|
+
const x = this._xAxis.dot(v);
|
|
54
|
+
const y = this._yAxis.dot(v);
|
|
55
|
+
result.x = x;
|
|
56
|
+
result.y = y;
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
get plane() {
|
|
60
|
+
return this._plane;
|
|
61
|
+
}
|
|
62
|
+
get origin() {
|
|
63
|
+
return this._origin;
|
|
64
|
+
}
|
|
65
|
+
get xAxis() {
|
|
66
|
+
return this._xAxis;
|
|
67
|
+
}
|
|
68
|
+
get yAxis() {
|
|
69
|
+
return this._yAxis;
|
|
70
|
+
}
|
|
71
|
+
get zAxis() {
|
|
72
|
+
return this._plane.normal;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=ellipsoid-tangent-plane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ellipsoid-tangent-plane.js","sourceRoot":"","sources":["../src/ellipsoid-tangent-plane.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,8CAA8C;AAC9C,oCAAoC;AAEpC,sEAAsE;AACtE,4FAA4F;AAE5F,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AACxD,OAAO,EAAC,KAAK,EAAE,GAAG,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,SAAS,EAAC,uBAAoB;AAEtC,MAAM,aAAa,GAAG,IAAI,OAAO,EAAE,CAAC;AACpC,MAAM,YAAY,GAAG,IAAI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
|
-
import type { AxisDirection } from "./helpers/ellipsoid-transform.js";
|
|
2
|
+
import type { AxisDirection } from "./ellipsoid-helpers/ellipsoid-transform.js";
|
|
3
3
|
/**
|
|
4
4
|
* A quadratic surface defined in Cartesian coordinates by the equation
|
|
5
5
|
* `(x / a)^2 + (y / b)^2 + (z / c)^2 = 1`. Primarily used
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ellipsoid.d.ts","sourceRoot":"","sources":["../src/ellipsoid.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,OAAO,EAAE,OAAO,EAA8B,YAAY,EAAO,MAAM,eAAe,CAAC;AAK/F,OAAO,KAAK,EAAC,aAAa,EAAC,mDAAgD;AAW3E;;;;GAIG;AACH,qBAAa,SAAS;IACpB,+DAA+D;IAC/D,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAiE;IAEjG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAuB;IAC9D,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IAEtC,4FAA4F;gBAChF,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;IAqC3C,2EAA2E;IAC3E,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAIjC,gGAAgG;IAChG,QAAQ,IAAI,MAAM;IAIlB,sEAAsE;IACtE,uBAAuB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE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EACpC,MAAM,EAAE,QAAQ,GACf,QAAQ;IACX,iCAAiC,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAgBnE,yGAAyG;IACzG,qBAAqB,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,GAAG,SAAS;IACnF,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAKpD;;0EAEsE;IACtE,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAIxE;yDACqD;IACrD,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,MAAM,EAAc,GAAG,MAAM,EAAE;IAmBrF;kEAC8D;IAC9D,8BAA8B,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,MAAM,EAAc,GAAG,MAAM,EAAE;IAI1F;4DACwD;IACxD,gCAAgC,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,MAAM,EAAc,GAAG,MAAM,EAAE;IAI5F,wFAAwF;IACxF,qCAAqC,CACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,MAAM,GAAE,MAAU,EAClB,MAAM,GAAE,MAAM,EAAc,GAC3B,MAAM,EAAE;CAcZ"}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
|
|
6
6
|
/* eslint-disable */
|
|
7
7
|
import { Vector3, Matrix4, assert, equals, _MathUtils, vec3 } from '@math.gl/core';
|
|
8
|
-
import { WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z } from "
|
|
9
|
-
import { fromCartographicToRadians, toCartographicFromRadians } from "
|
|
10
|
-
import { localFrameToFixedFrame } from "./helpers/ellipsoid-transform.js";
|
|
11
|
-
import { scaleToGeodeticSurface } from "./helpers/scale-to-geodetic-surface.js";
|
|
8
|
+
import { WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z } from "./constants.js";
|
|
9
|
+
import { fromCartographicToRadians, toCartographicFromRadians } from "./type-utils.js";
|
|
10
|
+
import { localFrameToFixedFrame } from "./ellipsoid-helpers/ellipsoid-transform.js";
|
|
11
|
+
import { scaleToGeodeticSurface } from "./ellipsoid-helpers/scale-to-geodetic-surface.js";
|
|
12
12
|
const scratchVector = new Vector3();
|
|
13
13
|
const scratchNormal = new Vector3();
|
|
14
14
|
const scratchK = new Vector3();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ellipsoid.js","sourceRoot":"","sources":["../src/ellipsoid.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,8CAA8C;AAC9C,oCAAoC;AAEpC,2EAA2E;AAC3E,4FAA4F;AAE5F,oBAAoB;AACpB,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAgB,IAAI,EAAC,MAAM,eAAe,CAAC;AAE/F,OAAO,EAAC,cAAc,EAAE,cAAc,EAAE,cAAc,EAAC,uBAAoB;AAC3E,OAAO,EAAC,yBAAyB,EAAE,yBAAyB,EAAC,wBAAqB;AAGlF,OAAO,EAAC,sBAAsB,EAAC,mDAAgD;AAC/E,OAAO,EAAC,sBAAsB,EAAC,yDAAsD;AAErF,MAAM,aAAa,GAAG,IAAI,OAAO,EAAE,CAAC;AACpC,MAAM,aAAa,GAAG,IAAI,OAAO,EAAE,CAAC;AACpC,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAE,CAAC;AAC/B,MAAM,eAAe,GAAG,IAAI,OAAO,EAAE,CAAC;AACtC,MAAM,aAAa,GAAG,IAAI,OAAO,EAAE,CAAC;AACpC,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAE,CAAC;AAEvC;;;;GAIG;AACH,MAAM,OAAO,SAAS;IAkBpB,YAAY,CAAC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20,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
var dist_exports = {};
|
|
21
21
|
__export(dist_exports, {
|
|
22
22
|
Ellipsoid: () => Ellipsoid,
|
|
23
|
+
EllipsoidTangentPlane: () => EllipsoidTangentPlane,
|
|
24
|
+
LngLatRectangle: () => LngLatRectangle,
|
|
23
25
|
isWGS84: () => isWGS84
|
|
24
26
|
});
|
|
25
27
|
module.exports = __toCommonJS(dist_exports);
|
|
26
28
|
|
|
27
|
-
// dist/ellipsoid
|
|
29
|
+
// dist/ellipsoid.js
|
|
28
30
|
var import_core4 = require("@math.gl/core");
|
|
29
31
|
|
|
30
32
|
// dist/constants.js
|
|
@@ -46,6 +48,7 @@ var WGS84_CONSTANTS = {
|
|
|
46
48
|
],
|
|
47
49
|
maximumRadius: Math.max(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z),
|
|
48
50
|
centerToleranceSquared: 0.1
|
|
51
|
+
// EPSILON1;
|
|
49
52
|
};
|
|
50
53
|
|
|
51
54
|
// dist/type-utils.js
|
|
@@ -104,7 +107,7 @@ function isWGS84(vector) {
|
|
|
104
107
|
return Math.abs(x2 + y2 + z2 - 1) < centerToleranceSquared;
|
|
105
108
|
}
|
|
106
109
|
|
|
107
|
-
// dist/ellipsoid
|
|
110
|
+
// dist/ellipsoid-helpers/ellipsoid-transform.js
|
|
108
111
|
var import_core2 = require("@math.gl/core");
|
|
109
112
|
var EPSILON14 = 1e-14;
|
|
110
113
|
var scratchOrigin = new import_core2.Vector3();
|
|
@@ -219,7 +222,7 @@ function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, car
|
|
|
219
222
|
return result;
|
|
220
223
|
}
|
|
221
224
|
|
|
222
|
-
// dist/ellipsoid
|
|
225
|
+
// dist/ellipsoid-helpers/scale-to-geodetic-surface.js
|
|
223
226
|
var import_core3 = require("@math.gl/core");
|
|
224
227
|
var scratchVector4 = new import_core3.Vector3();
|
|
225
228
|
var scaleToGeodeticSurfaceIntersection = new import_core3.Vector3();
|
|
@@ -276,7 +279,7 @@ function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
|
|
|
276
279
|
return scratchVector4.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);
|
|
277
280
|
}
|
|
278
281
|
|
|
279
|
-
// dist/ellipsoid
|
|
282
|
+
// dist/ellipsoid.js
|
|
280
283
|
var scratchVector5 = new import_core4.Vector3();
|
|
281
284
|
var scratchNormal = new import_core4.Vector3();
|
|
282
285
|
var scratchK = new import_core4.Vector3();
|
|
@@ -301,9 +304,11 @@ var Ellipsoid = class {
|
|
|
301
304
|
}
|
|
302
305
|
Object.freeze(this);
|
|
303
306
|
}
|
|
307
|
+
/** Compares this Ellipsoid against the provided Ellipsoid componentwise */
|
|
304
308
|
equals(right) {
|
|
305
309
|
return this === right || Boolean(right && this.radii.equals(right.radii));
|
|
306
310
|
}
|
|
311
|
+
/** Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'. */
|
|
307
312
|
toString() {
|
|
308
313
|
return this.radii.toString();
|
|
309
314
|
}
|
|
@@ -336,6 +341,8 @@ var Ellipsoid = class {
|
|
|
336
341
|
eastNorthUpToFixedFrame(origin, result = new import_core4.Matrix4()) {
|
|
337
342
|
return localFrameToFixedFrame(this, "east", "north", "up", origin, result);
|
|
338
343
|
}
|
|
344
|
+
// Computes a 4x4 transformation matrix from a reference frame centered at
|
|
345
|
+
// the provided origin to the ellipsoid's fixed reference frame.
|
|
339
346
|
localFrameToFixedFrame(firstAxis, secondAxis, thirdAxis, origin, result = new import_core4.Matrix4()) {
|
|
340
347
|
return localFrameToFixedFrame(this, firstAxis, secondAxis, thirdAxis, origin, result);
|
|
341
348
|
}
|
|
@@ -353,9 +360,14 @@ var Ellipsoid = class {
|
|
|
353
360
|
geodeticSurfaceNormal(cartesian, result = [0, 0, 0]) {
|
|
354
361
|
return scratchVector5.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
|
|
355
362
|
}
|
|
363
|
+
/** Scales the provided Cartesian position along the geodetic surface normal
|
|
364
|
+
* so that it is on the surface of this ellipsoid. If the position is
|
|
365
|
+
* at the center of the ellipsoid, this function returns undefined. */
|
|
356
366
|
scaleToGeodeticSurface(cartesian, result) {
|
|
357
367
|
return scaleToGeodeticSurface(cartesian, this, result);
|
|
358
368
|
}
|
|
369
|
+
/** Scales the provided Cartesian position along the geocentric surface normal
|
|
370
|
+
* so that it is on the surface of this ellipsoid. */
|
|
359
371
|
scaleToGeocentricSurface(cartesian, result = [0, 0, 0]) {
|
|
360
372
|
scratchPosition.from(cartesian);
|
|
361
373
|
const positionX = scratchPosition.x;
|
|
@@ -365,12 +377,17 @@ var Ellipsoid = class {
|
|
|
365
377
|
const beta = 1 / Math.sqrt(positionX * positionX * oneOverRadiiSquared.x + positionY * positionY * oneOverRadiiSquared.y + positionZ * positionZ * oneOverRadiiSquared.z);
|
|
366
378
|
return scratchPosition.multiplyScalar(beta).to(result);
|
|
367
379
|
}
|
|
380
|
+
/** Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying
|
|
381
|
+
* its components by the result of `Ellipsoid#oneOverRadii` */
|
|
368
382
|
transformPositionToScaledSpace(position, result = [0, 0, 0]) {
|
|
369
383
|
return scratchPosition.from(position).scale(this.oneOverRadii).to(result);
|
|
370
384
|
}
|
|
385
|
+
/** Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying
|
|
386
|
+
* its components by the result of `Ellipsoid#radii`. */
|
|
371
387
|
transformPositionFromScaledSpace(position, result = [0, 0, 0]) {
|
|
372
388
|
return scratchPosition.from(position).scale(this.radii).to(result);
|
|
373
389
|
}
|
|
390
|
+
/** Computes a point which is the intersection of the surface normal with the z-axis. */
|
|
374
391
|
getSurfaceNormalIntersectionWithZAxis(position, buffer = 0, result = [0, 0, 0]) {
|
|
375
392
|
(0, import_core4.assert)((0, import_core4.equals)(this.radii.x, this.radii.y, import_core4._MathUtils.EPSILON15));
|
|
376
393
|
(0, import_core4.assert)(this.radii.z > 0);
|
|
@@ -383,4 +400,122 @@ var Ellipsoid = class {
|
|
|
383
400
|
}
|
|
384
401
|
};
|
|
385
402
|
Ellipsoid.WGS84 = new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);
|
|
403
|
+
|
|
404
|
+
// dist/ellipsoid-tangent-plane.js
|
|
405
|
+
var import_core5 = require("@math.gl/core");
|
|
406
|
+
var import_culling = require("@math.gl/culling");
|
|
407
|
+
var scratchOrigin2 = new import_core5.Vector3();
|
|
408
|
+
var scratchCart3 = new import_core5.Vector3();
|
|
409
|
+
var scratchEastNorthUp = new import_core5.Matrix4();
|
|
410
|
+
var scratchPlane = new import_culling.Plane();
|
|
411
|
+
var scratchProjectPointOntoPlaneRay = new import_culling.Ray();
|
|
412
|
+
var scratchProjectPointOntoPlaneCartesian3 = new import_core5.Vector3();
|
|
413
|
+
var scratchDirection = new import_core5.Vector3();
|
|
414
|
+
var EllipsoidTangentPlane = class {
|
|
415
|
+
/**
|
|
416
|
+
* Creates a new plane tangent to the WGS84 ellipsoid at the provided origin.
|
|
417
|
+
* If origin is not on the surface of the ellipsoid, it's surface projection will be used.
|
|
418
|
+
*
|
|
419
|
+
* @param {Cartesian3} origin The point on the surface of the ellipsoid where the tangent plane touches.
|
|
420
|
+
*/
|
|
421
|
+
constructor(origin) {
|
|
422
|
+
origin = Ellipsoid.WGS84.scaleToGeodeticSurface(origin, scratchOrigin2);
|
|
423
|
+
const eastNorthUp = Ellipsoid.WGS84.eastNorthUpToFixedFrame(origin, scratchEastNorthUp);
|
|
424
|
+
this._origin = origin;
|
|
425
|
+
this._xAxis = new import_core5.Vector3(scratchCart3.from(eastNorthUp.getColumn(0)));
|
|
426
|
+
this._yAxis = new import_core5.Vector3(scratchCart3.from(eastNorthUp.getColumn(1)));
|
|
427
|
+
const normal = new import_core5.Vector3(scratchCart3.from(eastNorthUp.getColumn(2)));
|
|
428
|
+
this._plane = scratchPlane.fromPointNormal(origin, normal);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Computes the projection of the provided 3D position onto the 2D plane, along the plane normal.
|
|
432
|
+
*
|
|
433
|
+
* @param {Vector3} cartesian The point to project.
|
|
434
|
+
* @param {Vector2} [result] The object onto which to store the result.
|
|
435
|
+
* @returns {Vector2} The modified result parameter or a new Cartesian2 instance if none was provided.
|
|
436
|
+
*/
|
|
437
|
+
projectPointToNearestOnPlane(cartesian, result) {
|
|
438
|
+
if (!result)
|
|
439
|
+
result = new import_core5.Vector2();
|
|
440
|
+
const plane = this._plane;
|
|
441
|
+
const ray = scratchProjectPointOntoPlaneRay;
|
|
442
|
+
scratchProjectPointOntoPlaneRay.origin = cartesian;
|
|
443
|
+
scratchProjectPointOntoPlaneRay.direction = scratchDirection.copy(plane.normal);
|
|
444
|
+
let intersectionPoint = plane.intersectWithRay(ray, scratchProjectPointOntoPlaneCartesian3);
|
|
445
|
+
if (!intersectionPoint) {
|
|
446
|
+
ray.direction = ray.direction.negate();
|
|
447
|
+
intersectionPoint = plane.intersectWithRay(ray, scratchProjectPointOntoPlaneCartesian3);
|
|
448
|
+
}
|
|
449
|
+
const v = intersectionPoint.subtract(this._origin);
|
|
450
|
+
const x = this._xAxis.dot(v);
|
|
451
|
+
const y = this._yAxis.dot(v);
|
|
452
|
+
result.x = x;
|
|
453
|
+
result.y = y;
|
|
454
|
+
return result;
|
|
455
|
+
}
|
|
456
|
+
get plane() {
|
|
457
|
+
return this._plane;
|
|
458
|
+
}
|
|
459
|
+
get origin() {
|
|
460
|
+
return this._origin;
|
|
461
|
+
}
|
|
462
|
+
get xAxis() {
|
|
463
|
+
return this._xAxis;
|
|
464
|
+
}
|
|
465
|
+
get yAxis() {
|
|
466
|
+
return this._yAxis;
|
|
467
|
+
}
|
|
468
|
+
get zAxis() {
|
|
469
|
+
return this._plane.normal;
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
// dist/lng-lat-rectangle.js
|
|
474
|
+
var import_core6 = require("@math.gl/core");
|
|
475
|
+
var LngLatRectangle = class {
|
|
476
|
+
/**
|
|
477
|
+
* Creates a new two dimensional region specified as longitude and latitude coordinates.
|
|
478
|
+
*
|
|
479
|
+
* @param west The westernmost longitude, in radians, in the range [-Pi, Pi].
|
|
480
|
+
* @param south The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].
|
|
481
|
+
* @param east The easternmost longitude, in radians, in the range [-Pi, Pi].
|
|
482
|
+
* @param north The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].
|
|
483
|
+
*/
|
|
484
|
+
constructor(west, south, east, north) {
|
|
485
|
+
this.west = west;
|
|
486
|
+
this.south = south;
|
|
487
|
+
this.east = east;
|
|
488
|
+
this.north = north;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Computes the center of a rectangle.
|
|
492
|
+
*
|
|
493
|
+
* @param rectangle The rectangle for which to find the center
|
|
494
|
+
* @param [result] The object onto which to store the result.
|
|
495
|
+
* @returns The modified result parameter or a new Cartographic instance if none was provided.
|
|
496
|
+
*/
|
|
497
|
+
static center(rectangle, result) {
|
|
498
|
+
if (!result)
|
|
499
|
+
result = new import_core6.Vector3();
|
|
500
|
+
let east = rectangle.east;
|
|
501
|
+
const west = rectangle.west;
|
|
502
|
+
if (east < west) {
|
|
503
|
+
east += import_core6._MathUtils.TWO_PI;
|
|
504
|
+
}
|
|
505
|
+
const longitude = (0, import_core6.normalizeAngle)((west + east) * 0.5, "negative-pi-to-pi");
|
|
506
|
+
const latitude = (rectangle.south + rectangle.north) * 0.5;
|
|
507
|
+
result.x = longitude;
|
|
508
|
+
result.y = latitude;
|
|
509
|
+
result.z = 0;
|
|
510
|
+
return result;
|
|
511
|
+
}
|
|
512
|
+
get width() {
|
|
513
|
+
let east = this.east;
|
|
514
|
+
const west = this.west;
|
|
515
|
+
if (east < west) {
|
|
516
|
+
east += import_core6._MathUtils.TWO_PI;
|
|
517
|
+
}
|
|
518
|
+
return east - west;
|
|
519
|
+
}
|
|
520
|
+
};
|
|
386
521
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts", "../src/ellipsoid
|
|
4
|
-
"sourcesContent": ["// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {Ellipsoid} from './ellipsoid/ellipsoid';\nexport {isWGS84} from './type-utils';\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n/* eslint-disable */\nimport {Vector3, Matrix4, assert, equals, _MathUtils, NumericArray, vec3} from '@math.gl/core';\n\nimport {WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z} from '../constants';\nimport {fromCartographicToRadians, toCartographicFromRadians} from '../type-utils';\n\nimport type {AxisDirection} from './helpers/ellipsoid-transform';\nimport {localFrameToFixedFrame} from './helpers/ellipsoid-transform';\nimport {scaleToGeodeticSurface} from './helpers/scale-to-geodetic-surface';\n\nconst scratchVector = new Vector3();\nconst scratchNormal = new Vector3();\nconst scratchK = new Vector3();\nconst scratchPosition = new Vector3();\nconst scratchHeight = new Vector3();\nconst scratchCartesian = new Vector3();\n\n/**\n * A quadratic surface defined in Cartesian coordinates by the equation\n * `(x / a)^2 + (y / b)^2 + (z / c)^2 = 1`. Primarily used\n * to represent the shape of planetary bodies.\n */\nexport class Ellipsoid {\n /** An Ellipsoid instance initialized to the WGS84 standard. */\n static readonly WGS84: Ellipsoid = new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);\n\n readonly radii: Vector3;\n readonly radiiSquared: Vector3;\n readonly radiiToTheFourth: Vector3;\n readonly oneOverRadii: Vector3;\n readonly oneOverRadiiSquared: Vector3;\n readonly minimumRadius: number;\n readonly maximumRadius: number;\n readonly centerToleranceSquared: number = _MathUtils.EPSILON1;\n readonly squaredXOverSquaredZ: number;\n\n /** Creates an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions. */\n constructor(x: number, y: number, z: number);\n constructor();\n\n constructor(x = 0.0, y = 0.0, z = 0.0) {\n assert(x >= 0.0);\n assert(y >= 0.0);\n assert(z >= 0.0);\n\n this.radii = new Vector3(x, y, z);\n\n this.radiiSquared = new Vector3(x * x, y * y, z * z);\n\n this.radiiToTheFourth = new Vector3(x * x * x * x, y * y * y * y, z * z * z * z);\n\n this.oneOverRadii = new Vector3(\n x === 0.0 ? 0.0 : 1.0 / x,\n y === 0.0 ? 0.0 : 1.0 / y,\n z === 0.0 ? 0.0 : 1.0 / z\n );\n\n this.oneOverRadiiSquared = new Vector3(\n x === 0.0 ? 0.0 : 1.0 / (x * x),\n y === 0.0 ? 0.0 : 1.0 / (y * y),\n z === 0.0 ? 0.0 : 1.0 / (z * z)\n );\n\n this.minimumRadius = Math.min(x, y, z);\n\n this.maximumRadius = Math.max(x, y, z);\n\n if (this.radiiSquared.z !== 0) {\n this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z;\n }\n\n Object.freeze(this);\n }\n\n /** Compares this Ellipsoid against the provided Ellipsoid componentwise */\n equals(right: Ellipsoid): boolean {\n return this === right || Boolean(right && this.radii.equals(right.radii));\n }\n\n /** Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'. */\n toString(): string {\n return this.radii.toString();\n }\n\n /** Converts the provided cartographic to Cartesian representation. */\n cartographicToCartesian(cartographic: number[], result: Vector3): Vector3;\n cartographicToCartesian(cartographic: number[], result?: number[]): number[];\n\n cartographicToCartesian(cartographic: Readonly<NumericArray>, result = [0, 0, 0]) {\n const normal = scratchNormal;\n const k = scratchK;\n\n const [, , height] = cartographic;\n this.geodeticSurfaceNormalCartographic(cartographic, normal);\n k.copy(this.radiiSquared).scale(normal);\n\n const gamma = Math.sqrt(normal.dot(k));\n k.scale(1 / gamma);\n\n normal.scale(height);\n\n k.add(normal);\n\n return k.to(result);\n }\n\n /** Converts the provided cartesian to cartographic (lng/lat/z) representation.\n * The cartesian is undefined at the center of the ellipsoid. */\n cartesianToCartographic(cartesian: Readonly<NumericArray>, result: Vector3): Vector3;\n cartesianToCartographic(cartesian: Readonly<NumericArray>, result?: number[]): number[];\n\n cartesianToCartographic(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {\n scratchCartesian.from(cartesian);\n const point = this.scaleToGeodeticSurface(scratchCartesian, scratchPosition);\n\n if (!point) {\n return undefined;\n }\n\n const normal = this.geodeticSurfaceNormal(point, scratchNormal);\n\n const h = scratchHeight;\n h.copy(scratchCartesian).subtract(point);\n\n const longitude = Math.atan2(normal.y, normal.x);\n const latitude = Math.asin(normal.z);\n const height = Math.sign(vec3.dot(h, scratchCartesian)) * vec3.length(h);\n\n return toCartographicFromRadians([longitude, latitude, height], result);\n }\n\n /** Computes a 4x4 transformation matrix from a reference frame with an east-north-up axes\n * centered at the provided origin to the provided ellipsoid's fixed reference frame. */\n eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result?: Matrix4): Matrix4;\n eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result: number[]): number[];\n\n eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result = new Matrix4()) {\n return localFrameToFixedFrame(this, 'east', 'north', 'up', origin, result);\n }\n\n /** Computes a 4x4 transformation matrix from a reference frame centered at\n * the provided origin to the ellipsoid's fixed reference frame.\n */\n localFrameToFixedFrame(\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n origin: Readonly<NumericArray>,\n result?: Matrix4\n ): Matrix4;\n localFrameToFixedFrame<Matrix4T>(\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n origin: Readonly<NumericArray>,\n result: number[]\n ): number[];\n\n // Computes a 4x4 transformation matrix from a reference frame centered at\n // the provided origin to the ellipsoid's fixed reference frame.\n localFrameToFixedFrame(\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n origin: Readonly<NumericArray>,\n result = new Matrix4()\n ) {\n return localFrameToFixedFrame(this, firstAxis, secondAxis, thirdAxis, origin, result);\n }\n\n /** Computes the unit vector directed from the center of this ellipsoid toward\n * the provided Cartesian position. */\n geocentricSurfaceNormal(cartesian: number[], result?: number[]): number[];\n geocentricSurfaceNormal<NumArray>(cartesian: number[], result: NumArray): NumArray;\n geocentricSurfaceNormal(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {\n return scratchVector.from(cartesian).normalize().to(result);\n }\n\n /** Computes the normal of the plane tangent to the surface of the ellipsoid at provided position. */\n geodeticSurfaceNormalCartographic<NumArray>(\n cartographic: Readonly<NumericArray>,\n result: NumArray\n ): NumArray;\n geodeticSurfaceNormalCartographic(cartographic: number[]): number[];\n geodeticSurfaceNormalCartographic(cartographic: Readonly<NumericArray>, result = [0, 0, 0]) {\n const cartographicVectorRadians = fromCartographicToRadians(cartographic);\n\n const longitude = cartographicVectorRadians[0];\n const latitude = cartographicVectorRadians[1];\n\n const cosLatitude = Math.cos(latitude);\n\n scratchVector\n .set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude))\n .normalize();\n\n return scratchVector.to(result);\n }\n\n /** Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position. */\n geodeticSurfaceNormal<NumArrayT>(cartesian: number[], result: NumArrayT): NumArrayT;\n geodeticSurfaceNormal(cartesian: number[]): number[];\n geodeticSurfaceNormal(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {\n return scratchVector.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);\n }\n\n /** Scales the provided Cartesian position along the geodetic surface normal\n * so that it is on the surface of this ellipsoid. If the position is\n * at the center of the ellipsoid, this function returns undefined. */\n scaleToGeodeticSurface(cartesian: number[], result?: number[]): number[] {\n return scaleToGeodeticSurface(cartesian, this, result);\n }\n\n /** Scales the provided Cartesian position along the geocentric surface normal\n * so that it is on the surface of this ellipsoid. */\n scaleToGeocentricSurface(cartesian: number[], result: number[] = [0, 0, 0]): number[] {\n scratchPosition.from(cartesian);\n\n const positionX = scratchPosition.x;\n const positionY = scratchPosition.y;\n const positionZ = scratchPosition.z;\n const oneOverRadiiSquared = this.oneOverRadiiSquared;\n\n const beta =\n 1.0 /\n Math.sqrt(\n positionX * positionX * oneOverRadiiSquared.x +\n positionY * positionY * oneOverRadiiSquared.y +\n positionZ * positionZ * oneOverRadiiSquared.z\n );\n\n return scratchPosition.multiplyScalar(beta).to(result);\n }\n\n /** Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying\n * its components by the result of `Ellipsoid#oneOverRadii` */\n transformPositionToScaledSpace(position: number[], result: number[] = [0, 0, 0]): number[] {\n return scratchPosition.from(position).scale(this.oneOverRadii).to(result);\n }\n\n /** Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying\n * its components by the result of `Ellipsoid#radii`. */\n transformPositionFromScaledSpace(position: number[], result: number[] = [0, 0, 0]): number[] {\n return scratchPosition.from(position).scale(this.radii).to(result);\n }\n\n /** Computes a point which is the intersection of the surface normal with the z-axis. */\n getSurfaceNormalIntersectionWithZAxis(\n position: number[],\n buffer: number = 0,\n result: number[] = [0, 0, 0]\n ): number[] {\n // Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)\n assert(equals(this.radii.x, this.radii.y, _MathUtils.EPSILON15));\n assert(this.radii.z > 0);\n\n scratchPosition.from(position);\n const z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);\n\n if (Math.abs(z) >= this.radii.z - buffer) {\n return undefined;\n }\n\n return scratchPosition.set(0.0, 0.0, z).to(result);\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nexport const WGS84_RADIUS_X = 6378137.0;\nexport const WGS84_RADIUS_Y = 6378137.0;\nexport const WGS84_RADIUS_Z = 6356752.3142451793;\n\n// Pre-calculated ellipsoid defaults to avoid utils depending on `ellipsoid.js`\n\nexport const WGS84_CONSTANTS = {\n radii: [WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z],\n radiiSquared: [\n WGS84_RADIUS_X * WGS84_RADIUS_X,\n WGS84_RADIUS_Y * WGS84_RADIUS_Y,\n WGS84_RADIUS_Z * WGS84_RADIUS_Z\n ],\n oneOverRadii: [1.0 / WGS84_RADIUS_X, 1.0 / WGS84_RADIUS_Y, 1.0 / WGS84_RADIUS_Z],\n oneOverRadiiSquared: [\n 1.0 / (WGS84_RADIUS_X * WGS84_RADIUS_X),\n 1.0 / (WGS84_RADIUS_Y * WGS84_RADIUS_Y),\n 1.0 / (WGS84_RADIUS_Z * WGS84_RADIUS_Z)\n ],\n maximumRadius: Math.max(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z),\n centerToleranceSquared: 1e-1 // EPSILON1;\n};\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport type {NumericArray} from '@math.gl/core';\nimport {Vector3, toRadians, toDegrees, config} from '@math.gl/core';\nimport {WGS84_CONSTANTS} from './constants';\n\ntype LngLatHeightObject = {\n longitude: number;\n latitude: number;\n height: number;\n};\n\ntype XYZObject = {\n x: number;\n y: number;\n z: number;\n};\n\ntype Cartographic = LngLatHeightObject | XYZObject | NumericArray;\n\nfunction identity(x: number): number {\n return x;\n}\n\nconst scratchVector = new Vector3();\n\nexport function fromCartographic(cartographic: Readonly<Cartographic>): number[];\nexport function fromCartographic<NumArrayT>(\n cartographic: Readonly<Cartographic>,\n result: NumArrayT,\n map?: (x: number) => number\n): NumArrayT;\nexport function fromCartographic(\n cartographic: Readonly<Cartographic>,\n result = [] as number[],\n map = identity\n): number[] {\n if ('longitude' in cartographic) {\n result[0] = map(cartographic.longitude);\n result[1] = map(cartographic.latitude);\n result[2] = cartographic.height;\n } else if ('x' in cartographic) {\n result[0] = map(cartographic.x);\n result[1] = map(cartographic.y);\n result[2] = cartographic.z;\n } else {\n result[0] = map(cartographic[0]);\n result[1] = map(cartographic[1]);\n result[2] = cartographic[2];\n }\n return result;\n}\n\nexport function fromCartographicToRadians(\n cartographic: Readonly<Cartographic>,\n result?: number[]\n): number[];\nexport function fromCartographicToRadians<TArray>(\n cartographic: Readonly<Cartographic>,\n result: TArray\n): TArray;\nexport function fromCartographicToRadians(\n cartographic: Readonly<Cartographic>,\n vector = [] as number[]\n): number[] {\n return fromCartographic(cartographic, vector, config._cartographicRadians ? identity : toRadians);\n}\n\nexport function fromCartographicToDegrees(\n cartographic: Readonly<Cartographic>,\n result?: number[]\n): number[];\nexport function fromCartographicToDegrees<TArray>(\n cartographic: Readonly<Cartographic>,\n result: TArray\n): TArray;\nexport function fromCartographicToDegrees(\n cartographic: Readonly<Cartographic>,\n vector = [] as number[]\n): number[] {\n return fromCartographic(cartographic, vector, config._cartographicRadians ? toDegrees : identity);\n}\n\nexport function toCartographic<T extends Cartographic>(\n vector: Readonly<NumericArray>,\n cartographic: T,\n map: (x: number) => number = identity\n): T {\n if ('longitude' in cartographic) {\n cartographic.longitude = map(vector[0]);\n cartographic.latitude = map(vector[1]);\n cartographic.height = vector[2];\n } else if ('x' in cartographic) {\n cartographic.x = map(vector[0]);\n cartographic.y = map(vector[1]);\n cartographic.z = vector[2];\n } else {\n cartographic[0] = map(vector[0]);\n cartographic[1] = map(vector[1]);\n cartographic[2] = vector[2];\n }\n return cartographic;\n}\n\nexport function toCartographicFromRadians<T extends Cartographic>(\n vector: Readonly<NumericArray>,\n cartographic: T\n): T {\n return toCartographic(vector, cartographic, config._cartographicRadians ? identity : toDegrees);\n}\n\nexport function toCartographicFromDegrees<T extends Cartographic>(\n vector: Readonly<NumericArray>,\n cartographic: T\n): T {\n return toCartographic(vector, cartographic, config._cartographicRadians ? toRadians : identity);\n}\n\n// Estimates if a vector is close to the surface of the WGS84 Ellipsoid\nexport function isWGS84(vector: Readonly<NumericArray>): boolean {\n if (!vector) {\n return false;\n }\n scratchVector.from(vector);\n const {oneOverRadiiSquared, centerToleranceSquared} = WGS84_CONSTANTS;\n const x2 = vector[0] * vector[0] * oneOverRadiiSquared[0];\n const y2 = vector[1] * vector[1] * oneOverRadiiSquared[1];\n const z2 = vector[2] * vector[2] * oneOverRadiiSquared[2];\n return Math.abs(x2 + y2 + z2 - 1) < centerToleranceSquared;\n}\n\n/*\n\nexport function fromCartographic(cartographic: Cartographic, result?: number[]): number[];\nexport function fromCartographic(cartographic: Cartographic, result: TypedArray): TypedArray;\nexport function fromCartographicToRadians(cartographic: Cartographic, result?: number[]): number[];\nexport function fromCartographicToRadians(\n cartographic: Cartographic,\n result: TypedArray\n): TypedArray;\nexport function fromCartographicToDegrees(cartographic: Cartographic, result?: number[]): number[];\nexport function fromCartographicToDegrees(\n cartographic: Cartographic,\n result: TypedArray\n): TypedArray;\n\nexport function toCartographic(vector: number[] | TypedArray, result: Cartographic): number[];\nexport function toCartographicFromRadians(\n vector: number[] | TypedArray,\n result: Cartographic\n): number[];\nexport function toCartographicFromDegrees(\n vector: number[] | TypedArray,\n result: Cartographic\n): number[];\n\n// Estimates if a vector is close to the surface of the WGS84 Ellipsoid\nexport function isWGS84(vector: number[] | TypedArray): boolean;\n*/\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\nimport {NumericArray} from '@math.gl/types';\nimport {Vector3, assert, equals as equalsEpsilon} from '@math.gl/core';\n\nimport type {Ellipsoid} from '../ellipsoid';\n\nconst EPSILON14 = 1e-14;\n\nconst scratchOrigin = new Vector3();\n\nexport type AxisDirection = 'up' | 'down' | 'north' | 'east' | 'south' | 'west';\n\n// Caclulate third axis from given two axii\nconst VECTOR_PRODUCT_LOCAL_FRAME: Record<\n AxisDirection,\n Partial<Record<AxisDirection, AxisDirection>>\n> = {\n up: {\n south: 'east',\n north: 'west',\n west: 'south',\n east: 'north'\n },\n down: {\n south: 'west',\n north: 'east',\n west: 'north',\n east: 'south'\n },\n south: {\n up: 'west',\n down: 'east',\n west: 'down',\n east: 'up'\n },\n north: {\n up: 'east',\n down: 'west',\n west: 'up',\n east: 'down'\n },\n west: {\n up: 'north',\n down: 'south',\n north: 'down',\n south: 'up'\n },\n east: {\n up: 'south',\n down: 'north',\n north: 'up',\n south: 'down'\n }\n} as const;\n\nconst degeneratePositionLocalFrame = {\n north: [-1, 0, 0],\n east: [0, 1, 0],\n up: [0, 0, 1],\n south: [1, 0, 0],\n west: [0, -1, 0],\n down: [0, 0, -1]\n} as const;\n\nconst scratchAxisVectors = {\n east: new Vector3(),\n north: new Vector3(),\n up: new Vector3(),\n west: new Vector3(),\n south: new Vector3(),\n down: new Vector3()\n};\n\nconst scratchVector1 = new Vector3();\nconst scratchVector2 = new Vector3();\nconst scratchVector3 = new Vector3();\n\n// Computes a 4x4 transformation matrix from a reference frame\n// centered at the provided origin to the provided ellipsoid's fixed reference frame.\n// eslint-disable-next-line max-statements, max-params, complexity\nexport function localFrameToFixedFrame(\n ellipsoid: Ellipsoid,\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n cartesianOrigin: Readonly<NumericArray>,\n result: number[]\n): number[] {\n const thirdAxisInferred =\n VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];\n // firstAxis and secondAxis must be east, north, up, west, south or down.');\n assert(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));\n\n let firstAxisVector: Vector3;\n let secondAxisVector: Vector3;\n let thirdAxisVector: Vector3;\n\n const origin = scratchOrigin.copy(cartesianOrigin);\n\n // If x and y are zero, assume origin is at a pole, which is a special case.\n const atPole = equalsEpsilon(origin.x, 0.0, EPSILON14) && equalsEpsilon(origin.y, 0.0, EPSILON14);\n\n if (atPole) {\n // Look up axis value and adjust\n const sign = Math.sign(origin.z);\n\n firstAxisVector = scratchVector1.fromArray(degeneratePositionLocalFrame[firstAxis]);\n if (firstAxis !== 'east' && firstAxis !== 'west') {\n firstAxisVector.scale(sign);\n }\n\n secondAxisVector = scratchVector2.fromArray(degeneratePositionLocalFrame[secondAxis]);\n if (secondAxis !== 'east' && secondAxis !== 'west') {\n secondAxisVector.scale(sign);\n }\n\n thirdAxisVector = scratchVector3.fromArray(degeneratePositionLocalFrame[thirdAxis]);\n if (thirdAxis !== 'east' && thirdAxis !== 'west') {\n thirdAxisVector.scale(sign);\n }\n } else {\n // Calculate all axis\n const {up, east, north} = scratchAxisVectors;\n\n east.set(-origin.y, origin.x, 0.0).normalize();\n ellipsoid.geodeticSurfaceNormal(origin, up);\n north.copy(up).cross(east);\n\n const {down, west, south} = scratchAxisVectors;\n\n down.copy(up).scale(-1);\n west.copy(east).scale(-1);\n south.copy(north).scale(-1);\n\n // Pick three axis based on desired orientation\n firstAxisVector = scratchAxisVectors[firstAxis];\n secondAxisVector = scratchAxisVectors[secondAxis];\n thirdAxisVector = scratchAxisVectors[thirdAxis];\n }\n\n // TODO - assuming the result is column-major\n result[0] = firstAxisVector.x;\n result[1] = firstAxisVector.y;\n result[2] = firstAxisVector.z;\n result[3] = 0.0;\n result[4] = secondAxisVector.x;\n result[5] = secondAxisVector.y;\n result[6] = secondAxisVector.z;\n result[7] = 0.0;\n result[8] = thirdAxisVector.x;\n result[9] = thirdAxisVector.y;\n result[10] = thirdAxisVector.z;\n result[11] = 0.0;\n result[12] = origin.x;\n result[13] = origin.y;\n result[14] = origin.z;\n result[15] = 1.0;\n return result;\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable */\nimport {Vector3, _MathUtils} from '@math.gl/core';\nimport type {Ellipsoid} from '../ellipsoid';\n\nconst scratchVector = new Vector3();\nconst scaleToGeodeticSurfaceIntersection = new Vector3();\nconst scaleToGeodeticSurfaceGradient = new Vector3();\n\n// Scales the provided Cartesian position along the geodetic surface normal\n// so that it is on the surface of this ellipsoid. If the position is\n// at the center of the ellipsoid, this function returns undefined.\nexport function scaleToGeodeticSurface(\n cartesian: number[],\n ellipsoid: Ellipsoid,\n result: number[] = []\n): number[] {\n const {oneOverRadii, oneOverRadiiSquared, centerToleranceSquared} = ellipsoid;\n\n scratchVector.from(cartesian);\n\n const positionX = scratchVector.x;\n const positionY = scratchVector.y;\n const positionZ = scratchVector.z;\n\n const oneOverRadiiX = oneOverRadii.x;\n const oneOverRadiiY = oneOverRadii.y;\n const oneOverRadiiZ = oneOverRadii.z;\n\n const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;\n const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;\n const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;\n\n // Compute the squared ellipsoid norm.\n const squaredNorm = x2 + y2 + z2;\n const ratio = Math.sqrt(1.0 / squaredNorm);\n\n // When very close to center or at center\n if (!Number.isFinite(ratio)) {\n return undefined;\n }\n\n // As an initial approximation, assume that the radial intersection is the projection point.\n const intersection = scaleToGeodeticSurfaceIntersection;\n intersection.copy(cartesian).scale(ratio);\n\n // If the position is near the center, the iteration will not converge.\n if (squaredNorm < centerToleranceSquared) {\n return intersection.to(result);\n }\n\n const oneOverRadiiSquaredX = oneOverRadiiSquared.x;\n const oneOverRadiiSquaredY = oneOverRadiiSquared.y;\n const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;\n\n // Use the gradient at the intersection point in place of the true unit normal.\n // The difference in magnitude will be absorbed in the multiplier.\n const gradient = scaleToGeodeticSurfaceGradient;\n gradient.set(\n intersection.x * oneOverRadiiSquaredX * 2.0,\n intersection.y * oneOverRadiiSquaredY * 2.0,\n intersection.z * oneOverRadiiSquaredZ * 2.0\n );\n\n // Compute the initial guess at the normal vector multiplier, lambda.\n let lambda = ((1.0 - ratio) * scratchVector.len()) / (0.5 * gradient.len());\n let correction = 0.0;\n\n let xMultiplier;\n let yMultiplier;\n let zMultiplier;\n let func;\n\n do {\n lambda -= correction;\n\n xMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX);\n yMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY);\n zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ);\n\n const xMultiplier2 = xMultiplier * xMultiplier;\n const yMultiplier2 = yMultiplier * yMultiplier;\n const zMultiplier2 = zMultiplier * zMultiplier;\n\n const xMultiplier3 = xMultiplier2 * xMultiplier;\n const yMultiplier3 = yMultiplier2 * yMultiplier;\n const zMultiplier3 = zMultiplier2 * zMultiplier;\n\n func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0;\n\n // \"denominator\" here refers to the use of this expression in the velocity and acceleration\n // computations in the sections to follow.\n const denominator =\n x2 * xMultiplier3 * oneOverRadiiSquaredX +\n y2 * yMultiplier3 * oneOverRadiiSquaredY +\n z2 * zMultiplier3 * oneOverRadiiSquaredZ;\n\n const derivative = -2.0 * denominator;\n\n correction = func / derivative;\n } while (Math.abs(func) > _MathUtils.EPSILON12);\n\n return scratchVector.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;ACQA,IAAAA,eAA+E;;;ACDxE,IAAM,iBAAiB;AACvB,IAAM,iBAAiB;AACvB,IAAM,iBAAiB;AAIvB,IAAM,kBAAkB;EAC7B,OAAO,CAAC,gBAAgB,gBAAgB,cAAc;EACtD,cAAc;IACZ,iBAAiB;IACjB,iBAAiB;IACjB,iBAAi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/D,6BAAO,KAAK,MAAM,IAAI,CAAC;AAEvB,oBAAgB,KAAK,QAAQ;AAC7B,UAAM,IAAI,gBAAgB,KAAK,IAAI,KAAK;AAExC,QAAI,KAAK,IAAI,CAAC,KAAK,KAAK,MAAM,IAAI,QAAQ;AACxC,aAAO;IACT;AAEA,WAAO,gBAAgB,IAAI,GAAK,GAAK,CAAC,EAAE,GAAG,MAAM;EACnD;;AAhPgB,UAAA,QAAmB,IAAI,UAAU,gBAAgB,gBAAgB,cAAc;",
|
|
6
|
-
"names": ["import_core", "import_core", "equalsEpsilon", "import_core", "scratchVector", "scratchVector"]
|
|
3
|
+
"sources": ["../src/index.ts", "../src/ellipsoid.ts", "../src/constants.ts", "../src/type-utils.ts", "../src/ellipsoid-helpers/ellipsoid-transform.ts", "../src/ellipsoid-helpers/scale-to-geodetic-surface.ts", "../src/ellipsoid-tangent-plane.ts", "../src/lng-lat-rectangle.ts"],
|
|
4
|
+
"sourcesContent": ["// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {Ellipsoid} from './ellipsoid';\nexport {EllipsoidTangentPlane} from './ellipsoid-tangent-plane';\nexport {LngLatRectangle} from './lng-lat-rectangle';\nexport {isWGS84} from './type-utils';\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n/* eslint-disable */\nimport {Vector3, Matrix4, assert, equals, _MathUtils, NumericArray, vec3} from '@math.gl/core';\n\nimport {WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z} from './constants';\nimport {fromCartographicToRadians, toCartographicFromRadians} from './type-utils';\n\nimport type {AxisDirection} from './ellipsoid-helpers/ellipsoid-transform';\nimport {localFrameToFixedFrame} from './ellipsoid-helpers/ellipsoid-transform';\nimport {scaleToGeodeticSurface} from './ellipsoid-helpers/scale-to-geodetic-surface';\n\nconst scratchVector = new Vector3();\nconst scratchNormal = new Vector3();\nconst scratchK = new Vector3();\nconst scratchPosition = new Vector3();\nconst scratchHeight = new Vector3();\nconst scratchCartesian = new Vector3();\n\n/**\n * A quadratic surface defined in Cartesian coordinates by the equation\n * `(x / a)^2 + (y / b)^2 + (z / c)^2 = 1`. Primarily used\n * to represent the shape of planetary bodies.\n */\nexport class Ellipsoid {\n /** An Ellipsoid instance initialized to the WGS84 standard. */\n static readonly WGS84: Ellipsoid = new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);\n\n readonly radii: Vector3;\n readonly radiiSquared: Vector3;\n readonly radiiToTheFourth: Vector3;\n readonly oneOverRadii: Vector3;\n readonly oneOverRadiiSquared: Vector3;\n readonly minimumRadius: number;\n readonly maximumRadius: number;\n readonly centerToleranceSquared: number = _MathUtils.EPSILON1;\n readonly squaredXOverSquaredZ: number;\n\n /** Creates an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions. */\n constructor(x: number, y: number, z: number);\n constructor();\n\n constructor(x = 0.0, y = 0.0, z = 0.0) {\n assert(x >= 0.0);\n assert(y >= 0.0);\n assert(z >= 0.0);\n\n this.radii = new Vector3(x, y, z);\n\n this.radiiSquared = new Vector3(x * x, y * y, z * z);\n\n this.radiiToTheFourth = new Vector3(x * x * x * x, y * y * y * y, z * z * z * z);\n\n this.oneOverRadii = new Vector3(\n x === 0.0 ? 0.0 : 1.0 / x,\n y === 0.0 ? 0.0 : 1.0 / y,\n z === 0.0 ? 0.0 : 1.0 / z\n );\n\n this.oneOverRadiiSquared = new Vector3(\n x === 0.0 ? 0.0 : 1.0 / (x * x),\n y === 0.0 ? 0.0 : 1.0 / (y * y),\n z === 0.0 ? 0.0 : 1.0 / (z * z)\n );\n\n this.minimumRadius = Math.min(x, y, z);\n\n this.maximumRadius = Math.max(x, y, z);\n\n if (this.radiiSquared.z !== 0) {\n this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z;\n }\n\n Object.freeze(this);\n }\n\n /** Compares this Ellipsoid against the provided Ellipsoid componentwise */\n equals(right: Ellipsoid): boolean {\n return this === right || Boolean(right && this.radii.equals(right.radii));\n }\n\n /** Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'. */\n toString(): string {\n return this.radii.toString();\n }\n\n /** Converts the provided cartographic to Cartesian representation. */\n cartographicToCartesian(cartographic: number[], result: Vector3): Vector3;\n cartographicToCartesian(cartographic: number[], result?: number[]): number[];\n\n cartographicToCartesian(cartographic: Readonly<NumericArray>, result = [0, 0, 0]) {\n const normal = scratchNormal;\n const k = scratchK;\n\n const [, , height] = cartographic;\n this.geodeticSurfaceNormalCartographic(cartographic, normal);\n k.copy(this.radiiSquared).scale(normal);\n\n const gamma = Math.sqrt(normal.dot(k));\n k.scale(1 / gamma);\n\n normal.scale(height);\n\n k.add(normal);\n\n return k.to(result);\n }\n\n /** Converts the provided cartesian to cartographic (lng/lat/z) representation.\n * The cartesian is undefined at the center of the ellipsoid. */\n cartesianToCartographic(cartesian: Readonly<NumericArray>, result: Vector3): Vector3;\n cartesianToCartographic(cartesian: Readonly<NumericArray>, result?: number[]): number[];\n\n cartesianToCartographic(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {\n scratchCartesian.from(cartesian);\n const point = this.scaleToGeodeticSurface(scratchCartesian, scratchPosition);\n\n if (!point) {\n return undefined;\n }\n\n const normal = this.geodeticSurfaceNormal(point, scratchNormal);\n\n const h = scratchHeight;\n h.copy(scratchCartesian).subtract(point);\n\n const longitude = Math.atan2(normal.y, normal.x);\n const latitude = Math.asin(normal.z);\n const height = Math.sign(vec3.dot(h, scratchCartesian)) * vec3.length(h);\n\n return toCartographicFromRadians([longitude, latitude, height], result);\n }\n\n /** Computes a 4x4 transformation matrix from a reference frame with an east-north-up axes\n * centered at the provided origin to the provided ellipsoid's fixed reference frame. */\n eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result?: Matrix4): Matrix4;\n eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result: number[]): number[];\n\n eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result = new Matrix4()) {\n return localFrameToFixedFrame(this, 'east', 'north', 'up', origin, result);\n }\n\n /** Computes a 4x4 transformation matrix from a reference frame centered at\n * the provided origin to the ellipsoid's fixed reference frame.\n */\n localFrameToFixedFrame(\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n origin: Readonly<NumericArray>,\n result?: Matrix4\n ): Matrix4;\n localFrameToFixedFrame<Matrix4T>(\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n origin: Readonly<NumericArray>,\n result: number[]\n ): number[];\n\n // Computes a 4x4 transformation matrix from a reference frame centered at\n // the provided origin to the ellipsoid's fixed reference frame.\n localFrameToFixedFrame(\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n origin: Readonly<NumericArray>,\n result = new Matrix4()\n ) {\n return localFrameToFixedFrame(this, firstAxis, secondAxis, thirdAxis, origin, result);\n }\n\n /** Computes the unit vector directed from the center of this ellipsoid toward\n * the provided Cartesian position. */\n geocentricSurfaceNormal(cartesian: number[], result?: number[]): number[];\n geocentricSurfaceNormal<NumArray>(cartesian: number[], result: NumArray): NumArray;\n geocentricSurfaceNormal(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {\n return scratchVector.from(cartesian).normalize().to(result);\n }\n\n /** Computes the normal of the plane tangent to the surface of the ellipsoid at provided position. */\n geodeticSurfaceNormalCartographic<NumArray>(\n cartographic: Readonly<NumericArray>,\n result: NumArray\n ): NumArray;\n geodeticSurfaceNormalCartographic(cartographic: number[]): number[];\n geodeticSurfaceNormalCartographic(cartographic: Readonly<NumericArray>, result = [0, 0, 0]) {\n const cartographicVectorRadians = fromCartographicToRadians(cartographic);\n\n const longitude = cartographicVectorRadians[0];\n const latitude = cartographicVectorRadians[1];\n\n const cosLatitude = Math.cos(latitude);\n\n scratchVector\n .set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude))\n .normalize();\n\n return scratchVector.to(result);\n }\n\n /** Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position. */\n geodeticSurfaceNormal<NumArrayT>(cartesian: number[], result: NumArrayT): NumArrayT;\n geodeticSurfaceNormal(cartesian: number[]): number[];\n geodeticSurfaceNormal(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {\n return scratchVector.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);\n }\n\n /** Scales the provided Cartesian position along the geodetic surface normal\n * so that it is on the surface of this ellipsoid. If the position is\n * at the center of the ellipsoid, this function returns undefined. */\n scaleToGeodeticSurface(cartesian: number[], result?: number[]): number[] {\n return scaleToGeodeticSurface(cartesian, this, result);\n }\n\n /** Scales the provided Cartesian position along the geocentric surface normal\n * so that it is on the surface of this ellipsoid. */\n scaleToGeocentricSurface(cartesian: number[], result: number[] = [0, 0, 0]): number[] {\n scratchPosition.from(cartesian);\n\n const positionX = scratchPosition.x;\n const positionY = scratchPosition.y;\n const positionZ = scratchPosition.z;\n const oneOverRadiiSquared = this.oneOverRadiiSquared;\n\n const beta =\n 1.0 /\n Math.sqrt(\n positionX * positionX * oneOverRadiiSquared.x +\n positionY * positionY * oneOverRadiiSquared.y +\n positionZ * positionZ * oneOverRadiiSquared.z\n );\n\n return scratchPosition.multiplyScalar(beta).to(result);\n }\n\n /** Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying\n * its components by the result of `Ellipsoid#oneOverRadii` */\n transformPositionToScaledSpace(position: number[], result: number[] = [0, 0, 0]): number[] {\n return scratchPosition.from(position).scale(this.oneOverRadii).to(result);\n }\n\n /** Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying\n * its components by the result of `Ellipsoid#radii`. */\n transformPositionFromScaledSpace(position: number[], result: number[] = [0, 0, 0]): number[] {\n return scratchPosition.from(position).scale(this.radii).to(result);\n }\n\n /** Computes a point which is the intersection of the surface normal with the z-axis. */\n getSurfaceNormalIntersectionWithZAxis(\n position: number[],\n buffer: number = 0,\n result: number[] = [0, 0, 0]\n ): number[] {\n // Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)\n assert(equals(this.radii.x, this.radii.y, _MathUtils.EPSILON15));\n assert(this.radii.z > 0);\n\n scratchPosition.from(position);\n const z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);\n\n if (Math.abs(z) >= this.radii.z - buffer) {\n return undefined;\n }\n\n return scratchPosition.set(0.0, 0.0, z).to(result);\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nexport const WGS84_RADIUS_X = 6378137.0;\nexport const WGS84_RADIUS_Y = 6378137.0;\nexport const WGS84_RADIUS_Z = 6356752.3142451793;\n\n// Pre-calculated ellipsoid defaults to avoid utils depending on `ellipsoid.js`\n\nexport const WGS84_CONSTANTS = {\n radii: [WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z],\n radiiSquared: [\n WGS84_RADIUS_X * WGS84_RADIUS_X,\n WGS84_RADIUS_Y * WGS84_RADIUS_Y,\n WGS84_RADIUS_Z * WGS84_RADIUS_Z\n ],\n oneOverRadii: [1.0 / WGS84_RADIUS_X, 1.0 / WGS84_RADIUS_Y, 1.0 / WGS84_RADIUS_Z],\n oneOverRadiiSquared: [\n 1.0 / (WGS84_RADIUS_X * WGS84_RADIUS_X),\n 1.0 / (WGS84_RADIUS_Y * WGS84_RADIUS_Y),\n 1.0 / (WGS84_RADIUS_Z * WGS84_RADIUS_Z)\n ],\n maximumRadius: Math.max(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z),\n centerToleranceSquared: 1e-1 // EPSILON1;\n};\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport type {NumericArray} from '@math.gl/core';\nimport {Vector3, toRadians, toDegrees, config} from '@math.gl/core';\nimport {WGS84_CONSTANTS} from './constants';\n\ntype LngLatHeightObject = {\n longitude: number;\n latitude: number;\n height: number;\n};\n\ntype XYZObject = {\n x: number;\n y: number;\n z: number;\n};\n\ntype Cartographic = LngLatHeightObject | XYZObject | NumericArray;\n\nfunction identity(x: number): number {\n return x;\n}\n\nconst scratchVector = new Vector3();\n\nexport function fromCartographic(cartographic: Readonly<Cartographic>): number[];\nexport function fromCartographic<NumArrayT>(\n cartographic: Readonly<Cartographic>,\n result: NumArrayT,\n map?: (x: number) => number\n): NumArrayT;\nexport function fromCartographic(\n cartographic: Readonly<Cartographic>,\n result = [] as number[],\n map = identity\n): number[] {\n if ('longitude' in cartographic) {\n result[0] = map(cartographic.longitude);\n result[1] = map(cartographic.latitude);\n result[2] = cartographic.height;\n } else if ('x' in cartographic) {\n result[0] = map(cartographic.x);\n result[1] = map(cartographic.y);\n result[2] = cartographic.z;\n } else {\n result[0] = map(cartographic[0]);\n result[1] = map(cartographic[1]);\n result[2] = cartographic[2];\n }\n return result;\n}\n\nexport function fromCartographicToRadians(\n cartographic: Readonly<Cartographic>,\n result?: number[]\n): number[];\nexport function fromCartographicToRadians<TArray>(\n cartographic: Readonly<Cartographic>,\n result: TArray\n): TArray;\nexport function fromCartographicToRadians(\n cartographic: Readonly<Cartographic>,\n vector = [] as number[]\n): number[] {\n return fromCartographic(cartographic, vector, config._cartographicRadians ? identity : toRadians);\n}\n\nexport function fromCartographicToDegrees(\n cartographic: Readonly<Cartographic>,\n result?: number[]\n): number[];\nexport function fromCartographicToDegrees<TArray>(\n cartographic: Readonly<Cartographic>,\n result: TArray\n): TArray;\nexport function fromCartographicToDegrees(\n cartographic: Readonly<Cartographic>,\n vector = [] as number[]\n): number[] {\n return fromCartographic(cartographic, vector, config._cartographicRadians ? toDegrees : identity);\n}\n\nexport function toCartographic<T extends Cartographic>(\n vector: Readonly<NumericArray>,\n cartographic: T,\n map: (x: number) => number = identity\n): T {\n if ('longitude' in cartographic) {\n cartographic.longitude = map(vector[0]);\n cartographic.latitude = map(vector[1]);\n cartographic.height = vector[2];\n } else if ('x' in cartographic) {\n cartographic.x = map(vector[0]);\n cartographic.y = map(vector[1]);\n cartographic.z = vector[2];\n } else {\n cartographic[0] = map(vector[0]);\n cartographic[1] = map(vector[1]);\n cartographic[2] = vector[2];\n }\n return cartographic;\n}\n\nexport function toCartographicFromRadians<T extends Cartographic>(\n vector: Readonly<NumericArray>,\n cartographic: T\n): T {\n return toCartographic(vector, cartographic, config._cartographicRadians ? identity : toDegrees);\n}\n\nexport function toCartographicFromDegrees<T extends Cartographic>(\n vector: Readonly<NumericArray>,\n cartographic: T\n): T {\n return toCartographic(vector, cartographic, config._cartographicRadians ? toRadians : identity);\n}\n\n// Estimates if a vector is close to the surface of the WGS84 Ellipsoid\nexport function isWGS84(vector: Readonly<NumericArray>): boolean {\n if (!vector) {\n return false;\n }\n scratchVector.from(vector);\n const {oneOverRadiiSquared, centerToleranceSquared} = WGS84_CONSTANTS;\n const x2 = vector[0] * vector[0] * oneOverRadiiSquared[0];\n const y2 = vector[1] * vector[1] * oneOverRadiiSquared[1];\n const z2 = vector[2] * vector[2] * oneOverRadiiSquared[2];\n return Math.abs(x2 + y2 + z2 - 1) < centerToleranceSquared;\n}\n\n/*\n\nexport function fromCartographic(cartographic: Cartographic, result?: number[]): number[];\nexport function fromCartographic(cartographic: Cartographic, result: TypedArray): TypedArray;\nexport function fromCartographicToRadians(cartographic: Cartographic, result?: number[]): number[];\nexport function fromCartographicToRadians(\n cartographic: Cartographic,\n result: TypedArray\n): TypedArray;\nexport function fromCartographicToDegrees(cartographic: Cartographic, result?: number[]): number[];\nexport function fromCartographicToDegrees(\n cartographic: Cartographic,\n result: TypedArray\n): TypedArray;\n\nexport function toCartographic(vector: number[] | TypedArray, result: Cartographic): number[];\nexport function toCartographicFromRadians(\n vector: number[] | TypedArray,\n result: Cartographic\n): number[];\nexport function toCartographicFromDegrees(\n vector: number[] | TypedArray,\n result: Cartographic\n): number[];\n\n// Estimates if a vector is close to the surface of the WGS84 Ellipsoid\nexport function isWGS84(vector: number[] | TypedArray): boolean;\n*/\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\nimport {NumericArray} from '@math.gl/types';\nimport {Vector3, assert, equals as equalsEpsilon} from '@math.gl/core';\n\nimport type {Ellipsoid} from '../ellipsoid';\n\nconst EPSILON14 = 1e-14;\n\nconst scratchOrigin = new Vector3();\n\nexport type AxisDirection = 'up' | 'down' | 'north' | 'east' | 'south' | 'west';\n\n// Caclulate third axis from given two axii\nconst VECTOR_PRODUCT_LOCAL_FRAME: Record<\n AxisDirection,\n Partial<Record<AxisDirection, AxisDirection>>\n> = {\n up: {\n south: 'east',\n north: 'west',\n west: 'south',\n east: 'north'\n },\n down: {\n south: 'west',\n north: 'east',\n west: 'north',\n east: 'south'\n },\n south: {\n up: 'west',\n down: 'east',\n west: 'down',\n east: 'up'\n },\n north: {\n up: 'east',\n down: 'west',\n west: 'up',\n east: 'down'\n },\n west: {\n up: 'north',\n down: 'south',\n north: 'down',\n south: 'up'\n },\n east: {\n up: 'south',\n down: 'north',\n north: 'up',\n south: 'down'\n }\n} as const;\n\nconst degeneratePositionLocalFrame = {\n north: [-1, 0, 0],\n east: [0, 1, 0],\n up: [0, 0, 1],\n south: [1, 0, 0],\n west: [0, -1, 0],\n down: [0, 0, -1]\n} as const;\n\nconst scratchAxisVectors = {\n east: new Vector3(),\n north: new Vector3(),\n up: new Vector3(),\n west: new Vector3(),\n south: new Vector3(),\n down: new Vector3()\n};\n\nconst scratchVector1 = new Vector3();\nconst scratchVector2 = new Vector3();\nconst scratchVector3 = new Vector3();\n\n// Computes a 4x4 transformation matrix from a reference frame\n// centered at the provided origin to the provided ellipsoid's fixed reference frame.\n// eslint-disable-next-line max-statements, max-params, complexity\nexport function localFrameToFixedFrame(\n ellipsoid: Ellipsoid,\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n cartesianOrigin: Readonly<NumericArray>,\n result: number[]\n): number[] {\n const thirdAxisInferred =\n VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];\n // firstAxis and secondAxis must be east, north, up, west, south or down.');\n assert(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));\n\n let firstAxisVector: Vector3;\n let secondAxisVector: Vector3;\n let thirdAxisVector: Vector3;\n\n const origin = scratchOrigin.copy(cartesianOrigin);\n\n // If x and y are zero, assume origin is at a pole, which is a special case.\n const atPole = equalsEpsilon(origin.x, 0.0, EPSILON14) && equalsEpsilon(origin.y, 0.0, EPSILON14);\n\n if (atPole) {\n // Look up axis value and adjust\n const sign = Math.sign(origin.z);\n\n firstAxisVector = scratchVector1.fromArray(degeneratePositionLocalFrame[firstAxis]);\n if (firstAxis !== 'east' && firstAxis !== 'west') {\n firstAxisVector.scale(sign);\n }\n\n secondAxisVector = scratchVector2.fromArray(degeneratePositionLocalFrame[secondAxis]);\n if (secondAxis !== 'east' && secondAxis !== 'west') {\n secondAxisVector.scale(sign);\n }\n\n thirdAxisVector = scratchVector3.fromArray(degeneratePositionLocalFrame[thirdAxis]);\n if (thirdAxis !== 'east' && thirdAxis !== 'west') {\n thirdAxisVector.scale(sign);\n }\n } else {\n // Calculate all axis\n const {up, east, north} = scratchAxisVectors;\n\n east.set(-origin.y, origin.x, 0.0).normalize();\n ellipsoid.geodeticSurfaceNormal(origin, up);\n north.copy(up).cross(east);\n\n const {down, west, south} = scratchAxisVectors;\n\n down.copy(up).scale(-1);\n west.copy(east).scale(-1);\n south.copy(north).scale(-1);\n\n // Pick three axis based on desired orientation\n firstAxisVector = scratchAxisVectors[firstAxis];\n secondAxisVector = scratchAxisVectors[secondAxis];\n thirdAxisVector = scratchAxisVectors[thirdAxis];\n }\n\n // TODO - assuming the result is column-major\n result[0] = firstAxisVector.x;\n result[1] = firstAxisVector.y;\n result[2] = firstAxisVector.z;\n result[3] = 0.0;\n result[4] = secondAxisVector.x;\n result[5] = secondAxisVector.y;\n result[6] = secondAxisVector.z;\n result[7] = 0.0;\n result[8] = thirdAxisVector.x;\n result[9] = thirdAxisVector.y;\n result[10] = thirdAxisVector.z;\n result[11] = 0.0;\n result[12] = origin.x;\n result[13] = origin.y;\n result[14] = origin.z;\n result[15] = 1.0;\n return result;\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable */\nimport {Vector3, _MathUtils} from '@math.gl/core';\nimport type {Ellipsoid} from '../ellipsoid';\n\nconst scratchVector = new Vector3();\nconst scaleToGeodeticSurfaceIntersection = new Vector3();\nconst scaleToGeodeticSurfaceGradient = new Vector3();\n\n// Scales the provided Cartesian position along the geodetic surface normal\n// so that it is on the surface of this ellipsoid. If the position is\n// at the center of the ellipsoid, this function returns undefined.\nexport function scaleToGeodeticSurface(\n cartesian: number[],\n ellipsoid: Ellipsoid,\n result: number[] = []\n): number[] {\n const {oneOverRadii, oneOverRadiiSquared, centerToleranceSquared} = ellipsoid;\n\n scratchVector.from(cartesian);\n\n const positionX = scratchVector.x;\n const positionY = scratchVector.y;\n const positionZ = scratchVector.z;\n\n const oneOverRadiiX = oneOverRadii.x;\n const oneOverRadiiY = oneOverRadii.y;\n const oneOverRadiiZ = oneOverRadii.z;\n\n const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;\n const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;\n const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;\n\n // Compute the squared ellipsoid norm.\n const squaredNorm = x2 + y2 + z2;\n const ratio = Math.sqrt(1.0 / squaredNorm);\n\n // When very close to center or at center\n if (!Number.isFinite(ratio)) {\n return undefined;\n }\n\n // As an initial approximation, assume that the radial intersection is the projection point.\n const intersection = scaleToGeodeticSurfaceIntersection;\n intersection.copy(cartesian).scale(ratio);\n\n // If the position is near the center, the iteration will not converge.\n if (squaredNorm < centerToleranceSquared) {\n return intersection.to(result);\n }\n\n const oneOverRadiiSquaredX = oneOverRadiiSquared.x;\n const oneOverRadiiSquaredY = oneOverRadiiSquared.y;\n const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;\n\n // Use the gradient at the intersection point in place of the true unit normal.\n // The difference in magnitude will be absorbed in the multiplier.\n const gradient = scaleToGeodeticSurfaceGradient;\n gradient.set(\n intersection.x * oneOverRadiiSquaredX * 2.0,\n intersection.y * oneOverRadiiSquaredY * 2.0,\n intersection.z * oneOverRadiiSquaredZ * 2.0\n );\n\n // Compute the initial guess at the normal vector multiplier, lambda.\n let lambda = ((1.0 - ratio) * scratchVector.len()) / (0.5 * gradient.len());\n let correction = 0.0;\n\n let xMultiplier;\n let yMultiplier;\n let zMultiplier;\n let func;\n\n do {\n lambda -= correction;\n\n xMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX);\n yMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY);\n zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ);\n\n const xMultiplier2 = xMultiplier * xMultiplier;\n const yMultiplier2 = yMultiplier * yMultiplier;\n const zMultiplier2 = zMultiplier * zMultiplier;\n\n const xMultiplier3 = xMultiplier2 * xMultiplier;\n const yMultiplier3 = yMultiplier2 * yMultiplier;\n const zMultiplier3 = zMultiplier2 * zMultiplier;\n\n func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0;\n\n // \"denominator\" here refers to the use of this expression in the velocity and acceleration\n // computations in the sections to follow.\n const denominator =\n x2 * xMultiplier3 * oneOverRadiiSquaredX +\n y2 * yMultiplier3 * oneOverRadiiSquaredY +\n z2 * zMultiplier3 * oneOverRadiiSquaredZ;\n\n const derivative = -2.0 * denominator;\n\n correction = func / derivative;\n } while (Math.abs(func) > _MathUtils.EPSILON12);\n\n return scratchVector.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {Vector2, Vector3, Matrix4} from '@math.gl/core';\nimport {Plane, Ray} from '@math.gl/culling';\nimport {Ellipsoid} from './ellipsoid';\n\nconst scratchOrigin = new Vector3();\nconst scratchCart3 = new Vector3();\nconst scratchEastNorthUp = new Matrix4();\nconst scratchPlane = new Plane();\n\nconst scratchProjectPointOntoPlaneRay = new Ray();\nconst scratchProjectPointOntoPlaneCartesian3 = new Vector3();\nconst scratchDirection = new Vector3();\n\n/** A plane tangent to the WGS84 ellipsoid at the provided origin */\nexport class EllipsoidTangentPlane {\n private _origin: Vector3;\n private _xAxis: Vector3;\n private _yAxis: Vector3;\n private _plane: Plane;\n\n /**\n * Creates a new plane tangent to the WGS84 ellipsoid at the provided origin.\n * If origin is not on the surface of the ellipsoid, it's surface projection will be used.\n *\n * @param {Cartesian3} origin The point on the surface of the ellipsoid where the tangent plane touches.\n */\n constructor(origin: number[]) {\n origin = Ellipsoid.WGS84.scaleToGeodeticSurface(origin, scratchOrigin);\n\n const eastNorthUp = Ellipsoid.WGS84.eastNorthUpToFixedFrame(origin, scratchEastNorthUp);\n\n this._origin = origin as Vector3;\n this._xAxis = new Vector3(scratchCart3.from(eastNorthUp.getColumn(0)));\n this._yAxis = new Vector3(scratchCart3.from(eastNorthUp.getColumn(1)));\n const normal = new Vector3(scratchCart3.from(eastNorthUp.getColumn(2)));\n\n this._plane = scratchPlane.fromPointNormal(origin, normal);\n }\n\n /**\n * Computes the projection of the provided 3D position onto the 2D plane, along the plane normal.\n *\n * @param {Vector3} cartesian The point to project.\n * @param {Vector2} [result] The object onto which to store the result.\n * @returns {Vector2} The modified result parameter or a new Cartesian2 instance if none was provided.\n */\n projectPointToNearestOnPlane(cartesian: Vector3, result?: Vector2): Vector2 {\n if (!result) result = new Vector2();\n\n const plane = this._plane;\n\n const ray = scratchProjectPointOntoPlaneRay;\n scratchProjectPointOntoPlaneRay.origin = cartesian;\n scratchProjectPointOntoPlaneRay.direction = scratchDirection.copy(plane.normal);\n\n let intersectionPoint = plane.intersectWithRay(ray, scratchProjectPointOntoPlaneCartesian3);\n\n if (!intersectionPoint) {\n ray.direction = ray.direction.negate();\n intersectionPoint = plane.intersectWithRay(ray, scratchProjectPointOntoPlaneCartesian3);\n }\n\n const v = intersectionPoint.subtract(this._origin);\n const x = this._xAxis.dot(v);\n const y = this._yAxis.dot(v);\n\n result.x = x;\n result.y = y;\n return result;\n }\n\n get plane() {\n return this._plane;\n }\n\n get origin() {\n return this._origin;\n }\n\n get xAxis() {\n return this._xAxis;\n }\n\n get yAxis() {\n return this._yAxis;\n }\n\n get zAxis() {\n return this._plane.normal;\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {Vector3, normalizeAngle, _MathUtils} from '@math.gl/core';\n\n/** A two dimensional region specified as longitude and latitude coordinates. */\nexport class LngLatRectangle {\n west: number;\n south: number;\n east: number;\n north: number;\n\n /**\n * Creates a new two dimensional region specified as longitude and latitude coordinates.\n *\n * @param west The westernmost longitude, in radians, in the range [-Pi, Pi].\n * @param south The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].\n * @param east The easternmost longitude, in radians, in the range [-Pi, Pi].\n * @param north The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].\n */\n constructor(west: number, south: number, east: number, north: number) {\n this.west = west;\n this.south = south;\n this.east = east;\n this.north = north;\n }\n\n /**\n * Computes the center of a rectangle.\n *\n * @param rectangle The rectangle for which to find the center\n * @param [result] The object onto which to store the result.\n * @returns The modified result parameter or a new Cartographic instance if none was provided.\n */\n static center(rectangle: LngLatRectangle, result?: Vector3): Vector3 {\n if (!result) result = new Vector3();\n\n let east = rectangle.east;\n const west = rectangle.west;\n\n if (east < west) {\n east += _MathUtils.TWO_PI;\n }\n\n const longitude = normalizeAngle((west + east) * 0.5, 'negative-pi-to-pi');\n const latitude = (rectangle.south + rectangle.north) * 0.5;\n\n result.x = longitude;\n result.y = latitude;\n result.z = 0.0;\n return result;\n }\n\n get width() {\n let east = this.east;\n const west = this.west;\n\n if (east < west) {\n east += _MathUtils.TWO_PI;\n }\n return east - west;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACQA,IAAAA,eAA+E;;;ACDxE,IAAM,iBAAiB;AACvB,IAAM,iBAAiB;AACvB,IAAM,iBAAiB;AAIvB,IAAM,kBAAkB;EAC7B,OAAO,CAAC,gBAAgB,gBAAgB,cAAc;EACtD,cAAc;IACZ,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;;EAEnB,cAAc,CAAC,IAAM,gBAAgB,IAAM,gBAAgB,IAAM,cAAc;EAC/E,qBAAqB;IACnB,KAAO,iBAAiB;IACxB,KAAO,iBAAiB;IACxB,KAAO,iBAAiB;;EAE1B,eAAe,KAAK,IAAI,gBAAgB,gBAAgB,cAAc;EACtE,wBAAwB;;;;;ACnB1B,kBAAoD;AAiBpD,SAAS,SAAS,GAAS;AACzB,SAAO;AACT;AAEA,IAAM,gBAAgB,IAAI,oBAAO;AAQ3B,SAAU,iBACd,cACA,SAAS,CAAA,GACT,MAAM,UAAQ;AAEd,MAAI,eAAe,cAAc;AAC/B,WAAO,CAAC,IAAI,IAAI,aAAa,SAAS;AACtC,WAAO,CAAC,IAAI,IAAI,aAAa,QAAQ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B,UAAI,YAAY,IAAI,UAAU,OAAM;AACpC,0BAAoB,MAAM,iBAAiB,KAAK,sCAAsC;IACxF;AAEA,UAAM,IAAI,kBAAkB,SAAS,KAAK,OAAO;AACjD,UAAM,IAAI,KAAK,OAAO,IAAI,CAAC;AAC3B,UAAM,IAAI,KAAK,OAAO,IAAI,CAAC;AAE3B,WAAO,IAAI;AACX,WAAO,IAAI;AACX,WAAO;EACT;EAEA,IAAI,QAAK;AACP,WAAO,KAAK;EACd;EAEA,IAAI,SAAM;AACR,WAAO,KAAK;EACd;EAEA,IAAI,QAAK;AACP,WAAO,KAAK;EACd;EAEA,IAAI,QAAK;AACP,WAAO,KAAK;EACd;EAEA,IAAI,QAAK;AACP,WAAO,KAAK,OAAO;EACrB;;;;ACzFF,IAAAC,eAAkD;AAG5C,IAAO,kBAAP,MAAsB;;;;;;;;;EAc1B,YAAY,MAAc,OAAe,MAAc,OAAa;AAClE,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,QAAQ;EACf;;;;;;;;EASA,OAAO,OAAO,WAA4B,QAAgB;AACxD,QAAI,CAAC;AAAQ,eAAS,IAAI,qBAAO;AAEjC,QAAI,OAAO,UAAU;AACrB,UAAM,OAAO,UAAU;AAEvB,QAAI,OAAO,MAAM;AACf,cAAQ,wBAAW;IACrB;AAEA,UAAM,gBAAY,8BAAgB,OAAO,QAAQ,KAAK,mBAAmB;AACzE,UAAM,YAAY,UAAU,QAAQ,UAAU,SAAS;AAEvD,WAAO,IAAI;AACX,WAAO,IAAI;AACX,WAAO,IAAI;AACX,WAAO;EACT;EAEA,IAAI,QAAK;AACP,QAAI,OAAO,KAAK;AAChB,UAAM,OAAO,KAAK;AAElB,QAAI,OAAO,MAAM;AACf,cAAQ,wBAAW;IACrB;AACA,WAAO,OAAO;EAChB;;",
|
|
6
|
+
"names": ["import_core", "import_core", "equalsEpsilon", "import_core", "scratchVector", "scratchVector", "import_core", "scratchOrigin", "import_core"]
|
|
7
7
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export { Ellipsoid } from "./ellipsoid
|
|
1
|
+
export { Ellipsoid } from "./ellipsoid.js";
|
|
2
|
+
export { EllipsoidTangentPlane } from "./ellipsoid-tangent-plane.js";
|
|
3
|
+
export { LngLatRectangle } from "./lng-lat-rectangle.js";
|
|
2
4
|
export { isWGS84 } from "./type-utils.js";
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|