@itwin/ecschema-rpcinterface-tests 4.0.0-dev.46 → 4.0.0-dev.50

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.
@@ -22305,9 +22305,9 @@ module.exports = {
22305
22305
 
22306
22306
  /***/ }),
22307
22307
 
22308
- /***/ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/formats.js":
22308
+ /***/ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/formats.js":
22309
22309
  /*!*************************************************************************************!*\
22310
- !*** ../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/formats.js ***!
22310
+ !*** ../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/formats.js ***!
22311
22311
  \*************************************************************************************/
22312
22312
  /***/ ((module) => {
22313
22313
 
@@ -22339,18 +22339,18 @@ module.exports = {
22339
22339
 
22340
22340
  /***/ }),
22341
22341
 
22342
- /***/ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/index.js":
22342
+ /***/ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/index.js":
22343
22343
  /*!***********************************************************************************!*\
22344
- !*** ../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/index.js ***!
22344
+ !*** ../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/index.js ***!
22345
22345
  \***********************************************************************************/
22346
22346
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22347
22347
 
22348
22348
  "use strict";
22349
22349
 
22350
22350
 
22351
- var stringify = __webpack_require__(/*! ./stringify */ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/stringify.js");
22352
- var parse = __webpack_require__(/*! ./parse */ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/parse.js");
22353
- var formats = __webpack_require__(/*! ./formats */ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/formats.js");
22351
+ var stringify = __webpack_require__(/*! ./stringify */ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/stringify.js");
22352
+ var parse = __webpack_require__(/*! ./parse */ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/parse.js");
22353
+ var formats = __webpack_require__(/*! ./formats */ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/formats.js");
22354
22354
 
22355
22355
  module.exports = {
22356
22356
  formats: formats,
@@ -22361,16 +22361,16 @@ module.exports = {
22361
22361
 
22362
22362
  /***/ }),
22363
22363
 
22364
- /***/ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/parse.js":
22364
+ /***/ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/parse.js":
22365
22365
  /*!***********************************************************************************!*\
22366
- !*** ../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/parse.js ***!
22366
+ !*** ../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/parse.js ***!
22367
22367
  \***********************************************************************************/
22368
22368
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22369
22369
 
22370
22370
  "use strict";
22371
22371
 
22372
22372
 
22373
- var utils = __webpack_require__(/*! ./utils */ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/utils.js");
22373
+ var utils = __webpack_require__(/*! ./utils */ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/utils.js");
22374
22374
 
22375
22375
  var has = Object.prototype.hasOwnProperty;
22376
22376
  var isArray = Array.isArray;
@@ -22635,9 +22635,9 @@ module.exports = function (str, opts) {
22635
22635
 
22636
22636
  /***/ }),
22637
22637
 
22638
- /***/ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/stringify.js":
22638
+ /***/ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/stringify.js":
22639
22639
  /*!***************************************************************************************!*\
22640
- !*** ../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/stringify.js ***!
22640
+ !*** ../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/stringify.js ***!
22641
22641
  \***************************************************************************************/
22642
22642
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22643
22643
 
@@ -22645,8 +22645,8 @@ module.exports = function (str, opts) {
22645
22645
 
22646
22646
 
22647
22647
  var getSideChannel = __webpack_require__(/*! side-channel */ "../../common/temp/node_modules/.pnpm/side-channel@1.0.4/node_modules/side-channel/index.js");
22648
- var utils = __webpack_require__(/*! ./utils */ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/utils.js");
22649
- var formats = __webpack_require__(/*! ./formats */ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/formats.js");
22648
+ var utils = __webpack_require__(/*! ./utils */ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/utils.js");
22649
+ var formats = __webpack_require__(/*! ./formats */ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/formats.js");
22650
22650
  var has = Object.prototype.hasOwnProperty;
22651
22651
 
22652
22652
  var arrayPrefixGenerators = {
@@ -22663,7 +22663,6 @@ var arrayPrefixGenerators = {
22663
22663
  };
22664
22664
 
22665
22665
  var isArray = Array.isArray;
22666
- var split = String.prototype.split;
22667
22666
  var push = Array.prototype.push;
22668
22667
  var pushToArray = function (arr, valueOrArray) {
22669
22668
  push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
@@ -22765,14 +22764,6 @@ var stringify = function stringify(
22765
22764
  if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
22766
22765
  if (encoder) {
22767
22766
  var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
22768
- if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
22769
- var valuesArray = split.call(String(obj), ',');
22770
- var valuesJoined = '';
22771
- for (var i = 0; i < valuesArray.length; ++i) {
22772
- valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
22773
- }
22774
- return [formatter(keyValue) + (commaRoundTrip && isArray(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
22775
- }
22776
22767
  return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
22777
22768
  }
22778
22769
  return [formatter(prefix) + '=' + formatter(String(obj))];
@@ -22787,6 +22778,9 @@ var stringify = function stringify(
22787
22778
  var objKeys;
22788
22779
  if (generateArrayPrefix === 'comma' && isArray(obj)) {
22789
22780
  // we need to join elements in
22781
+ if (encodeValuesOnly && encoder) {
22782
+ obj = utils.maybeMap(obj, encoder);
22783
+ }
22790
22784
  objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
22791
22785
  } else if (isArray(filter)) {
22792
22786
  objKeys = filter;
@@ -22819,7 +22813,7 @@ var stringify = function stringify(
22819
22813
  commaRoundTrip,
22820
22814
  strictNullHandling,
22821
22815
  skipNulls,
22822
- encoder,
22816
+ generateArrayPrefix === 'comma' && encodeValuesOnly && isArray(obj) ? null : encoder,
22823
22817
  filter,
22824
22818
  sort,
22825
22819
  allowDots,
@@ -22972,16 +22966,16 @@ module.exports = function (object, opts) {
22972
22966
 
22973
22967
  /***/ }),
22974
22968
 
22975
- /***/ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/utils.js":
22969
+ /***/ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/utils.js":
22976
22970
  /*!***********************************************************************************!*\
22977
- !*** ../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/utils.js ***!
22971
+ !*** ../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/utils.js ***!
22978
22972
  \***********************************************************************************/
22979
22973
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22980
22974
 
22981
22975
  "use strict";
22982
22976
 
22983
22977
 
22984
- var formats = __webpack_require__(/*! ./formats */ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/formats.js");
22978
+ var formats = __webpack_require__(/*! ./formats */ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/formats.js");
22985
22979
 
22986
22980
  var has = Object.prototype.hasOwnProperty;
22987
22981
  var isArray = Array.isArray;
@@ -25965,7 +25959,7 @@ var Emitter = __webpack_require__(/*! component-emitter */ "../../common/temp/no
25965
25959
 
25966
25960
  var safeStringify = __webpack_require__(/*! fast-safe-stringify */ "../../common/temp/node_modules/.pnpm/fast-safe-stringify@2.1.1/node_modules/fast-safe-stringify/index.js");
25967
25961
 
25968
- var qs = __webpack_require__(/*! qs */ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/index.js");
25962
+ var qs = __webpack_require__(/*! qs */ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/index.js");
25969
25963
 
25970
25964
  var RequestBase = __webpack_require__(/*! ./request-base */ "../../common/temp/node_modules/.pnpm/superagent@7.1.5/node_modules/superagent/lib/request-base.js");
25971
25965
 
@@ -41581,6 +41575,10 @@ __webpack_require__.r(__webpack_exports__);
41581
41575
  /* harmony export */ "BatchType": () => (/* binding */ BatchType),
41582
41576
  /* harmony export */ "Feature": () => (/* binding */ Feature),
41583
41577
  /* harmony export */ "FeatureTable": () => (/* binding */ FeatureTable),
41578
+ /* harmony export */ "ModelFeature": () => (/* binding */ ModelFeature),
41579
+ /* harmony export */ "MultiModelPackedFeatureTable": () => (/* binding */ MultiModelPackedFeatureTable),
41580
+ /* harmony export */ "PackedFeature": () => (/* binding */ PackedFeature),
41581
+ /* harmony export */ "PackedFeatureModelTable": () => (/* binding */ PackedFeatureModelTable),
41584
41582
  /* harmony export */ "PackedFeatureTable": () => (/* binding */ PackedFeatureTable)
41585
41583
  /* harmony export */ });
41586
41584
  /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
@@ -41630,6 +41628,52 @@ class Feature {
41630
41628
  return cmp;
41631
41629
  }
41632
41630
  }
41631
+ /** @internal */
41632
+ var ModelFeature;
41633
+ (function (ModelFeature) {
41634
+ function create() {
41635
+ return {
41636
+ modelId: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.invalid,
41637
+ elementId: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.invalid,
41638
+ subCategoryId: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.invalid,
41639
+ geometryClass: _GeometryParams__WEBPACK_IMPORTED_MODULE_1__.GeometryClass.Primary,
41640
+ };
41641
+ }
41642
+ ModelFeature.create = create;
41643
+ function isDefined(feature) {
41644
+ return !_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.isInvalid(feature.modelId) || !_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.isInvalid(feature.elementId) || !_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.isInvalid(feature.subCategoryId) || feature.geometryClass !== _GeometryParams__WEBPACK_IMPORTED_MODULE_1__.GeometryClass.Primary;
41645
+ }
41646
+ ModelFeature.isDefined = isDefined;
41647
+ function unpack(packed, result, unpackedModelId) {
41648
+ result.modelId = unpackedModelId ?? _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.fromUint32PairObject(packed.modelId);
41649
+ result.elementId = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.fromUint32PairObject(packed.elementId);
41650
+ result.subCategoryId = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.fromUint32PairObject(packed.subCategoryId);
41651
+ result.geometryClass = packed.geometryClass;
41652
+ return result;
41653
+ }
41654
+ ModelFeature.unpack = unpack;
41655
+ })(ModelFeature || (ModelFeature = {}));
41656
+ /** @internal */
41657
+ var PackedFeature;
41658
+ (function (PackedFeature) {
41659
+ function create() {
41660
+ const pair = { upper: 0, lower: 0 };
41661
+ return {
41662
+ modelId: { ...pair },
41663
+ elementId: { ...pair },
41664
+ subCategoryId: { ...pair },
41665
+ geometryClass: _GeometryParams__WEBPACK_IMPORTED_MODULE_1__.GeometryClass.Primary,
41666
+ animationNodeId: 0,
41667
+ };
41668
+ }
41669
+ PackedFeature.create = create;
41670
+ function createWithIndex() {
41671
+ const result = create();
41672
+ result.index = 0;
41673
+ return result;
41674
+ }
41675
+ PackedFeature.createWithIndex = createWithIndex;
41676
+ })(PackedFeature || (PackedFeature = {}));
41633
41677
  /** Describes the type of a 'batch' of graphics representing multiple [[Feature]]s.
41634
41678
  * The most commonly-encountered batches are Tiles, which can be of either Primary or
41635
41679
  * Classifier type.
@@ -41698,6 +41742,7 @@ class FeatureTable extends _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Inde
41698
41742
  /** @internal */
41699
41743
  getArray() { return this._array; }
41700
41744
  }
41745
+ const scratchPackedFeature = PackedFeature.create();
41701
41746
  /**
41702
41747
  * An immutable, packed representation of a [[FeatureTable]]. The features are packed into a single array of 32-bit integer values,
41703
41748
  * wherein each feature occupies 3 32-bit integers.
@@ -41708,10 +41753,10 @@ class PackedFeatureTable {
41708
41753
  * This is used internally when deserializing Tiles in iMdl format.
41709
41754
  * @internal
41710
41755
  */
41711
- constructor(data, modelId, numFeatures, maxFeatures, type, animationNodeIds) {
41756
+ constructor(data, modelId, numFeatures, type, animationNodeIds) {
41712
41757
  this._data = data;
41713
- this.modelId = modelId;
41714
- this.maxFeatures = maxFeatures;
41758
+ this.batchModelId = modelId;
41759
+ this.batchModelIdPair = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.getUint32Pair(modelId);
41715
41760
  this.numFeatures = numFeatures;
41716
41761
  this.type = type;
41717
41762
  this._animationNodeIds = animationNodeIds;
@@ -41720,14 +41765,13 @@ class PackedFeatureTable {
41720
41765
  this.anyDefined = false;
41721
41766
  break;
41722
41767
  case 1:
41723
- this.anyDefined = this.getFeature(0).isDefined;
41768
+ this.anyDefined = ModelFeature.isDefined(this.getFeature(0, ModelFeature.create()));
41724
41769
  break;
41725
41770
  default:
41726
41771
  this.anyDefined = true;
41727
41772
  break;
41728
41773
  }
41729
41774
  (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(this._data.length >= this._subCategoriesOffset);
41730
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(this.maxFeatures >= this.numFeatures);
41731
41775
  (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(undefined === this._animationNodeIds || this._animationNodeIds.length === this.numFeatures);
41732
41776
  }
41733
41777
  get byteLength() { return this._data.byteLength; }
@@ -41763,18 +41807,16 @@ class PackedFeatureTable {
41763
41807
  uint32s[index32 + 0] = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.getLowerUint32(id);
41764
41808
  uint32s[index32 + 1] = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.getUpperUint32(id);
41765
41809
  });
41766
- return new PackedFeatureTable(uint32s, featureTable.modelId, featureTable.length, featureTable.maxFeatures, featureTable.type);
41810
+ return new PackedFeatureTable(uint32s, featureTable.modelId, featureTable.length, featureTable.type);
41767
41811
  }
41768
41812
  /** Retrieve the Feature associated with the specified index. */
41769
- getFeature(featureIndex) {
41770
- const packed = this.getPackedFeature(featureIndex);
41771
- const elemId = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.fromUint32Pair(packed.elementId.lower, packed.elementId.upper);
41772
- const subcatId = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.fromUint32Pair(packed.subCategoryId.lower, packed.subCategoryId.upper);
41773
- return new Feature(elemId, subcatId, packed.geometryClass);
41813
+ getFeature(featureIndex, result) {
41814
+ const packed = this.getPackedFeature(featureIndex, scratchPackedFeature);
41815
+ return ModelFeature.unpack(packed, result, this.batchModelId);
41774
41816
  }
41775
41817
  /** Returns the Feature associated with the specified index, or undefined if the index is out of range. */
41776
- findFeature(featureIndex) {
41777
- return featureIndex < this.numFeatures ? this.getFeature(featureIndex) : undefined;
41818
+ findFeature(featureIndex, result) {
41819
+ return featureIndex < this.numFeatures ? this.getFeature(featureIndex, result) : undefined;
41778
41820
  }
41779
41821
  /** @internal */
41780
41822
  getElementIdPair(featureIndex, out) {
@@ -41798,17 +41840,21 @@ class PackedFeatureTable {
41798
41840
  return undefined !== this._animationNodeIds && featureIndex < this.numFeatures ? this._animationNodeIds[featureIndex] : 0;
41799
41841
  }
41800
41842
  /** @internal */
41801
- getPackedFeature(featureIndex) {
41843
+ getPackedFeature(featureIndex, result) {
41802
41844
  (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(featureIndex < this.numFeatures);
41803
41845
  const index32 = 3 * featureIndex;
41804
- const elementId = { lower: this._data[index32], upper: this._data[index32 + 1] };
41846
+ result.elementId.lower = this._data[index32];
41847
+ result.elementId.upper = this._data[index32 + 1];
41805
41848
  const subCatIndexAndClass = this._data[index32 + 2];
41806
- const geometryClass = (subCatIndexAndClass >>> 24) & 0xff;
41849
+ result.geometryClass = (subCatIndexAndClass >>> 24) & 0xff;
41807
41850
  let subCatIndex = (subCatIndexAndClass & 0x00ffffff) >>> 0;
41808
41851
  subCatIndex = subCatIndex * 2 + this._subCategoriesOffset;
41809
- const subCategoryId = { lower: this._data[subCatIndex], upper: this._data[subCatIndex + 1] };
41810
- const animationNodeId = this.getAnimationNodeId(featureIndex);
41811
- return { elementId, subCategoryId, geometryClass, animationNodeId };
41852
+ result.subCategoryId.lower = this._data[subCatIndex];
41853
+ result.subCategoryId.upper = this._data[subCatIndex + 1];
41854
+ result.animationNodeId = this.getAnimationNodeId(featureIndex);
41855
+ result.modelId.lower = this.batchModelIdPair.lower;
41856
+ result.modelId.upper = this.batchModelIdPair.upper;
41857
+ return result;
41812
41858
  }
41813
41859
  /** Returns the element ID of the Feature associated with the specified index, or undefined if the index is out of range. */
41814
41860
  findElementId(featureIndex) {
@@ -41820,16 +41866,19 @@ class PackedFeatureTable {
41820
41866
  /** Return true if this table contains exactly 1 feature. */
41821
41867
  get isUniform() { return 1 === this.numFeatures; }
41822
41868
  /** If this table contains exactly 1 feature, return it. */
41823
- get uniform() { return this.isUniform ? this.getFeature(0) : undefined; }
41869
+ getUniform(result) {
41870
+ return this.isUniform ? this.getFeature(0, result) : undefined;
41871
+ }
41824
41872
  get isVolumeClassifier() { return BatchType.VolumeClassifier === this.type; }
41825
41873
  get isPlanarClassifier() { return BatchType.VolumeClassifier === this.type; }
41826
41874
  get isClassifier() { return this.isVolumeClassifier || this.isPlanarClassifier; }
41827
41875
  /** Unpack the features into a [[FeatureTable]]. */
41828
41876
  unpack() {
41829
- const table = new FeatureTable(this.maxFeatures, this.modelId);
41877
+ const table = new FeatureTable(this.numFeatures, this.batchModelId);
41878
+ const feature = ModelFeature.create();
41830
41879
  for (let i = 0; i < this.numFeatures; i++) {
41831
- const feature = this.getFeature(i);
41832
- table.insertWithIndex(feature, i);
41880
+ this.getFeature(i, feature);
41881
+ table.insertWithIndex(new Feature(feature.elementId, feature.subCategoryId, feature.geometryClass), i);
41833
41882
  }
41834
41883
  return table;
41835
41884
  }
@@ -41852,11 +41901,150 @@ class PackedFeatureTable {
41852
41901
  if (haveNodes)
41853
41902
  this._animationNodeIds = nodeIds;
41854
41903
  }
41904
+ *iterator(output) {
41905
+ for (let i = 0; i < this.numFeatures; i++) {
41906
+ this.getPackedFeature(i, output);
41907
+ output.index = i;
41908
+ yield output;
41909
+ }
41910
+ }
41911
+ iterable(output) {
41912
+ return {
41913
+ [Symbol.iterator]: () => this.iterator(output),
41914
+ };
41915
+ }
41855
41916
  get _subCategoriesOffset() { return this.numFeatures * 3; }
41856
41917
  readId(offset32) {
41857
41918
  return _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.fromUint32Pair(this._data[offset32], this._data[offset32 + 1]);
41858
41919
  }
41859
41920
  }
41921
+ const scratchPackedFeatureModelEntry = { lastFeatureIndex: -1, idLower: -1, idUpper: -1 };
41922
+ /** A table of model Ids associated with a [[MultiModelPackedFeatureTable]].
41923
+ * The feature indices in the packed feature table are grouped together by model, such that the first N features belong to model 1, the next M features to model 2, and so on.
41924
+ * The model table itself consists of one entry per model, where each entry looks like:
41925
+ * indexOfLastFeatureInModel: u32
41926
+ * modelId: u64
41927
+ * The modelId associated with a feature can therefore be derived by finding the entry in the model table with the highest indexOfLastFeatureInModel no greater than the feature index.
41928
+ * This lookup can be optimized using binary search.
41929
+ * Moreover, while iterating the feature table in sequence, the model table can be iterated in parallel so that no per-feature lookup of model Id is required.
41930
+ * @internal
41931
+ */
41932
+ class PackedFeatureModelTable {
41933
+ constructor(data) {
41934
+ this._data = data;
41935
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(this._data.length % 3 === 0);
41936
+ }
41937
+ /** The number of models in the table. */
41938
+ get length() {
41939
+ return this._data.length / 3;
41940
+ }
41941
+ get byteLength() {
41942
+ return this._data.byteLength;
41943
+ }
41944
+ getLastFeatureIndex(modelIndex) {
41945
+ return this._data[modelIndex * 3];
41946
+ }
41947
+ getEntry(modelIndex, result) {
41948
+ if (modelIndex >= this.length) {
41949
+ result.idLower = result.idUpper = 0;
41950
+ result.lastFeatureIndex = Number.MAX_SAFE_INTEGER;
41951
+ return result;
41952
+ }
41953
+ const index = modelIndex * 3;
41954
+ result.lastFeatureIndex = this._data[index + 0];
41955
+ result.idLower = this._data[index + 1];
41956
+ result.idUpper = this._data[index + 2];
41957
+ return result;
41958
+ }
41959
+ /** Get the Id of the model associated with the specified feature, or an invalid Id if the feature is not associated with any model. */
41960
+ getModelIdPair(featureIndex, result) {
41961
+ if (!result)
41962
+ result = { lower: 0, upper: 0 };
41963
+ else
41964
+ result.lower = result.upper = 0;
41965
+ let first = 0;
41966
+ const last = this.length;
41967
+ let count = last;
41968
+ while (count > 0) {
41969
+ const step = Math.floor(count / 2);
41970
+ const mid = first + step;
41971
+ const lastFeatureIndex = this.getLastFeatureIndex(mid);
41972
+ if (featureIndex > lastFeatureIndex) {
41973
+ first = mid + 1;
41974
+ count -= step + 1;
41975
+ }
41976
+ else {
41977
+ count = step;
41978
+ }
41979
+ }
41980
+ if (first < last) {
41981
+ result.lower = this._data[first * 3 + 1];
41982
+ result.upper = this._data[first * 3 + 2];
41983
+ }
41984
+ return result;
41985
+ }
41986
+ }
41987
+ /** A PackedFeatureTable with a PackedFeatureModelTable appended to it, capable of storing features belonging to more than one model.
41988
+ * @internal
41989
+ */
41990
+ class MultiModelPackedFeatureTable {
41991
+ constructor(features, models) {
41992
+ this._features = features;
41993
+ this._models = models;
41994
+ }
41995
+ static create(data, batchModelId, numFeatures, type, numSubCategories) {
41996
+ const modelTableOffset = 3 * numFeatures + 2 * numSubCategories;
41997
+ const featureData = data.subarray(0, modelTableOffset);
41998
+ const features = new PackedFeatureTable(featureData, batchModelId, numFeatures, type);
41999
+ const modelData = data.subarray(modelTableOffset);
42000
+ const models = new PackedFeatureModelTable(modelData);
42001
+ return new MultiModelPackedFeatureTable(features, models);
42002
+ }
42003
+ get batchModelId() { return this._features.batchModelId; }
42004
+ get batchModelIdPair() { return this._features.batchModelIdPair; }
42005
+ get numFeatures() { return this._features.numFeatures; }
42006
+ get type() { return this._features.type; }
42007
+ get byteLength() {
42008
+ return this._features.byteLength + this._models.byteLength;
42009
+ }
42010
+ getPackedFeature(featureIndex, result) {
42011
+ this._features.getPackedFeature(featureIndex, result);
42012
+ this._models.getModelIdPair(featureIndex, result.modelId);
42013
+ return result;
42014
+ }
42015
+ getFeature(featureIndex, result) {
42016
+ const packed = this.getPackedFeature(featureIndex, scratchPackedFeature);
42017
+ return ModelFeature.unpack(packed, result);
42018
+ }
42019
+ findFeature(featureIndex, result) {
42020
+ return featureIndex < this.numFeatures ? this.getFeature(featureIndex, result) : undefined;
42021
+ }
42022
+ getElementIdPair(featureIndex, out) {
42023
+ return this._features.getElementIdPair(featureIndex, out);
42024
+ }
42025
+ findElementId(featureIndex) {
42026
+ return this._features.findElementId(featureIndex);
42027
+ }
42028
+ *iterator(output) {
42029
+ // Rather than perform a binary search on the model table to find each feature's model Id, traverse the model table in parallel with the feature table.
42030
+ let modelIndex = 0;
42031
+ const modelEntry = this._models.getEntry(modelIndex, scratchPackedFeatureModelEntry);
42032
+ for (let featureIndex = 0; featureIndex < this.numFeatures; featureIndex++) {
42033
+ if (featureIndex > modelEntry.lastFeatureIndex)
42034
+ this._models.getEntry(++modelIndex, modelEntry);
42035
+ this._features.getPackedFeature(featureIndex, output);
42036
+ output.modelId.lower = modelEntry.idLower;
42037
+ output.modelId.upper = modelEntry.idUpper;
42038
+ output.index = featureIndex;
42039
+ yield output;
42040
+ }
42041
+ }
42042
+ iterable(output) {
42043
+ return {
42044
+ [Symbol.iterator]: () => this.iterator(output),
42045
+ };
42046
+ }
42047
+ }
41860
42048
 
41861
42049
 
41862
42050
  /***/ }),
@@ -51950,9 +52138,11 @@ __webpack_require__.r(__webpack_exports__);
51950
52138
  /* harmony export */ "MeshPolylineList": () => (/* reexport safe */ _Render__WEBPACK_IMPORTED_MODULE_90__.MeshPolylineList),
51951
52139
  /* harmony export */ "ModelClipGroup": () => (/* reexport safe */ _ModelClipGroup__WEBPACK_IMPORTED_MODULE_77__.ModelClipGroup),
51952
52140
  /* harmony export */ "ModelClipGroups": () => (/* reexport safe */ _ModelClipGroup__WEBPACK_IMPORTED_MODULE_77__.ModelClipGroups),
52141
+ /* harmony export */ "ModelFeature": () => (/* reexport safe */ _FeatureTable__WEBPACK_IMPORTED_MODULE_32__.ModelFeature),
51953
52142
  /* harmony export */ "ModelGeometryChanges": () => (/* reexport safe */ _ModelGeometryChanges__WEBPACK_IMPORTED_MODULE_84__.ModelGeometryChanges),
51954
52143
  /* harmony export */ "ModelMapLayerSettings": () => (/* reexport safe */ _MapLayerSettings__WEBPACK_IMPORTED_MODULE_74__.ModelMapLayerSettings),
51955
52144
  /* harmony export */ "MonochromeMode": () => (/* reexport safe */ _DisplayStyleSettings__WEBPACK_IMPORTED_MODULE_19__.MonochromeMode),
52145
+ /* harmony export */ "MultiModelPackedFeatureTable": () => (/* reexport safe */ _FeatureTable__WEBPACK_IMPORTED_MODULE_32__.MultiModelPackedFeatureTable),
51956
52146
  /* harmony export */ "NoContentError": () => (/* reexport safe */ _IModelError__WEBPACK_IMPORTED_MODULE_63__.NoContentError),
51957
52147
  /* harmony export */ "NonUniformColor": () => (/* reexport safe */ _FeatureIndex__WEBPACK_IMPORTED_MODULE_30__.NonUniformColor),
51958
52148
  /* harmony export */ "NormalMapFlags": () => (/* reexport safe */ _MaterialProps__WEBPACK_IMPORTED_MODULE_76__.NormalMapFlags),
@@ -51964,6 +52154,8 @@ __webpack_require__.r(__webpack_exports__);
51964
52154
  /* harmony export */ "OctEncodedNormalPair": () => (/* reexport safe */ _OctEncodedNormal__WEBPACK_IMPORTED_MODULE_80__.OctEncodedNormalPair),
51965
52155
  /* harmony export */ "OverriddenBy": () => (/* reexport safe */ _NativeAppProps__WEBPACK_IMPORTED_MODULE_79__.OverriddenBy),
51966
52156
  /* harmony export */ "POLICY": () => (/* reexport safe */ _rpc_core_RpcRegistry__WEBPACK_IMPORTED_MODULE_131__.POLICY),
52157
+ /* harmony export */ "PackedFeature": () => (/* reexport safe */ _FeatureTable__WEBPACK_IMPORTED_MODULE_32__.PackedFeature),
52158
+ /* harmony export */ "PackedFeatureModelTable": () => (/* reexport safe */ _FeatureTable__WEBPACK_IMPORTED_MODULE_32__.PackedFeatureModelTable),
51967
52159
  /* harmony export */ "PackedFeatureTable": () => (/* reexport safe */ _FeatureTable__WEBPACK_IMPORTED_MODULE_32__.PackedFeatureTable),
51968
52160
  /* harmony export */ "Placement2d": () => (/* reexport safe */ _geometry_Placement__WEBPACK_IMPORTED_MODULE_48__.Placement2d),
51969
52161
  /* harmony export */ "Placement3d": () => (/* reexport safe */ _geometry_Placement__WEBPACK_IMPORTED_MODULE_48__.Placement3d),
@@ -65927,6 +66119,8 @@ var ImdlFlags;
65927
66119
  ImdlFlags[ImdlFlags["Incomplete"] = 4] = "Incomplete";
65928
66120
  /** The tile must be refined by sub-division, not magnification. */
65929
66121
  ImdlFlags[ImdlFlags["DisallowMagnification"] = 8] = "DisallowMagnification";
66122
+ /** The tile's feature table contains features from multiple models. */
66123
+ ImdlFlags[ImdlFlags["MultiModelFeatureTable"] = 16] = "MultiModelFeatureTable";
65930
66124
  })(ImdlFlags || (ImdlFlags = {}));
65931
66125
  /** Describes the maximum major and minor version of the iMdl tile format supported by this version of this package.
65932
66126
  * @internal
@@ -65981,9 +66175,9 @@ class ImdlHeader extends _TileIO__WEBPACK_IMPORTED_MODULE_2__.TileHeader {
65981
66175
  * @internal
65982
66176
  */
65983
66177
  class FeatureTableHeader {
65984
- constructor(length, maxFeatures, count) {
66178
+ constructor(length, numSubCategories, count) {
65985
66179
  this.length = length;
65986
- this.maxFeatures = maxFeatures;
66180
+ this.numSubCategories = numSubCategories;
65987
66181
  this.count = count;
65988
66182
  }
65989
66183
  static readFrom(stream) {
@@ -84240,7 +84434,7 @@ class ElementPicker {
84240
84434
  });
84241
84435
  if (!hitPointWorld)
84242
84436
  continue;
84243
- const modelId = undefined !== pixel.featureTable ? pixel.featureTable.modelId : undefined;
84437
+ const modelId = pixel.modelId;
84244
84438
  const hit = new _HitDetail__WEBPACK_IMPORTED_MODULE_2__.HitDetail(pickPointWorld, vp, options.hitSource, hitPointWorld, pixel.elementId, this.getPixelPriority(pixel), testPointView.distance(elmPoint), pixel.distanceFraction, pixel.subCategoryId, pixel.geometryClass, modelId, pixel.iModel, pixel.tileId, pixel.isClassifier);
84245
84439
  this.hitList.addHit(hit);
84246
84440
  if (this.hitList.hits.length > options.maxHits)
@@ -93447,10 +93641,12 @@ class SpatialViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_6__.ViewState
93447
93641
  attachToViewport(args) {
93448
93642
  super.attachToViewport(args);
93449
93643
  this.registerModelSelectorListeners();
93644
+ this._treeRefs.attachToViewport(args);
93450
93645
  }
93451
93646
  /** @internal */
93452
93647
  detachFromViewport() {
93453
93648
  super.detachFromViewport();
93649
+ this._treeRefs.detachFromViewport();
93454
93650
  this.unregisterModelSelectorListeners();
93455
93651
  }
93456
93652
  /** Chiefly for debugging: change the "deactivated" state of one or more tile tree references. Deactivated references are
@@ -99871,6 +100067,10 @@ class Viewport {
99871
100067
  this._changeFlags.setFeatureOverrideProvider();
99872
100068
  this.maybeInvalidateScene();
99873
100069
  }
100070
+ /** @internal */
100071
+ invalidateSymbologyOverrides() {
100072
+ this.setFeatureOverrideProviderChanged();
100073
+ }
99874
100074
  /** The [[TiledGraphicsProvider]]s currently registered with this viewport.
99875
100075
  * @see [[addTiledGraphicsProvider]].
99876
100076
  */
@@ -100770,11 +100970,11 @@ class Viewport {
100770
100970
  }
100771
100971
  /** @internal */
100772
100972
  isPixelSelectable(pixel) {
100773
- if (undefined === pixel.featureTable || undefined === pixel.elementId)
100973
+ if (undefined === pixel.modelId || undefined === pixel.elementId)
100774
100974
  return false;
100775
- if (pixel.featureTable.modelId === pixel.elementId)
100975
+ if (pixel.modelId === pixel.elementId)
100776
100976
  return false; // Reality Models not selectable
100777
- return undefined === this.mapLayerFromIds(pixel.featureTable.modelId, pixel.elementId); // Maps no selectable.
100977
+ return undefined === this.mapLayerFromIds(pixel.modelId, pixel.elementId); // Maps no selectable.
100778
100978
  }
100779
100979
  /** Read the current image from this viewport from the rendering system. If a "null" rectangle is supplied (@see [[ViewRect.isNull]]), the entire view is captured.
100780
100980
  * @param rect The area of the view to read. The origin of a viewRect must specify the upper left corner.
@@ -100883,7 +101083,7 @@ class Viewport {
100883
101083
  // Likewise, if it is a hit on a model with a display transform, reverse the display transform.
100884
101084
  if (!preserveModelDisplayTransforms) {
100885
101085
  const pixel = pixels.getPixel(x, y);
100886
- const modelId = pixel.featureTable?.modelId;
101086
+ const modelId = pixel.modelId;
100887
101087
  if (undefined !== modelId) {
100888
101088
  const transform = this.view.computeDisplayTransform({ modelId, elementId: pixel.feature?.elementId });
100889
101089
  transform?.multiplyInversePoint3d(npc, npc);
@@ -102416,6 +102616,7 @@ __webpack_require__.r(__webpack_exports__);
102416
102616
  /* harmony export */ "queryVisibleFeatures": () => (/* reexport safe */ _render_VisibleFeature__WEBPACK_IMPORTED_MODULE_101__.queryVisibleFeatures),
102417
102617
  /* harmony export */ "rangeToCartographicArea": () => (/* reexport safe */ _ViewGlobalLocation__WEBPACK_IMPORTED_MODULE_58__.rangeToCartographicArea),
102418
102618
  /* harmony export */ "readElementGraphics": () => (/* reexport safe */ _tile_internal__WEBPACK_IMPORTED_MODULE_105__.readElementGraphics),
102619
+ /* harmony export */ "readGltf": () => (/* reexport safe */ _tile_internal__WEBPACK_IMPORTED_MODULE_105__.readGltf),
102419
102620
  /* harmony export */ "readGltfGraphics": () => (/* reexport safe */ _tile_internal__WEBPACK_IMPORTED_MODULE_105__.readGltfGraphics),
102420
102621
  /* harmony export */ "readPointCloudTileContent": () => (/* reexport safe */ _tile_internal__WEBPACK_IMPORTED_MODULE_105__.readPointCloudTileContent),
102421
102622
  /* harmony export */ "synchronizeViewportFrusta": () => (/* reexport safe */ _ViewportSync__WEBPACK_IMPORTED_MODULE_62__.synchronizeViewportFrusta),
@@ -106655,28 +106856,31 @@ var Pixel;
106655
106856
  /** Describes a single pixel within a [[Pixel.Buffer]]. */
106656
106857
  class Data {
106657
106858
  /** @internal */
106658
- constructor(feature, distanceFraction = -1.0, type = GeometryType.Unknown, planarity = Planarity.Unknown, featureTable, iModel, tileId) {
106659
- this.feature = feature;
106660
- this.distanceFraction = distanceFraction;
106661
- this.type = type;
106662
- this.planarity = planarity;
106663
- this.featureTable = featureTable;
106664
- this.iModel = iModel;
106665
- this.tileId = tileId;
106859
+ constructor(args) {
106860
+ if (args?.feature)
106861
+ this.feature = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Feature(args.feature.elementId, args.feature.subCategoryId, args.feature.geometryClass);
106862
+ this.modelId = args?.feature?.modelId;
106863
+ this.distanceFraction = args?.distanceFraction ?? -1;
106864
+ this.type = args?.type ?? GeometryType.Unknown;
106865
+ this.planarity = args?.planarity ?? Planarity.Unknown;
106866
+ this.iModel = args?.iModel;
106867
+ this.tileId = args?.tileId;
106666
106868
  }
106667
106869
  /** @internal */
106668
- get isClassifier() { return undefined !== this.featureTable && _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.BatchType.Primary !== this.featureTable.type; }
106870
+ get isClassifier() {
106871
+ return undefined !== this.batchType && _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.BatchType.Primary !== this.batchType;
106872
+ }
106669
106873
  /** The Id of the element that produced the pixel. */
106670
106874
  get elementId() {
106671
- return undefined !== this.feature ? this.feature.elementId : undefined;
106875
+ return this.feature?.elementId;
106672
106876
  }
106673
106877
  /** The Id of the [SubCategory]($backend) that produced the pixel. */
106674
106878
  get subCategoryId() {
106675
- return undefined !== this.feature ? this.feature.subCategoryId : undefined;
106879
+ return this.feature?.subCategoryId;
106676
106880
  }
106677
106881
  /** The class of geometry that produced the pixel. */
106678
106882
  get geometryClass() {
106679
- return undefined !== this.feature ? this.feature.geometryClass : undefined;
106883
+ return this.feature?.geometryClass;
106680
106884
  }
106681
106885
  }
106682
106886
  Pixel.Data = Data;
@@ -106715,7 +106919,7 @@ var Pixel;
106715
106919
  let Selector;
106716
106920
  (function (Selector) {
106717
106921
  Selector[Selector["None"] = 0] = "None";
106718
- /** Select the [[Feature]] which produced each pixel, as well as the [[PackedFeatureTable]] from which the feature originated. */
106922
+ /** Select the [[Feature]] which produced each pixel. */
106719
106923
  Selector[Selector["Feature"] = 1] = "Feature";
106720
106924
  /** Select the type and planarity of geometry which produced each pixel as well as the fraction of its distance between the near and far planes. */
106721
106925
  Selector[Selector["GeometryAndDistance"] = 4] = "GeometryAndDistance";
@@ -108371,12 +108575,12 @@ class ScreenFeatures {
108371
108575
  for (let x = rect.left; x < rect.right; x++) {
108372
108576
  for (let y = rect.top; y < rect.bottom; y++) {
108373
108577
  const pixel = pixels.getPixel(x, y);
108374
- if (pixel.feature && pixel.featureTable) {
108578
+ if (pixel.feature && pixel.modelId) {
108375
108579
  yield {
108376
108580
  elementId: pixel.feature.elementId,
108377
108581
  subCategoryId: pixel.feature.subCategoryId,
108378
108582
  geometryClass: pixel.feature.geometryClass,
108379
- modelId: pixel.featureTable.modelId,
108583
+ modelId: pixel.modelId,
108380
108584
  iModel: pixel.iModel ?? iModel,
108381
108585
  };
108382
108586
  }
@@ -113249,16 +113453,16 @@ class BatchState {
113249
113453
  return _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.invalid;
113250
113454
  const featureIndex = featureId - batch.batchId;
113251
113455
  (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(featureIndex >= 0);
113252
- const parts = batch.featureTable.getElementIdPair(featureIndex);
113456
+ const parts = batch.featureTable.getElementIdPair(featureIndex, BatchState._scratchElementIdPair);
113253
113457
  return _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.fromUint32Pair(parts.lower, parts.upper);
113254
113458
  }
113255
- getFeature(featureId) {
113459
+ getFeature(featureId, result) {
113256
113460
  const batch = this.find(featureId);
113257
113461
  if (undefined === batch)
113258
113462
  return undefined;
113259
113463
  const featureIndex = featureId - batch.batchId;
113260
113464
  (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(featureIndex >= 0);
113261
- return batch.featureTable.findFeature(featureIndex);
113465
+ return batch.featureTable.findFeature(featureIndex, result);
113262
113466
  }
113263
113467
  get numFeatureIds() { return this.nextBatchId; }
113264
113468
  get numBatches() { return this._batches.length; }
@@ -113301,6 +113505,7 @@ class BatchState {
113301
113505
  return -1 !== index ? this._batches[index] : undefined;
113302
113506
  }
113303
113507
  }
113508
+ BatchState._scratchElementIdPair = { lower: 0, upper: 0 };
113304
113509
 
113305
113510
 
113306
113511
  /***/ }),
@@ -115438,9 +115643,10 @@ __webpack_require__.r(__webpack_exports__);
115438
115643
  /* harmony export */ "extractHilitedVolumeClassifierCommands": () => (/* binding */ extractHilitedVolumeClassifierCommands)
115439
115644
  /* harmony export */ });
115440
115645
  /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
115441
- /* harmony import */ var _FeatureOverrides__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FeatureOverrides */ "../../core/frontend/lib/esm/render/webgl/FeatureOverrides.js");
115442
- /* harmony import */ var _System__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./System */ "../../core/frontend/lib/esm/render/webgl/System.js");
115443
- /* harmony import */ var _TechniqueFlags__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TechniqueFlags */ "../../core/frontend/lib/esm/render/webgl/TechniqueFlags.js");
115646
+ /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
115647
+ /* harmony import */ var _FeatureOverrides__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FeatureOverrides */ "../../core/frontend/lib/esm/render/webgl/FeatureOverrides.js");
115648
+ /* harmony import */ var _System__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./System */ "../../core/frontend/lib/esm/render/webgl/System.js");
115649
+ /* harmony import */ var _TechniqueFlags__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TechniqueFlags */ "../../core/frontend/lib/esm/render/webgl/TechniqueFlags.js");
115444
115650
  /*---------------------------------------------------------------------------------------------
115445
115651
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
115446
115652
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -115452,6 +115658,7 @@ __webpack_require__.r(__webpack_exports__);
115452
115658
 
115453
115659
 
115454
115660
 
115661
+
115455
115662
  /* eslint-disable no-restricted-syntax */
115456
115663
  /** @internal */
115457
115664
  class ShaderProgramParams {
@@ -115467,7 +115674,7 @@ class ShaderProgramParams {
115467
115674
  bindProjectionMatrix(uniform) { this.target.uniforms.bindProjectionMatrix(uniform, this.isViewCoords); }
115468
115675
  get isViewCoords() { return 13 /* ViewOverlay */ === this.renderPass || 0 /* Background */ === this.renderPass; }
115469
115676
  get isOverlayPass() { return 12 /* WorldOverlay */ === this.renderPass || 13 /* ViewOverlay */ === this.renderPass; }
115470
- get context() { return _System__WEBPACK_IMPORTED_MODULE_2__.System.instance.context; }
115677
+ get context() { return _System__WEBPACK_IMPORTED_MODULE_3__.System.instance.context; }
115471
115678
  init(target, pass = 5 /* OpaqueGeneral */) {
115472
115679
  this._renderPass = pass;
115473
115680
  this._target = target;
@@ -115621,7 +115828,7 @@ class PrimitiveCommand {
115621
115828
  return this.primitive.getPass(target);
115622
115829
  }
115623
115830
  }
115624
- PrimitiveCommand._scratchTechniqueFlags = new _TechniqueFlags__WEBPACK_IMPORTED_MODULE_3__.TechniqueFlags();
115831
+ PrimitiveCommand._scratchTechniqueFlags = new _TechniqueFlags__WEBPACK_IMPORTED_MODULE_4__.TechniqueFlags();
115625
115832
  /** Extracts the commands for rendering the flashed classifier (if any) from the by-index set of volume classifier commands.
115626
115833
  * NB: Cmds will be sets of some pushes, a primitive, and then some pops (equal to number of pushes).
115627
115834
  * The primitive should be right in the middle of a set. We need to find the set which matches the flashID.
@@ -115650,6 +115857,7 @@ function extractFlashedVolumeClassifierCommands(flashedId, cmds, numCmdsPerClass
115650
115857
  }
115651
115858
  return undefined;
115652
115859
  }
115860
+ const scratchFeature = _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.PackedFeature.create();
115653
115861
  /** @internal */
115654
115862
  function extractHilitedVolumeClassifierCommands(hilites, cmds) {
115655
115863
  // TODO: This could really be done at the time the HiliteClassification render pass commands are being generated
@@ -115680,8 +115888,8 @@ function extractHilitedVolumeClassifierCommands(hilites, cmds) {
115680
115888
  const surface = cmd.primitive.cachedGeometry.asSurface;
115681
115889
  if (undefined === surface || undefined === surface.mesh.uniformFeatureId)
115682
115890
  continue;
115683
- const feature = batch.featureTable.getPackedFeature(surface.mesh.uniformFeatureId);
115684
- if (undefined === feature || !(0,_FeatureOverrides__WEBPACK_IMPORTED_MODULE_1__.isFeatureHilited)(feature, hilites, hilites.models.hasId(batch.featureTable.modelId)))
115891
+ const feature = batch.featureTable.getPackedFeature(surface.mesh.uniformFeatureId, scratchFeature);
115892
+ if (undefined === feature || !(0,_FeatureOverrides__WEBPACK_IMPORTED_MODULE_2__.isFeatureHilited)(feature, hilites, hilites.models.hasId(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.fromUint32PairObject(feature.modelId))))
115685
115893
  continue;
115686
115894
  break;
115687
115895
  }
@@ -116266,13 +116474,14 @@ __webpack_require__.r(__webpack_exports__);
116266
116474
  /* harmony export */ "isFeatureHilited": () => (/* binding */ isFeatureHilited)
116267
116475
  /* harmony export */ });
116268
116476
  /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
116269
- /* harmony import */ var _primitives_DisplayParams__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../primitives/DisplayParams */ "../../core/frontend/lib/esm/render/primitives/DisplayParams.js");
116270
- /* harmony import */ var _LineCode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LineCode */ "../../core/frontend/lib/esm/render/webgl/LineCode.js");
116271
- /* harmony import */ var _GL__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./GL */ "../../core/frontend/lib/esm/render/webgl/GL.js");
116272
- /* harmony import */ var _RenderFlags__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./RenderFlags */ "../../core/frontend/lib/esm/render/webgl/RenderFlags.js");
116273
- /* harmony import */ var _Sync__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Sync */ "../../core/frontend/lib/esm/render/webgl/Sync.js");
116274
- /* harmony import */ var _System__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./System */ "../../core/frontend/lib/esm/render/webgl/System.js");
116275
- /* harmony import */ var _Texture__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Texture */ "../../core/frontend/lib/esm/render/webgl/Texture.js");
116477
+ /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
116478
+ /* harmony import */ var _primitives_DisplayParams__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../primitives/DisplayParams */ "../../core/frontend/lib/esm/render/primitives/DisplayParams.js");
116479
+ /* harmony import */ var _LineCode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LineCode */ "../../core/frontend/lib/esm/render/webgl/LineCode.js");
116480
+ /* harmony import */ var _GL__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./GL */ "../../core/frontend/lib/esm/render/webgl/GL.js");
116481
+ /* harmony import */ var _RenderFlags__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./RenderFlags */ "../../core/frontend/lib/esm/render/webgl/RenderFlags.js");
116482
+ /* harmony import */ var _Sync__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Sync */ "../../core/frontend/lib/esm/render/webgl/Sync.js");
116483
+ /* harmony import */ var _System__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./System */ "../../core/frontend/lib/esm/render/webgl/System.js");
116484
+ /* harmony import */ var _Texture__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Texture */ "../../core/frontend/lib/esm/render/webgl/Texture.js");
116276
116485
  /*---------------------------------------------------------------------------------------------
116277
116486
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
116278
116487
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -116288,8 +116497,9 @@ __webpack_require__.r(__webpack_exports__);
116288
116497
 
116289
116498
 
116290
116499
 
116500
+
116291
116501
  function computeWidthAndHeight(nEntries, nRgbaPerEntry, nExtraRgba = 0, nTables = 1) {
116292
- const maxSize = _System__WEBPACK_IMPORTED_MODULE_6__.System.instance.maxTextureSize;
116502
+ const maxSize = _System__WEBPACK_IMPORTED_MODULE_7__.System.instance.maxTextureSize;
116293
116503
  const nRgba = nEntries * nRgbaPerEntry * nTables + nExtraRgba;
116294
116504
  if (nRgba < maxSize)
116295
116505
  return { width: nRgba, height: 1 };
@@ -116318,6 +116528,7 @@ function isFeatureHilited(feature, hilites, isModelHilited) {
116318
116528
  return isModelHilited || hilites.elements.hasPair(feature.elementId) || hilites.subcategories.hasPair(feature.subCategoryId);
116319
116529
  return hilites.elements.hasPair(feature.elementId) || (isModelHilited && hilites.subcategories.hasPair(feature.subCategoryId));
116320
116530
  }
116531
+ const scratchPackedFeature = _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.PackedFeature.createWithIndex();
116321
116532
  /** @internal */
116322
116533
  class FeatureOverrides {
116323
116534
  constructor(target, options, cleanup) {
@@ -116377,12 +116588,12 @@ class FeatureOverrides {
116377
116588
  this._lutParams[0] = width;
116378
116589
  this._lutParams[1] = height;
116379
116590
  const data = new Uint8Array(width * height * 4);
116380
- const creator = new _Texture__WEBPACK_IMPORTED_MODULE_7__.Texture2DDataUpdater(data);
116591
+ const creator = new _Texture__WEBPACK_IMPORTED_MODULE_8__.Texture2DDataUpdater(data);
116381
116592
  this.buildLookupTable(creator, map, ovrs, flashed, hilite);
116382
- return _Texture__WEBPACK_IMPORTED_MODULE_7__.TextureHandle.createForData(width, height, data, true, _GL__WEBPACK_IMPORTED_MODULE_3__.GL.Texture.WrapMode.ClampToEdge);
116593
+ return _Texture__WEBPACK_IMPORTED_MODULE_8__.TextureHandle.createForData(width, height, data, true, _GL__WEBPACK_IMPORTED_MODULE_4__.GL.Texture.WrapMode.ClampToEdge);
116383
116594
  }
116384
116595
  _update(map, lut, flashed, hilites, ovrs) {
116385
- const updater = new _Texture__WEBPACK_IMPORTED_MODULE_7__.Texture2DDataUpdater(lut.dataBytes);
116596
+ const updater = new _Texture__WEBPACK_IMPORTED_MODULE_8__.Texture2DDataUpdater(lut.dataBytes);
116386
116597
  if (undefined === ovrs) {
116387
116598
  this.updateFlashedAndHilited(updater, map, flashed, hilites);
116388
116599
  }
@@ -116396,8 +116607,8 @@ class FeatureOverrides {
116396
116607
  const allowHilite = true !== this._options.noHilite;
116397
116608
  const allowFlash = true !== this._options.noFlash;
116398
116609
  const allowEmphasis = true !== this._options.noEmphasis;
116399
- const modelIdParts = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.getUint32Pair(map.modelId);
116400
- const isModelHilited = allowHilite && hilites.models.hasPair(modelIdParts);
116610
+ let isModelHilited = false;
116611
+ const prevModelId = { lower: -1, upper: -1 };
116401
116612
  this._anyOpaque = this._anyTranslucent = this._anyViewIndependentTranslucent = this._anyHilited = false;
116402
116613
  let nHidden = 0;
116403
116614
  let nOverridden = 0;
@@ -116409,10 +116620,15 @@ class FeatureOverrides {
116409
116620
  // [1]
116410
116621
  // RGB = rgb
116411
116622
  // A = alpha
116412
- for (let i = 0; i < map.numFeatures; i++) {
116413
- const feature = map.getPackedFeature(i);
116623
+ for (const feature of map.iterable(scratchPackedFeature)) {
116624
+ const i = feature.index;
116414
116625
  const dataIndex = i * 4 * 2;
116415
- const app = this.target.currentBranch.getFeatureAppearance(ovr, feature.elementId.lower, feature.elementId.upper, feature.subCategoryId.lower, feature.subCategoryId.upper, feature.geometryClass, modelIdParts.lower, modelIdParts.upper, map.type, feature.animationNodeId);
116626
+ if (prevModelId.lower !== feature.modelId.lower || prevModelId.upper !== feature.modelId.upper) {
116627
+ prevModelId.lower = feature.modelId.lower;
116628
+ prevModelId.upper = feature.modelId.upper;
116629
+ isModelHilited = allowHilite && hilites.models.hasPair(feature.modelId);
116630
+ }
116631
+ const app = this.target.currentBranch.getFeatureAppearance(ovr, feature.elementId.lower, feature.elementId.upper, feature.subCategoryId.lower, feature.subCategoryId.upper, feature.geometryClass, feature.modelId.lower, feature.modelId.upper, map.type, feature.animationNodeId);
116416
116632
  // NB: If the appearance is fully transparent, then:
116417
116633
  // - For normal ("primary") models, getAppearance() returns undefined.
116418
116634
  // - For classifier models, getAppearance() returns the appearance, and classification shader will discard fully-transparent classified pixels.
@@ -116445,7 +116661,7 @@ class FeatureOverrides {
116445
116661
  flags |= 4 /* Alpha */;
116446
116662
  let alpha = 1.0 - app.transparency;
116447
116663
  alpha = Math.floor(0xff * alpha + 0.5);
116448
- if ((0xff - alpha) < _primitives_DisplayParams__WEBPACK_IMPORTED_MODULE_1__.DisplayParams.minTransparency)
116664
+ if ((0xff - alpha) < _primitives_DisplayParams__WEBPACK_IMPORTED_MODULE_2__.DisplayParams.minTransparency)
116449
116665
  alpha = 0xff;
116450
116666
  data.setByteAtIndex(dataIndex + 7, alpha);
116451
116667
  if (0xff === alpha) {
@@ -116468,7 +116684,7 @@ class FeatureOverrides {
116468
116684
  }
116469
116685
  if (app.overridesLinePixels && app.linePixels) {
116470
116686
  flags |= 64 /* LineCode */;
116471
- const lineCode = _LineCode__WEBPACK_IMPORTED_MODULE_2__.LineCode.valueFromLinePixels(app.linePixels);
116687
+ const lineCode = _LineCode__WEBPACK_IMPORTED_MODULE_3__.LineCode.valueFromLinePixels(app.linePixels);
116472
116688
  data.setByteAtIndex(dataIndex + 2, lineCode);
116473
116689
  }
116474
116690
  if (app.ignoresMaterial)
@@ -116491,37 +116707,25 @@ class FeatureOverrides {
116491
116707
  }
116492
116708
  const allowFlash = true !== this._options.noFlash;
116493
116709
  const intersect = "intersection" === hilites.modelSubCategoryMode;
116494
- let isModelHilited = false;
116495
- if (!hilites.models.isEmpty) {
116496
- const modelId = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.getUint32Pair(map.modelId);
116497
- isModelHilited = hilites.models.hasPair(modelId);
116498
- }
116499
116710
  this._anyOverridden = this._anyHilited = false;
116500
- for (let i = 0; i < map.numFeatures; i++) {
116501
- const dataIndex = i * 4 * 2;
116711
+ for (const feature of map.iterable(scratchPackedFeature)) {
116712
+ const dataIndex = feature.index * 4 * 2;
116502
116713
  const oldFlags = data.getOvrFlagsAtIndex(dataIndex);
116503
116714
  if (0 /* None */ !== (oldFlags & 1 /* Visibility */)) {
116504
116715
  // If it's invisible, none of the other flags matter. We can't flash it and don't want to hilite it.
116505
116716
  this._anyOverridden = true;
116506
116717
  continue;
116507
116718
  }
116508
- let elemId;
116719
+ const isModelHilited = hilites.models.hasPair(feature.modelId);
116509
116720
  let isHilited = isModelHilited && !intersect;
116510
- if (!isHilited && !hilites.elements.isEmpty) {
116511
- elemId = map.getElementIdPair(i);
116512
- isHilited = hilites.elements.hasPair(elemId);
116513
- }
116514
- if (!isHilited && !hilites.subcategories.isEmpty) {
116515
- if (isModelHilited || !intersect) {
116516
- const subcat = map.getSubCategoryIdPair(i);
116517
- isHilited = hilites.subcategories.hasPair(subcat);
116518
- }
116519
- }
116721
+ if (!isHilited)
116722
+ isHilited = hilites.elements.hasPair(feature.elementId);
116723
+ if (!isHilited)
116724
+ if (isModelHilited || !intersect)
116725
+ isHilited = hilites.subcategories.hasPair(feature.subCategoryId);
116520
116726
  let isFlashed = false;
116521
- if (flashed && allowFlash) {
116522
- elemId = elemId ?? map.getElementIdPair(i);
116523
- isFlashed = elemId.lower === flashed.lower && elemId.upper === flashed.upper;
116524
- }
116727
+ if (flashed && allowFlash)
116728
+ isFlashed = feature.elementId.lower === flashed.lower && feature.elementId.upper === flashed.upper;
116525
116729
  let newFlags = isFlashed ? (oldFlags | 16 /* Flashed */) : (oldFlags & ~16 /* Flashed */);
116526
116730
  newFlags = isHilited ? (newFlags | 256 /* Hilited */) : (newFlags & ~256 /* Hilited */);
116527
116731
  data.setOvrFlagsAtIndex(dataIndex, newFlags);
@@ -116536,6 +116740,7 @@ class FeatureOverrides {
116536
116740
  if (true === this._options.noFlash)
116537
116741
  return;
116538
116742
  this._anyOverridden = false;
116743
+ const elemId = { lower: 0, upper: 0 };
116539
116744
  for (let i = 0; i < map.numFeatures; i++) {
116540
116745
  const dataIndex = i * 4 * 2;
116541
116746
  const oldFlags = data.getOvrFlagsAtIndex(dataIndex);
@@ -116546,7 +116751,7 @@ class FeatureOverrides {
116546
116751
  }
116547
116752
  let isFlashed = false;
116548
116753
  if (flashed) {
116549
- const elemId = map.getElementIdPair(i);
116754
+ map.getElementIdPair(i, elemId);
116550
116755
  isFlashed = elemId.lower === flashed.lower && elemId.upper === flashed.upper;
116551
116756
  }
116552
116757
  const newFlags = isFlashed ? (oldFlags | 16 /* Flashed */) : (oldFlags & ~16 /* Flashed */);
@@ -116587,7 +116792,7 @@ class FeatureOverrides {
116587
116792
  ovrs = undefined;
116588
116793
  const flashedId = this.target.flashedId;
116589
116794
  const hiliteSyncTarget = this.target.hiliteSyncTarget;
116590
- const hiliteUpdated = !(0,_Sync__WEBPACK_IMPORTED_MODULE_5__.sync)(hiliteSyncTarget, this._hiliteSyncObserver);
116795
+ const hiliteUpdated = !(0,_Sync__WEBPACK_IMPORTED_MODULE_6__.sync)(hiliteSyncTarget, this._hiliteSyncObserver);
116591
116796
  const hilite = this.target.hilites;
116592
116797
  if (ovrsUpdated || hiliteUpdated || flashedId !== this._lastFlashId) {
116593
116798
  // _lut can be undefined if context was lost, (gl.createTexture returns null)
@@ -116601,7 +116806,7 @@ class FeatureOverrides {
116601
116806
  }
116602
116807
  bindLUT(uniform) {
116603
116808
  if (this._lut)
116604
- this._lut.bindSampler(uniform, _RenderFlags__WEBPACK_IMPORTED_MODULE_4__.TextureUnit.FeatureSymbology);
116809
+ this._lut.bindSampler(uniform, _RenderFlags__WEBPACK_IMPORTED_MODULE_5__.TextureUnit.FeatureSymbology);
116605
116810
  }
116606
116811
  bindUniformSymbologyFlags(uniform) {
116607
116812
  uniform.setUniform1f(this._uniformSymbologyFlags);
@@ -122442,7 +122647,7 @@ class RenderCommands {
122442
122647
  }
122443
122648
  // If we have an active volume classifier then force all batches for the reality data being classified into a special render pass.
122444
122649
  let savedForcedRenderPass = 255 /* None */;
122445
- if (undefined !== this.target.activeVolumeClassifierModelId && batch.featureTable.modelId === this.target.activeVolumeClassifierModelId) {
122650
+ if (undefined !== this.target.activeVolumeClassifierModelId && batch.featureTable.batchModelId === this.target.activeVolumeClassifierModelId) {
122446
122651
  savedForcedRenderPass = this._forcedRenderPass;
122447
122652
  this._forcedRenderPass = 20 /* VolumeClassifiedRealityData */;
122448
122653
  }
@@ -123520,6 +123725,7 @@ class Geometry {
123520
123725
  // Represents a view of data read from a region of the frame buffer.
123521
123726
  class PixelBuffer {
123522
123727
  constructor(rect, selector, compositor) {
123728
+ this._scratchModelFeature = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ModelFeature.create();
123523
123729
  this._scratchUint32Array = new Uint32Array(1);
123524
123730
  this._scratchUint8Array = new Uint8Array(this._scratchUint32Array.buffer);
123525
123731
  this._scratchVector3d = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Vector3d();
@@ -123558,9 +123764,9 @@ class PixelBuffer {
123558
123764
  getPixel32(data, pixelIndex) {
123559
123765
  return pixelIndex < data.length ? data[pixelIndex] : undefined;
123560
123766
  }
123561
- getFeature(pixelIndex) {
123767
+ getFeature(pixelIndex, result) {
123562
123768
  const featureId = this.getFeatureId(pixelIndex);
123563
- return undefined !== featureId ? this._batchState.getFeature(featureId) : undefined;
123769
+ return undefined !== featureId ? this._batchState.getFeature(featureId, result) : undefined;
123564
123770
  }
123565
123771
  getFeatureId(pixelIndex) {
123566
123772
  return undefined !== this._featureId ? this.getPixel32(this._featureId, pixelIndex) : undefined;
@@ -123602,7 +123808,7 @@ class PixelBuffer {
123602
123808
  let geometryType = px.type;
123603
123809
  let planarity = px.planarity;
123604
123810
  const haveFeatureIds = _Pixel__WEBPACK_IMPORTED_MODULE_4__.Pixel.Selector.None !== (this._selector & _Pixel__WEBPACK_IMPORTED_MODULE_4__.Pixel.Selector.Feature);
123605
- const feature = haveFeatureIds ? this.getFeature(index) : undefined;
123811
+ const feature = haveFeatureIds ? this.getFeature(index, this._scratchModelFeature) : undefined;
123606
123812
  const batchInfo = haveFeatureIds ? this.getBatchInfo(index) : undefined;
123607
123813
  if (_Pixel__WEBPACK_IMPORTED_MODULE_4__.Pixel.Selector.None !== (this._selector & _Pixel__WEBPACK_IMPORTED_MODULE_4__.Pixel.Selector.GeometryAndDistance) && undefined !== this._depthAndOrder) {
123608
123814
  const depthAndOrder = this.getPixel32(this._depthAndOrder, index);
@@ -123646,7 +123852,15 @@ class PixelBuffer {
123646
123852
  iModel = batchInfo.iModel;
123647
123853
  tileId = batchInfo.tileId;
123648
123854
  }
123649
- return new _Pixel__WEBPACK_IMPORTED_MODULE_4__.Pixel.Data(feature, distanceFraction, geometryType, planarity, featureTable, iModel, tileId);
123855
+ return new _Pixel__WEBPACK_IMPORTED_MODULE_4__.Pixel.Data({
123856
+ feature,
123857
+ distanceFraction,
123858
+ type: geometryType,
123859
+ planarity,
123860
+ batchType: featureTable?.type,
123861
+ iModel,
123862
+ tileId,
123863
+ });
123650
123864
  }
123651
123865
  get isEmpty() { return _Pixel__WEBPACK_IMPORTED_MODULE_4__.Pixel.Selector.None === this._selector; }
123652
123866
  static create(rect, selector, compositor) {
@@ -132359,11 +132573,11 @@ const clippedPasses = [
132359
132573
  8 /* Translucent */,
132360
132574
  11 /* OverlayLayers */,
132361
132575
  ];
132362
- function isFeatureVisible(feature, target, modelIdParts, includeNonLocatable) {
132576
+ function isFeatureVisible(feature, target, includeNonLocatable) {
132363
132577
  const ovrs = target.currentFeatureSymbologyOverrides;
132364
132578
  if (!ovrs)
132365
132579
  return true;
132366
- const app = target.currentBranch.getFeatureAppearance(ovrs, feature.elementId.lower, feature.elementId.upper, feature.subCategoryId.lower, feature.subCategoryId.upper, feature.geometryClass, modelIdParts.lower, modelIdParts.upper, _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.BatchType.Primary, feature.animationNodeId);
132580
+ const app = target.currentBranch.getFeatureAppearance(ovrs, feature.elementId.lower, feature.elementId.upper, feature.subCategoryId.lower, feature.subCategoryId.upper, feature.geometryClass, feature.modelId.lower, feature.modelId.upper, _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.BatchType.Primary, feature.animationNodeId);
132367
132581
  return undefined !== app && (includeNonLocatable || !app.nonLocatable);
132368
132582
  }
132369
132583
  function* commandIterator(features, pass) {
@@ -132378,16 +132592,15 @@ function* commandIterator(features, pass) {
132378
132592
  const ovrs = command.batch.getOverrides(features.target);
132379
132593
  if (ovrs.allHidden)
132380
132594
  continue;
132595
+ const scratchFeature = _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.PackedFeature.createWithIndex();
132381
132596
  const table = command.batch.featureTable;
132382
- const modelIdParts = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.getUint32Pair(table.modelId);
132383
- for (let i = 0; i < table.numFeatures; i++) {
132384
- const feature = table.getPackedFeature(i);
132385
- if (!ovrs.anyOverridden || isFeatureVisible(feature, features.target, modelIdParts, features.includeNonLocatable)) {
132597
+ for (const feature of table.iterable(scratchFeature)) {
132598
+ if (!ovrs.anyOverridden || isFeatureVisible(feature, features.target, features.includeNonLocatable)) {
132386
132599
  yield {
132387
132600
  elementId: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.fromUint32PairObject(feature.elementId),
132388
132601
  subCategoryId: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.fromUint32PairObject(feature.subCategoryId),
132389
132602
  geometryClass: feature.geometryClass,
132390
- modelId: table.modelId,
132603
+ modelId: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.fromUint32PairObject(feature.modelId),
132391
132604
  iModel: command.batch.batchIModel ?? features.iModel,
132392
132605
  };
132393
132606
  }
@@ -139929,7 +140142,7 @@ __webpack_require__.r(__webpack_exports__);
139929
140142
  /* harmony export */ });
139930
140143
  /* harmony import */ var deep_assign__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! deep-assign */ "../../common/temp/node_modules/.pnpm/deep-assign@2.0.0/node_modules/deep-assign/index.js");
139931
140144
  /* harmony import */ var deep_assign__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(deep_assign__WEBPACK_IMPORTED_MODULE_0__);
139932
- /* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! qs */ "../../common/temp/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/index.js");
140145
+ /* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! qs */ "../../common/temp/node_modules/.pnpm/qs@6.11.1/node_modules/qs/lib/index.js");
139933
140146
  /* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_1__);
139934
140147
  /* harmony import */ var superagent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! superagent */ "../../common/temp/node_modules/.pnpm/superagent@7.1.5/node_modules/superagent/lib/client.js");
139935
140148
  /* harmony import */ var superagent__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(superagent__WEBPACK_IMPORTED_MODULE_2__);
@@ -141231,6 +141444,7 @@ __webpack_require__.r(__webpack_exports__);
141231
141444
  /* harmony export */ "GltfMeshData": () => (/* binding */ GltfMeshData),
141232
141445
  /* harmony export */ "GltfReader": () => (/* binding */ GltfReader),
141233
141446
  /* harmony export */ "GltfReaderProps": () => (/* binding */ GltfReaderProps),
141447
+ /* harmony export */ "readGltf": () => (/* binding */ readGltf),
141234
141448
  /* harmony export */ "readGltfGraphics": () => (/* binding */ readGltfGraphics)
141235
141449
  /* harmony export */ });
141236
141450
  /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
@@ -141641,6 +141855,7 @@ class GltfReader {
141641
141855
  readStatus,
141642
141856
  isLeaf,
141643
141857
  contentRange,
141858
+ range,
141644
141859
  graphic: renderGraphic,
141645
141860
  };
141646
141861
  }
@@ -142556,16 +142771,38 @@ class GltfReader {
142556
142771
  * If a particular glTF asset fails to load and/or display properly, please
142557
142772
  * [submit an issue](https://github.com/iTwin/itwinjs-core/issues).
142558
142773
  * @see [Example decorator]($docs/learning/frontend/ViewDecorations#gltf-decorations) for an example of a decorator that reads and displays a glTF asset.
142774
+ * @see [[readGltf]] to obtain more information about the glTF model.
142559
142775
  * @public
142560
142776
  */
142561
142777
  async function readGltfGraphics(args) {
142778
+ const result = await readGltf(args);
142779
+ return result?.graphic;
142780
+ }
142781
+ /** Produce a [[RenderGraphic]] from a [glTF](https://www.khronos.org/gltf/) asset suitable for use in [view decorations]($docs/learning/frontend/ViewDecorations).
142782
+ * @returns a graphic produced from the glTF asset's default scene, or `undefined` if a graphic could not be produced from the asset.
142783
+ * The returned graphic also includes the bounding boxes of the glTF model in world and local coordiantes.
142784
+ * @note Support for the full [glTF 2.0 specification](https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html) is currently a work in progress.
142785
+ * If a particular glTF asset fails to load and/or display properly, please
142786
+ * [submit an issue](https://github.com/iTwin/itwinjs-core/issues).
142787
+ * @see [Example decorator]($docs/learning/frontend/ViewDecorations#gltf-decorations) for an example of a decorator that reads and displays a glTF asset.
142788
+ * @public
142789
+ */
142790
+ async function readGltf(args) {
142562
142791
  const baseUrl = typeof args.baseUrl === "string" ? new URL(args.baseUrl) : args.baseUrl;
142563
142792
  const props = GltfReaderProps.create(args.gltf, true, baseUrl); // glTF supports exactly one coordinate system with y axis up.
142564
142793
  const reader = props ? new GltfGraphicsReader(props, args) : undefined;
142565
142794
  if (!reader)
142566
142795
  return undefined;
142567
142796
  const result = await reader.read();
142568
- return result.graphic;
142797
+ if (!result.graphic)
142798
+ return undefined;
142799
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(result.contentRange !== undefined, "readGltf always computes content range");
142800
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(result.range !== undefined, "readGltf always computes world range");
142801
+ return {
142802
+ graphic: result.graphic,
142803
+ localBoundingBox: result.contentRange ?? _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Range3d.createNull(),
142804
+ boundingBox: result.range ?? _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Range3d.createNull(),
142805
+ };
142569
142806
  }
142570
142807
  /** Implements [[readGltfGraphics]]. Exported strictly for tests.
142571
142808
  * @internal
@@ -143735,10 +143972,11 @@ function extractNodeId(nodeName) {
143735
143972
  * @internal
143736
143973
  */
143737
143974
  class ImdlReader {
143738
- constructor(imdl, binaryPosition, args) {
143975
+ constructor(imdl, binaryPosition, args, hasMultiModelFeatureTable) {
143739
143976
  this._patternGeometry = new Map();
143740
143977
  this._buffer = args.stream;
143741
143978
  this._binaryData = new Uint8Array(this._buffer.arrayBuffer, binaryPosition);
143979
+ this._hasMultiModelFeatureTable = hasMultiModelFeatureTable;
143742
143980
  this._animationNodes = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asObject(imdl.animationNodes);
143743
143981
  this._bufferViews = imdl.bufferViews;
143744
143982
  this._meshes = imdl.meshes;
@@ -143794,7 +144032,7 @@ class ImdlReader {
143794
144032
  patternSymbols: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asObject(sceneValue.patternSymbols),
143795
144033
  rtcCenter: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asArray(sceneValue.rtcCenter),
143796
144034
  };
143797
- return undefined !== imdl.meshes ? new ImdlReader(imdl, gltfHeader.binaryPosition, args) : undefined;
144035
+ return undefined !== imdl.meshes ? new ImdlReader(imdl, gltfHeader.binaryPosition, args, 0 !== (imdlHeader.flags & _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ImdlFlags.MultiModelFeatureTable)) : undefined;
143798
144036
  }
143799
144037
  catch (_) {
143800
144038
  return undefined;
@@ -143993,33 +144231,40 @@ class ImdlReader {
143993
144231
  const packedFeatureArray = new Uint32Array(this._buffer.nextUint32s(numUint32s));
143994
144232
  if (this._buffer.isPastTheEnd)
143995
144233
  return undefined;
143996
- let animNodesArray;
143997
- const animationNodes = this._animationNodes;
143998
- if (undefined !== animationNodes) {
143999
- const bytesPerId = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asInt(animationNodes.bytesPerId);
144000
- const bufferViewId = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asString(animationNodes.bufferView);
144001
- const bufferViewJson = this._bufferViews[bufferViewId];
144002
- if (undefined !== bufferViewJson) {
144003
- const byteOffset = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asInt(bufferViewJson.byteOffset);
144004
- const byteLength = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asInt(bufferViewJson.byteLength);
144005
- const bytes = this._binaryData.subarray(byteOffset, byteOffset + byteLength);
144006
- switch (bytesPerId) {
144007
- case 1:
144008
- animNodesArray = new Uint8Array(bytes);
144009
- break;
144010
- case 2:
144011
- // NB: A *copy* of the subarray.
144012
- animNodesArray = Uint16Array.from(new Uint16Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 2));
144013
- break;
144014
- case 4:
144015
- // NB: A *copy* of the subarray.
144016
- animNodesArray = Uint32Array.from(new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4));
144017
- break;
144234
+ let featureTable;
144235
+ if (this._hasMultiModelFeatureTable) {
144236
+ featureTable = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.MultiModelPackedFeatureTable.create(packedFeatureArray, this._modelId, header.count, this._type, header.numSubCategories);
144237
+ }
144238
+ else {
144239
+ let animNodesArray;
144240
+ const animationNodes = this._animationNodes;
144241
+ if (undefined !== animationNodes) {
144242
+ const bytesPerId = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asInt(animationNodes.bytesPerId);
144243
+ const bufferViewId = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asString(animationNodes.bufferView);
144244
+ const bufferViewJson = this._bufferViews[bufferViewId];
144245
+ if (undefined !== bufferViewJson) {
144246
+ const byteOffset = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asInt(bufferViewJson.byteOffset);
144247
+ const byteLength = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.JsonUtils.asInt(bufferViewJson.byteLength);
144248
+ const bytes = this._binaryData.subarray(byteOffset, byteOffset + byteLength);
144249
+ switch (bytesPerId) {
144250
+ case 1:
144251
+ animNodesArray = new Uint8Array(bytes);
144252
+ break;
144253
+ case 2:
144254
+ // NB: A *copy* of the subarray.
144255
+ animNodesArray = Uint16Array.from(new Uint16Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 2));
144256
+ break;
144257
+ case 4:
144258
+ // NB: A *copy* of the subarray.
144259
+ animNodesArray = Uint32Array.from(new Uint32Array(bytes.buffer, bytes.byteOffset, bytes.byteLength / 4));
144260
+ break;
144261
+ }
144018
144262
  }
144019
144263
  }
144264
+ featureTable = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.PackedFeatureTable(packedFeatureArray, this._modelId, header.count, this._type, animNodesArray);
144020
144265
  }
144021
144266
  this._buffer.curPos = startPos + header.length;
144022
- return new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.PackedFeatureTable(packedFeatureArray, this._modelId, header.count, header.maxFeatures, this._type, animNodesArray);
144267
+ return featureTable;
144023
144268
  }
144024
144269
  static skipFeatureTable(stream) {
144025
144270
  const startPos = stream.curPos;
@@ -144487,6 +144732,7 @@ class ImdlReader {
144487
144732
  if ("Node_Root" === nodeKey) {
144488
144733
  if (this._timeline) {
144489
144734
  // Split up the root node into transform nodes.
144735
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(featureTable instanceof _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.PackedFeatureTable, "multi-model feature tables never include animation branches");
144490
144736
  this.readAnimationBranches(graphics, meshValue, featureTable);
144491
144737
  }
144492
144738
  else if (this._containsTransformNodes) {
@@ -146183,6 +146429,8 @@ class SpatialRefs {
146183
146429
  update() {
146184
146430
  this._allLoaded = false;
146185
146431
  }
146432
+ attachToViewport() { }
146433
+ detachFromViewport() { }
146186
146434
  *[Symbol.iterator]() {
146187
146435
  this.load();
146188
146436
  for (const modelRef of this._refs.values())
@@ -151744,6 +151992,7 @@ __webpack_require__.r(__webpack_exports__);
151744
151992
  /* harmony export */ "internalMapLayerImageryFormats": () => (/* reexport safe */ _map_MapLayerImageryFormats__WEBPACK_IMPORTED_MODULE_51__.internalMapLayerImageryFormats),
151745
151993
  /* harmony export */ "overrideRequestTileTreeProps": () => (/* reexport safe */ _TileAdmin__WEBPACK_IMPORTED_MODULE_21__.overrideRequestTileTreeProps),
151746
151994
  /* harmony export */ "readElementGraphics": () => (/* reexport safe */ _ImdlReader__WEBPACK_IMPORTED_MODULE_33__.readElementGraphics),
151995
+ /* harmony export */ "readGltf": () => (/* reexport safe */ _GltfReader__WEBPACK_IMPORTED_MODULE_30__.readGltf),
151747
151996
  /* harmony export */ "readGltfGraphics": () => (/* reexport safe */ _GltfReader__WEBPACK_IMPORTED_MODULE_30__.readGltfGraphics),
151748
151997
  /* harmony export */ "readPointCloudTileContent": () => (/* reexport safe */ _PntsReader__WEBPACK_IMPORTED_MODULE_64__.readPointCloudTileContent)
151749
151998
  /* harmony export */ });
@@ -161857,7 +162106,11 @@ class ViewClipDecoration extends _EditManipulator__WEBPACK_IMPORTED_MODULE_8__.E
161857
162106
  this._clipEventHandler.onModifyClip(this._clipView);
161858
162107
  }
161859
162108
  testDecorationHit(id) { return (id === this._clipId || this._controlIds.includes(id)); }
161860
- async getDecorationToolTip(hit) { return (hit.sourceId === this._clipId ? "View Clip" : "Modify View Clip"); }
162109
+ async getDecorationToolTip(hit) {
162110
+ if (hit.sourceId === this._clipId)
162111
+ return _Tool__WEBPACK_IMPORTED_MODULE_10__.CoreTools.translate("ViewClip.Message.Clip");
162112
+ return _Tool__WEBPACK_IMPORTED_MODULE_10__.CoreTools.translate("ViewClip.Message.ModifyClip");
162113
+ }
161861
162114
  updateDecorationListener(_add) { super.updateDecorationListener(undefined !== this._clipId); } // Decorator isn't just for resize controls...
161862
162115
  decorate(context) {
161863
162116
  if (this._suspendDecorator)
@@ -180730,7 +180983,6 @@ var ClipMaskXYZRangePlanes;
180730
180983
  * * In normal usage, callers get "outside" clip behavior using ONLY the ClipShape isMask property.
180731
180984
  * * The ClipShape happens to pass the _invisible bit down to ClipPlanes that it creates.
180732
180985
  * * At that level, the flag controls whether the cut edges are produced on the plane
180733
- * * This seems like an confused overloading of the meaning.
180734
180986
  * @public
180735
180987
  */
180736
180988
  class ClipPrimitive {
@@ -181333,21 +181585,22 @@ __webpack_require__.r(__webpack_exports__);
181333
181585
  /* harmony export */ "ClipStepAction": () => (/* binding */ ClipStepAction),
181334
181586
  /* harmony export */ "ClipUtilities": () => (/* binding */ ClipUtilities)
181335
181587
  /* harmony export */ });
181588
+ /* harmony import */ var _curve_CurveFactory__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../curve/CurveFactory */ "../../core/geometry/lib/esm/curve/CurveFactory.js");
181336
181589
  /* harmony import */ var _curve_LineString3d__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../curve/LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
181337
181590
  /* harmony import */ var _curve_Loop__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../curve/Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
181338
181591
  /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
181339
181592
  /* harmony import */ var _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../geometry3d/GrowableXYZArray */ "../../core/geometry/lib/esm/geometry3d/GrowableXYZArray.js");
181593
+ /* harmony import */ var _geometry3d_Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../geometry3d/Point3dArrayCarrier */ "../../core/geometry/lib/esm/geometry3d/Point3dArrayCarrier.js");
181340
181594
  /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
181341
181595
  /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
181596
+ /* harmony import */ var _geometry3d_ReusableObjectCache__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../geometry3d/ReusableObjectCache */ "../../core/geometry/lib/esm/geometry3d/ReusableObjectCache.js");
181597
+ /* harmony import */ var _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../polyface/PolyfaceBuilder */ "../../core/geometry/lib/esm/polyface/PolyfaceBuilder.js");
181342
181598
  /* harmony import */ var _ClipPlane__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ClipPlane */ "../../core/geometry/lib/esm/clipping/ClipPlane.js");
181343
181599
  /* harmony import */ var _ClipPrimitive__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ClipPrimitive */ "../../core/geometry/lib/esm/clipping/ClipPrimitive.js");
181344
181600
  /* harmony import */ var _ClipVector__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ClipVector */ "../../core/geometry/lib/esm/clipping/ClipVector.js");
181345
181601
  /* harmony import */ var _ConvexClipPlaneSet__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ConvexClipPlaneSet */ "../../core/geometry/lib/esm/clipping/ConvexClipPlaneSet.js");
181602
+ /* harmony import */ var _internalContexts_LineStringOffsetClipperContext__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./internalContexts/LineStringOffsetClipperContext */ "../../core/geometry/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js");
181346
181603
  /* harmony import */ var _UnionOfConvexClipPlaneSets__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./UnionOfConvexClipPlaneSets */ "../../core/geometry/lib/esm/clipping/UnionOfConvexClipPlaneSets.js");
181347
- /* harmony import */ var _geometry3d_ReusableObjectCache__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../geometry3d/ReusableObjectCache */ "../../core/geometry/lib/esm/geometry3d/ReusableObjectCache.js");
181348
- /* harmony import */ var _internalContexts_LineStringOffsetClipperContext__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./internalContexts/LineStringOffsetClipperContext */ "../../core/geometry/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js");
181349
- /* harmony import */ var _geometry3d_Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../geometry3d/Point3dArrayCarrier */ "../../core/geometry/lib/esm/geometry3d/Point3dArrayCarrier.js");
181350
- /* harmony import */ var _curve_CurveFactory__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../curve/CurveFactory */ "../../core/geometry/lib/esm/curve/CurveFactory.js");
181351
181604
  /*---------------------------------------------------------------------------------------------
181352
181605
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
181353
181606
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -181370,6 +181623,7 @@ __webpack_require__.r(__webpack_exports__);
181370
181623
 
181371
181624
 
181372
181625
 
181626
+
181373
181627
  /** Enumerated type for describing where geometry lies with respect to clipping planes.
181374
181628
  * @public
181375
181629
  */
@@ -181407,7 +181661,7 @@ var ClipStatus;
181407
181661
  /** geometry is clearly inside */
181408
181662
  ClipStatus[ClipStatus["TrivialAccept"] = 2] = "TrivialAccept";
181409
181663
  })(ClipStatus || (ClipStatus = {}));
181410
- /** Static class whose various methods are functions for clipping geometry
181664
+ /** Class whose various static methods are functions for clipping geometry
181411
181665
  * @public
181412
181666
  */
181413
181667
  class ClipUtilities {
@@ -181757,6 +182011,32 @@ class ClipUtilities {
181757
182011
  }
181758
182012
  return false;
181759
182013
  }
182014
+ /** Test for intersection of two ranges in different local coordinates.
182015
+ * * Useful for clash detection of elements in iModels, using their stored (tight) local ranges and placement transforms.
182016
+ * @param range0 range in local coordinates of first geometry
182017
+ * @param local0ToWorld placement transform for first geometry
182018
+ * @param range1 range in local coordinates of second geometry
182019
+ * @param local1ToWorld placement transform for second geometry. Assumed to be invertible.
182020
+ * @param range1Margin optional signed local distance to expand/contract the second range before intersection. Positive expands.
182021
+ * @return whether the local ranges are adjacent or intersect. Also returns false if local1ToWorld is singular.
182022
+ */
182023
+ static doLocalRangesIntersect(range0, local0ToWorld, range1, local1ToWorld, range1Margin) {
182024
+ const worldToLocal1 = ClipUtilities._workTransform = local1ToWorld.inverse(ClipUtilities._workTransform);
182025
+ if (!worldToLocal1)
182026
+ return false;
182027
+ let myRange1 = range1;
182028
+ if (range1Margin) {
182029
+ myRange1 = ClipUtilities._workRange = range1.clone(ClipUtilities._workRange);
182030
+ myRange1.expandInPlace(range1Margin);
182031
+ }
182032
+ // convert range0 into a clipper in local1 coordinates, then intersect with range1
182033
+ const local0ToLocal1 = worldToLocal1.multiplyTransformTransform(local0ToWorld, worldToLocal1);
182034
+ const builder = _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_11__.PolyfaceBuilder.create();
182035
+ builder.addTransformedRangeMesh(local0ToLocal1, range0);
182036
+ const mesh0 = builder.claimPolyface();
182037
+ const clipper = ClipUtilities._workClipper = _ConvexClipPlaneSet__WEBPACK_IMPORTED_MODULE_3__.ConvexClipPlaneSet.createConvexPolyface(mesh0, ClipUtilities._workClipper).clipper;
182038
+ return ClipUtilities.doesClipperIntersectRange(clipper, myRange1);
182039
+ }
181760
182040
  /**
181761
182041
  * Test if `obj` is a `Clipper` object.
181762
182042
  * * This is implemented by testing for each of the methods in the `Clipper` interface.
@@ -181806,9 +182086,9 @@ class ClipUtilities {
181806
182086
  */
181807
182087
  static createXYOffsetClipFromLineString(points, leftOffset, rightOffset, z0, z1) {
181808
182088
  if (Array.isArray(points)) {
181809
- return _internalContexts_LineStringOffsetClipperContext__WEBPACK_IMPORTED_MODULE_11__.LineStringOffsetClipperContext.createClipBetweenOffsets(new _geometry3d_Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_12__.Point3dArrayCarrier(points), leftOffset, rightOffset, z0, z1);
182089
+ return _internalContexts_LineStringOffsetClipperContext__WEBPACK_IMPORTED_MODULE_12__.LineStringOffsetClipperContext.createClipBetweenOffsets(new _geometry3d_Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_13__.Point3dArrayCarrier(points), leftOffset, rightOffset, z0, z1);
181810
182090
  }
181811
- return _internalContexts_LineStringOffsetClipperContext__WEBPACK_IMPORTED_MODULE_11__.LineStringOffsetClipperContext.createClipBetweenOffsets(points, leftOffset, rightOffset, z0, z1);
182091
+ return _internalContexts_LineStringOffsetClipperContext__WEBPACK_IMPORTED_MODULE_12__.LineStringOffsetClipperContext.createClipBetweenOffsets(points, leftOffset, rightOffset, z0, z1);
181812
182092
  }
181813
182093
  /** if data.length >= minLength threshold, push it to destination; if smaller drop it back to the cache.
181814
182094
  */
@@ -181999,7 +182279,7 @@ class ClipUtilities {
181999
182279
  */
182000
182280
  static doPolygonClipSequence(xyz, clippers, acceptedIn, acceptedOut, finalCandidates, inAction, outAction, finalFragmentAction, arrayCache) {
182001
182281
  if (arrayCache === undefined)
182002
- arrayCache = new _geometry3d_ReusableObjectCache__WEBPACK_IMPORTED_MODULE_13__.GrowableXYZArrayCache();
182282
+ arrayCache = new _geometry3d_ReusableObjectCache__WEBPACK_IMPORTED_MODULE_14__.GrowableXYZArrayCache();
182003
182283
  let candidates = [arrayCache.grabAndFill(xyz)];
182004
182284
  let nextCandidates = [];
182005
182285
  const intermediateIn = [];
@@ -182038,7 +182318,7 @@ class ClipUtilities {
182038
182318
  */
182039
182319
  static doPolygonClipParitySequence(xyz, clippers, acceptedIn, acceptedOut, arrayCache) {
182040
182320
  if (arrayCache === undefined)
182041
- arrayCache = new _geometry3d_ReusableObjectCache__WEBPACK_IMPORTED_MODULE_13__.GrowableXYZArrayCache();
182321
+ arrayCache = new _geometry3d_ReusableObjectCache__WEBPACK_IMPORTED_MODULE_14__.GrowableXYZArrayCache();
182042
182322
  let candidatesOut = [arrayCache.grabAndFill(xyz)];
182043
182323
  let candidatesIn = [];
182044
182324
  let nextCandidatesIn = [];
@@ -182100,7 +182380,7 @@ class ClipUtilities {
182100
182380
  }
182101
182381
  for (let i = 0; i < n; i++) {
182102
182382
  for (let j = i + 1; j < n; j++) {
182103
- const ray = _curve_CurveFactory__WEBPACK_IMPORTED_MODULE_14__.CurveFactory.planePlaneIntersectionRay(planes[i], planes[j]);
182383
+ const ray = _curve_CurveFactory__WEBPACK_IMPORTED_MODULE_15__.CurveFactory.planePlaneIntersectionRay(planes[i], planes[j]);
182104
182384
  if (ray) {
182105
182385
  if (clipper.hasIntersectionWithRay(ray, interval)) {
182106
182386
  // the normal-to-normal vector is bisector (or close to bisector?)
@@ -187138,11 +187418,8 @@ class CurveCurve {
187138
187418
  return handler.grabResults();
187139
187419
  }
187140
187420
  /**
187141
- * Return xy intersections of 2 curves.
187142
- * @param geometryA first geometry
187143
- * @param extendA true to allow geometryA to extend
187144
- * @param geometryB second geometry
187145
- * @param extendB true to allow geometryB to extend
187421
+ * Return xy intersections of input curves.
187422
+ * @param primitives input curves to intersect
187146
187423
  * @param tolerance optional distance tolerance for coincidence
187147
187424
  */
187148
187425
  static allIntersectionsAmongPrimitivesXY(primitives, tolerance = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistance) {
@@ -188341,7 +188618,7 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
188341
188618
  const dataA = cpA.toTransformedVectors(this._worldToLocalAffine);
188342
188619
  matrixA = _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_8__.Matrix3d.createColumnsXYW(dataA.vector0, 0, dataA.vector90, 0, dataA.center, 1);
188343
188620
  }
188344
- // The worldToLocal has moved the arc vectors into screen space.
188621
+ // The worldToLocal has moved the arc vectors into local space.
188345
188622
  // matrixA captures the xyw parts (ignoring z)
188346
188623
  // for any point in world space,
188347
188624
  // THIS CODE ONLY WORKS FOR
@@ -189040,7 +189317,7 @@ class CurveCurveIntersectXYZ extends _geometry3d_GeometryHandler__WEBPACK_IMPORT
189040
189317
  const dataA = cpA.toTransformedVectors(this._worldToLocalAffine);
189041
189318
  matrixA = Matrix3d.createColumnsXYW(dataA.vector0, 0, dataA.vector90, 0, dataA.center, 1);
189042
189319
  }
189043
- // The worldToLocal has moved the arc vectors into screen space.
189320
+ // The worldToLocal has moved the arc vectors into local space.
189044
189321
  // matrixA captures the xyw parts (ignoring z)
189045
189322
  // for any point in world space,
189046
189323
  // THIS CODE ONLY WORKS FOR
@@ -208931,7 +209208,7 @@ class Matrix3d {
208931
209208
  this.setRowValues(0, 0, 0, 0, 0, 0, 0, 0, 0);
208932
209209
  this.inverseState = InverseMatrixState.singular;
208933
209210
  }
208934
- /** Copy contents from another matrix. */
209211
+ /** Copy contents from the `other` matrix. If `other` is undefined, use identity matrix. */
208935
209212
  setFrom(other) {
208936
209213
  if (other === undefined) {
208937
209214
  this.setIdentity();
@@ -209106,6 +209383,9 @@ class Matrix3d {
209106
209383
  * Construct a rigid matrix (orthogonal matrix with +1 determinant) using vectorA and its 2 perpendicular.
209107
209384
  * * If axisOrder is not passed then `AxisOrder = AxisOrder.ZXY` is used as default.
209108
209385
  * * This function internally uses createPerpendicularVectorFavorXYPlane and createRigidFromColumns.
209386
+ * * If you want to rotate a given plane (which contains (0,0,0)) to the xy-plane, pass the normal vector of
209387
+ * your plane into createRigidHeadsUp. The transpose of the returned Matrix3d can be used to rotate your plane
209388
+ * to the xy-plane. If plane does not contain (0,0,0) then the plane is rotated to a plane parallel to the xy-plane.
209109
209389
  * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/2PerpendicularVectorsTo1Vector
209110
209390
  */
209111
209391
  static createRigidHeadsUp(vectorA, axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.ZXY, result) {
@@ -209163,6 +209443,7 @@ class Matrix3d {
209163
209443
  /**
209164
209444
  * Replace current rows Ui and Uj with (c*Ui + s*Uj) and (c*Uj - s*Ui).
209165
209445
  * * There is no checking for i,j being 0,1,2.
209446
+ * * The instance matrix A is multiplied in place on the left by a Givens rotation G, resulting in the matrix G*A.
209166
209447
  * @param i first row index. **must be 0,1,2** (unchecked)
209167
209448
  * @param j second row index. **must be 0,1,2** (unchecked)
209168
209449
  * @param c fist coefficient
@@ -209182,6 +209463,7 @@ class Matrix3d {
209182
209463
  /**
209183
209464
  * Replace current columns Ui and Uj with (c*Ui + s*Uj) and (c*Uj - s*Ui).
209184
209465
  * * There is no checking for i,j being 0,1,2.
209466
+ * * The instance matrix A is multiplied in place on the right by a Givens rotation G, resulting in the matrix A*G.
209185
209467
  * * This is used in compute intensive inner loops
209186
209468
  * @param i first row index. **must be 0,1,2** (unchecked)
209187
209469
  * @param j second row index. **must be 0,1,2** (unchecked)
@@ -210207,7 +210489,7 @@ class Matrix3d {
210207
210489
  return undefined;
210208
210490
  }
210209
210491
  /**
210210
- * Multiply `matrixInverse * [x,y,z]` and return result as `Point4d` with given weight.
210492
+ * Multiply `matrixInverse * [x,y,z]` and return result as `Point4d` the with given weight as last element.
210211
210493
  * * Equivalent to solving `matrix * result = [x,y,z]` for an unknown `result`.
210212
210494
  * * Result is `undefined` if the matrix is singular (e.g. has parallel columns or a zero magnitude column)
210213
210495
  * @return result as a Point4d with the same weight.
@@ -210753,6 +211035,10 @@ class Matrix3d {
210753
211035
  * * column 1 is perpendicular to both. It is the "up" vector on the view plane.
210754
211036
  * * Multiplying the returned matrix times a local (view) vector gives the world vector.
210755
211037
  * * Multiplying transpose of the returned matrix times a world vector gives the local (view) vector.
211038
+ * * If you want to rotate a given plane (which contains (0,0,0)) to the xy-plane, pass coordinates of the normal
211039
+ * vector of your plane into createRigidViewAxesZTowardsEye. The transpose of the returned Matrix3d can be used
211040
+ * to rotate your plane to the xy-plane. If plane does not contain (0,0,0) then the plane is rotated to a plane
211041
+ * parallel to the xy-plane.
210756
211042
  * @param x eye x coordinate
210757
211043
  * @param y eye y coordinate
210758
211044
  * @param z eye z coordinate
@@ -210921,21 +211207,21 @@ class Matrix3d {
210921
211207
  * Test if all rows and columns are perpendicular to each other and have equal length.
210922
211208
  * If so, the length (or its negative) is the `scale` factor from a set of `orthonormal axes` to
210923
211209
  * the set of axes created by columns of `this` matrix. Otherwise, returns `undefined`.
211210
+ * @param result optional pre-allocated object to populate and return
210924
211211
  * @returns returns `{ rigidAxes, scale }` where `rigidAxes` is a Matrix3d with its columns as the rigid axes
210925
211212
  * (with the scale factor removed) and `scale` is the scale factor.
210926
211213
  * * Note that determinant of a rigid matrix is +1.
210927
211214
  * * The context for this method is to determine if the matrix is the product a `rotation` matrix and a uniform
210928
211215
  * `scale` matrix (diagonal matrix with all diagonal entries the same nonzero number).
210929
211216
  */
210930
- factorRigidWithSignedScale() {
211217
+ factorRigidWithSignedScale(result) {
210931
211218
  const product = this.multiplyMatrixMatrixTranspose(this);
210932
211219
  const scaleSquare = product.sameDiagonalScale();
210933
211220
  if (scaleSquare === undefined || scaleSquare <= 0.0)
210934
211221
  return undefined;
210935
211222
  const scale = this.determinant() > 0 ? Math.sqrt(scaleSquare) : -Math.sqrt(scaleSquare);
210936
211223
  const scaleInverse = 1.0 / scale;
210937
- const result = { rigidAxes: this.scaleColumns(scaleInverse, scaleInverse, scaleInverse), scale };
210938
- return result;
211224
+ return { rigidAxes: this.scaleColumns(scaleInverse, scaleInverse, scaleInverse, result), scale };
210939
211225
  }
210940
211226
  /** Test if `this` matrix reorders and/or negates the columns of the `identity` matrix. */
210941
211227
  get isSignedPermutation() {
@@ -210964,6 +211250,7 @@ class Matrix3d {
210964
211250
  * * columns are perpendicular and have unit length.
210965
211251
  * * transpose equals inverse.
210966
211252
  * * mirroring is removed.
211253
+ * * This function internally uses `axisOrderCrossProductsInPlace` to make the matrix rigid.
210967
211254
  * @param axisOrder how to reorder the matrix columns
210968
211255
  * @return whether the adjusted matrix is `rigid` on return
210969
211256
  */
@@ -210976,9 +211263,11 @@ class Matrix3d {
210976
211263
  this.axisOrderCrossProductsInPlace(axisOrder);
210977
211264
  return this.normalizeColumnsInPlace();
210978
211265
  }
210979
- /** Create a new orthogonal matrix (perpendicular columns, unit length, transpose is inverse).
211266
+ /**
211267
+ * Create a new orthogonal matrix (perpendicular columns, unit length, transpose is inverse).
210980
211268
  * * Columns are taken from the source Matrix3d in order indicated by the axis order.
210981
211269
  * * Mirroring in the matrix is removed.
211270
+ * * This function internally uses `axisOrderCrossProductsInPlace` to make the matrix rigid.
210982
211271
  */
210983
211272
  static createRigidFromMatrix3d(source, axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.XYZ, result) {
210984
211273
  result = source.clone(result);
@@ -211466,7 +211755,6 @@ __webpack_require__.r(__webpack_exports__);
211466
211755
 
211467
211756
  /**
211468
211757
  * A plane defined by
211469
- *
211470
211758
  * * Any point on the plane.
211471
211759
  * * a unit normal.
211472
211760
  * @public
@@ -211732,7 +212020,7 @@ __webpack_require__.r(__webpack_exports__);
211732
212020
 
211733
212021
 
211734
212022
  /**
211735
- * A Point3dVector3dVector3d is an origin and a pair of vectors.
212023
+ * A Plane3dByOriginAndVectors is an origin and a pair of vectors.
211736
212024
  * This defines a plane with a (possibly skewed) uv coordinate grid
211737
212025
  * * The grid directions (`vectorU` and `vectorV`)
211738
212026
  * * are NOT required to be unit vectors.
@@ -220168,21 +220456,25 @@ __webpack_require__.r(__webpack_exports__);
220168
220456
 
220169
220457
 
220170
220458
 
220171
- /** A transform is an origin and a Matrix3d.
220172
- *
220173
- * * This describes a coordinate frame with
220174
- * this origin, with the columns of the Matrix3d being the
220175
- * local x,y,z axis directions.
220176
- * * Beware that for common transformations (e.g. scale about point,
220177
- * rotate around line, mirror across a plane) the "fixed point" that is used
220178
- * when describing the transform is NOT the "origin" stored in the transform.
220179
- * Setup methods (e.g createFixedPointAndMatrix, createScaleAboutPoint)
220180
- * take care of determining the appropriate origin coordinates.
220459
+ /**
220460
+ * A Transform consists of an origin and a Matrix3d. This describes a coordinate frame with this origin, with
220461
+ * the columns of the Matrix3d being the local x,y,z axis directions.
220462
+ * * The math for a Transform `T` consisting of a Matrix3d `M` and a Point3d `o` on a Vector3d `p` is: `Tp = M*p + o`.
220463
+ * In other words, `T` is a combination of two operations on `p`: the action of matrix multiplication, followed by a
220464
+ * translation. `Origin` is a traditional term for `o`, because `T` can be interpreted as a change of basis from the
220465
+ * global axes centered at the global origin, to a new set of axes centered at `o`.
220466
+ * * Beware that for common transformations (e.g. scale about point, rotate around an axis, mirror across a
220467
+ * plane) the "fixed point" that is used when describing the transform is NOT the "origin" stored in the
220468
+ * transform. Setup methods (e.g createFixedPointAndMatrix, createScaleAboutPoint) take care of determining
220469
+ * the appropriate origin coordinates.
220181
220470
  * @public
220182
220471
  */
220183
220472
  class Transform {
220184
- // Constructor accepts and uses POINTER to content .. no copy here.
220185
- constructor(origin, matrix) { this._origin = origin; this._matrix = matrix; }
220473
+ // Constructor accepts and uses pointer to content (no copy is done here).
220474
+ constructor(origin, matrix) {
220475
+ this._origin = origin;
220476
+ this._matrix = matrix;
220477
+ }
220186
220478
  /** The identity Transform. Value is frozen and cannot be modified. */
220187
220479
  static get identity() {
220188
220480
  if (undefined === this._identity) {
@@ -220192,18 +220484,31 @@ class Transform {
220192
220484
  return this._identity;
220193
220485
  }
220194
220486
  /** Freeze this instance (and its members) so it is read-only */
220195
- freeze() { this._origin.freeze(); this._matrix.freeze(); return Object.freeze(this); }
220487
+ freeze() {
220488
+ this._origin.freeze();
220489
+ this._matrix.freeze();
220490
+ return Object.freeze(this);
220491
+ }
220196
220492
  /**
220197
220493
  * Copy contents from other Transform into this Transform
220198
220494
  * @param other source transform
220199
220495
  */
220200
- setFrom(other) { this._origin.setFrom(other._origin), this._matrix.setFrom(other._matrix); }
220496
+ setFrom(other) {
220497
+ this._origin.setFrom(other._origin);
220498
+ this._matrix.setFrom(other._matrix);
220499
+ }
220201
220500
  /** Set this Transform to be an identity. */
220202
- setIdentity() { this._origin.setZero(); this._matrix.setIdentity(); }
220203
- /** Set this Transform instance from flexible inputs:
220204
- * * Any object (such as another Transform) that has `origin` and `matrix` members accepted by Point3d.setFromJSON and Matrix3d.setFromJSON
220501
+ setIdentity() {
220502
+ this._origin.setZero();
220503
+ this._matrix.setIdentity();
220504
+ }
220505
+ /**
220506
+ * Set this Transform instance from flexible inputs:
220507
+ * * Any object (such as another Transform or TransformProps) that has `origin` and `matrix` members
220508
+ * accepted by `Point3d.setFromJSON` and `Matrix3d.setFromJSON`
220205
220509
  * * An array of 3 number arrays, each with 4 entries which are rows in a 3x4 matrix.
220206
220510
  * * An array of 12 numbers, each block of 4 entries as a row 3x4 matrix.
220511
+ * * If no input is provided, the identity Transform is returned.
220207
220512
  */
220208
220513
  setFromJSON(json) {
220209
220514
  if (json) {
@@ -220228,25 +220533,24 @@ class Transform {
220228
220533
  this.setIdentity();
220229
220534
  }
220230
220535
  /**
220231
- * Test for near equality with other Transform. Comparison uses the isAlmostEqual methods on
220232
- * the origin and matrix parts.
220536
+ * Test for near equality with `other` Transform. Comparison uses the `isAlmostEqual` methods on the `origin` and
220537
+ * `matrix` parts.
220233
220538
  * @param other Transform to compare to.
220234
220539
  */
220235
- isAlmostEqual(other) { return this.origin.isAlmostEqual(other.origin) && this.matrix.isAlmostEqual(other.matrix); }
220540
+ isAlmostEqual(other) {
220541
+ return this.origin.isAlmostEqual(other.origin) && this.matrix.isAlmostEqual(other.matrix);
220542
+ }
220236
220543
  /**
220237
- * Test for near equality with other Transform. Comparison uses the isAlmostEqualAllowZRotation method of Matrix3d
220238
- * the origin and matrix parts.
220544
+ * Test for near equality with `other` Transform. Comparison uses the `isAlmostEqual` methods on the `origin` part
220545
+ * and the `isAlmostEqualAllowZRotation` method on the `matrix` part.
220239
220546
  * @param other Transform to compare to.
220240
220547
  */
220241
- isAlmostEqualAllowZRotation(other) { return this._origin.isAlmostEqual(other._origin) && this._matrix.isAlmostEqualAllowZRotation(other._matrix); }
220242
- /** Return a 3 by 4 matrix containing the rows of this Transform
220243
- * * This transform's origin is the [3] entry of the json arrays
220244
- */
220245
- toJSON() {
220246
- return this.toRows();
220548
+ isAlmostEqualAllowZRotation(other) {
220549
+ return this._origin.isAlmostEqual(other._origin) && this._matrix.isAlmostEqualAllowZRotation(other._matrix);
220247
220550
  }
220248
- /** Return a 3 by 4 matrix containing the rows of this Transform
220249
- * * This transform's origin is the [3] entry of the json arrays
220551
+ /**
220552
+ * Return a 3 by 4 matrix containing the rows of this Transform.
220553
+ * * The transform's origin coordinates are the last entries of the 3 json arrays
220250
220554
  */
220251
220555
  toRows() {
220252
220556
  return [
@@ -220255,13 +220559,20 @@ class Transform {
220255
220559
  [this._matrix.coffs[6], this._matrix.coffs[7], this._matrix.coffs[8], this._origin.z],
220256
220560
  ];
220257
220561
  }
220258
- /** Return a new Transform initialized by `setFromJSON (json)` */
220562
+ /**
220563
+ * Return a 3 by 4 matrix containing the rows of this Transform.
220564
+ * * The transform's origin coordinates are the last entries of the 3 json arrays
220565
+ */
220566
+ toJSON() {
220567
+ return this.toRows();
220568
+ }
220569
+ /** Return a new Transform initialized by `Transform.setFromJSON` */
220259
220570
  static fromJSON(json) {
220260
220571
  const result = Transform.createIdentity();
220261
220572
  result.setFromJSON(json);
220262
220573
  return result;
220263
220574
  }
220264
- /** Copy the contents of this transform into a new Transform (or to the result, if specified). */
220575
+ /** Copy the contents of `this` transform into a new Transform (or to the result, if specified). */
220265
220576
  clone(result) {
220266
220577
  if (result) {
220267
220578
  result._matrix.setFrom(this._matrix);
@@ -220270,18 +220581,17 @@ class Transform {
220270
220581
  }
220271
220582
  return new Transform(_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Point3d.createFrom(this._origin), this._matrix.clone());
220272
220583
  }
220273
- /** Return a copy of this Transform, modified so that its axes are rigid
220274
- * * The first axis direction named in axisOrder is preserved
220275
- * * The plane of the first and second directions is preserved, and its vector in the rigid matrix has positive dot product with the corresponding vector if the instance
220276
- * * The third named column is the cross product of the first and second.
220584
+ /**
220585
+ * Return a modified copy of `this` Transform so that its `matrix` part is rigid (`origin` part is untouched).
220586
+ * * For details of how the matrix is modified to rigid, see documentation of `Matrix3d.axisOrderCrossProductsInPlace`
220277
220587
  */
220278
220588
  cloneRigid(axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.XYZ) {
220279
- const axes0 = _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createRigidFromMatrix3d(this.matrix, axisOrder);
220280
- if (!axes0)
220589
+ const modifiedMatrix = _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createRigidFromMatrix3d(this.matrix, axisOrder);
220590
+ if (!modifiedMatrix)
220281
220591
  return undefined;
220282
- return new Transform(this.origin.cloneAsPoint3d(), axes0);
220592
+ return new Transform(this.origin.cloneAsPoint3d(), modifiedMatrix);
220283
220593
  }
220284
- /** Create a copy with the given origin and matrix captured as the Transform origin and Matrix3d. */
220594
+ /** Create a Transform with the given `origin` and `matrix`. */
220285
220595
  static createRefs(origin, matrix, result) {
220286
220596
  if (!origin)
220287
220597
  origin = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Point3d.createZero();
@@ -220292,7 +220602,7 @@ class Transform {
220292
220602
  }
220293
220603
  return new Transform(origin, matrix);
220294
220604
  }
220295
- /** Create a transform with complete contents given */
220605
+ /** Create a Transform with complete contents given */
220296
220606
  static createRowValues(qxx, qxy, qxz, ax, qyx, qyy, qyz, ay, qzx, qzy, qzz, az, result) {
220297
220607
  if (result) {
220298
220608
  result._origin.set(ax, ay, az);
@@ -220301,42 +220611,55 @@ class Transform {
220301
220611
  }
220302
220612
  return new Transform(_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(ax, ay, az), _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createRowValues(qxx, qxy, qxz, qyx, qyy, qyz, qzx, qzy, qzz));
220303
220613
  }
220304
- /** Create a transform with all zeros.
220305
- */
220614
+ /** Create a Transform with all zeros */
220306
220615
  static createZero(result) {
220307
220616
  return Transform.createRowValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, result);
220308
220617
  }
220309
220618
  /**
220310
- * create a Transform with translation provided by x,y,z parts.
220619
+ * Create a Transform with translation provided by x,y,z parts.
220311
220620
  * @param x x part of translation
220312
220621
  * @param y y part of translation
220313
220622
  * @param z z part of translation
220314
- * @param result optional result
220315
- * @returns new or updated transform.
220623
+ * @param result optional pre-allocated Transform
220624
+ * @returns new or updated transform
220316
220625
  */
220317
220626
  static createTranslationXYZ(x = 0, y = 0, z = 0, result) {
220318
220627
  return Transform.createRefs(_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Vector3d.create(x, y, z), _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createIdentity(), result);
220319
220628
  }
220320
- /** Create a matrix with specified translation part.
220321
- * @param XYZ x,y,z parts of the translation.
220322
- * @returns new or updated transform.
220629
+ /**
220630
+ * Create a Transform with specified `translation` part.
220631
+ * @param translation x,y,z parts of the translation
220632
+ * @param result optional pre-allocated Transform
220633
+ * @returns new or updated transform
220323
220634
  */
220324
220635
  static createTranslation(translation, result) {
220325
220636
  return Transform.createRefs(translation, _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createIdentity(), result);
220326
220637
  }
220327
- /** Return a reference to the matrix within the transform. (NOT a copy) */
220328
- get matrix() { return this._matrix; }
220329
- /** Return a reference to the origin within the transform. (NOT a copy) */
220330
- get origin() { return this._origin; }
220331
- /** return a (clone of) the origin part of the transform, as a Point3d */
220332
- getOrigin() { return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Point3d.createFrom(this._origin); }
220333
- /** return a (clone of) the origin part of the transform, as a Vector3d */
220334
- getTranslation() { return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Vector3d.createFrom(this._origin); }
220335
- /** test if the transform has 000 origin and identity Matrix3d */
220638
+ /** Return a reference (and NOT a copy) to the `matrix` part of the Transform. */
220639
+ get matrix() {
220640
+ return this._matrix;
220641
+ }
220642
+ /** Return a reference (and NOT a copy) to the `origin` part of the Transform. */
220643
+ get origin() {
220644
+ return this._origin;
220645
+ }
220646
+ /** return a (clone of) the `origin` part of the Transform, as a `Point3d` */
220647
+ getOrigin() {
220648
+ return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Point3d.createFrom(this._origin);
220649
+ }
220650
+ /** return a (clone of) the `origin` part of the Transform, as a `Vector3d` */
220651
+ getTranslation() {
220652
+ return _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Vector3d.createFrom(this._origin);
220653
+ }
220654
+ /** return a (clone of) the `matrix` part of the Transform, as a `Matrix3d` */
220655
+ getMatrix() {
220656
+ return this._matrix.clone();
220657
+ }
220658
+ /** test if the transform has `origin` = (0,0,0) and identity `matrix` */
220336
220659
  get isIdentity() {
220337
220660
  return this._matrix.isIdentity && this._origin.isAlmostZero;
220338
220661
  }
220339
- /** Return an identity transform, optionally filling existing transform. */
220662
+ /** Create an identity transform */
220340
220663
  static createIdentity(result) {
220341
220664
  if (result) {
220342
220665
  result._origin.setZero();
@@ -220345,9 +220668,12 @@ class Transform {
220345
220668
  }
220346
220669
  return Transform.createRefs(_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Point3d.createZero(), _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createIdentity());
220347
220670
  }
220348
- /** Create by directly installing origin and matrix
220349
- * this is a the appropriate construction when the columns of the matrix are coordinate axes of a local-to-global mapping
220350
- * Note there is a closely related createFixedPointAndMatrix whose point input is the fixed point of the global-to-global transformation.
220671
+ /**
220672
+ * Create a Transform using the given `origin` and `matrix`.
220673
+ * * This is a the appropriate construction when the columns of the matrix are coordinate axes of a
220674
+ * local-to-world mapping.
220675
+ * * This function is a closely related to `createFixedPointAndMatrix` whose point input is the fixed point
220676
+ * of the world-to-world transformation.
220351
220677
  */
220352
220678
  static createOriginAndMatrix(origin, matrix, result) {
220353
220679
  if (result) {
@@ -220357,8 +220683,13 @@ class Transform {
220357
220683
  }
220358
220684
  return Transform.createRefs(origin ? origin.cloneAsPoint3d() : _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Point3d.createZero(), matrix === undefined ? _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createIdentity() : matrix.clone(), result);
220359
220685
  }
220360
- /** Create by directly installing origin and columns of the matrix
220361
- */
220686
+ /** Create a Transform using the given `origin` and columns of the `matrix`. If `undefined` zero is used. */
220687
+ setOriginAndMatrixColumns(origin, vectorX, vectorY, vectorZ) {
220688
+ if (origin !== undefined)
220689
+ this._origin.setFrom(origin);
220690
+ this._matrix.setColumns(vectorX, vectorY, vectorZ);
220691
+ }
220692
+ /** Create a Transform using the given `origin` and columns of the `matrix` */
220362
220693
  static createOriginAndMatrixColumns(origin, vectorX, vectorY, vectorZ, result) {
220363
220694
  if (result)
220364
220695
  result.setOriginAndMatrixColumns(origin, vectorX, vectorY, vectorZ);
@@ -220366,127 +220697,177 @@ class Transform {
220366
220697
  result = Transform.createRefs(_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Vector3d.createFrom(origin), _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createColumns(vectorX, vectorY, vectorZ));
220367
220698
  return result;
220368
220699
  }
220369
- /** Create by with matrix from Matrix3d.createRigidFromColumns.
220370
- * * Has careful logic for building up optional result without allocations.
220700
+ /**
220701
+ * Create a Transform such that its `matrix` part is rigid.
220702
+ * * For details of how the matrix is created to be rigid, see documentation of `Matrix3d.createRigidFromColumns`
220371
220703
  */
220372
220704
  static createRigidFromOriginAndColumns(origin, vectorX, vectorY, axisOrder, result) {
220373
220705
  const matrix = _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createRigidFromColumns(vectorX, vectorY, axisOrder, result ? result._matrix : undefined);
220374
220706
  if (!matrix)
220375
220707
  return undefined;
220376
220708
  if (result) {
220377
- // The matrix was already defined !!!
220709
+ // result._matrix was already modified to become rigid via createRigidFromColumns
220378
220710
  result._origin.setFrom(origin);
220379
220711
  return result;
220380
220712
  }
220381
- // cleanly capture the matrix and then the point ..
220713
+ /**
220714
+ * We don't want to pass "origin" to createRefs because createRefs does not clone "origin" and use its reference.
220715
+ * That means if "origin" is changed via Transform at any point, the initial "origin" passed by the user is also
220716
+ * changed. To avoid that, we pass undefined to createRefs. This would cause createRefs to create a new "origin"
220717
+ * equals (0,0,0) which then we set it to the "origin" passed by user in the next line.
220718
+ */
220382
220719
  result = Transform.createRefs(undefined, matrix);
220383
220720
  result._origin.setFromPoint3d(origin);
220384
220721
  return result;
220385
220722
  }
220386
- /** Reinitialize by directly installing origin and columns of the matrix
220387
- */
220388
- setOriginAndMatrixColumns(origin, vectorX, vectorY, vectorZ) {
220389
- if (origin !== undefined)
220390
- this._origin.setFrom(origin);
220391
- this._matrix.setColumns(vectorX, vectorY, vectorZ);
220392
- }
220393
- /** Create a transform with the specified matrix. Compute an origin (different from the given fixedPoint)
220394
- * so that the fixedPoint maps back to itself.
220723
+ /**
220724
+ * Create a Transform with the specified `matrix`. Compute an `origin` (different from the given `fixedPoint`)
220725
+ * so that the `fixedPoint` maps back to itself. The returned Transform, transforms a point `p` to `M*p + (f - M*f)`
220726
+ * where `f` is the fixedPoint (i.e., `Tp = M*(p-f) + f`).
220395
220727
  */
220396
220728
  static createFixedPointAndMatrix(fixedPoint, matrix, result) {
220397
220729
  if (fixedPoint) {
220730
+ /**
220731
+ * if f is a fixed point, then Tf = M*f + o = f where M is the matrix and o is the origin.
220732
+ * we define the origin o = f - M*f. Therefore, Tf = Mf + o = M*f + (f - M*f) = f.
220733
+ */
220398
220734
  const origin = _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyzMinusMatrixTimesXYZ(fixedPoint, matrix, fixedPoint);
220399
220735
  return Transform.createRefs(origin, matrix.clone(), result);
220400
220736
  }
220401
220737
  return Transform.createRefs(undefined, matrix.clone());
220402
220738
  }
220403
- /** Create a transform with the specified matrix, acting on any `pointX `via
220404
- * `pointY = matrix * (pointX - pointA) + pointB`
220405
- * so that the fixedPoint maps back to itself.
220739
+ /**
220740
+ * Create a transform with the specified `matrix` and points `a` and `b`. The returned Transform, transforms
220741
+ * point `p` to `M*(p-a) + b` (i.e., `Tp = M*(p-a) + b`) so transforms point `a` to 'b'.
220406
220742
  */
220407
- static createMatrixPickupPutdown(matrix, pointA, pointB, result) {
220408
- const origin = _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyzMinusMatrixTimesXYZ(pointB, matrix, pointA);
220743
+ static createMatrixPickupPutdown(matrix, a, b, result) {
220744
+ // we define the origin o = b - M*a so Tp = M*p + o = M*p + (b - M*a) = M*(x-a) + b
220745
+ const origin = _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyzMinusMatrixTimesXYZ(b, matrix, a);
220409
220746
  return Transform.createRefs(origin, matrix.clone(), result);
220410
220747
  }
220411
- /** Create a Transform which leaves the fixedPoint unchanged and
220412
- * scales everything else around it by a single scale factor.
220748
+ /**
220749
+ * Create a Transform which leaves the fixedPoint unchanged and scales everything else around it by
220750
+ * a single scale factor. The returned Transform, transforms a point `p` to `M*p + (f - M*f)`
220751
+ * where `f` is the fixedPoint and M is the scale matrix (i.e., `Tp = M*(p-f) + f`).
220413
220752
  */
220414
220753
  static createScaleAboutPoint(fixedPoint, scale, result) {
220415
220754
  const matrix = _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createScale(scale, scale, scale);
220755
+ /**
220756
+ * if f is a fixed point, then Tf = M*f + o = f where M is the matrix and o is the origin.
220757
+ * we define the origin o = f - M*f. Therefore, Tf = M*f + o = M*f + (f - M*f) = f.
220758
+ */
220416
220759
  const origin = _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyzMinusMatrixTimesXYZ(fixedPoint, matrix, fixedPoint);
220417
220760
  return Transform.createRefs(origin, matrix, result);
220418
220761
  }
220419
- /** Transform the input 2d point. Return as a new point or in the pre-allocated result (if result is given) */
220420
- multiplyPoint2d(source, result) {
220421
- return _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyPlusMatrixTimesXY(this._origin, this._matrix, source, result);
220762
+ /** Transform the input 2d point. Return as a new point or in the pre-allocated result (if result is given). */
220763
+ multiplyPoint2d(point, result) {
220764
+ // Tx = Mx + o so we return Mx + o
220765
+ return _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyPlusMatrixTimesXY(this._origin, this._matrix, point, result);
220422
220766
  }
220423
- /** Transform the input 3d point. Return as a new point or in the pre-allocated result (if result is given) */
220767
+ /** Transform the input 3d point. Return as a new point or in the pre-allocated result (if result is given). */
220424
220768
  multiplyPoint3d(point, result) {
220769
+ // Tx = Mx + o so we return Mx + o
220425
220770
  return _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyzPlusMatrixTimesXYZ(this._origin, this._matrix, point, result);
220426
220771
  }
220427
- /** Transform the input object with x,y,z members */
220772
+ /** Transform the input 3d point in place (override the input point by the transformed point). */
220428
220773
  multiplyXYAndZInPlace(point) {
220774
+ // Tx = Mx + o so we override x by Mx + o
220429
220775
  return _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyzPlusMatrixTimesXYZInPlace(this._origin, this._matrix, point);
220430
220776
  }
220431
- /** Transform the input point. Return as a new point or in the pre-allocated result (if result is given) */
220777
+ /** Transform the input point. Return as a new point or in the pre-allocated result (if result is given). */
220432
220778
  multiplyXYZ(x, y, z = 0, result) {
220779
+ // Tx = Mx + o so we return Mx + o
220433
220780
  return _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyzPlusMatrixTimesCoordinates(this._origin, this._matrix, x, y, z, result);
220434
220781
  }
220435
- /** Multiply a specific row of the transform times xyz. Return the (number). */
220782
+ /**
220783
+ * Multiply a specific row (component) of the transform matrix times xyz and add it to the origin element
220784
+ * at the same row. Return the result.
220785
+ */
220436
220786
  multiplyComponentXYZ(componentIndex, x, y, z = 0) {
220437
220787
  const coffs = this._matrix.coffs;
220438
- const i0 = 3 * componentIndex;
220439
- return this.origin.at(componentIndex) + coffs[i0] * x + coffs[i0 + 1] * y + coffs[i0 + 2] * z;
220788
+ const idx = 3 * componentIndex;
220789
+ return this.origin.at(componentIndex) + (coffs[idx] * x) + (coffs[idx + 1] * y) + (coffs[idx + 2] * z);
220440
220790
  }
220441
- /** Multiply a specific row of the transform times (weighted!) xyzw. Return the (number). */
220791
+ /**
220792
+ * Multiply a specific row (component) of the transform matrix times xyz and add it to the origin element
220793
+ * at the same row times w. Return the result.
220794
+ */
220442
220795
  multiplyComponentXYZW(componentIndex, x, y, z, w) {
220443
220796
  const coffs = this._matrix.coffs;
220444
- const i0 = 3 * componentIndex;
220445
- return this.origin.at(componentIndex) * w +
220446
- coffs[i0] * x + coffs[i0 + 1] * y + coffs[i0 + 2] * z;
220797
+ const idx = 3 * componentIndex;
220798
+ return (this.origin.at(componentIndex) * w) + (coffs[idx] * x) + (coffs[idx + 1] * y) + (coffs[idx + 2] * z);
220447
220799
  }
220448
- /** Transform the input homogeneous point. Return as a new point or in the pre-allocated result (if result is given) */
220800
+ /**
220801
+ * If `p = (x,y,z)` then transform is `Tp = M*p + o*w`. This function returns the transformed point as a new
220802
+ * point4d (`Tp` as first 3 elements and `w` as last element) or in the pre-allocated result (if result is given).
220803
+ */
220449
220804
  multiplyXYZW(x, y, z, w, result) {
220450
220805
  return _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyzPlusMatrixTimesWeightedCoordinates(this._origin, this._matrix, x, y, z, w, result);
220451
220806
  }
220452
- /** Transform the input homogeneous point. Return as a new point or in the pre-allocated result (if result is given) */
220807
+ /**
220808
+ * If `p = (x,y,z)` then transform is `Tp = M*p + o*w`. This function returns the transformed point as a new
220809
+ * Float64Array with size 4 (`Tp` as first 3 elements and `w` as last element) or in the pre-allocated result
220810
+ * (if result is given).
220811
+ */
220453
220812
  multiplyXYZWToFloat64Array(x, y, z, w, result) {
220454
220813
  return _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyzPlusMatrixTimesWeightedCoordinatesToFloat64Array(this._origin, this._matrix, x, y, z, w, result);
220455
220814
  }
220456
- /** Transform the input homogeneous point. Return as a new point or in the pre-allocated result (if result is given) */
220815
+ /**
220816
+ * If `p = (x,y,z)` then transform is `Tp = M*p + o`. This function returns the transformed point as a new
220817
+ * Float64Array with size 3 (`Tp` as 3 elements) or in the pre-allocated result (if result is given).
220818
+ */
220457
220819
  multiplyXYZToFloat64Array(x, y, z, result) {
220458
220820
  return _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyzPlusMatrixTimesCoordinatesToFloat64Array(this._origin, this._matrix, x, y, z, result);
220459
220821
  }
220460
- /** Multiply the transposed transform (as 4x4 with 0001 row) by Point4d given as xyzw.. Return as a new point or in the pre-allocated result (if result is given) */
220822
+ /**
220823
+ * Treat the 3x3 matrix and origin as upper 3x4 part of a 4x4 matrix, with 0001 as the final row. Now multiply
220824
+ * the transposed of this 4x4 matrix by Point4d given as xyzw. Return as a new point4d (`M*p` as first 3 elements
220825
+ * and `o*p + w` as last element where `p = (x,y,z)`) or in the pre-allocated result (if result is given).
220826
+ */
220461
220827
  multiplyTransposeXYZW(x, y, z, w, result) {
220462
220828
  const coffs = this._matrix.coffs;
220463
220829
  const origin = this._origin;
220464
- return _geometry4d_Point4d__WEBPACK_IMPORTED_MODULE_3__.Point4d.create(x * coffs[0] + y * coffs[3] + z * coffs[6], x * coffs[1] + y * coffs[4] + z * coffs[7], x * coffs[2] + y * coffs[5] + z * coffs[8], x * origin.x + y * origin.y + z * origin.z + w, result);
220830
+ return _geometry4d_Point4d__WEBPACK_IMPORTED_MODULE_3__.Point4d.create((x * coffs[0]) + (y * coffs[3]) + (z * coffs[6]), (x * coffs[1]) + (y * coffs[4]) + (z * coffs[7]), (x * coffs[2]) + (y * coffs[5]) + (z * coffs[8]), (x * origin.x) + (y * origin.y) + (z * origin.z) + w, result);
220465
220831
  }
220466
- /** for each point: replace point by Transform*point */
220832
+ /** For each point in the array, replace point by the transformed point (by `Tp = M*p + o`) */
220467
220833
  multiplyPoint3dArrayInPlace(points) {
220468
220834
  let point;
220469
220835
  for (point of points)
220470
220836
  _Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyzPlusMatrixTimesXYZ(this._origin, this._matrix, point, point);
220471
220837
  }
220472
- /** for each point: replace point by Transform*point */
220838
+ /** For each point in the 2d array, replace point by the transformed point (by `Tp = M*p + o`) */
220473
220839
  multiplyPoint3dArrayArrayInPlace(chains) {
220474
220840
  for (const chain of chains)
220475
220841
  this.multiplyPoint3dArrayInPlace(chain);
220476
220842
  }
220477
- /** Return product of the transform's inverse times a point. */
220843
+ /**
220844
+ * If for a point `p` we have `Tp = M*p + o = point` (where `point` is the transformed point), then
220845
+ * `p = MInverse * (point - o)`. This function returns the original point `p` if `point` is the
220846
+ * transformed point (`Tp = point`).
220847
+ * * Return as a new point or in the optional `result`.
220848
+ * * Returns `undefined` if the `matrix` part if this Transform is singular.
220849
+ */
220478
220850
  multiplyInversePoint3d(point, result) {
220479
220851
  return this._matrix.multiplyInverseXYZAsPoint3d(point.x - this._origin.x, point.y - this._origin.y, point.z - this._origin.z, result);
220480
220852
  }
220481
- /** Inverse transform the input homogeneous point.
220482
- * * Return as a new point or in the optional result.
220483
- * * returns undefined if the matrix part if this Transform is singular.
220853
+ /**
220854
+ * If for a point `p` we have `Tp = M*p + w*o = weightedPoint` (where `weightedPoint` is the transformed point), then
220855
+ * `p = MInverse * (weightedPoint - w*o)`. This function returns a Point4d where first 3 elements are the original
220856
+ * point `p` if `weightedPoint` is the transformed point (`Tp = weightedPoint`) and the last element is `w`.
220857
+ * * Return as a new point or in the optional `result`.
220858
+ * * Returns `undefined` if the `matrix` part if this Transform is singular.
220484
220859
  */
220485
220860
  multiplyInversePoint4d(weightedPoint, result) {
220486
220861
  const w = weightedPoint.w;
220487
220862
  return this._matrix.multiplyInverseXYZW(weightedPoint.x - w * this.origin.x, weightedPoint.y - w * this.origin.y, weightedPoint.z - w * this.origin.z, w, result);
220488
220863
  }
220489
- /** Return product of the transform's inverse times a point (point given as x,y,z) */
220864
+ /**
220865
+ * If for a point `p = (x,y,z)` we have `Tp = M*p + o = point` (where `point` is the transformed point), then
220866
+ * `p = MInverse * (point - o)`. This function returns the original point `p` if `point` is the transformed
220867
+ * point (`Tp = point`).
220868
+ * * Return as a new point or in the optional `result`.
220869
+ * * Returns `undefined` if the `matrix` part if this Transform is singular.
220870
+ */
220490
220871
  multiplyInverseXYZ(x, y, z, result) {
220491
220872
  return this._matrix.multiplyInverseXYZAsPoint3d(x - this._origin.x, y - this._origin.y, z - this._origin.z, result);
220492
220873
  }
@@ -220512,8 +220893,8 @@ class Transform {
220512
220893
  return result;
220513
220894
  }
220514
220895
  /**
220515
- * * for each point in source: multiply transformInverse * point in place in the point.
220516
- * * return false if not invertible.
220896
+ * * For each point in source: multiply transformInverse * point in place in the point.
220897
+ * * Return false if not invertible.
220517
220898
  */
220518
220899
  multiplyInversePoint3dArrayInPlace(source) {
220519
220900
  if (!this._matrix.computeCachedInverse(true))
@@ -220557,9 +220938,9 @@ class Transform {
220557
220938
  return numSource;
220558
220939
  }
220559
220940
  /**
220560
- * * for each point: multiply transform * point
220561
- * * if result is given, resize to match source and replace each corresponding pi
220562
- * * if result is not given, return a new array.
220941
+ * * For each point: multiply transform * point
220942
+ * * If result is given, resize to match source and replace each corresponding pi
220943
+ * * If result is not given, return a new array.
220563
220944
  */
220564
220945
  multiplyPoint2dArray(source, result) {
220565
220946
  if (result) {
@@ -220574,9 +220955,9 @@ class Transform {
220574
220955
  return result;
220575
220956
  }
220576
220957
  /**
220577
- * * for each point: multiply transform * point
220578
- * * if result is given, resize to match source and replace each corresponding pi
220579
- * * if result is not given, return a new array.
220958
+ * * For each point: multiply transform * point
220959
+ * * If result is given, resize to match source and replace each corresponding pi
220960
+ * * If result is not given, return a new array.
220580
220961
  */
220581
220962
  multiplyPoint3dArray(source, result) {
220582
220963
  if (result) {
@@ -220590,30 +220971,30 @@ class Transform {
220590
220971
  result.push(_Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.xyzPlusMatrixTimesXYZ(this._origin, this._matrix, p));
220591
220972
  return result;
220592
220973
  }
220593
- /** Multiply the vector by the Matrix3d part of the transform.
220594
- *
220595
- * * The transform's origin is not used.
220596
- * * Return as new or result by usual optional result convention
220974
+ /**
220975
+ * Multiply the vector by the Matrix3d part of the transform.
220976
+ * * The transform's origin is not used.
220977
+ * * Return as new or result by usual optional result convention
220597
220978
  */
220598
220979
  multiplyVector(vector, result) {
220599
220980
  return this._matrix.multiplyVector(vector, result);
220600
220981
  }
220601
- /** Multiply the vector in place by the Matrix3d part of the transform.
220602
- *
220603
- * * The transform's origin is not used.
220604
- */
220982
+ /**
220983
+ * Multiply the vector in place by the Matrix3d part of the transform.
220984
+ * * The transform's origin is not used.
220985
+ */
220605
220986
  multiplyVectorInPlace(vector) {
220606
220987
  this._matrix.multiplyVectorInPlace(vector);
220607
220988
  }
220608
- /** Multiply the vector (x,y,z) by the Matrix3d part of the transform.
220609
- *
220610
- * * The transform's origin is not used.
220611
- * * Return as new or result by usual optional result convention
220989
+ /**
220990
+ * Multiply the vector (x,y,z) by the Matrix3d part of the transform.
220991
+ * * The transform's origin is not used.
220992
+ * * Return as new or result by usual optional result convention
220612
220993
  */
220613
220994
  multiplyVectorXYZ(x, y, z, result) {
220614
220995
  return this._matrix.multiplyXYZ(x, y, z, result);
220615
220996
  }
220616
- /** multiply this Transform times other Transform.
220997
+ /** Multiply this Transform times other Transform.
220617
220998
  * ```
220618
220999
  * equation
220619
221000
  * \begin{matrix}
@@ -220632,7 +221013,7 @@ class Transform {
220632
221013
  return result;
220633
221014
  }
220634
221015
  /**
220635
- * multiply transformA * transformB, store to calling instance.
221016
+ * Multiply transformA * transformB, store to calling instance.
220636
221017
  * @param transformA left operand
220637
221018
  * @param transformB right operand
220638
221019
  */
@@ -220645,7 +221026,8 @@ class Transform {
220645
221026
  }
220646
221027
  // [Q A][R 0] = [QR A]
220647
221028
  // [0 1][0 1] [0 1]
220648
- /** multiply this Transform times other Matrix3d, with other considered to be a Transform with 0 translation.
221029
+ /**
221030
+ * Multiply this Transform times other Matrix3d, with other considered to be a Transform with 0 translation.
220649
221031
  * ```
220650
221032
  * equation
220651
221033
  * \begin{matrix}
@@ -220668,7 +221050,7 @@ class Transform {
220668
221050
  * Return the range of the transformed corners.
220669
221051
  * * The 8 corners are transformed individually.
220670
221052
  * * Note that if there is anything other than translation and principal axis scaling in the transform, the volume of the range rotation will increase.
220671
- * * Hence to get a "tight" range on rotated geometry, a range computation must be made on the rotated geometry itself.
221053
+ * * Hence to get a "tight" range on rotated geometry, a range computation must be made on the rotated geometry itself.
220672
221054
  */
220673
221055
  multiplyRange(range, result) {
220674
221056
  if (range.isNull)
@@ -220693,15 +221075,22 @@ class Transform {
220693
221075
  }
220694
221076
  /**
220695
221077
  * * Return a Transform which is the inverse of this transform.
220696
- * * Return undefined if this Transform's matrix is singular.
221078
+ * @param result optional pre-allocated result
221079
+ * @return the inverse Transform, or undefined if the matrix is singular
220697
221080
  */
220698
- inverse() {
220699
- const matrixInverse = this._matrix.inverse();
221081
+ inverse(result) {
221082
+ const matrixInverse = this._matrix.inverse(result ? result._matrix : undefined);
220700
221083
  if (!matrixInverse)
220701
221084
  return undefined;
221085
+ if (result) {
221086
+ // result._matrix is already defined
221087
+ matrixInverse.multiplyXYZ(-this._origin.x, -this._origin.y, -this._origin.z, result._origin);
221088
+ return result;
221089
+ }
220702
221090
  return Transform.createRefs(matrixInverse.multiplyXYZ(-this._origin.x, -this._origin.y, -this._origin.z), matrixInverse);
220703
221091
  }
220704
- /** Initialize transforms that map each direction of a box (axis aligned) to `[0,1]`.
221092
+ /**
221093
+ * Initialize transforms that map each direction of a box (axis aligned) to `[0,1]`.
220705
221094
  * * The corner coordinates do _not_ need to be in order in any of the x,y,z directions.
220706
221095
  * * The npcToGlobalTransform (if supplied) maps 000 to the point named point000.
220707
221096
  * * The npcToGlobalTransform (if supplied) maps 11 to the point named point000.
@@ -220877,7 +221266,8 @@ __webpack_require__.r(__webpack_exports__);
220877
221266
  /** @public */
220878
221267
  var XYAndZ;
220879
221268
  (function (XYAndZ) {
220880
- /** Return true if two XYAndZs have equal x,y,z parts within a specified tolerance.
221269
+ /**
221270
+ * Return true if two XYAndZs have equal x,y,z parts within a specified tolerance.
220881
221271
  * @param a The first XYAndZ to compare
220882
221272
  * @param b The second XYAndZ to compare
220883
221273
  * @param The tolerance for comparison. If undefined, [[Geometry.smallMetricDistance]] is used.
@@ -231509,8 +231899,10 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
231509
231899
  addTransformedUnitBox(transform) {
231510
231900
  this.addTransformedRangeMesh(transform, _geometry3d_Range__WEBPACK_IMPORTED_MODULE_5__.Range3d.createXYZXYZ(0, 0, 0, 1, 1, 1));
231511
231901
  }
231512
- /** add facets for a transformed unit box.
231513
- * * for each face in the order of BoxTopology.cornerIndexCCW, faceSelector[i]===false skips that facet.
231902
+ /** Add facets for a transformed range box.
231903
+ * @param transform applied to the range points before adding to the polyface
231904
+ * @param range sides become 6 quad polyface facets
231905
+ * @param faceSelector for each face in the order of BoxTopology.cornerIndexCCW, faceSelector[i]===false skips that facet.
231514
231906
  */
231515
231907
  addTransformedRangeMesh(transform, range, faceSelector) {
231516
231908
  const pointIndex0 = this._polyface.data.pointCount;
@@ -231521,8 +231913,16 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
231521
231913
  let faceCounter = 0;
231522
231914
  for (const facet of _BoxTopology__WEBPACK_IMPORTED_MODULE_6__.BoxTopology.cornerIndexCCW) {
231523
231915
  if (!faceSelector || (faceCounter < faceSelector.length && faceSelector[faceCounter])) {
231524
- for (const pointIndex of facet)
231525
- this._polyface.addPointIndex(pointIndex0 + pointIndex);
231916
+ const myFacet = facet.map((pointIndex) => pointIndex + pointIndex0);
231917
+ if (this._reversed)
231918
+ myFacet.reverse();
231919
+ if (this._options.shouldTriangulate) {
231920
+ this.addIndexedTrianglePointIndexes(myFacet[0], myFacet[1], myFacet[2], false);
231921
+ this.addIndexedTrianglePointIndexes(myFacet[0], myFacet[2], myFacet[3], false);
231922
+ }
231923
+ else {
231924
+ this.addIndexedQuadPointIndexes(myFacet[0], myFacet[1], myFacet[3], myFacet[2], false);
231925
+ }
231526
231926
  this._polyface.terminateFacet();
231527
231927
  }
231528
231928
  faceCounter++;
@@ -231852,10 +232252,10 @@ class PolyfaceBuilder extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
231852
232252
  this.addIndexedQuadPointIndexes(idx0, idx1, idx3, idx2);
231853
232253
  }
231854
232254
  /** Announce a single quad facet's point indexes.
231855
- *
231856
232255
  * * The actual quad may be reversed or triangulated based on builder setup.
231857
- * * indexA0 and indexA1 are in the forward order at the "A" end of the quad
231858
- * * indexB0 and indexB1 are in the forward order at the "B" end of the quad.
232256
+ * * indexA0 and indexA1 are in the forward order at the "A" end of the quad
232257
+ * * indexB0 and indexB1 are in the forward order at the "B" end of the quad.
232258
+ * * This means ccw/cw ordered vertices v[i] should be passed into this function as i=[0,1,3,2]
231859
232259
  */
231860
232260
  addIndexedQuadPointIndexes(indexA0, indexA1, indexB0, indexB1, terminate = true) {
231861
232261
  if (this._reversed) {
@@ -287968,7 +288368,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
287968
288368
  /***/ ((module) => {
287969
288369
 
287970
288370
  "use strict";
287971
- module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.0.0-dev.46","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs","build:ci":"npm run -s build && npm run -s build:esm","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2020 --outDir lib/esm","clean":"rimraf lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","docs":"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/primitives,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-eslintrc -c \\"./node_modules/@itwin/eslint-plugin/dist/configs/extension-exports-config.js\\" \\"./src/**/*.ts\\" 1>&2","lint":"eslint -f visualstudio \\"./src/**/*.ts\\" 1>&2","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run -s webpackTests && certa -r chrome","cover":"npm -s test","test:debug":"certa -r chrome --debug","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core/tree/master/core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^4.0.0-dev.46","@itwin/core-bentley":"workspace:^4.0.0-dev.46","@itwin/core-common":"workspace:^4.0.0-dev.46","@itwin/core-geometry":"workspace:^4.0.0-dev.46","@itwin/core-orbitgt":"workspace:^4.0.0-dev.46","@itwin/core-quantity":"workspace:^4.0.0-dev.46"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/certa":"workspace:*","@itwin/eslint-plugin":"nightly","@itwin/webgl-compatibility":"workspace:*","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/deep-assign":"^0.1.0","@types/mocha":"^8.2.2","@types/node":"^18.11.5","@types/qs":"^6.5.0","@types/semver":"7.3.10","@types/superagent":"^4.1.14","@types/sinon":"^9.0.0","babel-loader":"~8.2.5","babel-plugin-istanbul":"~6.1.1","chai":"^4.1.2","chai-as-promised":"^7","cpx2":"^3.0.0","eslint":"^7.11.0","glob":"^7.1.2","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^9.0.2","source-map-loader":"^4.0.0","typescript":"~4.4.0","webpack":"^5.76.0"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/object-storage-azure":"^1.5.0","@itwin/cloud-agnostic-core":"^1.5.0","@itwin/object-storage-core":"^1.5.0","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","deep-assign":"^2.0.0","fuse.js":"^3.3.0","qs":"^6.5.3","semver":"^7.3.5","superagent":"^7.1.5","wms-capabilities":"0.4.0","reflect-metadata":"0.1.13"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"},"eslintConfig":{"plugins":["@itwin"],"extends":"plugin:@itwin/itwinjs-recommended","rules":{"@itwin/no-internal-barrel-imports":["error",{"required-barrel-modules":["./src/tile/internal.ts"]}],"@itwin/public-extension-exports":["error",{"releaseTags":["public","preview"],"outputApiFile":false}]},"overrides":[{"files":["*.test.ts","*.test.tsx","**/test/**/*.ts"],"rules":{"@itwin/no-internal-barrel-imports":"off"}}]}}');
288371
+ module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"4.0.0-dev.50","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs","build:ci":"npm run -s build && npm run -s build:esm","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2020 --outDir lib/esm","clean":"rimraf lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","docs":"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/primitives,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-eslintrc -c \\"./node_modules/@itwin/eslint-plugin/dist/configs/extension-exports-config.js\\" \\"./src/**/*.ts\\" 1>&2","lint":"eslint -f visualstudio \\"./src/**/*.ts\\" 1>&2","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run -s webpackTests && certa -r chrome","cover":"npm -s test","test:debug":"certa -r chrome --debug","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core/tree/master/core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^4.0.0-dev.50","@itwin/core-bentley":"workspace:^4.0.0-dev.50","@itwin/core-common":"workspace:^4.0.0-dev.50","@itwin/core-geometry":"workspace:^4.0.0-dev.50","@itwin/core-orbitgt":"workspace:^4.0.0-dev.50","@itwin/core-quantity":"workspace:^4.0.0-dev.50"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/certa":"workspace:*","@itwin/eslint-plugin":"nightly","@itwin/webgl-compatibility":"workspace:*","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/deep-assign":"^0.1.0","@types/mocha":"^8.2.2","@types/node":"^18.11.5","@types/qs":"^6.5.0","@types/semver":"7.3.10","@types/superagent":"^4.1.14","@types/sinon":"^9.0.0","babel-loader":"~8.2.5","babel-plugin-istanbul":"~6.1.1","chai":"^4.1.2","chai-as-promised":"^7","cpx2":"^3.0.0","eslint":"^7.11.0","glob":"^7.1.2","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^9.0.2","source-map-loader":"^4.0.0","typescript":"~4.4.0","webpack":"^5.76.0"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/object-storage-azure":"^1.5.0","@itwin/cloud-agnostic-core":"^1.5.0","@itwin/object-storage-core":"^1.5.0","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","deep-assign":"^2.0.0","fuse.js":"^3.3.0","qs":"^6.5.3","semver":"^7.3.5","superagent":"^7.1.5","wms-capabilities":"0.4.0","reflect-metadata":"0.1.13"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"},"eslintConfig":{"plugins":["@itwin"],"extends":"plugin:@itwin/itwinjs-recommended","rules":{"@itwin/no-internal-barrel-imports":["error",{"required-barrel-modules":["./src/tile/internal.ts"]}],"@itwin/public-extension-exports":["error",{"releaseTags":["public","preview"],"outputApiFile":false}]},"overrides":[{"files":["*.test.ts","*.test.tsx","**/test/**/*.ts"],"rules":{"@itwin/no-internal-barrel-imports":"off"}}]}}');
287972
288372
 
287973
288373
  /***/ })
287974
288374