@loaders.gl/i3s 4.3.0-alpha.7 → 4.3.0-alpha.8

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
@@ -4335,52 +4335,6 @@ var __exports__ = (() => {
4335
4335
  var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
4336
4336
  var nodeVersion = matches && parseFloat(matches[1]) || 0;
4337
4337
 
4338
- // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
4339
- function _typeof(obj) {
4340
- "@babel/helpers - typeof";
4341
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
4342
- return typeof obj2;
4343
- } : function(obj2) {
4344
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
4345
- }, _typeof(obj);
4346
- }
4347
-
4348
- // ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
4349
- function _toPrimitive(input, hint) {
4350
- if (_typeof(input) !== "object" || input === null)
4351
- return input;
4352
- var prim = input[Symbol.toPrimitive];
4353
- if (prim !== void 0) {
4354
- var res = prim.call(input, hint || "default");
4355
- if (_typeof(res) !== "object")
4356
- return res;
4357
- throw new TypeError("@@toPrimitive must return a primitive value.");
4358
- }
4359
- return (hint === "string" ? String : Number)(input);
4360
- }
4361
-
4362
- // ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
4363
- function _toPropertyKey(arg) {
4364
- var key = _toPrimitive(arg, "string");
4365
- return _typeof(key) === "symbol" ? key : String(key);
4366
- }
4367
-
4368
- // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
4369
- function _defineProperty(obj, key, value) {
4370
- key = _toPropertyKey(key);
4371
- if (key in obj) {
4372
- Object.defineProperty(obj, key, {
4373
- value,
4374
- enumerable: true,
4375
- configurable: true,
4376
- writable: true
4377
- });
4378
- } else {
4379
- obj[key] = value;
4380
- }
4381
- return obj;
4382
- }
4383
-
4384
4338
  // ../loader-utils/src/lib/module-utils/js-module-utils.ts
4385
4339
  function registerJSModules(modules) {
4386
4340
  globalThis.loaders ||= {};
@@ -4814,17 +4768,11 @@ var __exports__ = (() => {
4814
4768
  printRowMajor: true,
4815
4769
  _cartographicRadians: false
4816
4770
  };
4817
- globalThis.mathgl = globalThis.mathgl || {
4818
- config: {
4819
- ...DEFAULT_CONFIG
4820
- }
4821
- };
4771
+ globalThis.mathgl = globalThis.mathgl || { config: { ...DEFAULT_CONFIG } };
4822
4772
  var config = globalThis.mathgl.config;
4823
- function formatValue(value, {
4824
- precision = config.precision
4825
- } = {}) {
4773
+ function formatValue(value, { precision = config.precision } = {}) {
4826
4774
  value = round(value);
4827
- return "".concat(parseFloat(value.toPrecision(precision)));
4775
+ return `${parseFloat(value.toPrecision(precision))}`;
4828
4776
  }
4829
4777
  function isArray(value) {
4830
4778
  return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
@@ -4895,28 +4843,12 @@ var __exports__ = (() => {
4895
4843
  }
4896
4844
 
4897
4845
  // ../../node_modules/@math.gl/core/dist/classes/base/math-array.js
4898
- function _extendableBuiltin(cls) {
4899
- function ExtendableBuiltin() {
4900
- var instance = Reflect.construct(cls, Array.from(arguments));
4901
- Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
4902
- return instance;
4903
- }
4904
- ExtendableBuiltin.prototype = Object.create(cls.prototype, {
4905
- constructor: {
4906
- value: cls,
4907
- enumerable: false,
4908
- writable: true,
4909
- configurable: true
4910
- }
4911
- });
4912
- if (Object.setPrototypeOf) {
4913
- Object.setPrototypeOf(ExtendableBuiltin, cls);
4914
- } else {
4915
- ExtendableBuiltin.__proto__ = cls;
4916
- }
4917
- return ExtendableBuiltin;
4918
- }
4919
- var MathArray = class extends _extendableBuiltin(Array) {
4846
+ var MathArray = class extends Array {
4847
+ // Common methods
4848
+ /**
4849
+ * Clone the current object
4850
+ * @returns a new copy of this object
4851
+ */
4920
4852
  clone() {
4921
4853
  return new this.constructor().copy(this);
4922
4854
  }
@@ -4936,7 +4868,10 @@ var __exports__ = (() => {
4936
4868
  return targetObject;
4937
4869
  }
4938
4870
  from(arrayOrObject) {
4939
- return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
4871
+ return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : (
4872
+ // @ts-ignore
4873
+ this.fromObject(arrayOrObject)
4874
+ );
4940
4875
  }
4941
4876
  to(arrayOrObject) {
4942
4877
  if (arrayOrObject === this) {
@@ -4947,18 +4882,20 @@ var __exports__ = (() => {
4947
4882
  toTarget(target) {
4948
4883
  return target ? this.to(target) : this;
4949
4884
  }
4885
+ /** @deprecated */
4950
4886
  toFloat32Array() {
4951
4887
  return new Float32Array(this);
4952
4888
  }
4953
4889
  toString() {
4954
4890
  return this.formatString(config);
4955
4891
  }
4892
+ /** Formats string according to options */
4956
4893
  formatString(opts) {
4957
4894
  let string = "";
4958
4895
  for (let i = 0; i < this.ELEMENTS; ++i) {
4959
4896
  string += (i > 0 ? ", " : "") + formatValue(this[i], opts);
4960
4897
  }
4961
- return "".concat(opts.printTypes ? this.constructor.name : "", "[").concat(string, "]");
4898
+ return `${opts.printTypes ? this.constructor.name : ""}[${string}]`;
4962
4899
  }
4963
4900
  equals(array) {
4964
4901
  if (!array || this.length !== array.length) {
@@ -4982,6 +4919,8 @@ var __exports__ = (() => {
4982
4919
  }
4983
4920
  return true;
4984
4921
  }
4922
+ // Modifiers
4923
+ /** Negates all values in this object */
4985
4924
  negate() {
4986
4925
  for (let i = 0; i < this.ELEMENTS; ++i) {
4987
4926
  this[i] = -this[i];
@@ -4999,12 +4938,14 @@ var __exports__ = (() => {
4999
4938
  }
5000
4939
  return this.check();
5001
4940
  }
4941
+ /** Minimal */
5002
4942
  min(vector) {
5003
4943
  for (let i = 0; i < this.ELEMENTS; ++i) {
5004
4944
  this[i] = Math.min(vector[i], this[i]);
5005
4945
  }
5006
4946
  return this.check();
5007
4947
  }
4948
+ /** Maximal */
5008
4949
  max(vector) {
5009
4950
  for (let i = 0; i < this.ELEMENTS; ++i) {
5010
4951
  this[i] = Math.max(vector[i], this[i]);
@@ -5045,18 +4986,25 @@ var __exports__ = (() => {
5045
4986
  }
5046
4987
  return this.check();
5047
4988
  }
4989
+ /**
4990
+ * Multiplies all elements by `scale`
4991
+ * Note: `Matrix4.multiplyByScalar` only scales its 3x3 "minor"
4992
+ */
5048
4993
  multiplyByScalar(scalar) {
5049
4994
  for (let i = 0; i < this.ELEMENTS; ++i) {
5050
4995
  this[i] *= scalar;
5051
4996
  }
5052
4997
  return this.check();
5053
4998
  }
4999
+ // Debug checks
5000
+ /** Throws an error if array length is incorrect or contains illegal values */
5054
5001
  check() {
5055
5002
  if (config.debug && !this.validate()) {
5056
- throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
5003
+ throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);
5057
5004
  }
5058
5005
  return this;
5059
5006
  }
5007
+ /** Returns false if the array length is incorrect or contains illegal values */
5060
5008
  validate() {
5061
5009
  let valid = this.length === this.ELEMENTS;
5062
5010
  for (let i = 0; i < this.ELEMENTS; ++i) {
@@ -5064,39 +5012,48 @@ var __exports__ = (() => {
5064
5012
  }
5065
5013
  return valid;
5066
5014
  }
5015
+ // three.js compatibility
5016
+ /** @deprecated */
5067
5017
  sub(a) {
5068
5018
  return this.subtract(a);
5069
5019
  }
5020
+ /** @deprecated */
5070
5021
  setScalar(a) {
5071
5022
  for (let i = 0; i < this.ELEMENTS; ++i) {
5072
5023
  this[i] = a;
5073
5024
  }
5074
5025
  return this.check();
5075
5026
  }
5027
+ /** @deprecated */
5076
5028
  addScalar(a) {
5077
5029
  for (let i = 0; i < this.ELEMENTS; ++i) {
5078
5030
  this[i] += a;
5079
5031
  }
5080
5032
  return this.check();
5081
5033
  }
5034
+ /** @deprecated */
5082
5035
  subScalar(a) {
5083
5036
  return this.addScalar(-a);
5084
5037
  }
5038
+ /** @deprecated */
5085
5039
  multiplyScalar(scalar) {
5086
5040
  for (let i = 0; i < this.ELEMENTS; ++i) {
5087
5041
  this[i] *= scalar;
5088
5042
  }
5089
5043
  return this.check();
5090
5044
  }
5045
+ /** @deprecated */
5091
5046
  divideScalar(a) {
5092
5047
  return this.multiplyByScalar(1 / a);
5093
5048
  }
5049
+ /** @deprecated */
5094
5050
  clampScalar(min2, max2) {
5095
5051
  for (let i = 0; i < this.ELEMENTS; ++i) {
5096
5052
  this[i] = Math.min(Math.max(this[i], min2), max2);
5097
5053
  }
5098
5054
  return this.check();
5099
5055
  }
5056
+ /** @deprecated */
5100
5057
  get elements() {
5101
5058
  return this;
5102
5059
  }
@@ -5116,13 +5073,13 @@ var __exports__ = (() => {
5116
5073
  }
5117
5074
  function checkNumber(value) {
5118
5075
  if (!Number.isFinite(value)) {
5119
- throw new Error("Invalid number ".concat(JSON.stringify(value)));
5076
+ throw new Error(`Invalid number ${JSON.stringify(value)}`);
5120
5077
  }
5121
5078
  return value;
5122
5079
  }
5123
5080
  function checkVector(v, length4, callerName = "") {
5124
5081
  if (config.debug && !validateVector(v, length4)) {
5125
- throw new Error("math.gl: ".concat(callerName, " some fields set to invalid numbers'"));
5082
+ throw new Error(`math.gl: ${callerName} some fields set to invalid numbers'`);
5126
5083
  }
5127
5084
  return v;
5128
5085
  }
@@ -5130,12 +5087,13 @@ var __exports__ = (() => {
5130
5087
  // ../../node_modules/@math.gl/core/dist/lib/assert.js
5131
5088
  function assert3(condition, message) {
5132
5089
  if (!condition) {
5133
- throw new Error("math.gl assertion ".concat(message));
5090
+ throw new Error(`math.gl assertion ${message}`);
5134
5091
  }
5135
5092
  }
5136
5093
 
5137
5094
  // ../../node_modules/@math.gl/core/dist/classes/base/vector.js
5138
5095
  var Vector = class extends MathArray {
5096
+ // ACCESSORS
5139
5097
  get x() {
5140
5098
  return this[0];
5141
5099
  }
@@ -5148,12 +5106,24 @@ var __exports__ = (() => {
5148
5106
  set y(value) {
5149
5107
  this[1] = checkNumber(value);
5150
5108
  }
5109
+ /**
5110
+ * Returns the length of the vector from the origin to the point described by this vector
5111
+ *
5112
+ * @note `length` is a reserved word for Arrays, so `v.length()` will return number of elements
5113
+ * Instead we provide `len` and `magnitude`
5114
+ */
5151
5115
  len() {
5152
5116
  return Math.sqrt(this.lengthSquared());
5153
5117
  }
5118
+ /**
5119
+ * Returns the length of the vector from the origin to the point described by this vector
5120
+ */
5154
5121
  magnitude() {
5155
5122
  return this.len();
5156
5123
  }
5124
+ /**
5125
+ * Returns the squared length of the vector from the origin to the point described by this vector
5126
+ */
5157
5127
  lengthSquared() {
5158
5128
  let length4 = 0;
5159
5129
  for (let i = 0; i < this.ELEMENTS; ++i) {
@@ -5161,6 +5131,9 @@ var __exports__ = (() => {
5161
5131
  }
5162
5132
  return length4;
5163
5133
  }
5134
+ /**
5135
+ * Returns the squared length of the vector from the origin to the point described by this vector
5136
+ */
5164
5137
  magnitudeSquared() {
5165
5138
  return this.lengthSquared();
5166
5139
  }
@@ -5182,6 +5155,7 @@ var __exports__ = (() => {
5182
5155
  }
5183
5156
  return checkNumber(product);
5184
5157
  }
5158
+ // MODIFIERS
5185
5159
  normalize() {
5186
5160
  const length4 = this.magnitude();
5187
5161
  if (length4 !== 0) {
@@ -5207,6 +5181,7 @@ var __exports__ = (() => {
5207
5181
  }
5208
5182
  return this.check();
5209
5183
  }
5184
+ // THREE.js compatibility
5210
5185
  lengthSq() {
5211
5186
  return this.lengthSquared();
5212
5187
  }
@@ -5724,7 +5699,7 @@ var __exports__ = (() => {
5724
5699
  return out;
5725
5700
  }
5726
5701
  function str(a) {
5727
- return "vec3(".concat(a[0], ", ").concat(a[1], ", ").concat(a[2], ")");
5702
+ return `vec3(${a[0]}, ${a[1]}, ${a[2]})`;
5728
5703
  }
5729
5704
  function exactEquals(a, b) {
5730
5705
  return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
@@ -5785,6 +5760,12 @@ var __exports__ = (() => {
5785
5760
  }
5786
5761
  return ZERO;
5787
5762
  }
5763
+ /**
5764
+ * @class
5765
+ * @param x
5766
+ * @param y
5767
+ * @param z
5768
+ */
5788
5769
  constructor(x = 0, y = 0, z = 0) {
5789
5770
  super(-0, -0, -0);
5790
5771
  if (arguments.length === 1 && isArray(x)) {
@@ -5829,6 +5810,7 @@ var __exports__ = (() => {
5829
5810
  object.z = this[2];
5830
5811
  return object;
5831
5812
  }
5813
+ // Getters/setters
5832
5814
  get ELEMENTS() {
5833
5815
  return 3;
5834
5816
  }
@@ -5838,41 +5820,38 @@ var __exports__ = (() => {
5838
5820
  set z(value) {
5839
5821
  this[2] = checkNumber(value);
5840
5822
  }
5823
+ // ACCESSORS
5841
5824
  angle(vector) {
5842
5825
  return angle(this, vector);
5843
5826
  }
5827
+ // MODIFIERS
5844
5828
  cross(vector) {
5845
5829
  cross(this, this, vector);
5846
5830
  return this.check();
5847
5831
  }
5848
- rotateX({
5849
- radians: radians2,
5850
- origin = ORIGIN
5851
- }) {
5832
+ rotateX({ radians: radians2, origin = ORIGIN }) {
5852
5833
  rotateX(this, this, origin, radians2);
5853
5834
  return this.check();
5854
5835
  }
5855
- rotateY({
5856
- radians: radians2,
5857
- origin = ORIGIN
5858
- }) {
5836
+ rotateY({ radians: radians2, origin = ORIGIN }) {
5859
5837
  rotateY(this, this, origin, radians2);
5860
5838
  return this.check();
5861
5839
  }
5862
- rotateZ({
5863
- radians: radians2,
5864
- origin = ORIGIN
5865
- }) {
5840
+ rotateZ({ radians: radians2, origin = ORIGIN }) {
5866
5841
  rotateZ(this, this, origin, radians2);
5867
5842
  return this.check();
5868
5843
  }
5844
+ // Transforms
5845
+ // transforms as point (4th component is implicitly 1)
5869
5846
  transform(matrix4) {
5870
5847
  return this.transformAsPoint(matrix4);
5871
5848
  }
5849
+ // transforms as point (4th component is implicitly 1)
5872
5850
  transformAsPoint(matrix4) {
5873
5851
  transformMat42(this, this, matrix4);
5874
5852
  return this.check();
5875
5853
  }
5854
+ // transforms as vector (4th component is implicitly 0, ignores translation. slightly faster)
5876
5855
  transformAsVector(matrix4) {
5877
5856
  vec3_transformMat4AsVector(this, this, matrix4);
5878
5857
  return this.check();
@@ -5952,6 +5931,8 @@ var __exports__ = (() => {
5952
5931
  object.w = this[3];
5953
5932
  return object;
5954
5933
  }
5934
+ // Getters/setters
5935
+ /* eslint-disable no-multi-spaces, brace-style, no-return-assign */
5955
5936
  get ELEMENTS() {
5956
5937
  return 4;
5957
5938
  }
@@ -5983,6 +5964,7 @@ var __exports__ = (() => {
5983
5964
  transformQuat(this, this, quaternion);
5984
5965
  return this.check();
5985
5966
  }
5967
+ // three.js compatibility
5986
5968
  applyMatrix4(m) {
5987
5969
  m.transform(this, this);
5988
5970
  return this;
@@ -5991,19 +5973,29 @@ var __exports__ = (() => {
5991
5973
 
5992
5974
  // ../../node_modules/@math.gl/core/dist/classes/base/matrix.js
5993
5975
  var Matrix = class extends MathArray {
5976
+ // fromObject(object) {
5977
+ // const array = object.elements;
5978
+ // return this.fromRowMajor(array);
5979
+ // }
5980
+ // toObject(object) {
5981
+ // const array = object.elements;
5982
+ // this.toRowMajor(array);
5983
+ // return object;
5984
+ // }
5985
+ // TODO better override formatString?
5994
5986
  toString() {
5995
5987
  let string = "[";
5996
5988
  if (config.printRowMajor) {
5997
5989
  string += "row-major:";
5998
5990
  for (let row = 0; row < this.RANK; ++row) {
5999
5991
  for (let col = 0; col < this.RANK; ++col) {
6000
- string += " ".concat(this[col * this.RANK + row]);
5992
+ string += ` ${this[col * this.RANK + row]}`;
6001
5993
  }
6002
5994
  }
6003
5995
  } else {
6004
5996
  string += "column-major:";
6005
5997
  for (let i = 0; i < this.ELEMENTS; ++i) {
6006
- string += " ".concat(this[i]);
5998
+ string += ` ${this[i]}`;
6007
5999
  }
6008
6000
  }
6009
6001
  string += "]";
@@ -6012,9 +6004,11 @@ var __exports__ = (() => {
6012
6004
  getElementIndex(row, col) {
6013
6005
  return col * this.RANK + row;
6014
6006
  }
6007
+ // By default assumes row major indices
6015
6008
  getElement(row, col) {
6016
6009
  return this[col * this.RANK + row];
6017
6010
  }
6011
+ // By default assumes row major indices
6018
6012
  setElement(row, col, value) {
6019
6013
  this[col * this.RANK + row] = checkNumber(value);
6020
6014
  return this;
@@ -6287,16 +6281,30 @@ var __exports__ = (() => {
6287
6281
  this[8] = array[8];
6288
6282
  return this.check();
6289
6283
  }
6284
+ // Constructors
6290
6285
  identity() {
6291
6286
  return this.copy(IDENTITY_MATRIX);
6292
6287
  }
6288
+ /**
6289
+ *
6290
+ * @param object
6291
+ * @returns self
6292
+ */
6293
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
6293
6294
  fromObject(object) {
6294
6295
  return this.check();
6295
6296
  }
6297
+ /** Calculates a 3x3 matrix from the given quaternion
6298
+ * q quat Quaternion to create matrix from
6299
+ */
6296
6300
  fromQuaternion(q) {
6297
6301
  fromQuat(this, q);
6298
6302
  return this.check();
6299
6303
  }
6304
+ /**
6305
+ * accepts column major order, stores in column major order
6306
+ */
6307
+ // eslint-disable-next-line max-params
6300
6308
  set(m00, m10, m20, m01, m11, m21, m02, m12, m22) {
6301
6309
  this[0] = m00;
6302
6310
  this[1] = m10;
@@ -6309,6 +6317,10 @@ var __exports__ = (() => {
6309
6317
  this[8] = m22;
6310
6318
  return this.check();
6311
6319
  }
6320
+ /**
6321
+ * accepts row major order, stores as column major
6322
+ */
6323
+ // eslint-disable-next-line max-params
6312
6324
  setRowMajor(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
6313
6325
  this[0] = m00;
6314
6326
  this[1] = m10;
@@ -6321,17 +6333,21 @@ var __exports__ = (() => {
6321
6333
  this[8] = m22;
6322
6334
  return this.check();
6323
6335
  }
6336
+ // Accessors
6324
6337
  determinant() {
6325
6338
  return determinant(this);
6326
6339
  }
6340
+ // Modifiers
6327
6341
  transpose() {
6328
6342
  transpose(this, this);
6329
6343
  return this.check();
6330
6344
  }
6345
+ /** Invert a matrix. Note that this can fail if the matrix is not invertible */
6331
6346
  invert() {
6332
6347
  invert(this, this);
6333
6348
  return this.check();
6334
6349
  }
6350
+ // Operations
6335
6351
  multiplyLeft(a) {
6336
6352
  multiply2(this, a, this);
6337
6353
  return this.check();
@@ -6356,6 +6372,7 @@ var __exports__ = (() => {
6356
6372
  translate(this, this, vec);
6357
6373
  return this.check();
6358
6374
  }
6375
+ // Transforms
6359
6376
  transform(vector, result) {
6360
6377
  let out;
6361
6378
  switch (vector.length) {
@@ -6374,12 +6391,15 @@ var __exports__ = (() => {
6374
6391
  checkVector(out, vector.length);
6375
6392
  return out;
6376
6393
  }
6394
+ /** @deprecated */
6377
6395
  transformVector(vector, result) {
6378
6396
  return this.transform(vector, result);
6379
6397
  }
6398
+ /** @deprecated */
6380
6399
  transformVector2(vector, result) {
6381
6400
  return this.transform(vector, result);
6382
6401
  }
6402
+ /** @deprecated */
6383
6403
  transformVector3(vector, result) {
6384
6404
  return this.transform(vector, result);
6385
6405
  }
@@ -7750,7 +7770,7 @@ var __exports__ = (() => {
7750
7770
  return out;
7751
7771
  }
7752
7772
  function str2(a) {
7753
- return "mat4(".concat(a[0], ", ").concat(a[1], ", ").concat(a[2], ", ").concat(a[3], ", ").concat(a[4], ", ").concat(a[5], ", ").concat(a[6], ", ").concat(a[7], ", ").concat(a[8], ", ").concat(a[9], ", ").concat(a[10], ", ").concat(a[11], ", ").concat(a[12], ", ").concat(a[13], ", ").concat(a[14], ", ").concat(a[15], ")");
7773
+ return `mat4(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]}, ${a[4]}, ${a[5]}, ${a[6]}, ${a[7]}, ${a[8]}, ${a[9]}, ${a[10]}, ${a[11]}, ${a[12]}, ${a[13]}, ${a[14]}, ${a[15]})`;
7754
7774
  }
7755
7775
  function frob(a) {
7756
7776
  return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15]);
@@ -8068,6 +8088,7 @@ var __exports__ = (() => {
8068
8088
  this[15] = array[15];
8069
8089
  return this.check();
8070
8090
  }
8091
+ // eslint-disable-next-line max-params
8071
8092
  set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {
8072
8093
  this[0] = m00;
8073
8094
  this[1] = m10;
@@ -8087,6 +8108,8 @@ var __exports__ = (() => {
8087
8108
  this[15] = m33;
8088
8109
  return this.check();
8089
8110
  }
8111
+ // accepts row major order, stores as column major
8112
+ // eslint-disable-next-line max-params
8090
8113
  setRowMajor(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
8091
8114
  this[0] = m00;
8092
8115
  this[1] = m10;
@@ -8125,25 +8148,41 @@ var __exports__ = (() => {
8125
8148
  result[15] = this[15];
8126
8149
  return result;
8127
8150
  }
8151
+ // Constructors
8152
+ /** Set to identity matrix */
8128
8153
  identity() {
8129
8154
  return this.copy(IDENTITY_MATRIX2);
8130
8155
  }
8156
+ /**
8157
+ *
8158
+ * @param object
8159
+ * @returns self
8160
+ */
8161
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
8131
8162
  fromObject(object) {
8132
8163
  return this.check();
8133
8164
  }
8165
+ /**
8166
+ * Calculates a 4x4 matrix from the given quaternion
8167
+ * @param quaternion Quaternion to create matrix from
8168
+ * @returns self
8169
+ */
8134
8170
  fromQuaternion(quaternion) {
8135
8171
  fromQuat3(this, quaternion);
8136
8172
  return this.check();
8137
8173
  }
8174
+ /**
8175
+ * Generates a frustum matrix with the given bounds
8176
+ * @param view.left - Left bound of the frustum
8177
+ * @param view.right - Right bound of the frustum
8178
+ * @param view.bottom - Bottom bound of the frustum
8179
+ * @param view.top - Top bound of the frustum
8180
+ * @param view.near - Near bound of the frustum
8181
+ * @param view.far - Far bound of the frustum. Can be set to Infinity.
8182
+ * @returns self
8183
+ */
8138
8184
  frustum(view) {
8139
- const {
8140
- left,
8141
- right,
8142
- bottom,
8143
- top,
8144
- near = DEFAULT_NEAR,
8145
- far = DEFAULT_FAR
8146
- } = view;
8185
+ const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
8147
8186
  if (far === Infinity) {
8148
8187
  computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
8149
8188
  } else {
@@ -8151,35 +8190,47 @@ var __exports__ = (() => {
8151
8190
  }
8152
8191
  return this.check();
8153
8192
  }
8193
+ /**
8194
+ * Generates a look-at matrix with the given eye position, focal point,
8195
+ * and up axis
8196
+ * @param view.eye - (vector) Position of the viewer
8197
+ * @param view.center - (vector) Point the viewer is looking at
8198
+ * @param view.up - (vector) Up axis
8199
+ * @returns self
8200
+ */
8154
8201
  lookAt(view) {
8155
- const {
8156
- eye,
8157
- center = [0, 0, 0],
8158
- up = [0, 1, 0]
8159
- } = view;
8202
+ const { eye, center = [0, 0, 0], up = [0, 1, 0] } = view;
8160
8203
  lookAt(this, eye, center, up);
8161
8204
  return this.check();
8162
8205
  }
8206
+ /**
8207
+ * Generates a orthogonal projection matrix with the given bounds
8208
+ * from "traditional" view space parameters
8209
+ * @param view.left - Left bound of the frustum
8210
+ * @param view.right number Right bound of the frustum
8211
+ * @param view.bottom - Bottom bound of the frustum
8212
+ * @param view.top number Top bound of the frustum
8213
+ * @param view.near - Near bound of the frustum
8214
+ * @param view.far number Far bound of the frustum
8215
+ * @returns self
8216
+ */
8163
8217
  ortho(view) {
8164
- const {
8165
- left,
8166
- right,
8167
- bottom,
8168
- top,
8169
- near = DEFAULT_NEAR,
8170
- far = DEFAULT_FAR
8171
- } = view;
8218
+ const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
8172
8219
  ortho(this, left, right, bottom, top, near, far);
8173
8220
  return this.check();
8174
8221
  }
8222
+ /**
8223
+ * Generates an orthogonal projection matrix with the same parameters
8224
+ * as a perspective matrix (plus focalDistance)
8225
+ * @param view.fovy Vertical field of view in radians
8226
+ * @param view.aspect Aspect ratio. Typically viewport width / viewport height
8227
+ * @param view.focalDistance Distance in the view frustum used for extent calculations
8228
+ * @param view.near Near bound of the frustum
8229
+ * @param view.far Far bound of the frustum
8230
+ * @returns self
8231
+ */
8175
8232
  orthographic(view) {
8176
- const {
8177
- fovy = DEFAULT_FOVY,
8178
- aspect = DEFAULT_ASPECT,
8179
- focalDistance = 1,
8180
- near = DEFAULT_NEAR,
8181
- far = DEFAULT_FAR
8182
- } = view;
8233
+ const { fovy = DEFAULT_FOVY, aspect = DEFAULT_ASPECT, focalDistance = 1, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
8183
8234
  checkRadians(fovy);
8184
8235
  const halfY = fovy / 2;
8185
8236
  const top = focalDistance * Math.tan(halfY);
@@ -8193,32 +8244,53 @@ var __exports__ = (() => {
8193
8244
  far
8194
8245
  });
8195
8246
  }
8247
+ /**
8248
+ * Generates a perspective projection matrix with the given bounds
8249
+ * @param view.fovy Vertical field of view in radians
8250
+ * @param view.aspect Aspect ratio. typically viewport width/height
8251
+ * @param view.near Near bound of the frustum
8252
+ * @param view.far Far bound of the frustum
8253
+ * @returns self
8254
+ */
8196
8255
  perspective(view) {
8197
- const {
8198
- fovy = 45 * Math.PI / 180,
8199
- aspect = 1,
8200
- near = 0.1,
8201
- far = 500
8202
- } = view;
8256
+ const { fovy = 45 * Math.PI / 180, aspect = 1, near = 0.1, far = 500 } = view;
8203
8257
  checkRadians(fovy);
8204
8258
  perspective(this, fovy, aspect, near, far);
8205
8259
  return this.check();
8206
8260
  }
8261
+ // Accessors
8207
8262
  determinant() {
8208
8263
  return determinant2(this);
8209
8264
  }
8265
+ /**
8266
+ * Extracts the non-uniform scale assuming the matrix is an affine transformation.
8267
+ * The scales are the "lengths" of the column vectors in the upper-left 3x3 matrix.
8268
+ * @param result
8269
+ * @returns self
8270
+ */
8210
8271
  getScale(result = [-0, -0, -0]) {
8211
8272
  result[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]);
8212
8273
  result[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]);
8213
8274
  result[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]);
8214
8275
  return result;
8215
8276
  }
8277
+ /**
8278
+ * Gets the translation portion, assuming the matrix is a affine transformation matrix.
8279
+ * @param result
8280
+ * @returns self
8281
+ */
8216
8282
  getTranslation(result = [-0, -0, -0]) {
8217
8283
  result[0] = this[12];
8218
8284
  result[1] = this[13];
8219
8285
  result[2] = this[14];
8220
8286
  return result;
8221
8287
  }
8288
+ /**
8289
+ * Gets upper left 3x3 pure rotation matrix (non-scaling), assume affine transformation matrix
8290
+ * @param result
8291
+ * @param scaleResult
8292
+ * @returns self
8293
+ */
8222
8294
  getRotation(result, scaleResult) {
8223
8295
  result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
8224
8296
  scaleResult = scaleResult || [-0, -0, -0];
@@ -8244,6 +8316,12 @@ var __exports__ = (() => {
8244
8316
  result[15] = 1;
8245
8317
  return result;
8246
8318
  }
8319
+ /**
8320
+ *
8321
+ * @param result
8322
+ * @param scaleResult
8323
+ * @returns self
8324
+ */
8247
8325
  getRotationMatrix3(result, scaleResult) {
8248
8326
  result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
8249
8327
  scaleResult = scaleResult || [-0, -0, -0];
@@ -8262,6 +8340,7 @@ var __exports__ = (() => {
8262
8340
  result[8] = this[10] * inverseScale2;
8263
8341
  return result;
8264
8342
  }
8343
+ // Modifiers
8265
8344
  transpose() {
8266
8345
  transpose2(this, this);
8267
8346
  return this.check();
@@ -8270,6 +8349,7 @@ var __exports__ = (() => {
8270
8349
  invert2(this, this);
8271
8350
  return this.check();
8272
8351
  }
8352
+ // Operations
8273
8353
  multiplyLeft(a) {
8274
8354
  multiply3(this, a, this);
8275
8355
  return this.check();
@@ -8278,33 +8358,68 @@ var __exports__ = (() => {
8278
8358
  multiply3(this, this, a);
8279
8359
  return this.check();
8280
8360
  }
8361
+ // Rotates a matrix by the given angle around the X axis
8281
8362
  rotateX(radians2) {
8282
8363
  rotateX2(this, this, radians2);
8283
8364
  return this.check();
8284
8365
  }
8366
+ // Rotates a matrix by the given angle around the Y axis.
8285
8367
  rotateY(radians2) {
8286
8368
  rotateY2(this, this, radians2);
8287
8369
  return this.check();
8288
8370
  }
8371
+ /**
8372
+ * Rotates a matrix by the given angle around the Z axis.
8373
+ * @param radians
8374
+ * @returns self
8375
+ */
8289
8376
  rotateZ(radians2) {
8290
8377
  rotateZ2(this, this, radians2);
8291
8378
  return this.check();
8292
8379
  }
8380
+ /**
8381
+ *
8382
+ * @param param0
8383
+ * @returns self
8384
+ */
8293
8385
  rotateXYZ(angleXYZ) {
8294
8386
  return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
8295
8387
  }
8388
+ /**
8389
+ *
8390
+ * @param radians
8391
+ * @param axis
8392
+ * @returns self
8393
+ */
8296
8394
  rotateAxis(radians2, axis) {
8297
8395
  rotate2(this, this, radians2, axis);
8298
8396
  return this.check();
8299
8397
  }
8398
+ /**
8399
+ *
8400
+ * @param factor
8401
+ * @returns self
8402
+ */
8300
8403
  scale(factor) {
8301
8404
  scale3(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
8302
8405
  return this.check();
8303
8406
  }
8407
+ /**
8408
+ *
8409
+ * @param vec
8410
+ * @returns self
8411
+ */
8304
8412
  translate(vector) {
8305
8413
  translate2(this, this, vector);
8306
8414
  return this.check();
8307
8415
  }
8416
+ // Transforms
8417
+ /**
8418
+ * Transforms any 2, 3 or 4 element vector. 2 and 3 elements are treated as points
8419
+ * @param vector
8420
+ * @param result
8421
+ * @returns self
8422
+ */
8308
8423
  transform(vector, result) {
8309
8424
  if (vector.length === 4) {
8310
8425
  result = transformMat43(result || [-0, -0, -0, -0], vector, this);
@@ -8313,10 +8428,14 @@ var __exports__ = (() => {
8313
8428
  }
8314
8429
  return this.transformAsPoint(vector, result);
8315
8430
  }
8431
+ /**
8432
+ * Transforms any 2 or 3 element array as point (w implicitly 1)
8433
+ * @param vector
8434
+ * @param result
8435
+ * @returns self
8436
+ */
8316
8437
  transformAsPoint(vector, result) {
8317
- const {
8318
- length: length4
8319
- } = vector;
8438
+ const { length: length4 } = vector;
8320
8439
  let out;
8321
8440
  switch (length4) {
8322
8441
  case 2:
@@ -8331,6 +8450,12 @@ var __exports__ = (() => {
8331
8450
  checkVector(out, vector.length);
8332
8451
  return out;
8333
8452
  }
8453
+ /**
8454
+ * Transforms any 2 or 3 element array as vector (w implicitly 0)
8455
+ * @param vector
8456
+ * @param result
8457
+ * @returns self
8458
+ */
8334
8459
  transformAsVector(vector, result) {
8335
8460
  let out;
8336
8461
  switch (vector.length) {
@@ -8346,15 +8471,19 @@ var __exports__ = (() => {
8346
8471
  checkVector(out, vector.length);
8347
8472
  return out;
8348
8473
  }
8474
+ /** @deprecated */
8349
8475
  transformPoint(vector, result) {
8350
8476
  return this.transformAsPoint(vector, result);
8351
8477
  }
8478
+ /** @deprecated */
8352
8479
  transformVector(vector, result) {
8353
8480
  return this.transformAsPoint(vector, result);
8354
8481
  }
8482
+ /** @deprecated */
8355
8483
  transformDirection(vector, result) {
8356
8484
  return this.transformAsVector(vector, result);
8357
8485
  }
8486
+ // three.js math API compatibility
8358
8487
  makeRotationX(radians2) {
8359
8488
  return this.identity().rotateX(radians2);
8360
8489
  }
@@ -8681,6 +8810,13 @@ var __exports__ = (() => {
8681
8810
  this[3] = object.w;
8682
8811
  return this.check();
8683
8812
  }
8813
+ /**
8814
+ * Creates a quaternion from the given 3x3 rotation matrix.
8815
+ * NOTE: The resultant quaternion is not normalized, so you should
8816
+ * be sure to renormalize the quaternion yourself where necessary.
8817
+ * @param m
8818
+ * @returns
8819
+ */
8684
8820
  fromMatrix3(m) {
8685
8821
  fromMat3(this, m);
8686
8822
  return this.check();
@@ -8689,13 +8825,21 @@ var __exports__ = (() => {
8689
8825
  setAxisAngle(this, axis, rad);
8690
8826
  return this.check();
8691
8827
  }
8828
+ /** Set a quat to the identity quaternion */
8692
8829
  identity() {
8693
8830
  identity2(this);
8694
8831
  return this.check();
8695
8832
  }
8833
+ // Set the components of a quat to the given values
8834
+ // set(i, j, k, l) {
8835
+ // quat_set(this, i, j, k, l);
8836
+ // return this.check();
8837
+ // }
8838
+ // Sets a quat from the given angle and rotation axis, then returns it.
8696
8839
  setAxisAngle(axis, rad) {
8697
8840
  return this.fromAxisRotation(axis, rad);
8698
8841
  }
8842
+ // Getters/setters
8699
8843
  get ELEMENTS() {
8700
8844
  return 4;
8701
8845
  }
@@ -8723,35 +8867,72 @@ var __exports__ = (() => {
8723
8867
  set w(value) {
8724
8868
  this[3] = checkNumber(value);
8725
8869
  }
8870
+ // Calculates the length of a quat
8726
8871
  len() {
8727
8872
  return length3(this);
8728
8873
  }
8874
+ // Calculates the squared length of a quat
8729
8875
  lengthSquared() {
8730
8876
  return squaredLength3(this);
8731
8877
  }
8878
+ // Calculates the dot product of two quat's
8879
+ // @return {Number}
8732
8880
  dot(a) {
8733
8881
  return dot3(this, a);
8734
8882
  }
8883
+ // Gets the rotation axis and angle for a given quaternion.
8884
+ // If a quaternion is created with setAxisAngle, this method will
8885
+ // return the same values as providied in the original parameter
8886
+ // list OR functionally equivalent values.
8887
+ // Example: The quaternion formed by axis [0, 0, 1] and angle -90
8888
+ // is the same as the quaternion formed by [0, 0, 1] and 270.
8889
+ // This method favors the latter.
8890
+ // @return {{[x,y,z], Number}}
8891
+ // getAxisAngle() {
8892
+ // const axis = [];
8893
+ // // const angle = quat_getAxisAngle(axis, this);
8894
+ // return {axis, angle};
8895
+ // }
8896
+ // MODIFIERS
8897
+ // Sets a quaternion to represent the shortest rotation from one vector
8898
+ // to another. Both vectors are assumed to be unit length.
8735
8899
  rotationTo(vectorA, vectorB) {
8736
8900
  rotationTo(this, vectorA, vectorB);
8737
8901
  return this.check();
8738
8902
  }
8903
+ // Sets the specified quaternion with values corresponding to the given axes.
8904
+ // Each axis is a vec3 and is expected to be unit length and perpendicular
8905
+ // to all other specified axes.
8906
+ // setAxes() {
8907
+ // Number
8908
+ // }
8909
+ // Performs a spherical linear interpolation with two control points
8910
+ // sqlerp() {
8911
+ // Number;
8912
+ // }
8913
+ // Adds two quat's
8739
8914
  add(a) {
8740
8915
  add4(this, this, a);
8741
8916
  return this.check();
8742
8917
  }
8918
+ // Calculates the W component of a quat from the X, Y, and Z components.
8919
+ // Any existing W component will be ignored.
8743
8920
  calculateW() {
8744
8921
  calculateW(this, this);
8745
8922
  return this.check();
8746
8923
  }
8924
+ // Calculates the conjugate of a quat If the quaternion is normalized,
8925
+ // this function is faster than quat_invert and produces the same result.
8747
8926
  conjugate() {
8748
8927
  conjugate(this, this);
8749
8928
  return this.check();
8750
8929
  }
8930
+ // Calculates the inverse of a quat
8751
8931
  invert() {
8752
8932
  invert3(this, this);
8753
8933
  return this.check();
8754
8934
  }
8935
+ // Performs a linear interpolation between two quat's
8755
8936
  lerp(a, b, t) {
8756
8937
  if (t === void 0) {
8757
8938
  return this.lerp(this, a, b);
@@ -8759,6 +8940,7 @@ var __exports__ = (() => {
8759
8940
  lerp3(this, a, b, t);
8760
8941
  return this.check();
8761
8942
  }
8943
+ // Multiplies two quat's
8762
8944
  multiplyRight(a) {
8763
8945
  multiply4(this, this, a);
8764
8946
  return this.check();
@@ -8767,6 +8949,7 @@ var __exports__ = (() => {
8767
8949
  multiply4(this, a, this);
8768
8950
  return this.check();
8769
8951
  }
8952
+ // Normalize a quat
8770
8953
  normalize() {
8771
8954
  const length4 = this.len();
8772
8955
  const l = length4 > 0 ? 1 / length4 : 0;
@@ -8779,22 +8962,27 @@ var __exports__ = (() => {
8779
8962
  }
8780
8963
  return this.check();
8781
8964
  }
8965
+ // Rotates a quaternion by the given angle about the X axis
8782
8966
  rotateX(rad) {
8783
8967
  rotateX3(this, this, rad);
8784
8968
  return this.check();
8785
8969
  }
8970
+ // Rotates a quaternion by the given angle about the Y axis
8786
8971
  rotateY(rad) {
8787
8972
  rotateY3(this, this, rad);
8788
8973
  return this.check();
8789
8974
  }
8975
+ // Rotates a quaternion by the given angle about the Z axis
8790
8976
  rotateZ(rad) {
8791
8977
  rotateZ3(this, this, rad);
8792
8978
  return this.check();
8793
8979
  }
8980
+ // Scales a quat by a scalar number
8794
8981
  scale(b) {
8795
8982
  scale5(this, this, b);
8796
8983
  return this.check();
8797
8984
  }
8985
+ // Performs a spherical linear interpolation between two quat
8798
8986
  slerp(arg0, arg1, arg2) {
8799
8987
  let start;
8800
8988
  let target;
@@ -8824,6 +9012,7 @@ var __exports__ = (() => {
8824
9012
  transformQuat2(result, vector, this);
8825
9013
  return checkVector(result, 4);
8826
9014
  }
9015
+ // THREE.js Math API compatibility
8827
9016
  lengthSq() {
8828
9017
  return this.lengthSquared();
8829
9018
  }
@@ -8959,11 +9148,20 @@ var __exports__ = (() => {
8959
9148
  var WGS84_RADIUS_Z = 6356752314245179e-9;
8960
9149
  var WGS84_CONSTANTS = {
8961
9150
  radii: [WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z],
8962
- radiiSquared: [WGS84_RADIUS_X * WGS84_RADIUS_X, WGS84_RADIUS_Y * WGS84_RADIUS_Y, WGS84_RADIUS_Z * WGS84_RADIUS_Z],
9151
+ radiiSquared: [
9152
+ WGS84_RADIUS_X * WGS84_RADIUS_X,
9153
+ WGS84_RADIUS_Y * WGS84_RADIUS_Y,
9154
+ WGS84_RADIUS_Z * WGS84_RADIUS_Z
9155
+ ],
8963
9156
  oneOverRadii: [1 / WGS84_RADIUS_X, 1 / WGS84_RADIUS_Y, 1 / WGS84_RADIUS_Z],
8964
- oneOverRadiiSquared: [1 / (WGS84_RADIUS_X * WGS84_RADIUS_X), 1 / (WGS84_RADIUS_Y * WGS84_RADIUS_Y), 1 / (WGS84_RADIUS_Z * WGS84_RADIUS_Z)],
9157
+ oneOverRadiiSquared: [
9158
+ 1 / (WGS84_RADIUS_X * WGS84_RADIUS_X),
9159
+ 1 / (WGS84_RADIUS_Y * WGS84_RADIUS_Y),
9160
+ 1 / (WGS84_RADIUS_Z * WGS84_RADIUS_Z)
9161
+ ],
8965
9162
  maximumRadius: Math.max(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z),
8966
9163
  centerToleranceSquared: 0.1
9164
+ // EPSILON1;
8967
9165
  };
8968
9166
 
8969
9167
  // ../../node_modules/@math.gl/geospatial/dist/type-utils.js
@@ -9093,19 +9291,11 @@ var __exports__ = (() => {
9093
9291
  thirdAxisVector.scale(sign);
9094
9292
  }
9095
9293
  } else {
9096
- const {
9097
- up,
9098
- east,
9099
- north
9100
- } = scratchAxisVectors;
9294
+ const { up, east, north } = scratchAxisVectors;
9101
9295
  east.set(-origin.y, origin.x, 0).normalize();
9102
9296
  ellipsoid.geodeticSurfaceNormal(origin, up);
9103
9297
  north.copy(up).cross(east);
9104
- const {
9105
- down,
9106
- west,
9107
- south
9108
- } = scratchAxisVectors;
9298
+ const { down, west, south } = scratchAxisVectors;
9109
9299
  down.copy(up).scale(-1);
9110
9300
  west.copy(east).scale(-1);
9111
9301
  south.copy(north).scale(-1);
@@ -9137,11 +9327,7 @@ var __exports__ = (() => {
9137
9327
  var scaleToGeodeticSurfaceIntersection = new Vector3();
9138
9328
  var scaleToGeodeticSurfaceGradient = new Vector3();
9139
9329
  function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
9140
- const {
9141
- oneOverRadii,
9142
- oneOverRadiiSquared,
9143
- centerToleranceSquared
9144
- } = ellipsoid;
9330
+ const { oneOverRadii, oneOverRadiiSquared, centerToleranceSquared } = ellipsoid;
9145
9331
  scratchVector4.from(cartesian);
9146
9332
  const positionX = scratchVector4.x;
9147
9333
  const positionY = scratchVector4.y;
@@ -9201,15 +9387,7 @@ var __exports__ = (() => {
9201
9387
  var scratchCartesian = new Vector3();
9202
9388
  var Ellipsoid = class {
9203
9389
  constructor(x = 0, y = 0, z = 0) {
9204
- _defineProperty(this, "radii", void 0);
9205
- _defineProperty(this, "radiiSquared", void 0);
9206
- _defineProperty(this, "radiiToTheFourth", void 0);
9207
- _defineProperty(this, "oneOverRadii", void 0);
9208
- _defineProperty(this, "oneOverRadiiSquared", void 0);
9209
- _defineProperty(this, "minimumRadius", void 0);
9210
- _defineProperty(this, "maximumRadius", void 0);
9211
- _defineProperty(this, "centerToleranceSquared", math_utils_exports.EPSILON1);
9212
- _defineProperty(this, "squaredXOverSquaredZ", void 0);
9390
+ this.centerToleranceSquared = math_utils_exports.EPSILON1;
9213
9391
  assert3(x >= 0);
9214
9392
  assert3(y >= 0);
9215
9393
  assert3(z >= 0);
@@ -9225,9 +9403,11 @@ var __exports__ = (() => {
9225
9403
  }
9226
9404
  Object.freeze(this);
9227
9405
  }
9406
+ /** Compares this Ellipsoid against the provided Ellipsoid componentwise */
9228
9407
  equals(right) {
9229
9408
  return this === right || Boolean(right && this.radii.equals(right.radii));
9230
9409
  }
9410
+ /** Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'. */
9231
9411
  toString() {
9232
9412
  return this.radii.toString();
9233
9413
  }
@@ -9260,6 +9440,8 @@ var __exports__ = (() => {
9260
9440
  eastNorthUpToFixedFrame(origin, result = new Matrix4()) {
9261
9441
  return localFrameToFixedFrame(this, "east", "north", "up", origin, result);
9262
9442
  }
9443
+ // Computes a 4x4 transformation matrix from a reference frame centered at
9444
+ // the provided origin to the ellipsoid's fixed reference frame.
9263
9445
  localFrameToFixedFrame(firstAxis, secondAxis, thirdAxis, origin, result = new Matrix4()) {
9264
9446
  return localFrameToFixedFrame(this, firstAxis, secondAxis, thirdAxis, origin, result);
9265
9447
  }
@@ -9277,9 +9459,14 @@ var __exports__ = (() => {
9277
9459
  geodeticSurfaceNormal(cartesian, result = [0, 0, 0]) {
9278
9460
  return scratchVector5.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
9279
9461
  }
9462
+ /** Scales the provided Cartesian position along the geodetic surface normal
9463
+ * so that it is on the surface of this ellipsoid. If the position is
9464
+ * at the center of the ellipsoid, this function returns undefined. */
9280
9465
  scaleToGeodeticSurface(cartesian, result) {
9281
9466
  return scaleToGeodeticSurface(cartesian, this, result);
9282
9467
  }
9468
+ /** Scales the provided Cartesian position along the geocentric surface normal
9469
+ * so that it is on the surface of this ellipsoid. */
9283
9470
  scaleToGeocentricSurface(cartesian, result = [0, 0, 0]) {
9284
9471
  scratchPosition.from(cartesian);
9285
9472
  const positionX = scratchPosition.x;
@@ -9289,12 +9476,17 @@ var __exports__ = (() => {
9289
9476
  const beta = 1 / Math.sqrt(positionX * positionX * oneOverRadiiSquared.x + positionY * positionY * oneOverRadiiSquared.y + positionZ * positionZ * oneOverRadiiSquared.z);
9290
9477
  return scratchPosition.multiplyScalar(beta).to(result);
9291
9478
  }
9479
+ /** Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying
9480
+ * its components by the result of `Ellipsoid#oneOverRadii` */
9292
9481
  transformPositionToScaledSpace(position, result = [0, 0, 0]) {
9293
9482
  return scratchPosition.from(position).scale(this.oneOverRadii).to(result);
9294
9483
  }
9484
+ /** Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying
9485
+ * its components by the result of `Ellipsoid#radii`. */
9295
9486
  transformPositionFromScaledSpace(position, result = [0, 0, 0]) {
9296
9487
  return scratchPosition.from(position).scale(this.radii).to(result);
9297
9488
  }
9489
+ /** Computes a point which is the intersection of the surface normal with the z-axis. */
9298
9490
  getSurfaceNormalIntersectionWithZAxis(position, buffer = 0, result = [0, 0, 0]) {
9299
9491
  assert3(equals(this.radii.x, this.radii.y, math_utils_exports.EPSILON15));
9300
9492
  assert3(this.radii.z > 0);
@@ -9306,7 +9498,7 @@ var __exports__ = (() => {
9306
9498
  return scratchPosition.set(0, 0, z).to(result);
9307
9499
  }
9308
9500
  };
9309
- _defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
9501
+ Ellipsoid.WGS84 = new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);
9310
9502
 
9311
9503
  // ../images/src/lib/utils/version.ts
9312
9504
  var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
@@ -12085,8 +12277,11 @@ var __exports__ = (() => {
12085
12277
  // ../../node_modules/@math.gl/culling/dist/constants.js
12086
12278
  var INTERSECTION = {
12087
12279
  OUTSIDE: -1,
12280
+ // Represents that an object is not contained within the frustum.
12088
12281
  INTERSECTING: 0,
12282
+ // Represents that an object intersects one of the frustum's planes.
12089
12283
  INSIDE: 1
12284
+ // Represents that an object is fully within the frustum.
12090
12285
  };
12091
12286
 
12092
12287
  // ../../node_modules/@math.gl/culling/dist/lib/bounding-volumes/axis-aligned-bounding-box.js
@@ -12097,30 +12292,37 @@ var __exports__ = (() => {
12097
12292
  var scratchVector8 = new Vector3();
12098
12293
  var scratchVector22 = new Vector3();
12099
12294
  var BoundingSphere = class {
12295
+ /** Creates a bounding sphere */
12100
12296
  constructor(center = [0, 0, 0], radius = 0) {
12101
- _defineProperty(this, "center", void 0);
12102
- _defineProperty(this, "radius", void 0);
12103
12297
  this.radius = -0;
12104
12298
  this.center = new Vector3();
12105
12299
  this.fromCenterRadius(center, radius);
12106
12300
  }
12301
+ /** Sets the bounding sphere from `center` and `radius`. */
12107
12302
  fromCenterRadius(center, radius) {
12108
12303
  this.center.from(center);
12109
12304
  this.radius = radius;
12110
12305
  return this;
12111
12306
  }
12307
+ /**
12308
+ * Computes a bounding sphere from the corner points of an axis-aligned bounding box. The sphere
12309
+ * tightly and fully encompasses the box.
12310
+ */
12112
12311
  fromCornerPoints(corner, oppositeCorner) {
12113
12312
  oppositeCorner = scratchVector8.from(oppositeCorner);
12114
12313
  this.center = new Vector3().from(corner).add(oppositeCorner).scale(0.5);
12115
12314
  this.radius = this.center.distance(oppositeCorner);
12116
12315
  return this;
12117
12316
  }
12317
+ /** Compares the provided BoundingSphere component wise */
12118
12318
  equals(right) {
12119
12319
  return this === right || Boolean(right) && this.center.equals(right.center) && this.radius === right.radius;
12120
12320
  }
12321
+ /** Duplicates a BoundingSphere instance. */
12121
12322
  clone() {
12122
12323
  return new BoundingSphere(this.center, this.radius);
12123
12324
  }
12325
+ /** Computes a bounding sphere that contains both the left and right bounding spheres. */
12124
12326
  union(boundingSphere) {
12125
12327
  const leftCenter = this.center;
12126
12328
  const leftRadius = this.radius;
@@ -12140,6 +12342,7 @@ var __exports__ = (() => {
12140
12342
  this.radius = halfDistanceBetweenTangentPoints;
12141
12343
  return this;
12142
12344
  }
12345
+ /** Computes a bounding sphere by enlarging the provided sphere to contain the provided point. */
12143
12346
  expand(point) {
12144
12347
  const scratchPoint = scratchVector8.from(point);
12145
12348
  const radius = scratchPoint.subtract(this.center).magnitude();
@@ -12148,21 +12351,31 @@ var __exports__ = (() => {
12148
12351
  }
12149
12352
  return this;
12150
12353
  }
12354
+ // BoundingVolume interface
12355
+ /**
12356
+ * Applies a 4x4 affine transformation matrix to a bounding sphere.
12357
+ * @param sphere The bounding sphere to apply the transformation to.
12358
+ * @param transform The transformation matrix to apply to the bounding sphere.
12359
+ * @returns self.
12360
+ */
12151
12361
  transform(transform) {
12152
12362
  this.center.transform(transform);
12153
12363
  const scale6 = mat4_exports.getScaling(scratchVector8, transform);
12154
12364
  this.radius = Math.max(scale6[0], Math.max(scale6[1], scale6[2])) * this.radius;
12155
12365
  return this;
12156
12366
  }
12367
+ /** Computes the estimated distance squared from the closest point on a bounding sphere to a point. */
12157
12368
  distanceSquaredTo(point) {
12158
12369
  const d = this.distanceTo(point);
12159
12370
  return d * d;
12160
12371
  }
12372
+ /** Computes the estimated distance from the closest point on a bounding sphere to a point. */
12161
12373
  distanceTo(point) {
12162
12374
  const scratchPoint = scratchVector8.from(point);
12163
12375
  const delta = scratchPoint.subtract(this.center);
12164
12376
  return Math.max(0, delta.len() - this.radius);
12165
12377
  }
12378
+ /** Determines which side of a plane a sphere is located. */
12166
12379
  intersectPlane(plane) {
12167
12380
  const center = this.center;
12168
12381
  const radius = this.radius;
@@ -12199,17 +12412,17 @@ var __exports__ = (() => {
12199
12412
  };
12200
12413
  var OrientedBoundingBox = class {
12201
12414
  constructor(center = [0, 0, 0], halfAxes = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {
12202
- _defineProperty(this, "center", void 0);
12203
- _defineProperty(this, "halfAxes", void 0);
12204
12415
  this.center = new Vector3().from(center);
12205
12416
  this.halfAxes = new Matrix3(halfAxes);
12206
12417
  }
12418
+ /** Returns an array with three halfSizes for the bounding box */
12207
12419
  get halfSize() {
12208
12420
  const xAxis = this.halfAxes.getColumn(0);
12209
12421
  const yAxis = this.halfAxes.getColumn(1);
12210
12422
  const zAxis = this.halfAxes.getColumn(2);
12211
12423
  return [new Vector3(xAxis).len(), new Vector3(yAxis).len(), new Vector3(zAxis).len()];
12212
12424
  }
12425
+ /** Returns a quaternion describing the orientation of the bounding box */
12213
12426
  get quaternion() {
12214
12427
  const xAxis = this.halfAxes.getColumn(0);
12215
12428
  const yAxis = this.halfAxes.getColumn(1);
@@ -12219,6 +12432,9 @@ var __exports__ = (() => {
12219
12432
  const normZAxis = new Vector3(zAxis).normalize();
12220
12433
  return new Quaternion().fromMatrix3(new Matrix3([...normXAxis, ...normYAxis, ...normZAxis]));
12221
12434
  }
12435
+ /**
12436
+ * Create OrientedBoundingBox from quaternion based OBB,
12437
+ */
12222
12438
  fromCenterHalfSizeQuaternion(center, halfSize, quaternion) {
12223
12439
  const quaternionObject = new Quaternion(quaternion);
12224
12440
  const directionsMatrix = new Matrix3().fromQuaternion(quaternionObject);
@@ -12235,12 +12451,15 @@ var __exports__ = (() => {
12235
12451
  this.halfAxes = directionsMatrix;
12236
12452
  return this;
12237
12453
  }
12454
+ /** Duplicates a OrientedBoundingBox instance. */
12238
12455
  clone() {
12239
12456
  return new OrientedBoundingBox(this.center, this.halfAxes);
12240
12457
  }
12458
+ /** Compares the provided OrientedBoundingBox component wise and returns */
12241
12459
  equals(right) {
12242
12460
  return this === right || Boolean(right) && this.center.equals(right.center) && this.halfAxes.equals(right.halfAxes);
12243
12461
  }
12462
+ /** Computes a tight-fitting bounding sphere enclosing the provided oriented bounding box. */
12244
12463
  getBoundingSphere(result = new BoundingSphere()) {
12245
12464
  const halfAxes = this.halfAxes;
12246
12465
  const u = halfAxes.getColumn(0, scratchVectorU);
@@ -12251,6 +12470,7 @@ var __exports__ = (() => {
12251
12470
  result.radius = cornerVector.magnitude();
12252
12471
  return result;
12253
12472
  }
12473
+ /** Determines which side of a plane the oriented bounding box is located. */
12254
12474
  intersectPlane(plane) {
12255
12475
  const center = this.center;
12256
12476
  const normal = plane.normal;
@@ -12267,9 +12487,15 @@ var __exports__ = (() => {
12267
12487
  }
12268
12488
  return INTERSECTION.INTERSECTING;
12269
12489
  }
12490
+ /** Computes the estimated distance from the closest point on a bounding box to a point. */
12270
12491
  distanceTo(point) {
12271
12492
  return Math.sqrt(this.distanceSquaredTo(point));
12272
12493
  }
12494
+ /**
12495
+ * Computes the estimated distance squared from the closest point
12496
+ * on a bounding box to a point.
12497
+ * See Geometric Tools for Computer Graphics 10.4.2
12498
+ */
12273
12499
  distanceSquaredTo(point) {
12274
12500
  const offset = scratchOffset.from(point).subtract(this.center);
12275
12501
  const halfAxes = this.halfAxes;
@@ -12298,6 +12524,21 @@ var __exports__ = (() => {
12298
12524
  }
12299
12525
  return distanceSquared;
12300
12526
  }
12527
+ /**
12528
+ * The distances calculated by the vector from the center of the bounding box
12529
+ * to position projected onto direction.
12530
+ *
12531
+ * - If you imagine the infinite number of planes with normal direction,
12532
+ * this computes the smallest distance to the closest and farthest planes
12533
+ * from `position` that intersect the bounding box.
12534
+ *
12535
+ * @param position The position to calculate the distance from.
12536
+ * @param direction The direction from position.
12537
+ * @param result An Interval (array of length 2) to store the nearest and farthest distances.
12538
+ * @returns Interval (array of length 2) with nearest and farthest distances
12539
+ * on the bounding box from position in direction.
12540
+ */
12541
+ // eslint-disable-next-line max-statements
12301
12542
  computePlaneDistances(position, direction, result = [-0, -0]) {
12302
12543
  let minDist = Number.POSITIVE_INFINITY;
12303
12544
  let maxDist = Number.NEGATIVE_INFINITY;
@@ -12350,6 +12591,11 @@ var __exports__ = (() => {
12350
12591
  result[1] = maxDist;
12351
12592
  return result;
12352
12593
  }
12594
+ /**
12595
+ * Applies a 4x4 affine transformation matrix to a bounding sphere.
12596
+ * @param transform The transformation matrix to apply to the bounding sphere.
12597
+ * @returns itself, i.e. the modified BoundingVolume.
12598
+ */
12353
12599
  transform(transformation) {
12354
12600
  this.center.transformAsPoint(transformation);
12355
12601
  const xAxis = this.halfAxes.getColumn(0, scratchVectorU);
@@ -12371,18 +12617,18 @@ var __exports__ = (() => {
12371
12617
  var scratchNormal3 = new Vector3();
12372
12618
  var Plane = class {
12373
12619
  constructor(normal = [0, 0, 1], distance2 = 0) {
12374
- _defineProperty(this, "normal", void 0);
12375
- _defineProperty(this, "distance", void 0);
12376
12620
  this.normal = new Vector3();
12377
12621
  this.distance = -0;
12378
12622
  this.fromNormalDistance(normal, distance2);
12379
12623
  }
12624
+ /** Creates a plane from a normal and a distance from the origin. */
12380
12625
  fromNormalDistance(normal, distance2) {
12381
12626
  assert3(Number.isFinite(distance2));
12382
12627
  this.normal.from(normal).normalize();
12383
12628
  this.distance = distance2;
12384
12629
  return this;
12385
12630
  }
12631
+ /** Creates a plane from a normal and a point on the plane. */
12386
12632
  fromPointNormal(point, normal) {
12387
12633
  point = scratchPosition2.from(point);
12388
12634
  this.normal.from(normal).normalize();
@@ -12390,21 +12636,28 @@ var __exports__ = (() => {
12390
12636
  this.distance = distance2;
12391
12637
  return this;
12392
12638
  }
12639
+ /** Creates a plane from the general equation */
12393
12640
  fromCoefficients(a, b, c, d) {
12394
12641
  this.normal.set(a, b, c);
12395
12642
  assert3(equals(this.normal.len(), 1));
12396
12643
  this.distance = d;
12397
12644
  return this;
12398
12645
  }
12646
+ /** Duplicates a Plane instance. */
12399
12647
  clone() {
12400
12648
  return new Plane(this.normal, this.distance);
12401
12649
  }
12650
+ /** Compares the provided Planes by normal and distance */
12402
12651
  equals(right) {
12403
12652
  return equals(this.distance, right.distance) && equals(this.normal, right.normal);
12404
12653
  }
12654
+ /** Computes the signed shortest distance of a point to a plane.
12655
+ * The sign of the distance determines which side of the plane the point is on.
12656
+ */
12405
12657
  getPointDistance(point) {
12406
12658
  return this.normal.dot(point) + this.distance;
12407
12659
  }
12660
+ /** Transforms the plane by the given transformation matrix. */
12408
12661
  transform(matrix4) {
12409
12662
  const normal = scratchNormal3.copy(this.normal).transformAsVector(matrix4).normalize();
12410
12663
  const point = this.normal.scale(-this.distance).transform(matrix4);
@@ -12423,10 +12676,17 @@ var __exports__ = (() => {
12423
12676
  var scratchPlaneCenter = new Vector3();
12424
12677
  var scratchPlaneNormal = new Vector3();
12425
12678
  var CullingVolume = class {
12679
+ /**
12680
+ * Create a new `CullingVolume` bounded by an array of clipping planed
12681
+ * @param planes Array of clipping planes.
12682
+ * */
12426
12683
  constructor(planes = []) {
12427
- _defineProperty(this, "planes", void 0);
12428
12684
  this.planes = planes;
12429
12685
  }
12686
+ /**
12687
+ * Constructs a culling volume from a bounding sphere. Creates six planes that create a box containing the sphere.
12688
+ * The planes are aligned to the x, y, and z axes in world coordinates.
12689
+ */
12430
12690
  fromBoundingSphere(boundingSphere) {
12431
12691
  this.planes.length = 2 * faces.length;
12432
12692
  const center = boundingSphere.center;
@@ -12450,6 +12710,7 @@ var __exports__ = (() => {
12450
12710
  }
12451
12711
  return this;
12452
12712
  }
12713
+ /** Determines whether a bounding volume intersects the culling volume. */
12453
12714
  computeVisibility(boundingVolume) {
12454
12715
  let intersect = INTERSECTION.INSIDE;
12455
12716
  for (const plane of this.planes) {
@@ -12465,6 +12726,14 @@ var __exports__ = (() => {
12465
12726
  }
12466
12727
  return intersect;
12467
12728
  }
12729
+ /**
12730
+ * Determines whether a bounding volume intersects the culling volume.
12731
+ *
12732
+ * @param parentPlaneMask A bit mask from the boundingVolume's parent's check against the same culling
12733
+ * volume, such that if (planeMask & (1 << planeIndex) === 0), for k < 31, then
12734
+ * the parent (and therefore this) volume is completely inside plane[planeIndex]
12735
+ * and that plane check can be skipped.
12736
+ */
12468
12737
  computeVisibilityWithPlaneMask(boundingVolume, parentPlaneMask) {
12469
12738
  assert3(Number.isFinite(parentPlaneMask), "parentPlaneMask is required.");
12470
12739
  if (parentPlaneMask === CullingVolume.MASK_OUTSIDE || parentPlaneMask === CullingVolume.MASK_INSIDE) {
@@ -12488,9 +12757,9 @@ var __exports__ = (() => {
12488
12757
  return mask;
12489
12758
  }
12490
12759
  };
12491
- _defineProperty(CullingVolume, "MASK_OUTSIDE", 4294967295);
12492
- _defineProperty(CullingVolume, "MASK_INSIDE", 0);
12493
- _defineProperty(CullingVolume, "MASK_INDETERMINATE", 2147483647);
12760
+ CullingVolume.MASK_OUTSIDE = 4294967295;
12761
+ CullingVolume.MASK_INSIDE = 0;
12762
+ CullingVolume.MASK_INDETERMINATE = 2147483647;
12494
12763
 
12495
12764
  // ../../node_modules/@math.gl/culling/dist/lib/perspective-off-center-frustum.js
12496
12765
  var scratchPlaneUpVector = new Vector3();