@gisatcz/deckgl-geolib 1.10.2-dev.0 → 1.10.2-dev.1

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/cjs/index.js CHANGED
@@ -20941,46 +20941,71 @@ class Tile {
20941
20941
  }
20942
20942
  }
20943
20943
 
20944
- function getMeshBoundingBox(attributes) {
20945
- let minX = Infinity;
20946
- let minY = Infinity;
20947
- let minZ = Infinity;
20948
- let maxX = -Infinity;
20949
- let maxY = -Infinity;
20950
- let maxZ = -Infinity;
20951
- const positions = attributes.POSITION ? attributes.POSITION.value : [];
20952
- const len = positions && positions.length;
20953
- for (let i = 0; i < len; i += 3) {
20954
- const x = positions[i];
20955
- const y = positions[i + 1];
20956
- const z = positions[i + 2];
20957
- minX = x < minX ? x : minX;
20958
- minY = y < minY ? y : minY;
20959
- minZ = z < minZ ? z : minZ;
20960
- maxX = x > maxX ? x : maxX;
20961
- maxY = y > maxY ? y : maxY;
20962
- maxZ = z > maxZ ? z : maxZ;
20963
- }
20964
- return [[minX, minY, minZ], [maxX, maxY, maxZ]];
20944
+ /**
20945
+ * Get number of vertices in mesh
20946
+ * @param attributes
20947
+ */
20948
+ /**
20949
+ * Get the (axis aligned) bounding box of a mesh
20950
+ * @param attributes
20951
+ * @returns array of two vectors representing the axis aligned bounding box
20952
+ */
20953
+ // eslint-disable-next-line complexity
20954
+ function getMeshBoundingBox$1(attributes) {
20955
+ let minX = Infinity;
20956
+ let minY = Infinity;
20957
+ let minZ = Infinity;
20958
+ let maxX = -Infinity;
20959
+ let maxY = -Infinity;
20960
+ let maxZ = -Infinity;
20961
+ const positions = attributes.POSITION ? attributes.POSITION.value : [];
20962
+ const len = positions && positions.length;
20963
+ for (let i = 0; i < len; i += 3) {
20964
+ const x = positions[i];
20965
+ const y = positions[i + 1];
20966
+ const z = positions[i + 2];
20967
+ minX = x < minX ? x : minX;
20968
+ minY = y < minY ? y : minY;
20969
+ minZ = z < minZ ? z : minZ;
20970
+ maxX = x > maxX ? x : maxX;
20971
+ maxY = y > maxY ? y : maxY;
20972
+ maxZ = z > maxZ ? z : maxZ;
20973
+ }
20974
+ return [
20975
+ [minX, minY, minZ],
20976
+ [maxX, maxY, maxZ]
20977
+ ];
20965
20978
  }
20966
20979
 
20967
- function concatenateTypedArrays() {
20968
- for (var _len2 = arguments.length, typedArrays = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
20969
- typedArrays[_key2] = arguments[_key2];
20970
- }
20971
- const arrays = typedArrays;
20972
- const TypedArrayConstructor = arrays && arrays.length > 1 && arrays[0].constructor || null;
20973
- if (!TypedArrayConstructor) {
20974
- throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');
20975
- }
20976
- const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);
20977
- const result = new TypedArrayConstructor(sumLength);
20978
- let offset = 0;
20979
- for (const array of arrays) {
20980
- result.set(array, offset);
20981
- offset += array.length;
20982
- }
20983
- return result;
20980
+ /**
20981
+ * compare two binary arrays for equality
20982
+ * @param a
20983
+ * @param b
20984
+ * @param byteLength
20985
+ */
20986
+ /**
20987
+ * Concatenate arbitrary count of typed arrays
20988
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays
20989
+ * @param - list of arrays. All arrays should be the same type
20990
+ * @return A concatenated TypedArray
20991
+ */
20992
+ function concatenateTypedArrays(...typedArrays) {
20993
+ // @ts-ignore
20994
+ const arrays = typedArrays;
20995
+ // @ts-ignore
20996
+ const TypedArrayConstructor = (arrays && arrays.length > 1 && arrays[0].constructor) || null;
20997
+ if (!TypedArrayConstructor) {
20998
+ throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');
20999
+ }
21000
+ const sumLength = arrays.reduce((acc, value) => acc + value.length, 0);
21001
+ // @ts-ignore typescript does not like dynamic constructors
21002
+ const result = new TypedArrayConstructor(sumLength);
21003
+ let offset = 0;
21004
+ for (const array of arrays) {
21005
+ result.set(array, offset);
21006
+ offset += array.length;
21007
+ }
21008
+ return result;
20984
21009
  }
20985
21010
 
20986
21011
  // loaders.gl
@@ -21684,7 +21709,7 @@ class GeoImage {
21684
21709
  let { triangles } = mesh;
21685
21710
  let attributes = getMeshAttributes(vertices, terrain, width, height, input.bounds);
21686
21711
  // Compute bounding box before adding skirt so that z values are not skewed
21687
- const boundingBox = getMeshBoundingBox(attributes);
21712
+ const boundingBox = getMeshBoundingBox$1(attributes);
21688
21713
  // FIXME uncomment and add skirt
21689
21714
  console.log('xxx_skirtHeight', terrainSkirtHeight);
21690
21715
  if (terrainSkirtHeight) {
@@ -22601,6 +22626,29 @@ fragColor = vec4(lightColor, color.a * opacity);
22601
22626
  }
22602
22627
  `;
22603
22628
 
22629
+ function getMeshBoundingBox(attributes) {
22630
+ let minX = Infinity;
22631
+ let minY = Infinity;
22632
+ let minZ = Infinity;
22633
+ let maxX = -Infinity;
22634
+ let maxY = -Infinity;
22635
+ let maxZ = -Infinity;
22636
+ const positions = attributes.POSITION ? attributes.POSITION.value : [];
22637
+ const len = positions && positions.length;
22638
+ for (let i = 0; i < len; i += 3) {
22639
+ const x = positions[i];
22640
+ const y = positions[i + 1];
22641
+ const z = positions[i + 2];
22642
+ minX = x < minX ? x : minX;
22643
+ minY = y < minY ? y : minY;
22644
+ minZ = z < minZ ? z : minZ;
22645
+ maxX = x > maxX ? x : maxX;
22646
+ maxY = y > maxY ? y : maxY;
22647
+ maxZ = z > maxZ ? z : maxZ;
22648
+ }
22649
+ return [[minX, minY, minZ], [maxX, maxY, maxZ]];
22650
+ }
22651
+
22604
22652
  // Note: This file will either be moved back to deck.gl or reformatted to web-monorepo standards
22605
22653
  // Disabling lint temporarily to facilitate copying code in and out of this repo
22606
22654
  /* eslint-disable */