@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.
Files changed (45) hide show
  1. package/LICENSE +51 -0
  2. package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts.map +1 -0
  3. package/dist/ellipsoid-helpers/ellipsoid-transform.js.map +1 -0
  4. package/dist/ellipsoid-helpers/scale-to-geodetic-surface.d.ts.map +1 -0
  5. package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js.map +1 -0
  6. package/dist/ellipsoid-tangent-plane.d.ts +32 -0
  7. package/dist/ellipsoid-tangent-plane.d.ts.map +1 -0
  8. package/dist/ellipsoid-tangent-plane.js +65 -0
  9. package/dist/ellipsoid-tangent-plane.js.map +1 -0
  10. package/dist/{ellipsoid/ellipsoid.d.ts → ellipsoid.d.ts} +13 -6
  11. package/dist/ellipsoid.d.ts.map +1 -0
  12. package/dist/{ellipsoid/ellipsoid.js → ellipsoid.js} +4 -4
  13. package/dist/ellipsoid.js.map +1 -0
  14. package/dist/index.cjs +329 -8
  15. package/dist/index.cjs.map +3 -4
  16. package/dist/index.d.ts +5 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +4 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/lng-lat-rectangle.d.ts +27 -0
  21. package/dist/lng-lat-rectangle.d.ts.map +1 -0
  22. package/dist/lng-lat-rectangle.js +54 -0
  23. package/dist/lng-lat-rectangle.js.map +1 -0
  24. package/dist/make-obb-from-region.d.ts +28 -0
  25. package/dist/make-obb-from-region.d.ts.map +1 -0
  26. package/dist/make-obb-from-region.js +246 -0
  27. package/dist/make-obb-from-region.js.map +1 -0
  28. package/package.json +5 -4
  29. package/src/ellipsoid-tangent-plane.ts +87 -0
  30. package/src/{ellipsoid/ellipsoid.ts → ellipsoid.ts} +17 -10
  31. package/src/index.ts +5 -1
  32. package/src/lng-lat-rectangle.ts +67 -0
  33. package/src/make-obb-from-region.ts +414 -0
  34. package/dist/ellipsoid/ellipsoid.d.ts.map +0 -1
  35. package/dist/ellipsoid/ellipsoid.js.map +0 -1
  36. package/dist/ellipsoid/helpers/ellipsoid-transform.d.ts.map +0 -1
  37. package/dist/ellipsoid/helpers/ellipsoid-transform.js.map +0 -1
  38. package/dist/ellipsoid/helpers/scale-to-geodetic-surface.d.ts.map +0 -1
  39. package/dist/ellipsoid/helpers/scale-to-geodetic-surface.js.map +0 -1
  40. /package/dist/{ellipsoid/helpers → ellipsoid-helpers}/ellipsoid-transform.d.ts +0 -0
  41. /package/dist/{ellipsoid/helpers → ellipsoid-helpers}/ellipsoid-transform.js +0 -0
  42. /package/dist/{ellipsoid/helpers → ellipsoid-helpers}/scale-to-geodetic-surface.d.ts +0 -0
  43. /package/dist/{ellipsoid/helpers → ellipsoid-helpers}/scale-to-geodetic-surface.js +0 -0
  44. /package/src/{ellipsoid/helpers → ellipsoid-helpers}/ellipsoid-transform.ts +0 -0
  45. /package/src/{ellipsoid/helpers → ellipsoid-helpers}/scale-to-geodetic-surface.ts +0 -0
@@ -0,0 +1,28 @@
1
+ import { Matrix4 } from '@math.gl/core';
2
+ import { OrientedBoundingBox } from '@math.gl/culling';
3
+ import { Ellipsoid } from "./ellipsoid.js";
4
+ export type GeodeticRegion = readonly [
5
+ west: number,
6
+ south: number,
7
+ east: number,
8
+ north: number,
9
+ minimumHeight: number,
10
+ maximumHeight: number
11
+ ];
12
+ export type MakeOBBFromRegionOptions = {
13
+ /** Longitude and latitude units. Defaults to radians, as in 3D Tiles regions. */
14
+ units?: 'radians' | 'degrees';
15
+ /** Affine transform from ellipsoid-fixed coordinates into the caller's world space. */
16
+ transform?: Matrix4;
17
+ };
18
+ /**
19
+ * Creates a conservative oriented bounding box for a geodetic region.
20
+ *
21
+ * Longitudes and latitudes are radians by default. An east longitude smaller than west
22
+ * denotes the directed eastward interval crossing the antimeridian; equal longitudes denote
23
+ * zero width unless the original endpoints differ by a full turn.
24
+ * Heights use the ellipsoid's linear unit. Inputs and the supplied ellipsoid and transform are
25
+ * never mutated.
26
+ */
27
+ export declare function makeOBBFromRegion(region: readonly number[], ellipsoid?: Ellipsoid, options?: MakeOBBFromRegionOptions): OrientedBoundingBox;
28
+ //# sourceMappingURL=make-obb-from-region.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-obb-from-region.d.ts","sourceRoot":"","sources":["../src/make-obb-from-region.ts"],"names":[],"mappings":"AAOA,OAAO,EAAU,OAAO,EAAiD,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAC,mBAAmB,EAAQ,MAAM,kBAAkB,CAAC;AAI5D,OAAO,EAAC,SAAS,EAAC,uBAAoB;AAkCtC,MAAM,MAAM,cAAc,GAAG,SAAS;IACpC,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,MAAM;IACrB,aAAa,EAAE,MAAM;CACtB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,iFAAiF;IACjF,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,uFAAuF;IACvF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;;;;;;;GAQG;AAEH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,SAAS,GAAE,SAA2B,EACtC,OAAO,GAAE,wBAA6B,GACrC,mBAAmB,CAmCrB"}
@@ -0,0 +1,246 @@
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 math library under Apache 2 license
5
+ // See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
6
+ import { Matrix3, Vector2, Vector3, degrees, radians, _MathUtils } from '@math.gl/core';
7
+ import { OrientedBoundingBox, Plane } from '@math.gl/culling';
8
+ // @ts-ignore
9
+ // eslint-disable-next-line import/no-unresolved
10
+ import { LngLatRectangle } from "./lng-lat-rectangle.js";
11
+ import { Ellipsoid } from "./ellipsoid.js";
12
+ import { EllipsoidTangentPlane } from "./ellipsoid-tangent-plane.js";
13
+ const scratchOffset = new Vector3();
14
+ const scratchTangentPoint = new Vector3();
15
+ const scratchPerimeterCartographicNC = new Vector3();
16
+ const scratchPerimeterCartographicNW = new Vector3();
17
+ const scratchPerimeterCartographicCW = new Vector3();
18
+ const scratchPerimeterCartographicSW = new Vector3();
19
+ const scratchPerimeterCartographicSC = new Vector3();
20
+ const scratchPerimeterCartesianNC = new Vector3();
21
+ const scratchPerimeterCartesianNW = new Vector3();
22
+ const scratchPerimeterCartesianCW = new Vector3();
23
+ const scratchPerimeterCartesianSW = new Vector3();
24
+ const scratchPerimeterCartesianSC = new Vector3();
25
+ const scratchPerimeterProjectedNC = new Vector2();
26
+ const scratchPerimeterProjectedNW = new Vector2();
27
+ const scratchPerimeterProjectedCW = new Vector2();
28
+ const scratchPerimeterProjectedSW = new Vector2();
29
+ const scratchPerimeterProjectedSC = new Vector2();
30
+ const scratchPlane = new Plane();
31
+ const scratchPlaneOrigin = new Vector3();
32
+ const scratchPlaneNormal = new Vector3();
33
+ const scratchPlaneXAxis = new Vector3();
34
+ const scratchHorizonCartesian = new Vector3();
35
+ const scratchHorizonProjected = new Vector2();
36
+ const scratchMaxY = new Vector3();
37
+ const scratchZ = new Vector3();
38
+ const VECTOR3_UNIT_X = new Vector3(1, 0, 0);
39
+ const VECTOR3_UNIT_Z = new Vector3(0, 0, 1);
40
+ /**
41
+ * Creates a conservative oriented bounding box for a geodetic region.
42
+ *
43
+ * Longitudes and latitudes are radians by default. An east longitude smaller than west
44
+ * denotes the directed eastward interval crossing the antimeridian; equal longitudes denote
45
+ * zero width unless the original endpoints differ by a full turn.
46
+ * Heights use the ellipsoid's linear unit. Inputs and the supplied ellipsoid and transform are
47
+ * never mutated.
48
+ */
49
+ // eslint-disable-next-line max-statements
50
+ export function makeOBBFromRegion(region, ellipsoid = Ellipsoid.WGS84, options = {}) {
51
+ if (!region || region.length !== 6 || region.some(value => !Number.isFinite(value))) {
52
+ throw new Error('makeOBBFromRegion: region must contain exactly six finite numbers');
53
+ }
54
+ const unitScale = options.units === 'degrees' ? radians(1) : 1;
55
+ const [rawWest, rawSouth, rawEast, rawNorth, minimumHeight, maximumHeight] = region;
56
+ if (minimumHeight > maximumHeight) {
57
+ throw new Error('makeOBBFromRegion: minimumHeight must not exceed maximumHeight');
58
+ }
59
+ const south = rawSouth * unitScale;
60
+ const north = rawNorth * unitScale;
61
+ const west = normalizeLongitude(rawWest * unitScale);
62
+ let east = normalizeLongitude(rawEast * unitScale);
63
+ // Preserve a complete directed turn, which would otherwise collapse when both endpoints
64
+ // are normalized to the same longitude. Reversed boundaries retain Cesium/3D Tiles semantics.
65
+ const directedSpan = rawEast * unitScale - rawWest * unitScale;
66
+ if (directedSpan >= _MathUtils.TWO_PI - 1e-12) {
67
+ east = west + _MathUtils.TWO_PI;
68
+ }
69
+ const latitudeTolerance = 1e-12;
70
+ if (south > north ||
71
+ south < -_MathUtils.PI_OVER_TWO - latitudeTolerance ||
72
+ north > _MathUtils.PI_OVER_TWO + latitudeTolerance) {
73
+ throw new Error('makeOBBFromRegion: latitude must be within [-π/2, π/2] and south ≤ north');
74
+ }
75
+ // Avoid passing a tiny out-of-range value to the ellipsoid conversion at a boundary.
76
+ const clampedSouth = Math.max(-_MathUtils.PI_OVER_TWO, Math.min(_MathUtils.PI_OVER_TWO, south));
77
+ const clampedNorth = Math.max(-_MathUtils.PI_OVER_TWO, Math.min(_MathUtils.PI_OVER_TWO, north));
78
+ return makeOBBFromNormalizedRegion([west, clampedSouth, east, clampedNorth, minimumHeight, maximumHeight], ellipsoid, options.transform);
79
+ }
80
+ function normalizeLongitude(value) {
81
+ const normalized = ((((value + Math.PI) % _MathUtils.TWO_PI) + _MathUtils.TWO_PI) % _MathUtils.TWO_PI) - Math.PI;
82
+ return normalized === -Math.PI && value > 0 ? Math.PI : normalized;
83
+ }
84
+ function makeOBBFromNormalizedRegion(region, ellipsoid, transform) {
85
+ const obb = new OrientedBoundingBox();
86
+ const [west, south, east, north, minimumHeight, maximumHeight] = region;
87
+ const northDeg = degrees(north);
88
+ const southDeg = degrees(south);
89
+ let maxX;
90
+ let maxY;
91
+ let maxZ;
92
+ let minX;
93
+ let minY;
94
+ let minZ;
95
+ let plane;
96
+ const rectangle = new LngLatRectangle(west, south, east, north);
97
+ const tangentPoint = LngLatRectangle.center(rectangle, scratchTangentPoint);
98
+ const tangentPointCartographic = new Vector3([
99
+ degrees(tangentPoint.x),
100
+ degrees(tangentPoint.y),
101
+ 0.0
102
+ ]);
103
+ const lonCenter = tangentPoint.x;
104
+ const lonCenterDeg = tangentPointCartographic.x;
105
+ if (rectangle.width <= _MathUtils.PI) {
106
+ const westDeg = degrees(west);
107
+ const tangentPoint = ellipsoid.cartographicToCartesian(tangentPointCartographic);
108
+ const ellipsoidTangentPlane = new EllipsoidTangentPlane(tangentPoint, ellipsoid);
109
+ const latCenter = southDeg < 0.0 && northDeg > 0.0 ? 0.0 : tangentPointCartographic.y;
110
+ const perimeterCartographicNC = scratchPerimeterCartographicNC.copy([
111
+ lonCenterDeg,
112
+ northDeg,
113
+ maximumHeight
114
+ ]);
115
+ const perimeterCartographicNW = scratchPerimeterCartographicNW.copy([
116
+ westDeg,
117
+ northDeg,
118
+ maximumHeight
119
+ ]);
120
+ const perimeterCartographicCW = scratchPerimeterCartographicCW.copy([
121
+ westDeg,
122
+ latCenter,
123
+ maximumHeight
124
+ ]);
125
+ const perimeterCartographicSW = scratchPerimeterCartographicSW.copy([
126
+ westDeg,
127
+ southDeg,
128
+ maximumHeight
129
+ ]);
130
+ const perimeterCartographicSC = scratchPerimeterCartographicSC.copy([
131
+ lonCenterDeg,
132
+ southDeg,
133
+ maximumHeight
134
+ ]);
135
+ const perimeterCartesianNC = ellipsoid.cartographicToCartesian(perimeterCartographicNC, scratchPerimeterCartesianNC);
136
+ let perimeterCartesianNW = ellipsoid.cartographicToCartesian(perimeterCartographicNW, scratchPerimeterCartesianNW);
137
+ const perimeterCartesianCW = ellipsoid.cartographicToCartesian(perimeterCartographicCW, scratchPerimeterCartesianCW);
138
+ let perimeterCartesianSW = ellipsoid.cartographicToCartesian(perimeterCartographicSW, scratchPerimeterCartesianSW);
139
+ const perimeterCartesianSC = ellipsoid.cartographicToCartesian(perimeterCartographicSC, scratchPerimeterCartesianSC);
140
+ const perimeterProjectedNC = ellipsoidTangentPlane.projectPointToNearestOnPlane(perimeterCartesianNC, scratchPerimeterProjectedNC);
141
+ const perimeterProjectedNW = ellipsoidTangentPlane.projectPointToNearestOnPlane(perimeterCartesianNW, scratchPerimeterProjectedNW);
142
+ const perimeterProjectedCW = ellipsoidTangentPlane.projectPointToNearestOnPlane(perimeterCartesianCW, scratchPerimeterProjectedCW);
143
+ const perimeterProjectedSW = ellipsoidTangentPlane.projectPointToNearestOnPlane(perimeterCartesianSW, scratchPerimeterProjectedSW);
144
+ const perimeterProjectedSC = ellipsoidTangentPlane.projectPointToNearestOnPlane(perimeterCartesianSC, scratchPerimeterProjectedSC);
145
+ minX = Math.min(perimeterProjectedNW.x, perimeterProjectedCW.x, perimeterProjectedSW.x);
146
+ maxX = -minX;
147
+ maxY = Math.max(perimeterProjectedNW.y, perimeterProjectedNC.y);
148
+ minY = Math.min(perimeterProjectedSW.y, perimeterProjectedSC.y);
149
+ perimeterCartographicNW.z = perimeterCartographicSW.z = minimumHeight;
150
+ perimeterCartesianNW = ellipsoid.cartographicToCartesian(perimeterCartographicNW, scratchPerimeterCartesianNW);
151
+ perimeterCartesianSW = ellipsoid.cartographicToCartesian(perimeterCartographicSW, scratchPerimeterCartesianSW);
152
+ plane = ellipsoidTangentPlane.plane;
153
+ minZ = Math.min(plane.getPointDistance(perimeterCartesianNW), plane.getPointDistance(perimeterCartesianSW));
154
+ maxZ = maximumHeight;
155
+ return applyTransform(fromPlaneExtents(ellipsoidTangentPlane.origin, ellipsoidTangentPlane.xAxis, ellipsoidTangentPlane.yAxis, ellipsoidTangentPlane.zAxis, minX, maxX, minY, maxY, minZ, maxZ, obb), transform);
156
+ }
157
+ const eastDeg = degrees(east);
158
+ const fullyAboveEquator = south > 0.0;
159
+ const fullyBelowEquator = north < 0.0;
160
+ const latitudeNearestToEquator = fullyAboveEquator
161
+ ? southDeg
162
+ : fullyBelowEquator
163
+ ? northDeg
164
+ : 0.0;
165
+ const planeOrigin = ellipsoid.cartographicToCartesian([lonCenterDeg, latitudeNearestToEquator, maximumHeight], scratchPlaneOrigin);
166
+ planeOrigin.z = 0.0;
167
+ const isPole = Math.abs(planeOrigin.x) < _MathUtils.EPSILON10 &&
168
+ Math.abs(planeOrigin.y) < _MathUtils.EPSILON10;
169
+ const planeNormal = !isPole ? scratchPlaneNormal.copy(planeOrigin).normalize() : VECTOR3_UNIT_X;
170
+ const planeYAxis = VECTOR3_UNIT_Z;
171
+ const planeXAxis = scratchPlaneXAxis.copy(planeNormal).cross(planeYAxis);
172
+ plane = scratchPlane.fromPointNormal(planeOrigin, planeNormal);
173
+ const horizonCartesian = ellipsoid.cartographicToCartesian([degrees(lonCenter + _MathUtils.PI_OVER_TWO), latitudeNearestToEquator, maximumHeight], scratchHorizonCartesian);
174
+ const projectedPoint = plane.projectPointOntoPlane(horizonCartesian, scratchHorizonProjected);
175
+ maxX = projectedPoint.dot(planeXAxis);
176
+ minX = -maxX;
177
+ const northHeight = fullyBelowEquator ? minimumHeight : maximumHeight;
178
+ const southHeight = fullyAboveEquator ? minimumHeight : maximumHeight;
179
+ maxY = latitudeZExtent(ellipsoid, northDeg, northHeight, true);
180
+ minY = latitudeZExtent(ellipsoid, southDeg, southHeight, false);
181
+ const farZ = ellipsoid.cartographicToCartesian([eastDeg, latitudeNearestToEquator, maximumHeight], scratchZ);
182
+ minZ = plane.getPointDistance(farZ);
183
+ maxZ = 0.0;
184
+ return applyTransform(fromPlaneExtents(planeOrigin, planeXAxis, planeYAxis, planeNormal, minX, maxX, minY, maxY, minZ, maxZ, obb), transform);
185
+ }
186
+ function applyTransform(obb, transform) {
187
+ if (!transform)
188
+ return obb;
189
+ // A general affine transform turns an OBB into a parallelepiped. Refit its eight
190
+ // corners to an axis-aligned OBB so culling methods that assume orthogonal axes remain safe.
191
+ const axes = [0, 1, 2].map(column => obb.halfAxes.getColumn(column, new Vector3()));
192
+ const center = transform.transformAsPoint(obb.center);
193
+ const minimum = [Infinity, Infinity, Infinity];
194
+ const maximum = [-Infinity, -Infinity, -Infinity];
195
+ for (let mask = 0; mask < 8; mask++) {
196
+ const corner = new Vector3(center);
197
+ for (let axis = 0; axis < 3; axis++) {
198
+ const transformedAxis = transform.transformAsVector(axes[axis]);
199
+ corner.add(new Vector3(transformedAxis).scale((mask & (1 << axis)) === 0 ? -1 : 1));
200
+ }
201
+ for (let component = 0; component < 3; component++) {
202
+ minimum[component] = Math.min(minimum[component], corner[component]);
203
+ maximum[component] = Math.max(maximum[component], corner[component]);
204
+ }
205
+ }
206
+ obb.center.copy(minimum).add(maximum).scale(0.5);
207
+ const halfSize = new Vector3(maximum).subtract(minimum).scale(0.5);
208
+ obb.halfAxes = new Matrix3().set(halfSize.x, 0, 0, 0, halfSize.y, 0, 0, 0, halfSize.z);
209
+ return obb;
210
+ }
211
+ function latitudeZExtent(ellipsoid, latitude, height, maximum) {
212
+ let extent = maximum ? -Infinity : Infinity;
213
+ // A triaxial ellipsoid's fixed-latitude extrema occur at a principal longitude.
214
+ for (const longitude of [0, 90, 180, 270]) {
215
+ const z = ellipsoid.cartographicToCartesian([longitude, latitude, height], scratchMaxY).z;
216
+ extent = maximum ? Math.max(extent, z) : Math.min(extent, z);
217
+ }
218
+ return extent;
219
+ }
220
+ /** Helper function for makeOBBFromRegion(). */
221
+ // eslint-disable-next-line max-params
222
+ function fromPlaneExtents(planeOrigin, planeXAxis, planeYAxis, planeZAxis, minimumX, maximumX, minimumY, maximumY, minimumZ, maximumZ, result) {
223
+ const center = result.center;
224
+ const halfAxes = result.halfAxes;
225
+ halfAxes.setColumn(0, planeXAxis);
226
+ halfAxes.setColumn(1, planeYAxis);
227
+ halfAxes.setColumn(2, planeZAxis);
228
+ const centerOffset = scratchOffset
229
+ .set((minimumX + maximumX) / 2.0, (minimumY + maximumY) / 2.0, (minimumZ + maximumZ) / 2.0)
230
+ .transformByMatrix3(halfAxes);
231
+ const scaleX = (maximumX - minimumX) / 2.0;
232
+ const scaleY = (maximumY - minimumY) / 2.0;
233
+ const scaleZ = (maximumZ - minimumZ) / 2.0;
234
+ halfAxes[0] *= scaleX;
235
+ halfAxes[1] *= scaleX;
236
+ halfAxes[2] *= scaleX;
237
+ halfAxes[3] *= scaleY;
238
+ halfAxes[4] *= scaleY;
239
+ halfAxes[5] *= scaleY;
240
+ halfAxes[6] *= scaleZ;
241
+ halfAxes[7] *= scaleZ;
242
+ halfAxes[8] *= scaleZ;
243
+ center.copy(planeOrigin).add(centerOffset);
244
+ return result;
245
+ }
246
+ //# sourceMappingURL=make-obb-from-region.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-obb-from-region.js","sourceRoot":"","sources":["../src/make-obb-from-region.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,8CAA8C;AAC9C,oCAAoC;AAEpC,2EAA2E;AAC3E,4FAA4F;AAE5F,OAAO,EAAC,OAAO,EAAW,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAC,mBAAmB,EAAE,KAAK,EAAC,MAAM,kBAAkB,CAAC;AAC5D,aAAa;AACb,gDAAgD;AAChD,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,EAAC,SAAS,EAAC,uBAAoB;AACtC,OAAO,EAAC,qBAAqB,EAAC,qCAAkC;AAEhE,MAAM,aAAa,GAAG,IAAI,OAAO,EAAE,CAAC;AAEpC,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAAE,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C,IAAI,MAAM,CAAC;IAEtB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAE3C,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
- "version": "4.1.0",
9
+ "version": "4.2.0-alpha.5",
10
10
  "keywords": [
11
11
  "webgl",
12
12
  "javascript",
@@ -39,8 +39,9 @@
39
39
  "src"
40
40
  ],
41
41
  "dependencies": {
42
- "@math.gl/core": "4.1.0",
43
- "@math.gl/types": "4.1.0"
42
+ "@math.gl/core": "4.2.0-alpha.5",
43
+ "@math.gl/culling": "4.2.0-alpha.5",
44
+ "@math.gl/types": "4.2.0-alpha.5"
44
45
  },
45
- "gitHead": "76820f54e2a9034b42bd24ffeb381cc4e01ad46e"
46
+ "gitHead": "9c13785761867748e2edb167b5f2749dce803039"
46
47
  }
@@ -0,0 +1,87 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT and Apache-2.0
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ // This file is derived from the Cesium library under Apache 2 license
6
+ // See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
7
+
8
+ import {Vector2, Vector3, Matrix4} from '@math.gl/core';
9
+ import {Plane} from '@math.gl/culling';
10
+ import {Ellipsoid} from './ellipsoid';
11
+
12
+ const scratchOrigin = new Vector3();
13
+ const scratchCart3 = new Vector3();
14
+ const scratchEastNorthUp = new Matrix4();
15
+ const scratchProjectPointOntoPlaneCartesian3 = new Vector3();
16
+
17
+ /** A two-dimensional east-north plane tangent to an ellipsoid. */
18
+ export class EllipsoidTangentPlane {
19
+ private _origin: Vector3;
20
+ private _xAxis: Vector3;
21
+ private _yAxis: Vector3;
22
+ private _plane: Plane;
23
+
24
+ /**
25
+ * Creates a new plane tangent to the WGS84 ellipsoid at the provided origin.
26
+ * If origin is not on the surface of the ellipsoid, its surface projection will be used.
27
+ *
28
+ * @param origin A nonzero Cartesian point on or near the ellipsoid.
29
+ * @param ellipsoid The ellipsoid to which the origin belongs. Defaults to WGS84.
30
+ */
31
+ constructor(origin: number[], ellipsoid: Ellipsoid = Ellipsoid.WGS84) {
32
+ const originOnSurface = ellipsoid.scaleToGeodeticSurface(origin, scratchOrigin);
33
+
34
+ const eastNorthUp = ellipsoid.eastNorthUpToFixedFrame(originOnSurface, scratchEastNorthUp);
35
+
36
+ this._origin = new Vector3(originOnSurface);
37
+ this._xAxis = new Vector3(scratchCart3.from(eastNorthUp.getColumn(0)));
38
+ this._yAxis = new Vector3(scratchCart3.from(eastNorthUp.getColumn(1)));
39
+ const normal = new Vector3(scratchCart3.from(eastNorthUp.getColumn(2)));
40
+
41
+ this._plane = new Plane().fromPointNormal(this._origin, normal);
42
+ }
43
+
44
+ /**
45
+ * Computes the projection of the provided 3D position onto the 2D plane, along the plane normal.
46
+ *
47
+ * @param cartesian The WGS84 Cartesian point to project.
48
+ * @param result The optional object in which to store the local east-north coordinates.
49
+ * @returns The supplied result or a new Vector2.
50
+ */
51
+ projectPointToNearestOnPlane(cartesian: Vector3, result?: Vector2): Vector2 {
52
+ if (!result) result = new Vector2();
53
+
54
+ const intersectionPoint = this._plane.projectPointOntoPlane(
55
+ cartesian,
56
+ scratchProjectPointOntoPlaneCartesian3
57
+ );
58
+
59
+ const v = intersectionPoint.subtract(this._origin);
60
+ const x = this._xAxis.dot(v);
61
+ const y = this._yAxis.dot(v);
62
+
63
+ result.x = x;
64
+ result.y = y;
65
+ return result;
66
+ }
67
+
68
+ get plane(): Plane {
69
+ return this._plane;
70
+ }
71
+
72
+ get origin(): Vector3 {
73
+ return this._origin;
74
+ }
75
+
76
+ get xAxis(): Vector3 {
77
+ return this._xAxis;
78
+ }
79
+
80
+ get yAxis(): Vector3 {
81
+ return this._yAxis;
82
+ }
83
+
84
+ get zAxis(): Vector3 {
85
+ return this._plane.normal;
86
+ }
87
+ }
@@ -8,12 +8,12 @@
8
8
  /* eslint-disable */
9
9
  import {Vector3, Matrix4, assert, equals, _MathUtils, NumericArray, vec3} from '@math.gl/core';
10
10
 
11
- import {WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z} from '../constants';
12
- import {fromCartographicToRadians, toCartographicFromRadians} from '../type-utils';
11
+ import {WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z} from './constants';
12
+ import {fromCartographicToRadians, toCartographicFromRadians} from './type-utils';
13
13
 
14
- import type {AxisDirection} from './helpers/ellipsoid-transform';
15
- import {localFrameToFixedFrame} from './helpers/ellipsoid-transform';
16
- import {scaleToGeodeticSurface} from './helpers/scale-to-geodetic-surface';
14
+ import type {AxisDirection} from './ellipsoid-helpers/ellipsoid-transform';
15
+ import {localFrameToFixedFrame} from './ellipsoid-helpers/ellipsoid-transform';
16
+ import {scaleToGeodeticSurface} from './ellipsoid-helpers/scale-to-geodetic-surface';
17
17
 
18
18
  const scratchVector = new Vector3();
19
19
  const scratchNormal = new Vector3();
@@ -89,7 +89,10 @@ export class Ellipsoid {
89
89
  return this.radii.toString();
90
90
  }
91
91
 
92
- /** Converts the provided cartographic to Cartesian representation. */
92
+ /** Converts the provided cartographic position to Cartesian representation.
93
+ * The position is supplied as [longitude, latitude, height], where longitude and latitude
94
+ * are in degrees and height is in meters above the ellipsoid.
95
+ */
93
96
  cartographicToCartesian(cartographic: number[], result: Vector3): Vector3;
94
97
  cartographicToCartesian(cartographic: number[], result?: number[]): number[];
95
98
 
@@ -111,8 +114,10 @@ export class Ellipsoid {
111
114
  return k.to(result);
112
115
  }
113
116
 
114
- /** Converts the provided cartesian to cartographic (lng/lat/z) representation.
115
- * The cartesian is undefined at the center of the ellipsoid. */
117
+ /** Converts the provided Cartesian position to [longitude, latitude, height],
118
+ * where longitude and latitude are in degrees and height is in meters above the ellipsoid.
119
+ * The cartographic position is undefined at the center of the ellipsoid.
120
+ */
116
121
  cartesianToCartographic(cartesian: Readonly<NumericArray>, result: Vector3): Vector3;
117
122
  cartesianToCartographic(cartesian: Readonly<NumericArray>, result?: number[]): number[];
118
123
 
@@ -155,7 +160,7 @@ export class Ellipsoid {
155
160
  origin: Readonly<NumericArray>,
156
161
  result?: Matrix4
157
162
  ): Matrix4;
158
- localFrameToFixedFrame<Matrix4T>(
163
+ localFrameToFixedFrame<_Matrix4T>(
159
164
  firstAxis: AxisDirection,
160
165
  secondAxis: AxisDirection,
161
166
  thirdAxis: AxisDirection,
@@ -183,7 +188,9 @@ export class Ellipsoid {
183
188
  return scratchVector.from(cartesian).normalize().to(result);
184
189
  }
185
190
 
186
- /** Computes the normal of the plane tangent to the surface of the ellipsoid at provided position. */
191
+ /** Computes the normal of the plane tangent to the surface of the ellipsoid at the provided
192
+ * [longitude, latitude, height], where longitude and latitude are in degrees.
193
+ */
187
194
  geodeticSurfaceNormalCartographic<NumArray>(
188
195
  cartographic: Readonly<NumericArray>,
189
196
  result: NumArray
package/src/index.ts CHANGED
@@ -2,5 +2,9 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- export {Ellipsoid} from './ellipsoid/ellipsoid';
5
+ export {Ellipsoid} from './ellipsoid';
6
+ export {EllipsoidTangentPlane} from './ellipsoid-tangent-plane';
7
+ export {LngLatRectangle} from './lng-lat-rectangle';
8
+ export {makeOBBFromRegion} from './make-obb-from-region';
9
+ export type {GeodeticRegion, MakeOBBFromRegionOptions} from './make-obb-from-region';
6
10
  export {isWGS84} from './type-utils';
@@ -0,0 +1,67 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT and Apache-2.0
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ // This file is derived from the Cesium library under Apache 2 license
6
+ // See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
7
+
8
+ import {Vector3, normalizeAngle, _MathUtils} from '@math.gl/core';
9
+
10
+ /** A two dimensional region specified as longitude and latitude coordinates. */
11
+ export class LngLatRectangle {
12
+ west: number;
13
+ south: number;
14
+ east: number;
15
+ north: number;
16
+
17
+ /**
18
+ * Creates a new two dimensional region specified as longitude and latitude coordinates.
19
+ *
20
+ * @param west The westernmost longitude, in radians, in the range [-Pi, Pi].
21
+ * @param south The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].
22
+ * @param east The easternmost longitude, in radians, in the range [-Pi, Pi].
23
+ * @param north The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].
24
+ */
25
+ constructor(west: number, south: number, east: number, north: number) {
26
+ this.west = west;
27
+ this.south = south;
28
+ this.east = east;
29
+ this.north = north;
30
+ }
31
+
32
+ /**
33
+ * Computes the center of a rectangle.
34
+ *
35
+ * @param rectangle The rectangle for which to find the center
36
+ * @param [result] The object onto which to store the result.
37
+ * @returns The modified result parameter or a new Cartographic instance if none was provided.
38
+ */
39
+ static center(rectangle: LngLatRectangle, result?: Vector3): Vector3 {
40
+ if (!result) result = new Vector3();
41
+
42
+ let east = rectangle.east;
43
+ const west = rectangle.west;
44
+
45
+ if (east < west) {
46
+ east += _MathUtils.TWO_PI;
47
+ }
48
+
49
+ const longitude = normalizeAngle((west + east) * 0.5, 'negative-pi-to-pi');
50
+ const latitude = (rectangle.south + rectangle.north) * 0.5;
51
+
52
+ result.x = longitude;
53
+ result.y = latitude;
54
+ result.z = 0.0;
55
+ return result;
56
+ }
57
+
58
+ get width(): number {
59
+ let east = this.east;
60
+ const west = this.west;
61
+
62
+ if (east < west) {
63
+ east += _MathUtils.TWO_PI;
64
+ }
65
+ return east - west;
66
+ }
67
+ }