@deck.gl/geo-layers 9.2.0-alpha.3 → 9.2.0-beta.2

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/dist.dev.js CHANGED
@@ -3401,12 +3401,12 @@ var __exports__ = (() => {
3401
3401
  function frob(a22) {
3402
3402
  return Math.hypot(a22[0], a22[1], a22[2], a22[3]);
3403
3403
  }
3404
- function LDU(L2, D, U, a22) {
3404
+ function LDU(L2, D2, U, a22) {
3405
3405
  L2[2] = a22[2] / a22[0];
3406
3406
  U[0] = a22[0];
3407
3407
  U[1] = a22[1];
3408
3408
  U[3] = a22[3] - L2[2] * U[1];
3409
- return [L2, D, U];
3409
+ return [L2, D2, U];
3410
3410
  }
3411
3411
  function add(out, a22, b2) {
3412
3412
  out[0] = a22[0] + b2[0];
@@ -4600,7 +4600,6 @@ var __exports__ = (() => {
4600
4600
  var PentagonShape = class _PentagonShape {
4601
4601
  constructor(vertices) {
4602
4602
  this.vertices = vertices;
4603
- this.id = { i: 0, j: 0, k: 0, resolution: 1 };
4604
4603
  if (!this.isWindingCorrect()) {
4605
4604
  this.vertices.reverse();
4606
4605
  }
@@ -4671,36 +4670,36 @@ var __exports__ = (() => {
4671
4670
  return newPentagon;
4672
4671
  }
4673
4672
  getCenter() {
4674
- return this.vertices.reduce(
4675
- (sum, v2) => [sum[0] + v2[0] / 5, sum[1] + v2[1] / 5],
4676
- [0, 0]
4677
- );
4673
+ const n2 = this.vertices.length;
4674
+ const sum = this.vertices.reduce((sum2, v2) => [sum2[0] + v2[0] / n2, sum2[1] + v2[1] / n2], [0, 0]);
4675
+ return sum;
4678
4676
  }
4679
4677
  /**
4680
4678
  * Tests if a point is inside the pentagon by checking if it's on the correct side of all edges.
4681
4679
  * Assumes consistent winding order (counter-clockwise).
4682
4680
  * @param point The point to test
4683
- * @returns -1 if point is inside, otherwise a value proportional to the distance from the point to the edge
4681
+ * @returns 1 if point is inside, otherwise a negative value proportional to the distance from the point to the edge
4684
4682
  */
4685
4683
  containsPoint(point) {
4686
4684
  if (!this.isWindingCorrect()) {
4687
4685
  throw new Error("Pentagon is not counter-clockwise");
4688
4686
  }
4689
4687
  const N = this.vertices.length;
4688
+ let dMax = 1;
4690
4689
  for (let i3 = 0; i3 < N; i3++) {
4691
4690
  const v1 = this.vertices[i3];
4692
4691
  const v2 = this.vertices[(i3 + 1) % N];
4693
- const dx = v2[0] - v1[0];
4694
- const dy = v2[1] - v1[1];
4692
+ const dx = v1[0] - v2[0];
4693
+ const dy = v1[1] - v2[1];
4695
4694
  const px = point[0] - v1[0];
4696
4695
  const py = point[1] - v1[1];
4697
4696
  const crossProduct = dx * py - dy * px;
4698
- if (crossProduct > 0) {
4697
+ if (crossProduct < 0) {
4699
4698
  const pLength = Math.sqrt(px * px + py * py);
4700
- return crossProduct / pLength;
4699
+ dMax = Math.min(dMax, crossProduct / pLength);
4701
4700
  }
4702
4701
  }
4703
- return -1;
4702
+ return dMax;
4704
4703
  }
4705
4704
  /**
4706
4705
  * Splits each edge of the pentagon into the specified number of segments
@@ -4774,16 +4773,16 @@ var __exports__ = (() => {
4774
4773
  * @param C Array of coefficients
4775
4774
  * @returns Transformed angle in radians
4776
4775
  */
4777
- applyCoefficients(phi, C) {
4776
+ applyCoefficients(phi, C2) {
4778
4777
  const sinPhi = Math.sin(phi);
4779
4778
  const cosPhi = Math.cos(phi);
4780
4779
  const X = 2 * (cosPhi - sinPhi) * (cosPhi + sinPhi);
4781
4780
  let u0, u1;
4782
- u0 = X * C[5] + C[4];
4783
- u1 = X * u0 + C[3];
4784
- u0 = X * u1 - u0 + C[2];
4785
- u1 = X * u0 - u1 + C[1];
4786
- u0 = X * u1 - u0 + C[0];
4781
+ u0 = X * C2[5] + C2[4];
4782
+ u1 = X * u0 + C2[3];
4783
+ u0 = X * u1 - u0 + C2[2];
4784
+ u1 = X * u0 - u1 + C2[1];
4785
+ u0 = X * u1 - u0 + C2[0];
4787
4786
  return phi + 2 * sinPhi * cosPhi * u0;
4788
4787
  }
4789
4788
  /**
@@ -4865,12 +4864,6 @@ var __exports__ = (() => {
4865
4864
  const latitude = radToDeg(geodeticLat);
4866
4865
  return [longitude, latitude];
4867
4866
  }
4868
- function quatFromSpherical(axis) {
4869
- const cartesian = toCartesian(axis);
4870
- const Q = quat_exports.create();
4871
- quat_exports.rotationTo(Q, [0, 0, 1], cartesian);
4872
- return Q;
4873
- }
4874
4867
  function normalizeLongitudes(contour) {
4875
4868
  const points = contour.map((lonLat) => toCartesian(fromLonLat(lonLat)));
4876
4869
  const center2 = vec3_exports.create();
@@ -4893,6 +4886,53 @@ var __exports__ = (() => {
4893
4886
  });
4894
4887
  }
4895
4888
  common_exports.setMatrixArrayType(Float64Array);
4889
+ var SQRT5 = Math.sqrt(5);
4890
+ var INV_SQRT5 = Math.sqrt(0.2);
4891
+ var sinAlpha = Math.sqrt((1 - INV_SQRT5) / 2);
4892
+ var cosAlpha = Math.sqrt((1 + INV_SQRT5) / 2);
4893
+ var A = 0.5;
4894
+ var B = Math.sqrt((2.5 - SQRT5) / 10);
4895
+ var C = Math.sqrt((2.5 + SQRT5) / 10);
4896
+ var D = Math.sqrt((1 + INV_SQRT5) / 8);
4897
+ var E = Math.sqrt((1 - INV_SQRT5) / 8);
4898
+ var F = Math.sqrt((3 - SQRT5) / 8);
4899
+ var G = Math.sqrt((3 + SQRT5) / 8);
4900
+ var faceCenters = [
4901
+ [0, 0],
4902
+ // Doesn't actually matter as rotation is 0
4903
+ // First ring: five vertices, CCW, multiplied by sinAlpha
4904
+ [sinAlpha, 0],
4905
+ // [cos0, sin0]
4906
+ [B, A],
4907
+ // [cos72, sin72]
4908
+ [-D, F],
4909
+ // [-cos36, sin36]
4910
+ [-D, -F],
4911
+ // [-cos36, -sin36]
4912
+ [B, -A],
4913
+ // [cos72, -sin72]
4914
+ // Second ring: the same five vertices but negated (180deg rotation), multiplied by cosAlpha
4915
+ [-cosAlpha, 0],
4916
+ // [-cos0, -sin0]
4917
+ [-E, -G],
4918
+ // [-cos72, -sin72]
4919
+ [C, -A],
4920
+ // [cos36, -sin36]
4921
+ [C, A],
4922
+ // [cos36, sin36]
4923
+ [-E, G],
4924
+ // [-cos72, sin72]
4925
+ [0, 0]
4926
+ ];
4927
+ var axes = faceCenters.map(([x2, y2]) => [-y2, x2]);
4928
+ var quaternions = axes.map((axis, i3) => {
4929
+ if (i3 === 0)
4930
+ return [0, 0, 0, 1];
4931
+ if (i3 === 11)
4932
+ return [0, -1, 0, 0];
4933
+ return [...axis, 0, i3 < 6 ? cosAlpha : sinAlpha];
4934
+ });
4935
+ common_exports.setMatrixArrayType(Float64Array);
4896
4936
  var clockwiseFan = ["vu", "uw", "vw", "vw", "vw"];
4897
4937
  var clockwiseStep = ["wu", "uw", "vw", "vu", "uw"];
4898
4938
  var counterStep = ["wu", "uv", "wv", "wu", "uw"];
@@ -4927,24 +4967,27 @@ var __exports__ = (() => {
4927
4967
  var ORIGIN_ORDER = [0, 1, 2, 4, 3, 5, 7, 8, 6, 11, 10, 9];
4928
4968
  var origins = [];
4929
4969
  function generateOrigins() {
4930
- addOrigin([0, 0], 0);
4970
+ addOrigin([0, 0], 0, quaternions[0]);
4931
4971
  for (let i3 = 0; i3 < 5; i3++) {
4932
4972
  const alpha = i3 * TWO_PI_OVER_5;
4933
4973
  const alpha2 = alpha + PI_OVER_5;
4934
- addOrigin([alpha, interhedralAngle], PI_OVER_5);
4935
- addOrigin([alpha2, Math.PI - interhedralAngle], PI_OVER_5);
4974
+ addOrigin([alpha, interhedralAngle], PI_OVER_5, quaternions[i3 + 1]);
4975
+ addOrigin([alpha2, Math.PI - interhedralAngle], PI_OVER_5, quaternions[(i3 + 3) % 5 + 6]);
4936
4976
  }
4937
- addOrigin([0, Math.PI], 0);
4977
+ addOrigin([0, Math.PI], 0, quaternions[11]);
4938
4978
  }
4939
4979
  var originId = 0;
4940
- function addOrigin(axis, angle32) {
4980
+ function addOrigin(axis, angle32, quaternion) {
4941
4981
  if (originId > 11) {
4942
4982
  throw new Error(`Too many origins: ${originId}`);
4943
4983
  }
4984
+ const inverseQuat = quat_exports.create();
4985
+ quat_exports.conjugate(inverseQuat, quaternion);
4944
4986
  const origin = {
4945
4987
  id: originId,
4946
4988
  axis,
4947
- quat: quatFromSpherical(axis),
4989
+ quat: quaternion,
4990
+ inverseQuat,
4948
4991
  angle: angle32,
4949
4992
  orientation: QUINTANT_ORIENTATIONS[originId],
4950
4993
  firstQuintant: QUINTANT_FIRST[originId]
@@ -4985,39 +5028,39 @@ var __exports__ = (() => {
4985
5028
  var crossCD = vec3_exports.create();
4986
5029
  var scaledA = vec3_exports.create();
4987
5030
  var scaledB = vec3_exports.create();
4988
- function vectorDifference(A, B) {
4989
- vec3_exports.lerp(midpointAB, A, B, 0.5);
5031
+ function vectorDifference(A2, B2) {
5032
+ vec3_exports.lerp(midpointAB, A2, B2, 0.5);
4990
5033
  vec3_exports.normalize(midpointAB, midpointAB);
4991
- vec3_exports.cross(midpointAB, A, midpointAB);
4992
- const D = vec3_exports.length(midpointAB);
4993
- if (D < 1e-8) {
4994
- const AB = vec3_exports.subtract(vec3_exports.create(), A, B);
5034
+ vec3_exports.cross(midpointAB, A2, midpointAB);
5035
+ const D2 = vec3_exports.length(midpointAB);
5036
+ if (D2 < 1e-8) {
5037
+ const AB = vec3_exports.subtract(vec3_exports.create(), A2, B2);
4995
5038
  const halfDistance = 0.5 * vec3_exports.length(AB);
4996
5039
  return halfDistance;
4997
5040
  }
4998
- return D;
5041
+ return D2;
4999
5042
  }
5000
- function tripleProduct(A, B, C) {
5001
- vec3_exports.cross(crossCD, B, C);
5002
- return vec3_exports.dot(A, crossCD);
5043
+ function tripleProduct(A2, B2, C2) {
5044
+ vec3_exports.cross(crossCD, B2, C2);
5045
+ return vec3_exports.dot(A2, crossCD);
5003
5046
  }
5004
- function quadrupleProduct(out, A, B, C, D) {
5005
- vec3_exports.cross(crossCD, C, D);
5006
- const tripleProductACD = vec3_exports.dot(A, crossCD);
5007
- const tripleProductBCD = vec3_exports.dot(B, crossCD);
5008
- vec3_exports.scale(scaledA, A, tripleProductBCD);
5009
- vec3_exports.scale(scaledB, B, tripleProductACD);
5047
+ function quadrupleProduct(out, A2, B2, C2, D2) {
5048
+ vec3_exports.cross(crossCD, C2, D2);
5049
+ const tripleProductACD = vec3_exports.dot(A2, crossCD);
5050
+ const tripleProductBCD = vec3_exports.dot(B2, crossCD);
5051
+ vec3_exports.scale(scaledA, A2, tripleProductBCD);
5052
+ vec3_exports.scale(scaledB, B2, tripleProductACD);
5010
5053
  return vec3_exports.sub(out, scaledB, scaledA);
5011
5054
  }
5012
- function slerp2(out, A, B, t2) {
5013
- const gamma = vec3_exports.angle(A, B);
5055
+ function slerp2(out, A2, B2, t2) {
5056
+ const gamma = vec3_exports.angle(A2, B2);
5014
5057
  if (gamma < 1e-12) {
5015
- return vec3_exports.lerp(out, A, B, t2);
5058
+ return vec3_exports.lerp(out, A2, B2, t2);
5016
5059
  }
5017
5060
  const weightA = Math.sin((1 - t2) * gamma) / Math.sin(gamma);
5018
5061
  const weightB = Math.sin(t2 * gamma) / Math.sin(gamma);
5019
- const scaledA2 = vec3_exports.scale(vec3_exports.create(), A, weightA);
5020
- const scaledB2 = vec3_exports.scale(vec3_exports.create(), B, weightB);
5062
+ const scaledA2 = vec3_exports.scale(vec3_exports.create(), A2, weightA);
5063
+ const scaledB2 = vec3_exports.scale(vec3_exports.create(), B2, weightB);
5021
5064
  return vec3_exports.add(out, scaledA2, scaledB2);
5022
5065
  }
5023
5066
  common_exports.setMatrixArrayType(Float64Array);
@@ -5184,19 +5227,19 @@ var __exports__ = (() => {
5184
5227
  * @returns The face coordinates
5185
5228
  */
5186
5229
  forward(v2, sphericalTriangle, faceTriangle) {
5187
- const [A, B, C] = sphericalTriangle;
5188
- const triangleShape = new SphericalTriangleShape([A, B, C]);
5189
- const Z = vec3_exports.subtract(vec3_exports.create(), v2, A);
5230
+ const [A2, B2, C2] = sphericalTriangle;
5231
+ const triangleShape = new SphericalTriangleShape([A2, B2, C2]);
5232
+ const Z = vec3_exports.subtract(vec3_exports.create(), v2, A2);
5190
5233
  vec3_exports.normalize(Z, Z);
5191
- const p2 = quadrupleProduct(vec3_exports.create(), A, Z, B, C);
5234
+ const p2 = quadrupleProduct(vec3_exports.create(), A2, Z, B2, C2);
5192
5235
  vec3_exports.normalize(p2, p2);
5193
- const h = vectorDifference(A, v2) / vectorDifference(A, p2);
5236
+ const h = vectorDifference(A2, v2) / vectorDifference(A2, p2);
5194
5237
  const Area_ABC = triangleShape.getArea();
5195
5238
  const scaledArea = h / Area_ABC;
5196
5239
  const b2 = [
5197
5240
  1 - h,
5198
- scaledArea * new SphericalTriangleShape([A, p2, C]).getArea(),
5199
- scaledArea * new SphericalTriangleShape([A, B, p2]).getArea()
5241
+ scaledArea * new SphericalTriangleShape([A2, p2, C2]).getArea(),
5242
+ scaledArea * new SphericalTriangleShape([A2, B2, p2]).getArea()
5200
5243
  ];
5201
5244
  return barycentricToFace(b2, faceTriangle);
5202
5245
  }
@@ -5208,18 +5251,18 @@ var __exports__ = (() => {
5208
5251
  * @returns The spherical coordinates
5209
5252
  */
5210
5253
  inverse(facePoint, faceTriangle, sphericalTriangle) {
5211
- const [A, B, C] = sphericalTriangle;
5212
- const triangleShape = new SphericalTriangleShape([A, B, C]);
5254
+ const [A2, B2, C2] = sphericalTriangle;
5255
+ const triangleShape = new SphericalTriangleShape([A2, B2, C2]);
5213
5256
  const b2 = faceToBarycentric(facePoint, faceTriangle);
5214
5257
  const threshold = 1 - 1e-14;
5215
5258
  if (b2[0] > threshold)
5216
- return A;
5259
+ return A2;
5217
5260
  if (b2[1] > threshold)
5218
- return B;
5261
+ return B2;
5219
5262
  if (b2[2] > threshold)
5220
- return C;
5263
+ return C2;
5221
5264
  const c1 = vec3_exports.create();
5222
- vec3_exports.cross(c1, B, C);
5265
+ vec3_exports.cross(c1, B2, C2);
5223
5266
  const Area_ABC = triangleShape.getArea();
5224
5267
  const h = 1 - b2[0];
5225
5268
  const R = b2[2] / h;
@@ -5227,18 +5270,18 @@ var __exports__ = (() => {
5227
5270
  const S = Math.sin(alpha);
5228
5271
  const halfC = Math.sin(alpha / 2);
5229
5272
  const CC = 2 * halfC * halfC;
5230
- const c01 = vec3_exports.dot(A, B);
5231
- const c12 = vec3_exports.dot(B, C);
5232
- const c20 = vec3_exports.dot(C, A);
5273
+ const c01 = vec3_exports.dot(A2, B2);
5274
+ const c12 = vec3_exports.dot(B2, C2);
5275
+ const c20 = vec3_exports.dot(C2, A2);
5233
5276
  const s12 = vec3_exports.length(c1);
5234
- const V2 = vec3_exports.dot(A, c1);
5277
+ const V2 = vec3_exports.dot(A2, c1);
5235
5278
  const f2 = S * V2 + CC * (c01 * c12 - c20);
5236
5279
  const g = CC * s12 * (1 + c01);
5237
5280
  const q = 2 / Math.acos(c12) * Math.atan2(g, f2);
5238
- const P = slerp2(vec3_exports.create(), B, C, q);
5239
- const K = vectorDifference(A, P);
5281
+ const P = slerp2(vec3_exports.create(), B2, C2, q);
5282
+ const K = vectorDifference(A2, P);
5240
5283
  const t2 = this.safeAcos(h * K) / this.safeAcos(K);
5241
- const out = slerp2([0, 0, 0], A, P, t2);
5284
+ const out = slerp2([0, 0, 0], A2, P, t2);
5242
5285
  return out;
5243
5286
  }
5244
5287
  /**
@@ -5310,10 +5353,10 @@ var __exports__ = (() => {
5310
5353
  return;
5311
5354
  const parentK = digits[i3] || 0;
5312
5355
  const childK = digits[i3 - 1];
5313
- const F = flips[0] + flips[1];
5356
+ const F2 = flips[0] + flips[1];
5314
5357
  let needsShift = true;
5315
5358
  let first = true;
5316
- if (invertJ !== (F === 0)) {
5359
+ if (invertJ !== (F2 === 0)) {
5317
5360
  needsShift = parentK === 1 || parentK === 2;
5318
5361
  first = parentK === 1;
5319
5362
  } else {
@@ -5395,11 +5438,11 @@ var __exports__ = (() => {
5395
5438
  pentagon.rotate180();
5396
5439
  }
5397
5440
  const { k } = anchor;
5398
- const F = anchor.flips[0] + anchor.flips[1];
5441
+ const F2 = anchor.flips[0] + anchor.flips[1];
5399
5442
  if (
5400
5443
  // Orient last two pentagons when both or neither flips are YES
5401
- (F === -2 || F === 2) && k > 1 || // Orient first & last pentagons when only one of flips is YES
5402
- F === 0 && (k === 0 || k === 3)
5444
+ (F2 === -2 || F2 === 2) && k > 1 || // Orient first & last pentagons when only one of flips is YES
5445
+ F2 === 0 && (k === 0 || k === 3)
5403
5446
  ) {
5404
5447
  pentagon.reflectY();
5405
5448
  }
@@ -5506,16 +5549,15 @@ var __exports__ = (() => {
5506
5549
  forward(spherical, originId2) {
5507
5550
  const origin = origins[originId2];
5508
5551
  const unprojected = toCartesian(spherical);
5509
- const inverseQuat = quat_exports.create();
5510
- quat_exports.invert(inverseQuat, origin.quat);
5511
5552
  const out = vec3_exports.create();
5512
- vec3_exports.transformQuat(out, unprojected, inverseQuat);
5553
+ vec3_exports.transformQuat(out, unprojected, origin.inverseQuat);
5513
5554
  const projectedSpherical = toSpherical(out);
5514
5555
  const polar = this.gnomonic.forward(projectedSpherical);
5515
5556
  polar[1] = polar[1] - origin.angle;
5516
5557
  const faceTriangleIndex = this.getFaceTriangleIndex(polar);
5517
- let faceTriangle = this.getFaceTriangle(faceTriangleIndex);
5518
- let sphericalTriangle = this.getSphericalTriangle(faceTriangleIndex, originId2, false);
5558
+ const reflect = this.shouldReflect(polar);
5559
+ let faceTriangle = this.getFaceTriangle(faceTriangleIndex, reflect, false);
5560
+ let sphericalTriangle = this.getSphericalTriangle(faceTriangleIndex, originId2, reflect);
5519
5561
  return this.polyhedral.forward(unprojected, sphericalTriangle, faceTriangle);
5520
5562
  }
5521
5563
  /**
@@ -5527,14 +5569,26 @@ var __exports__ = (() => {
5527
5569
  inverse(face, originId2) {
5528
5570
  const polar = toPolar(face);
5529
5571
  const faceTriangleIndex = this.getFaceTriangleIndex(polar);
5530
- const [rho, gamma] = polar;
5531
- const D = toFace([rho, this.normalizeGamma(gamma)])[0];
5532
- const reflect = D > distanceToEdge;
5572
+ const reflect = this.shouldReflect(polar);
5533
5573
  const faceTriangle = this.getFaceTriangle(faceTriangleIndex, reflect, false);
5534
- let sphericalTriangle = this.getSphericalTriangle(faceTriangleIndex, originId2, reflect);
5574
+ const sphericalTriangle = this.getSphericalTriangle(faceTriangleIndex, originId2, reflect);
5535
5575
  const unprojected = this.polyhedral.inverse(face, faceTriangle, sphericalTriangle);
5536
5576
  return toSpherical(unprojected);
5537
5577
  }
5578
+ /**
5579
+ * Detects when point is beyond the edge of the dodecahedron face
5580
+ * In the standard case (reflect = false), the face and spherical triangle can be
5581
+ * used directly.
5582
+ * In the reflected case (reflect = true), the point is beyond the edge of the dodecahedron face,
5583
+ * and so the face triangle is squashed to unproject correctly onto the neighboring dodecahedron face.
5584
+ * @param polar Polar coordinates
5585
+ * @returns True if point is beyond the edge of the dodecahedron face
5586
+ */
5587
+ shouldReflect(polar) {
5588
+ const [rho, gamma] = polar;
5589
+ const D2 = toFace([rho, this.normalizeGamma(gamma)])[0];
5590
+ return D2 > distanceToEdge;
5591
+ }
5538
5592
  /**
5539
5593
  * Given a polar coordinate, returns the index of the face triangle it belongs to
5540
5594
  * @param polar Polar coordinates
@@ -5569,12 +5623,12 @@ var __exports__ = (() => {
5569
5623
  return even ? [vCenter, vEdgeMidpoint, vCorner1] : [vCenter, vCorner2, vEdgeMidpoint];
5570
5624
  }
5571
5625
  _getReflectedFaceTriangle(faceTriangleIndex, squashed = false) {
5572
- let [A, B, C] = this._getFaceTriangle(faceTriangleIndex).map((face) => vec2_exports.clone(face));
5626
+ let [A2, B2, C2] = this._getFaceTriangle(faceTriangleIndex).map((face) => vec2_exports.clone(face));
5573
5627
  const even = faceTriangleIndex % 2 === 0;
5574
- vec2_exports.negate(A, A);
5575
- const midpoint = even ? B : C;
5576
- vec2_exports.scaleAndAdd(A, A, midpoint, squashed ? 1 + 1 / Math.cos(interhedralAngle) : 2);
5577
- return [A, C, B];
5628
+ vec2_exports.negate(A2, A2);
5629
+ const midpoint = even ? B2 : C2;
5630
+ vec2_exports.scaleAndAdd(A2, A2, midpoint, squashed ? 1 + 1 / Math.cos(interhedralAngle) : 2);
5631
+ return [A2, C2, B2];
5578
5632
  }
5579
5633
  /**
5580
5634
  * Gets the spherical triangle for a given face triangle index and origin
@@ -5692,7 +5746,7 @@ var __exports__ = (() => {
5692
5746
  normalizedBoundary.reverse();
5693
5747
  return normalizedBoundary;
5694
5748
  }
5695
- function hexToBigInt(hex) {
5749
+ function hexToU64(hex) {
5696
5750
  return BigInt(`0x${hex}`);
5697
5751
  }
5698
5752
  var AUTHALIC_RADIUS = 63710072e-1;
@@ -9813,7 +9867,7 @@ var __exports__ = (() => {
9813
9867
  getPolygon: (x2, objectInfo) => {
9814
9868
  const pentagon = getPentagon(x2, objectInfo);
9815
9869
  const boundary = cellToBoundary(
9816
- typeof pentagon === "string" ? hexToBigInt(pentagon) : pentagon,
9870
+ typeof pentagon === "string" ? hexToU64(pentagon) : pentagon,
9817
9871
  { closedRing: true, segments: "auto" }
9818
9872
  );
9819
9873
  return flattenPolygon(boundary);
@@ -14291,7 +14345,7 @@ var __exports__ = (() => {
14291
14345
  return this._frameNumber;
14292
14346
  }
14293
14347
  // eslint-disable-next-line complexity
14294
- isTileVisible(tile, cullRect) {
14348
+ isTileVisible(tile, cullRect, modelMatrix) {
14295
14349
  if (!tile.isVisible) {
14296
14350
  return false;
14297
14351
  }
@@ -14301,12 +14355,19 @@ var __exports__ = (() => {
14301
14355
  z: this._zRange,
14302
14356
  cullRect
14303
14357
  });
14304
- const { bbox } = tile;
14358
+ let { bbox } = tile;
14305
14359
  for (const [minX, minY, maxX, maxY] of boundsArr) {
14306
14360
  let overlaps;
14307
14361
  if ("west" in bbox) {
14308
14362
  overlaps = bbox.west < maxX && bbox.east > minX && bbox.south < maxY && bbox.north > minY;
14309
14363
  } else {
14364
+ if (modelMatrix && !Matrix4.IDENTITY.equals(modelMatrix)) {
14365
+ const [left, top, right, bottom] = transformBox(
14366
+ [bbox.left, bbox.top, bbox.right, bbox.bottom],
14367
+ modelMatrix
14368
+ );
14369
+ bbox = { left, top, right, bottom };
14370
+ }
14310
14371
  const y0 = Math.min(bbox.top, bbox.bottom);
14311
14372
  const y1 = Math.max(bbox.top, bbox.bottom);
14312
14373
  overlaps = bbox.left < maxX && bbox.right > minX && y0 < maxY && y1 > minY;
@@ -14736,7 +14797,12 @@ var __exports__ = (() => {
14736
14797
  }
14737
14798
  filterSubLayer({ layer, cullRect }) {
14738
14799
  const { tile } = layer.props;
14739
- return this.state.tileset.isTileVisible(tile, cullRect);
14800
+ const { modelMatrix } = this.props;
14801
+ return this.state.tileset.isTileVisible(
14802
+ tile,
14803
+ cullRect,
14804
+ modelMatrix ? new Matrix4(modelMatrix) : null
14805
+ );
14740
14806
  }
14741
14807
  };
14742
14808
  TileLayer.defaultProps = defaultProps7;
@@ -14828,11 +14894,11 @@ out float vTime;
14828
14894
 
14829
14895
  // src/h3-layers/h3-cluster-layer.ts
14830
14896
  var import_h3_js3 = __toESM(require_h3_js(), 1);
14831
- var import_core17 = __toESM(require_core(), 1);
14897
+ var import_core18 = __toESM(require_core(), 1);
14832
14898
 
14833
14899
  // src/h3-layers/h3-hexagon-layer.ts
14834
14900
  var import_h3_js2 = __toESM(require_h3_js(), 1);
14835
- var import_core16 = __toESM(require_core(), 1);
14901
+ var import_core17 = __toESM(require_core(), 1);
14836
14902
  var import_layers7 = __toESM(require_layers(), 1);
14837
14903
  var UPDATE_THRESHOLD_KM = 10;
14838
14904
  function mergeTriggers(getHexagon, coverage) {
@@ -14854,7 +14920,7 @@ out float vTime;
14854
14920
  getHexagon: { type: "accessor", value: (x2) => x2.hexagon },
14855
14921
  extruded: true
14856
14922
  };
14857
- var _H3HexagonLayer = class extends import_core16.CompositeLayer {
14923
+ var _H3HexagonLayer = class extends import_core17.CompositeLayer {
14858
14924
  initializeState() {
14859
14925
  _H3HexagonLayer._checkH3Lib();
14860
14926
  this.state = {
@@ -14876,7 +14942,7 @@ out float vTime;
14876
14942
  let resolution = -1;
14877
14943
  let hasPentagon = false;
14878
14944
  let hasMultipleRes = false;
14879
- const { iterable, objectInfo } = (0, import_core16.createIterable)(this.props.data);
14945
+ const { iterable, objectInfo } = (0, import_core17.createIterable)(this.props.data);
14880
14946
  for (const object of iterable) {
14881
14947
  objectInfo.index++;
14882
14948
  const hexId = this.props.getHexagon(object, objectInfo);
@@ -15056,7 +15122,7 @@ out float vTime;
15056
15122
  if (changeFlags.dataChanged || changeFlags.updateTriggersChanged && changeFlags.updateTriggersChanged.getHexagons) {
15057
15123
  const { data, getHexagons } = props;
15058
15124
  const polygons = [];
15059
- const { iterable, objectInfo } = (0, import_core17.createIterable)(data);
15125
+ const { iterable, objectInfo } = (0, import_core18.createIterable)(data);
15060
15126
  for (const object of iterable) {
15061
15127
  objectInfo.index++;
15062
15128
  const hexagons = getHexagons(object, objectInfo);
@@ -15088,7 +15154,7 @@ out float vTime;
15088
15154
 
15089
15155
  // src/tile-3d-layer/tile-3d-layer.ts
15090
15156
  var import_engine2 = __toESM(require_engine(), 1);
15091
- var import_core53 = __toESM(require_core(), 1);
15157
+ var import_core54 = __toESM(require_core(), 1);
15092
15158
  var import_layers8 = __toESM(require_layers(), 1);
15093
15159
  var import_mesh_layers2 = __toESM(require_mesh_layers(), 1);
15094
15160
 
@@ -15566,7 +15632,7 @@ out float vTime;
15566
15632
  };
15567
15633
 
15568
15634
  // ../../node_modules/@luma.gl/gltf/dist/parsers/parse-pbr-material.js
15569
- var import_core18 = __toESM(require_core2(), 1);
15635
+ var import_core19 = __toESM(require_core2(), 1);
15570
15636
 
15571
15637
  // ../../node_modules/@luma.gl/gltf/dist/webgl-to-webgpu/convert-webgl-sampler.js
15572
15638
  function convertSampler(gltfSampler) {
@@ -15692,7 +15758,7 @@ out float vTime;
15692
15758
  parsedMaterial.uniforms.alphaCutoff = alphaCutoff;
15693
15759
  break;
15694
15760
  case "BLEND":
15695
- import_core18.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")();
15761
+ import_core19.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")();
15696
15762
  parsedMaterial.parameters.blend = true;
15697
15763
  parsedMaterial.parameters.blendColorOperation = "add";
15698
15764
  parsedMaterial.parameters.blendColorSrcFactor = "src-alpha";
@@ -15749,7 +15815,7 @@ out float vTime;
15749
15815
  }
15750
15816
 
15751
15817
  // ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting.js
15752
- var import_core19 = __toESM(require_core2(), 1);
15818
+ var import_core20 = __toESM(require_core2(), 1);
15753
15819
 
15754
15820
  // ../../node_modules/@luma.gl/shadertools/dist/modules/lighting/lights/lighting-glsl.js
15755
15821
  var lightingUniformsGLSL = (
@@ -15992,7 +16058,7 @@ fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
15992
16058
  currentLight++;
15993
16059
  }
15994
16060
  if (currentLight > MAX_LIGHTS) {
15995
- import_core19.log.warn("MAX_LIGHTS exceeded")();
16061
+ import_core20.log.warn("MAX_LIGHTS exceeded")();
15996
16062
  }
15997
16063
  lightSourceUniforms.directionalLightCount = directionalLights.length;
15998
16064
  lightSourceUniforms.pointLightCount = pointLights.length;
@@ -17248,7 +17314,7 @@ void main(void) {
17248
17314
  MeshLayer.defaultProps = defaultProps11;
17249
17315
 
17250
17316
  // src/tile-3d-layer/tile-3d-layer.ts
17251
- var import_core54 = __toESM(require_core3(), 1);
17317
+ var import_core55 = __toESM(require_core3(), 1);
17252
17318
 
17253
17319
  // ../../node_modules/@loaders.gl/tiles/node_modules/@math.gl/core/dist/lib/common.js
17254
17320
  var RADIANS_TO_DEGREES3 = 1 / Math.PI * 180;
@@ -27675,7 +27741,7 @@ void main(void) {
27675
27741
  }
27676
27742
 
27677
27743
  // ../../node_modules/@loaders.gl/tiles/dist/tileset/tile-3d.js
27678
- var import_core40 = __toESM(require_core3(), 1);
27744
+ var import_core41 = __toESM(require_core3(), 1);
27679
27745
 
27680
27746
  // ../../node_modules/@loaders.gl/tiles/dist/constants.js
27681
27747
  var TILE_CONTENT_STATE = {
@@ -28643,7 +28709,7 @@ void main(void) {
28643
28709
  ...this._getLoaderSpecificOptions(loader.id)
28644
28710
  }
28645
28711
  };
28646
- this.content = await (0, import_core40.load)(contentUrl, loader, options);
28712
+ this.content = await (0, import_core41.load)(contentUrl, loader, options);
28647
28713
  if (this.tileset.options.contentLoader) {
28648
28714
  await this.tileset.options.contentLoader(this);
28649
28715
  }
@@ -28926,7 +28992,7 @@ void main(void) {
28926
28992
  };
28927
28993
 
28928
28994
  // ../../node_modules/@loaders.gl/tiles/dist/tileset/format-i3s/i3s-tileset-traverser.js
28929
- var import_core41 = __toESM(require_core3(), 1);
28995
+ var import_core42 = __toESM(require_core3(), 1);
28930
28996
 
28931
28997
  // ../../node_modules/@loaders.gl/tiles/dist/tileset/format-i3s/i3s-pending-tiles-register.js
28932
28998
  var I3SPendingTilesRegister = class {
@@ -29090,7 +29156,7 @@ void main(void) {
29090
29156
  isTileHeader: true
29091
29157
  }
29092
29158
  };
29093
- return await (0, import_core41.load)(nodeUrl, loader, options);
29159
+ return await (0, import_core42.load)(nodeUrl, loader, options);
29094
29160
  }
29095
29161
  /**
29096
29162
  * The callback to init Tile3D instance after loading the tile JSON
@@ -40357,10 +40423,10 @@ void main(void) {
40357
40423
  };
40358
40424
 
40359
40425
  // ../../node_modules/@loaders.gl/3d-tiles/dist/lib/parsers/parse-3d-tile-header.js
40360
- var import_core52 = __toESM(require_core3(), 1);
40426
+ var import_core53 = __toESM(require_core3(), 1);
40361
40427
 
40362
40428
  // ../../node_modules/@loaders.gl/3d-tiles/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js
40363
- var import_core51 = __toESM(require_core3(), 1);
40429
+ var import_core52 = __toESM(require_core3(), 1);
40364
40430
 
40365
40431
  // ../../node_modules/@loaders.gl/3d-tiles/node_modules/long/index.js
40366
40432
  var wasm = null;
@@ -41522,16 +41588,16 @@ void main(void) {
41522
41588
  const region = getS2Region(s2cell);
41523
41589
  const W2 = region.west;
41524
41590
  const S = region.south;
41525
- const E = region.east;
41591
+ const E2 = region.east;
41526
41592
  const N = region.north;
41527
41593
  const points = [];
41528
41594
  points.push(new Vector36(W2, N, min4));
41529
- points.push(new Vector36(E, N, min4));
41530
- points.push(new Vector36(E, S, min4));
41595
+ points.push(new Vector36(E2, N, min4));
41596
+ points.push(new Vector36(E2, S, min4));
41531
41597
  points.push(new Vector36(W2, S, min4));
41532
41598
  points.push(new Vector36(W2, N, max4));
41533
- points.push(new Vector36(E, N, max4));
41534
- points.push(new Vector36(E, S, max4));
41599
+ points.push(new Vector36(E2, N, max4));
41600
+ points.push(new Vector36(E2, S, max4));
41535
41601
  points.push(new Vector36(W2, S, max4));
41536
41602
  return points;
41537
41603
  }
@@ -41639,7 +41705,7 @@ void main(void) {
41639
41705
  if (isChildSubtreeAvailable) {
41640
41706
  const subtreePath = `${basePath}/${subtreesUriTemplate}`;
41641
41707
  const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, lev, x2, y2, z);
41642
- const childSubtree = await (0, import_core51.load)(childSubtreeUrl, Tile3DSubtreeLoader, loaderOptions);
41708
+ const childSubtree = await (0, import_core52.load)(childSubtreeUrl, Tile3DSubtreeLoader, loaderOptions);
41643
41709
  subtree = childSubtree;
41644
41710
  globalData = {
41645
41711
  mortonIndex: childTileMortonIndex,
@@ -41867,7 +41933,7 @@ void main(void) {
41867
41933
  const { subdivisionScheme, maximumLevel, availableLevels, subtreeLevels, subtrees: { uri: subtreesUriTemplate } } = implicitTilingExtension;
41868
41934
  const replacedUrlTemplate = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);
41869
41935
  const subtreeUrl = resolveUri(replacedUrlTemplate, basePath);
41870
- const subtree = await (0, import_core52.load)(subtreeUrl, Tile3DSubtreeLoader, options);
41936
+ const subtree = await (0, import_core53.load)(subtreeUrl, Tile3DSubtreeLoader, options);
41871
41937
  const tileContentUri = tile.content?.uri;
41872
41938
  const contentUrlTemplate = tileContentUri ? resolveUri(tileContentUri, basePath) : "";
41873
41939
  const refine = tileset?.root?.refine;
@@ -42011,10 +42077,10 @@ void main(void) {
42011
42077
  } },
42012
42078
  _getMeshColor: { type: "function", value: (tileHeader) => [255, 255, 255] }
42013
42079
  };
42014
- var Tile3DLayer = class extends import_core53.CompositeLayer {
42080
+ var Tile3DLayer = class extends import_core54.CompositeLayer {
42015
42081
  initializeState() {
42016
42082
  if ("onTileLoadFail" in this.props) {
42017
- import_core53.log.removed("onTileLoadFail", "onTileError")();
42083
+ import_core54.log.removed("onTileLoadFail", "onTileError")();
42018
42084
  }
42019
42085
  this.state = {
42020
42086
  layerMap: {},
@@ -42098,7 +42164,7 @@ void main(void) {
42098
42164
  }
42099
42165
  Object.assign(options, preloadOptions);
42100
42166
  }
42101
- const tilesetJson = await (0, import_core54.load)(actualTilesetUrl, loader, options.loadOptions);
42167
+ const tilesetJson = await (0, import_core55.load)(actualTilesetUrl, loader, options.loadOptions);
42102
42168
  const tileset3d = new Tileset3D(tilesetJson, {
42103
42169
  onTileLoad: this._onTileLoad.bind(this),
42104
42170
  onTileUnload: this._onTileUnload.bind(this),
@@ -42183,7 +42249,7 @@ void main(void) {
42183
42249
  id: `${this.id}-pointcloud-${tileHeader.id}`,
42184
42250
  tile: tileHeader,
42185
42251
  data,
42186
- coordinateSystem: import_core53.COORDINATE_SYSTEM.METER_OFFSETS,
42252
+ coordinateSystem: import_core54.COORDINATE_SYSTEM.METER_OFFSETS,
42187
42253
  coordinateOrigin: cartographicOrigin,
42188
42254
  modelMatrix,
42189
42255
  getColor: constantRGBA || getPointColor,
@@ -42206,7 +42272,7 @@ void main(void) {
42206
42272
  tile: tileHeader,
42207
42273
  data: instances || SINGLE_DATA,
42208
42274
  scenegraph: gltf,
42209
- coordinateSystem: import_core53.COORDINATE_SYSTEM.METER_OFFSETS,
42275
+ coordinateSystem: import_core54.COORDINATE_SYSTEM.METER_OFFSETS,
42210
42276
  coordinateOrigin: cartographicOrigin,
42211
42277
  modelMatrix,
42212
42278
  getTransformMatrix: (instance) => instance.modelMatrix,
@@ -42222,7 +42288,7 @@ void main(void) {
42222
42288
  indices,
42223
42289
  modelMatrix,
42224
42290
  cartographicOrigin,
42225
- coordinateSystem = import_core53.COORDINATE_SYSTEM.METER_OFFSETS,
42291
+ coordinateSystem = import_core54.COORDINATE_SYSTEM.METER_OFFSETS,
42226
42292
  material,
42227
42293
  featureIds
42228
42294
  } = content;
@@ -42297,9 +42363,9 @@ void main(void) {
42297
42363
  }
42298
42364
 
42299
42365
  // src/terrain-layer/terrain-layer.ts
42300
- var import_core55 = __toESM(require_core(), 1);
42301
- var import_mesh_layers3 = __toESM(require_mesh_layers(), 1);
42302
42366
  var import_core56 = __toESM(require_core(), 1);
42367
+ var import_mesh_layers3 = __toESM(require_mesh_layers(), 1);
42368
+ var import_core57 = __toESM(require_core(), 1);
42303
42369
 
42304
42370
  // ../../node_modules/@loaders.gl/terrain/dist/lib/decode-quantized-mesh.js
42305
42371
  var QUANTIZED_MESH_HEADER = /* @__PURE__ */ new Map([
@@ -43367,7 +43433,7 @@ void main(void) {
43367
43433
  }
43368
43434
  return template || "";
43369
43435
  }
43370
- var TerrainLayer = class extends import_core55.CompositeLayer {
43436
+ var TerrainLayer = class extends import_core56.CompositeLayer {
43371
43437
  updateState({ props, oldProps }) {
43372
43438
  const elevationDataChanged = props.elevationData !== oldProps.elevationData;
43373
43439
  if (elevationDataChanged) {
@@ -43381,7 +43447,7 @@ void main(void) {
43381
43447
  this.setState({ terrain });
43382
43448
  }
43383
43449
  if (props.workerUrl) {
43384
- import_core55.log.removed("workerUrl", "loadOptions.terrain.workerUrl")();
43450
+ import_core56.log.removed("workerUrl", "loadOptions.terrain.workerUrl")();
43385
43451
  }
43386
43452
  }
43387
43453
  loadTerrain({
@@ -43452,7 +43518,7 @@ void main(void) {
43452
43518
  mesh,
43453
43519
  texture,
43454
43520
  _instanced: false,
43455
- coordinateSystem: import_core56.COORDINATE_SYSTEM.CARTESIAN,
43521
+ coordinateSystem: import_core57.COORDINATE_SYSTEM.CARTESIAN,
43456
43522
  getPosition: (d2) => [0, 0, 0],
43457
43523
  getColor: color,
43458
43524
  wireframe,
@@ -43557,7 +43623,7 @@ void main(void) {
43557
43623
  var isTileSetURL = (url) => url.includes("{x}") && (url.includes("{y}") || url.includes("{-y}"));
43558
43624
 
43559
43625
  // src/mvt-layer/mvt-layer.ts
43560
- var import_core58 = __toESM(require_core(), 1);
43626
+ var import_core59 = __toESM(require_core(), 1);
43561
43627
  var import_layers9 = __toESM(require_layers(), 1);
43562
43628
  var import_extensions = __toESM(require_extensions(), 1);
43563
43629
 
@@ -45478,12 +45544,12 @@ void main(void) {
45478
45544
  if (!this.context.viewport.resolution) {
45479
45545
  props.modelMatrix = modelMatrix;
45480
45546
  props.coordinateOrigin = [xOffset, yOffset, 0];
45481
- props.coordinateSystem = import_core58.COORDINATE_SYSTEM.CARTESIAN;
45547
+ props.coordinateSystem = import_core59.COORDINATE_SYSTEM.CARTESIAN;
45482
45548
  props.extensions = [...props.extensions || [], new import_extensions.ClipExtension()];
45483
45549
  }
45484
45550
  const subLayers = super.renderSubLayers(props);
45485
45551
  if (this.state.binary && !(subLayers instanceof import_layers9.GeoJsonLayer)) {
45486
- import_core58.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")();
45552
+ import_core59.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")();
45487
45553
  }
45488
45554
  return subLayers;
45489
45555
  }