@math.gl/geospatial 4.1.0 → 4.2.0-alpha.5
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/LICENSE +51 -0
- 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 +32 -0
- package/dist/ellipsoid-tangent-plane.d.ts.map +1 -0
- package/dist/ellipsoid-tangent-plane.js +65 -0
- package/dist/ellipsoid-tangent-plane.js.map +1 -0
- package/dist/{ellipsoid/ellipsoid.d.ts → ellipsoid.d.ts} +13 -6
- 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 +329 -8
- package/dist/index.cjs.map +3 -4
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -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 +28 -0
- package/dist/make-obb-from-region.d.ts.map +1 -0
- package/dist/make-obb-from-region.js +246 -0
- package/dist/make-obb-from-region.js.map +1 -0
- package/package.json +5 -4
- package/src/ellipsoid-tangent-plane.ts +87 -0
- package/src/{ellipsoid/ellipsoid.ts → ellipsoid.ts} +17 -10
- package/src/index.ts +5 -1
- package/src/lng-lat-rectangle.ts +67 -0
- package/src/make-obb-from-region.ts +414 -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
package/dist/index.cjs
CHANGED
|
@@ -17,14 +17,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
19
|
// dist/index.js
|
|
20
|
-
var
|
|
21
|
-
__export(
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
22
|
Ellipsoid: () => Ellipsoid,
|
|
23
|
-
|
|
23
|
+
EllipsoidTangentPlane: () => EllipsoidTangentPlane,
|
|
24
|
+
LngLatRectangle: () => LngLatRectangle,
|
|
25
|
+
isWGS84: () => isWGS84,
|
|
26
|
+
makeOBBFromRegion: () => makeOBBFromRegion
|
|
24
27
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
29
|
|
|
27
|
-
// dist/ellipsoid
|
|
30
|
+
// dist/ellipsoid.js
|
|
28
31
|
var import_core4 = require("@math.gl/core");
|
|
29
32
|
|
|
30
33
|
// dist/constants.js
|
|
@@ -105,7 +108,7 @@ function isWGS84(vector) {
|
|
|
105
108
|
return Math.abs(x2 + y2 + z2 - 1) < centerToleranceSquared;
|
|
106
109
|
}
|
|
107
110
|
|
|
108
|
-
// dist/ellipsoid
|
|
111
|
+
// dist/ellipsoid-helpers/ellipsoid-transform.js
|
|
109
112
|
var import_core2 = require("@math.gl/core");
|
|
110
113
|
var EPSILON14 = 1e-14;
|
|
111
114
|
var scratchOrigin = new import_core2.Vector3();
|
|
@@ -220,7 +223,7 @@ function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, car
|
|
|
220
223
|
return result;
|
|
221
224
|
}
|
|
222
225
|
|
|
223
|
-
// dist/ellipsoid
|
|
226
|
+
// dist/ellipsoid-helpers/scale-to-geodetic-surface.js
|
|
224
227
|
var import_core3 = require("@math.gl/core");
|
|
225
228
|
var scratchVector4 = new import_core3.Vector3();
|
|
226
229
|
var scaleToGeodeticSurfaceIntersection = new import_core3.Vector3();
|
|
@@ -277,7 +280,7 @@ function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
|
|
|
277
280
|
return scratchVector4.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);
|
|
278
281
|
}
|
|
279
282
|
|
|
280
|
-
// dist/ellipsoid
|
|
283
|
+
// dist/ellipsoid.js
|
|
281
284
|
var scratchVector5 = new import_core4.Vector3();
|
|
282
285
|
var scratchNormal = new import_core4.Vector3();
|
|
283
286
|
var scratchK = new import_core4.Vector3();
|
|
@@ -398,4 +401,322 @@ var Ellipsoid = class {
|
|
|
398
401
|
}
|
|
399
402
|
};
|
|
400
403
|
Ellipsoid.WGS84 = new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);
|
|
404
|
+
|
|
405
|
+
// dist/ellipsoid-tangent-plane.js
|
|
406
|
+
var import_core5 = require("@math.gl/core");
|
|
407
|
+
var import_culling = require("@math.gl/culling");
|
|
408
|
+
var scratchOrigin2 = new import_core5.Vector3();
|
|
409
|
+
var scratchCart3 = new import_core5.Vector3();
|
|
410
|
+
var scratchEastNorthUp = new import_core5.Matrix4();
|
|
411
|
+
var scratchProjectPointOntoPlaneCartesian3 = new import_core5.Vector3();
|
|
412
|
+
var EllipsoidTangentPlane = class {
|
|
413
|
+
/**
|
|
414
|
+
* Creates a new plane tangent to the WGS84 ellipsoid at the provided origin.
|
|
415
|
+
* If origin is not on the surface of the ellipsoid, its surface projection will be used.
|
|
416
|
+
*
|
|
417
|
+
* @param origin A nonzero Cartesian point on or near the ellipsoid.
|
|
418
|
+
* @param ellipsoid The ellipsoid to which the origin belongs. Defaults to WGS84.
|
|
419
|
+
*/
|
|
420
|
+
constructor(origin, ellipsoid = Ellipsoid.WGS84) {
|
|
421
|
+
const originOnSurface = ellipsoid.scaleToGeodeticSurface(origin, scratchOrigin2);
|
|
422
|
+
const eastNorthUp = ellipsoid.eastNorthUpToFixedFrame(originOnSurface, scratchEastNorthUp);
|
|
423
|
+
this._origin = new import_core5.Vector3(originOnSurface);
|
|
424
|
+
this._xAxis = new import_core5.Vector3(scratchCart3.from(eastNorthUp.getColumn(0)));
|
|
425
|
+
this._yAxis = new import_core5.Vector3(scratchCart3.from(eastNorthUp.getColumn(1)));
|
|
426
|
+
const normal = new import_core5.Vector3(scratchCart3.from(eastNorthUp.getColumn(2)));
|
|
427
|
+
this._plane = new import_culling.Plane().fromPointNormal(this._origin, normal);
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Computes the projection of the provided 3D position onto the 2D plane, along the plane normal.
|
|
431
|
+
*
|
|
432
|
+
* @param cartesian The WGS84 Cartesian point to project.
|
|
433
|
+
* @param result The optional object in which to store the local east-north coordinates.
|
|
434
|
+
* @returns The supplied result or a new Vector2.
|
|
435
|
+
*/
|
|
436
|
+
projectPointToNearestOnPlane(cartesian, result) {
|
|
437
|
+
if (!result)
|
|
438
|
+
result = new import_core5.Vector2();
|
|
439
|
+
const intersectionPoint = this._plane.projectPointOntoPlane(cartesian, scratchProjectPointOntoPlaneCartesian3);
|
|
440
|
+
const v = intersectionPoint.subtract(this._origin);
|
|
441
|
+
const x = this._xAxis.dot(v);
|
|
442
|
+
const y = this._yAxis.dot(v);
|
|
443
|
+
result.x = x;
|
|
444
|
+
result.y = y;
|
|
445
|
+
return result;
|
|
446
|
+
}
|
|
447
|
+
get plane() {
|
|
448
|
+
return this._plane;
|
|
449
|
+
}
|
|
450
|
+
get origin() {
|
|
451
|
+
return this._origin;
|
|
452
|
+
}
|
|
453
|
+
get xAxis() {
|
|
454
|
+
return this._xAxis;
|
|
455
|
+
}
|
|
456
|
+
get yAxis() {
|
|
457
|
+
return this._yAxis;
|
|
458
|
+
}
|
|
459
|
+
get zAxis() {
|
|
460
|
+
return this._plane.normal;
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
// dist/lng-lat-rectangle.js
|
|
465
|
+
var import_core6 = require("@math.gl/core");
|
|
466
|
+
var LngLatRectangle = class {
|
|
467
|
+
/**
|
|
468
|
+
* Creates a new two dimensional region specified as longitude and latitude coordinates.
|
|
469
|
+
*
|
|
470
|
+
* @param west The westernmost longitude, in radians, in the range [-Pi, Pi].
|
|
471
|
+
* @param south The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].
|
|
472
|
+
* @param east The easternmost longitude, in radians, in the range [-Pi, Pi].
|
|
473
|
+
* @param north The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].
|
|
474
|
+
*/
|
|
475
|
+
constructor(west, south, east, north) {
|
|
476
|
+
this.west = west;
|
|
477
|
+
this.south = south;
|
|
478
|
+
this.east = east;
|
|
479
|
+
this.north = north;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Computes the center of a rectangle.
|
|
483
|
+
*
|
|
484
|
+
* @param rectangle The rectangle for which to find the center
|
|
485
|
+
* @param [result] The object onto which to store the result.
|
|
486
|
+
* @returns The modified result parameter or a new Cartographic instance if none was provided.
|
|
487
|
+
*/
|
|
488
|
+
static center(rectangle, result) {
|
|
489
|
+
if (!result)
|
|
490
|
+
result = new import_core6.Vector3();
|
|
491
|
+
let east = rectangle.east;
|
|
492
|
+
const west = rectangle.west;
|
|
493
|
+
if (east < west) {
|
|
494
|
+
east += import_core6._MathUtils.TWO_PI;
|
|
495
|
+
}
|
|
496
|
+
const longitude = (0, import_core6.normalizeAngle)((west + east) * 0.5, "negative-pi-to-pi");
|
|
497
|
+
const latitude = (rectangle.south + rectangle.north) * 0.5;
|
|
498
|
+
result.x = longitude;
|
|
499
|
+
result.y = latitude;
|
|
500
|
+
result.z = 0;
|
|
501
|
+
return result;
|
|
502
|
+
}
|
|
503
|
+
get width() {
|
|
504
|
+
let east = this.east;
|
|
505
|
+
const west = this.west;
|
|
506
|
+
if (east < west) {
|
|
507
|
+
east += import_core6._MathUtils.TWO_PI;
|
|
508
|
+
}
|
|
509
|
+
return east - west;
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
// dist/make-obb-from-region.js
|
|
514
|
+
var import_core7 = require("@math.gl/core");
|
|
515
|
+
var import_culling2 = require("@math.gl/culling");
|
|
516
|
+
var scratchOffset = new import_core7.Vector3();
|
|
517
|
+
var scratchTangentPoint = new import_core7.Vector3();
|
|
518
|
+
var scratchPerimeterCartographicNC = new import_core7.Vector3();
|
|
519
|
+
var scratchPerimeterCartographicNW = new import_core7.Vector3();
|
|
520
|
+
var scratchPerimeterCartographicCW = new import_core7.Vector3();
|
|
521
|
+
var scratchPerimeterCartographicSW = new import_core7.Vector3();
|
|
522
|
+
var scratchPerimeterCartographicSC = new import_core7.Vector3();
|
|
523
|
+
var scratchPerimeterCartesianNC = new import_core7.Vector3();
|
|
524
|
+
var scratchPerimeterCartesianNW = new import_core7.Vector3();
|
|
525
|
+
var scratchPerimeterCartesianCW = new import_core7.Vector3();
|
|
526
|
+
var scratchPerimeterCartesianSW = new import_core7.Vector3();
|
|
527
|
+
var scratchPerimeterCartesianSC = new import_core7.Vector3();
|
|
528
|
+
var scratchPerimeterProjectedNC = new import_core7.Vector2();
|
|
529
|
+
var scratchPerimeterProjectedNW = new import_core7.Vector2();
|
|
530
|
+
var scratchPerimeterProjectedCW = new import_core7.Vector2();
|
|
531
|
+
var scratchPerimeterProjectedSW = new import_core7.Vector2();
|
|
532
|
+
var scratchPerimeterProjectedSC = new import_core7.Vector2();
|
|
533
|
+
var scratchPlane = new import_culling2.Plane();
|
|
534
|
+
var scratchPlaneOrigin = new import_core7.Vector3();
|
|
535
|
+
var scratchPlaneNormal = new import_core7.Vector3();
|
|
536
|
+
var scratchPlaneXAxis = new import_core7.Vector3();
|
|
537
|
+
var scratchHorizonCartesian = new import_core7.Vector3();
|
|
538
|
+
var scratchHorizonProjected = new import_core7.Vector2();
|
|
539
|
+
var scratchMaxY = new import_core7.Vector3();
|
|
540
|
+
var scratchZ = new import_core7.Vector3();
|
|
541
|
+
var VECTOR3_UNIT_X = new import_core7.Vector3(1, 0, 0);
|
|
542
|
+
var VECTOR3_UNIT_Z = new import_core7.Vector3(0, 0, 1);
|
|
543
|
+
function makeOBBFromRegion(region, ellipsoid = Ellipsoid.WGS84, options = {}) {
|
|
544
|
+
if (!region || region.length !== 6 || region.some((value) => !Number.isFinite(value))) {
|
|
545
|
+
throw new Error("makeOBBFromRegion: region must contain exactly six finite numbers");
|
|
546
|
+
}
|
|
547
|
+
const unitScale = options.units === "degrees" ? (0, import_core7.radians)(1) : 1;
|
|
548
|
+
const [rawWest, rawSouth, rawEast, rawNorth, minimumHeight, maximumHeight] = region;
|
|
549
|
+
if (minimumHeight > maximumHeight) {
|
|
550
|
+
throw new Error("makeOBBFromRegion: minimumHeight must not exceed maximumHeight");
|
|
551
|
+
}
|
|
552
|
+
const south = rawSouth * unitScale;
|
|
553
|
+
const north = rawNorth * unitScale;
|
|
554
|
+
const west = normalizeLongitude(rawWest * unitScale);
|
|
555
|
+
let east = normalizeLongitude(rawEast * unitScale);
|
|
556
|
+
const directedSpan = rawEast * unitScale - rawWest * unitScale;
|
|
557
|
+
if (directedSpan >= import_core7._MathUtils.TWO_PI - 1e-12) {
|
|
558
|
+
east = west + import_core7._MathUtils.TWO_PI;
|
|
559
|
+
}
|
|
560
|
+
const latitudeTolerance = 1e-12;
|
|
561
|
+
if (south > north || south < -import_core7._MathUtils.PI_OVER_TWO - latitudeTolerance || north > import_core7._MathUtils.PI_OVER_TWO + latitudeTolerance) {
|
|
562
|
+
throw new Error("makeOBBFromRegion: latitude must be within [-\u03C0/2, \u03C0/2] and south \u2264 north");
|
|
563
|
+
}
|
|
564
|
+
const clampedSouth = Math.max(-import_core7._MathUtils.PI_OVER_TWO, Math.min(import_core7._MathUtils.PI_OVER_TWO, south));
|
|
565
|
+
const clampedNorth = Math.max(-import_core7._MathUtils.PI_OVER_TWO, Math.min(import_core7._MathUtils.PI_OVER_TWO, north));
|
|
566
|
+
return makeOBBFromNormalizedRegion([west, clampedSouth, east, clampedNorth, minimumHeight, maximumHeight], ellipsoid, options.transform);
|
|
567
|
+
}
|
|
568
|
+
function normalizeLongitude(value) {
|
|
569
|
+
const normalized = ((value + Math.PI) % import_core7._MathUtils.TWO_PI + import_core7._MathUtils.TWO_PI) % import_core7._MathUtils.TWO_PI - Math.PI;
|
|
570
|
+
return normalized === -Math.PI && value > 0 ? Math.PI : normalized;
|
|
571
|
+
}
|
|
572
|
+
function makeOBBFromNormalizedRegion(region, ellipsoid, transform) {
|
|
573
|
+
const obb = new import_culling2.OrientedBoundingBox();
|
|
574
|
+
const [west, south, east, north, minimumHeight, maximumHeight] = region;
|
|
575
|
+
const northDeg = (0, import_core7.degrees)(north);
|
|
576
|
+
const southDeg = (0, import_core7.degrees)(south);
|
|
577
|
+
let maxX;
|
|
578
|
+
let maxY;
|
|
579
|
+
let maxZ;
|
|
580
|
+
let minX;
|
|
581
|
+
let minY;
|
|
582
|
+
let minZ;
|
|
583
|
+
let plane;
|
|
584
|
+
const rectangle = new LngLatRectangle(west, south, east, north);
|
|
585
|
+
const tangentPoint = LngLatRectangle.center(rectangle, scratchTangentPoint);
|
|
586
|
+
const tangentPointCartographic = new import_core7.Vector3([
|
|
587
|
+
(0, import_core7.degrees)(tangentPoint.x),
|
|
588
|
+
(0, import_core7.degrees)(tangentPoint.y),
|
|
589
|
+
0
|
|
590
|
+
]);
|
|
591
|
+
const lonCenter = tangentPoint.x;
|
|
592
|
+
const lonCenterDeg = tangentPointCartographic.x;
|
|
593
|
+
if (rectangle.width <= import_core7._MathUtils.PI) {
|
|
594
|
+
const westDeg = (0, import_core7.degrees)(west);
|
|
595
|
+
const tangentPoint2 = ellipsoid.cartographicToCartesian(tangentPointCartographic);
|
|
596
|
+
const ellipsoidTangentPlane = new EllipsoidTangentPlane(tangentPoint2, ellipsoid);
|
|
597
|
+
const latCenter = southDeg < 0 && northDeg > 0 ? 0 : tangentPointCartographic.y;
|
|
598
|
+
const perimeterCartographicNC = scratchPerimeterCartographicNC.copy([
|
|
599
|
+
lonCenterDeg,
|
|
600
|
+
northDeg,
|
|
601
|
+
maximumHeight
|
|
602
|
+
]);
|
|
603
|
+
const perimeterCartographicNW = scratchPerimeterCartographicNW.copy([
|
|
604
|
+
westDeg,
|
|
605
|
+
northDeg,
|
|
606
|
+
maximumHeight
|
|
607
|
+
]);
|
|
608
|
+
const perimeterCartographicCW = scratchPerimeterCartographicCW.copy([
|
|
609
|
+
westDeg,
|
|
610
|
+
latCenter,
|
|
611
|
+
maximumHeight
|
|
612
|
+
]);
|
|
613
|
+
const perimeterCartographicSW = scratchPerimeterCartographicSW.copy([
|
|
614
|
+
westDeg,
|
|
615
|
+
southDeg,
|
|
616
|
+
maximumHeight
|
|
617
|
+
]);
|
|
618
|
+
const perimeterCartographicSC = scratchPerimeterCartographicSC.copy([
|
|
619
|
+
lonCenterDeg,
|
|
620
|
+
southDeg,
|
|
621
|
+
maximumHeight
|
|
622
|
+
]);
|
|
623
|
+
const perimeterCartesianNC = ellipsoid.cartographicToCartesian(perimeterCartographicNC, scratchPerimeterCartesianNC);
|
|
624
|
+
let perimeterCartesianNW = ellipsoid.cartographicToCartesian(perimeterCartographicNW, scratchPerimeterCartesianNW);
|
|
625
|
+
const perimeterCartesianCW = ellipsoid.cartographicToCartesian(perimeterCartographicCW, scratchPerimeterCartesianCW);
|
|
626
|
+
let perimeterCartesianSW = ellipsoid.cartographicToCartesian(perimeterCartographicSW, scratchPerimeterCartesianSW);
|
|
627
|
+
const perimeterCartesianSC = ellipsoid.cartographicToCartesian(perimeterCartographicSC, scratchPerimeterCartesianSC);
|
|
628
|
+
const perimeterProjectedNC = ellipsoidTangentPlane.projectPointToNearestOnPlane(perimeterCartesianNC, scratchPerimeterProjectedNC);
|
|
629
|
+
const perimeterProjectedNW = ellipsoidTangentPlane.projectPointToNearestOnPlane(perimeterCartesianNW, scratchPerimeterProjectedNW);
|
|
630
|
+
const perimeterProjectedCW = ellipsoidTangentPlane.projectPointToNearestOnPlane(perimeterCartesianCW, scratchPerimeterProjectedCW);
|
|
631
|
+
const perimeterProjectedSW = ellipsoidTangentPlane.projectPointToNearestOnPlane(perimeterCartesianSW, scratchPerimeterProjectedSW);
|
|
632
|
+
const perimeterProjectedSC = ellipsoidTangentPlane.projectPointToNearestOnPlane(perimeterCartesianSC, scratchPerimeterProjectedSC);
|
|
633
|
+
minX = Math.min(perimeterProjectedNW.x, perimeterProjectedCW.x, perimeterProjectedSW.x);
|
|
634
|
+
maxX = -minX;
|
|
635
|
+
maxY = Math.max(perimeterProjectedNW.y, perimeterProjectedNC.y);
|
|
636
|
+
minY = Math.min(perimeterProjectedSW.y, perimeterProjectedSC.y);
|
|
637
|
+
perimeterCartographicNW.z = perimeterCartographicSW.z = minimumHeight;
|
|
638
|
+
perimeterCartesianNW = ellipsoid.cartographicToCartesian(perimeterCartographicNW, scratchPerimeterCartesianNW);
|
|
639
|
+
perimeterCartesianSW = ellipsoid.cartographicToCartesian(perimeterCartographicSW, scratchPerimeterCartesianSW);
|
|
640
|
+
plane = ellipsoidTangentPlane.plane;
|
|
641
|
+
minZ = Math.min(plane.getPointDistance(perimeterCartesianNW), plane.getPointDistance(perimeterCartesianSW));
|
|
642
|
+
maxZ = maximumHeight;
|
|
643
|
+
return applyTransform(fromPlaneExtents(ellipsoidTangentPlane.origin, ellipsoidTangentPlane.xAxis, ellipsoidTangentPlane.yAxis, ellipsoidTangentPlane.zAxis, minX, maxX, minY, maxY, minZ, maxZ, obb), transform);
|
|
644
|
+
}
|
|
645
|
+
const eastDeg = (0, import_core7.degrees)(east);
|
|
646
|
+
const fullyAboveEquator = south > 0;
|
|
647
|
+
const fullyBelowEquator = north < 0;
|
|
648
|
+
const latitudeNearestToEquator = fullyAboveEquator ? southDeg : fullyBelowEquator ? northDeg : 0;
|
|
649
|
+
const planeOrigin = ellipsoid.cartographicToCartesian([lonCenterDeg, latitudeNearestToEquator, maximumHeight], scratchPlaneOrigin);
|
|
650
|
+
planeOrigin.z = 0;
|
|
651
|
+
const isPole = Math.abs(planeOrigin.x) < import_core7._MathUtils.EPSILON10 && Math.abs(planeOrigin.y) < import_core7._MathUtils.EPSILON10;
|
|
652
|
+
const planeNormal = !isPole ? scratchPlaneNormal.copy(planeOrigin).normalize() : VECTOR3_UNIT_X;
|
|
653
|
+
const planeYAxis = VECTOR3_UNIT_Z;
|
|
654
|
+
const planeXAxis = scratchPlaneXAxis.copy(planeNormal).cross(planeYAxis);
|
|
655
|
+
plane = scratchPlane.fromPointNormal(planeOrigin, planeNormal);
|
|
656
|
+
const horizonCartesian = ellipsoid.cartographicToCartesian([(0, import_core7.degrees)(lonCenter + import_core7._MathUtils.PI_OVER_TWO), latitudeNearestToEquator, maximumHeight], scratchHorizonCartesian);
|
|
657
|
+
const projectedPoint = plane.projectPointOntoPlane(horizonCartesian, scratchHorizonProjected);
|
|
658
|
+
maxX = projectedPoint.dot(planeXAxis);
|
|
659
|
+
minX = -maxX;
|
|
660
|
+
const northHeight = fullyBelowEquator ? minimumHeight : maximumHeight;
|
|
661
|
+
const southHeight = fullyAboveEquator ? minimumHeight : maximumHeight;
|
|
662
|
+
maxY = latitudeZExtent(ellipsoid, northDeg, northHeight, true);
|
|
663
|
+
minY = latitudeZExtent(ellipsoid, southDeg, southHeight, false);
|
|
664
|
+
const farZ = ellipsoid.cartographicToCartesian([eastDeg, latitudeNearestToEquator, maximumHeight], scratchZ);
|
|
665
|
+
minZ = plane.getPointDistance(farZ);
|
|
666
|
+
maxZ = 0;
|
|
667
|
+
return applyTransform(fromPlaneExtents(planeOrigin, planeXAxis, planeYAxis, planeNormal, minX, maxX, minY, maxY, minZ, maxZ, obb), transform);
|
|
668
|
+
}
|
|
669
|
+
function applyTransform(obb, transform) {
|
|
670
|
+
if (!transform)
|
|
671
|
+
return obb;
|
|
672
|
+
const axes = [0, 1, 2].map((column) => obb.halfAxes.getColumn(column, new import_core7.Vector3()));
|
|
673
|
+
const center = transform.transformAsPoint(obb.center);
|
|
674
|
+
const minimum = [Infinity, Infinity, Infinity];
|
|
675
|
+
const maximum = [-Infinity, -Infinity, -Infinity];
|
|
676
|
+
for (let mask = 0; mask < 8; mask++) {
|
|
677
|
+
const corner = new import_core7.Vector3(center);
|
|
678
|
+
for (let axis = 0; axis < 3; axis++) {
|
|
679
|
+
const transformedAxis = transform.transformAsVector(axes[axis]);
|
|
680
|
+
corner.add(new import_core7.Vector3(transformedAxis).scale((mask & 1 << axis) === 0 ? -1 : 1));
|
|
681
|
+
}
|
|
682
|
+
for (let component = 0; component < 3; component++) {
|
|
683
|
+
minimum[component] = Math.min(minimum[component], corner[component]);
|
|
684
|
+
maximum[component] = Math.max(maximum[component], corner[component]);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
obb.center.copy(minimum).add(maximum).scale(0.5);
|
|
688
|
+
const halfSize = new import_core7.Vector3(maximum).subtract(minimum).scale(0.5);
|
|
689
|
+
obb.halfAxes = new import_core7.Matrix3().set(halfSize.x, 0, 0, 0, halfSize.y, 0, 0, 0, halfSize.z);
|
|
690
|
+
return obb;
|
|
691
|
+
}
|
|
692
|
+
function latitudeZExtent(ellipsoid, latitude, height, maximum) {
|
|
693
|
+
let extent = maximum ? -Infinity : Infinity;
|
|
694
|
+
for (const longitude of [0, 90, 180, 270]) {
|
|
695
|
+
const z = ellipsoid.cartographicToCartesian([longitude, latitude, height], scratchMaxY).z;
|
|
696
|
+
extent = maximum ? Math.max(extent, z) : Math.min(extent, z);
|
|
697
|
+
}
|
|
698
|
+
return extent;
|
|
699
|
+
}
|
|
700
|
+
function fromPlaneExtents(planeOrigin, planeXAxis, planeYAxis, planeZAxis, minimumX, maximumX, minimumY, maximumY, minimumZ, maximumZ, result) {
|
|
701
|
+
const center = result.center;
|
|
702
|
+
const halfAxes = result.halfAxes;
|
|
703
|
+
halfAxes.setColumn(0, planeXAxis);
|
|
704
|
+
halfAxes.setColumn(1, planeYAxis);
|
|
705
|
+
halfAxes.setColumn(2, planeZAxis);
|
|
706
|
+
const centerOffset = scratchOffset.set((minimumX + maximumX) / 2, (minimumY + maximumY) / 2, (minimumZ + maximumZ) / 2).transformByMatrix3(halfAxes);
|
|
707
|
+
const scaleX = (maximumX - minimumX) / 2;
|
|
708
|
+
const scaleY = (maximumY - minimumY) / 2;
|
|
709
|
+
const scaleZ = (maximumZ - minimumZ) / 2;
|
|
710
|
+
halfAxes[0] *= scaleX;
|
|
711
|
+
halfAxes[1] *= scaleX;
|
|
712
|
+
halfAxes[2] *= scaleX;
|
|
713
|
+
halfAxes[3] *= scaleY;
|
|
714
|
+
halfAxes[4] *= scaleY;
|
|
715
|
+
halfAxes[5] *= scaleY;
|
|
716
|
+
halfAxes[6] *= scaleZ;
|
|
717
|
+
halfAxes[7] *= scaleZ;
|
|
718
|
+
halfAxes[8] *= scaleZ;
|
|
719
|
+
center.copy(planeOrigin).add(centerOffset);
|
|
720
|
+
return result;
|
|
721
|
+
}
|
|
401
722
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
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
|
-
"
|
|
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", "../src/make-obb-from-region.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;ACQA,IAAAA,eAA+E;;;ACDxE,IAAM,iBAAiB;AACvB,IAAM,iBAAiB;AACvB,IAAM,iBAAiB;AAIvB,IAAM,kBAAkB;EAC7B,OAA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WAAS,CAAC,KAAK;AACf,WAAS,CAAC,KAAK;AACf,WAAS,CAAC,KAAK;AACf,WAAS,CAAC,KAAK;AACf,WAAS,CAAC,KAAK;AACf,WAAS,CAAC,KAAK;AACf,WAAS,CAAC,KAAK;AACf,WAAS,CAAC,KAAK;AAEf,SAAO,KAAK,WAAW,EAAE,IAAI,YAAY;AAEzC,SAAO;AACT;",
|
|
5
|
+
"names": ["import_core", "import_core", "equalsEpsilon", "import_core", "scratchVector", "scratchVector", "import_core", "scratchOrigin", "import_core", "import_core", "import_culling", "tangentPoint"]
|
|
7
6
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
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";
|
|
4
|
+
export { makeOBBFromRegion } from "./make-obb-from-region.js";
|
|
5
|
+
export type { GeodeticRegion, MakeOBBFromRegionOptions } from "./make-obb-from-region.js";
|
|
2
6
|
export { isWGS84 } from "./type-utils.js";
|
|
3
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,SAAS,EAAC,uBAAoB;AACtC,OAAO,EAAC,qBAAqB,EAAC,qCAAkC;AAChE,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,EAAC,iBAAiB,EAAC,kCAA+B;AACzD,YAAY,EAAC,cAAc,EAAE,wBAAwB,EAAC,kCAA+B;AACrF,OAAO,EAAC,OAAO,EAAC,wBAAqB"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// math.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
export { Ellipsoid } from "./ellipsoid
|
|
4
|
+
export { Ellipsoid } from "./ellipsoid.js";
|
|
5
|
+
export { EllipsoidTangentPlane } from "./ellipsoid-tangent-plane.js";
|
|
6
|
+
export { LngLatRectangle } from "./lng-lat-rectangle.js";
|
|
7
|
+
export { makeOBBFromRegion } from "./make-obb-from-region.js";
|
|
5
8
|
export { isWGS84 } from "./type-utils.js";
|
|
6
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,SAAS,EAAC,uBAAoB;AACtC,OAAO,EAAC,qBAAqB,EAAC,qCAAkC;AAChE,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,EAAC,iBAAiB,EAAC,kCAA+B;AAEzD,OAAO,EAAC,OAAO,EAAC,wBAAqB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Vector3 } from '@math.gl/core';
|
|
2
|
+
/** A two dimensional region specified as longitude and latitude coordinates. */
|
|
3
|
+
export declare class LngLatRectangle {
|
|
4
|
+
west: number;
|
|
5
|
+
south: number;
|
|
6
|
+
east: number;
|
|
7
|
+
north: number;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new two dimensional region specified as longitude and latitude coordinates.
|
|
10
|
+
*
|
|
11
|
+
* @param west The westernmost longitude, in radians, in the range [-Pi, Pi].
|
|
12
|
+
* @param south The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].
|
|
13
|
+
* @param east The easternmost longitude, in radians, in the range [-Pi, Pi].
|
|
14
|
+
* @param north The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].
|
|
15
|
+
*/
|
|
16
|
+
constructor(west: number, south: number, east: number, north: number);
|
|
17
|
+
/**
|
|
18
|
+
* Computes the center of a rectangle.
|
|
19
|
+
*
|
|
20
|
+
* @param rectangle The rectangle for which to find the center
|
|
21
|
+
* @param [result] The object onto which to store the result.
|
|
22
|
+
* @returns The modified result parameter or a new Cartographic instance if none was provided.
|
|
23
|
+
*/
|
|
24
|
+
static center(rectangle: LngLatRectangle, result?: Vector3): Vector3;
|
|
25
|
+
get width(): number;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=lng-lat-rectangle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lng-lat-rectangle.d.ts","sourceRoot":"","sources":["../src/lng-lat-rectangle.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,OAAO,EAA6B,MAAM,eAAe,CAAC;AAElE,gFAAgF;AAChF,qBAAa,eAAe;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;OAOG;gBACS,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAOpE;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAmBpE,IAAI,KAAK,IAAI,MAAM,CAQlB;CACF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 { Vector3, normalizeAngle, _MathUtils } from '@math.gl/core';
|
|
7
|
+
/** A two dimensional region specified as longitude and latitude coordinates. */
|
|
8
|
+
export class LngLatRectangle {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new two dimensional region specified as longitude and latitude coordinates.
|
|
11
|
+
*
|
|
12
|
+
* @param west The westernmost longitude, in radians, in the range [-Pi, Pi].
|
|
13
|
+
* @param south The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].
|
|
14
|
+
* @param east The easternmost longitude, in radians, in the range [-Pi, Pi].
|
|
15
|
+
* @param north The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].
|
|
16
|
+
*/
|
|
17
|
+
constructor(west, south, east, north) {
|
|
18
|
+
this.west = west;
|
|
19
|
+
this.south = south;
|
|
20
|
+
this.east = east;
|
|
21
|
+
this.north = north;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Computes the center of a rectangle.
|
|
25
|
+
*
|
|
26
|
+
* @param rectangle The rectangle for which to find the center
|
|
27
|
+
* @param [result] The object onto which to store the result.
|
|
28
|
+
* @returns The modified result parameter or a new Cartographic instance if none was provided.
|
|
29
|
+
*/
|
|
30
|
+
static center(rectangle, result) {
|
|
31
|
+
if (!result)
|
|
32
|
+
result = new Vector3();
|
|
33
|
+
let east = rectangle.east;
|
|
34
|
+
const west = rectangle.west;
|
|
35
|
+
if (east < west) {
|
|
36
|
+
east += _MathUtils.TWO_PI;
|
|
37
|
+
}
|
|
38
|
+
const longitude = normalizeAngle((west + east) * 0.5, 'negative-pi-to-pi');
|
|
39
|
+
const latitude = (rectangle.south + rectangle.north) * 0.5;
|
|
40
|
+
result.x = longitude;
|
|
41
|
+
result.y = latitude;
|
|
42
|
+
result.z = 0.0;
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
get width() {
|
|
46
|
+
let east = this.east;
|
|
47
|
+
const west = this.west;
|
|
48
|
+
if (east < west) {
|
|
49
|
+
east += _MathUtils.TWO_PI;
|
|
50
|
+
}
|
|
51
|
+
return east - west;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=lng-lat-rectangle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lng-lat-rectangle.js","sourceRoot":"","sources":["../src/lng-lat-rectangle.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,8CAA8C;AAC9C,oCAAoC;AAEpC,sEAAsE;AACtE,4FAA4F;AAE5F,OAAO,EAAC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAElE,gFAAgF;AAChF,MAAM,OAAO,eAAe;IAM1B;;;;;;;OAOG;IACH,YAAY,IAAY,EAAE,KAAa,EAAE,IAAY,EAAE,KAAa;QAClE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,SAA0B,EAAE,MAAgB;QACxD,IAAI,CAAC,MAAM;YAAE,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAEpC,IAAI,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;QAC1B,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;QAE5B,IAAI,IAAI,GAAG,IAAI,EAAE,CAAC;YAChB,IAAI,IAAI,UAAU,CAAC,MAAM,CAAC;QAC5B,CAAC;QAED,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,GAAG,EAAE,mBAAmB,CAAC,C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