@itwin/ecschema-rpcinterface-tests 5.1.0-dev.1 → 5.1.0-dev.12

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.
@@ -38986,6 +38986,20 @@ var RenderSchedule;
38986
38986
  get maxBatchId() {
38987
38987
  return this._maxBatchId ?? (this._maxBatchId = this.modelTimelines.reduce((accum, timeline) => Math.max(accum, timeline.maxBatchId), 0));
38988
38988
  }
38989
+ /**
38990
+ * Replaces all elementIds in a ScriptProps object with an empty string. Returns modified ScriptProps.
38991
+ * @param scheduleScript The script props to modify.
38992
+ * @internal */
38993
+ static removeScheduleScriptElementIds(scheduleScript) {
38994
+ scheduleScript.forEach((modelTimeline) => {
38995
+ modelTimeline.elementTimelines.forEach((elementTimeline) => {
38996
+ if (elementTimeline.elementIds) {
38997
+ elementTimeline.elementIds = "";
38998
+ }
38999
+ });
39000
+ });
39001
+ return scheduleScript;
39002
+ }
38989
39003
  }
38990
39004
  RenderSchedule.Script = Script;
38991
39005
  /** A reference to a [[RenderSchedule.Script]], optionally identifying the source of the script.
@@ -64621,34 +64635,44 @@ class ECClass extends _SchemaItem__WEBPACK_IMPORTED_MODULE_9__.SchemaItem {
64621
64635
  * @param name The name of the property to retrieve.
64622
64636
  * @param excludeInherited If true, excludes inherited properties from the results. Defaults to false.
64623
64637
  */
64624
- async getProperty(name, excludeInherited = false) {
64638
+ async getProperty(name, excludeInherited) {
64639
+ const upperKey = name.toUpperCase();
64640
+ let property;
64625
64641
  if (this._properties) {
64626
- const upperKey = name.toUpperCase();
64627
- const property = this._properties.get(upperKey);
64628
- if (property)
64642
+ property = this._properties.get(upperKey);
64643
+ if (property) {
64629
64644
  return property;
64645
+ }
64630
64646
  }
64631
64647
  if (excludeInherited) {
64632
64648
  return undefined;
64633
64649
  }
64634
- return this.getInheritedProperty(name);
64650
+ if (!this._mergedPropertyCache) {
64651
+ this._mergedPropertyCache = await this.buildPropertyCache();
64652
+ }
64653
+ return this._mergedPropertyCache.get(upperKey);
64635
64654
  }
64636
64655
  /**
64637
64656
  * Searches, case-insensitive, for a local ECProperty with the name provided.
64638
64657
  * @param name The name of the property to retrieve.
64639
64658
  * @param excludeInherited If true, excludes inherited properties from the results. Defaults to false.
64640
64659
  */
64641
- getPropertySync(name, excludeInherited = false) {
64660
+ getPropertySync(name, excludeInherited) {
64661
+ const upperKey = name.toUpperCase();
64662
+ let property;
64642
64663
  if (this._properties) {
64643
- const upperKey = name.toUpperCase();
64644
- const property = this._properties.get(upperKey);
64645
- if (property)
64664
+ property = this._properties.get(upperKey);
64665
+ if (property) {
64646
64666
  return property;
64667
+ }
64647
64668
  }
64648
64669
  if (excludeInherited) {
64649
64670
  return undefined;
64650
64671
  }
64651
- return this.getInheritedPropertySync(name);
64672
+ if (!this._mergedPropertyCache) {
64673
+ this._mergedPropertyCache = this.buildPropertyCacheSync();
64674
+ }
64675
+ return this._mergedPropertyCache.get(upperKey);
64652
64676
  }
64653
64677
  /**
64654
64678
  * Searches the base class, if one exists, for the property with the name provided.
@@ -64980,69 +65004,51 @@ class ECClass extends _SchemaItem__WEBPACK_IMPORTED_MODULE_9__.SchemaItem {
64980
65004
  }
64981
65005
  /**
64982
65006
  *
64983
- * @param target
64984
- * @param existingValues
64985
- * @param propertiesToMerge
64986
- * @param overwriteExisting
65007
+ * @param cache
65008
+ * @returns
64987
65009
  *
64988
65010
  * @internal
64989
65011
  */
64990
- static mergeProperties(target, existingValues, propertiesToMerge, overwriteExisting) {
64991
- for (const property of propertiesToMerge) {
64992
- const upperCaseName = property.name.toUpperCase();
64993
- const existing = existingValues.get(upperCaseName);
64994
- if (existing !== undefined) {
64995
- if (overwriteExisting) {
64996
- target[existing] = property;
65012
+ async buildPropertyCache() {
65013
+ const cache = new Map();
65014
+ const baseClass = await this.baseClass;
65015
+ if (baseClass) {
65016
+ for (const property of await baseClass.getProperties()) {
65017
+ if (!cache.has(property.name.toUpperCase())) {
65018
+ cache.set(property.name.toUpperCase(), property);
64997
65019
  }
64998
65020
  }
64999
- else {
65000
- existingValues.set(upperCaseName, target.length);
65001
- target.push(property);
65002
- }
65003
- }
65004
- }
65005
- /**
65006
- *
65007
- * @param result
65008
- * @param existingValues
65009
- * @returns
65010
- *
65011
- * @internal
65012
- */
65013
- async buildPropertyCache(result, existingValues) {
65014
- if (!existingValues) {
65015
- existingValues = new Map();
65016
65021
  }
65017
- if (this.baseClass) {
65018
- const baseClass = await this.baseClass;
65019
- if (baseClass) {
65020
- ECClass.mergeProperties(result, existingValues, await baseClass.getProperties(), false);
65021
- }
65022
+ if (this._properties) {
65023
+ this._properties.forEach(property => {
65024
+ cache.set(property.name.toUpperCase(), property);
65025
+ });
65022
65026
  }
65023
- if (!this._properties)
65024
- return;
65025
- ECClass.mergeProperties(result, existingValues, [...this._properties.values()], true);
65027
+ return cache;
65026
65028
  }
65027
65029
  /**
65028
65030
  *
65029
- * @param result
65030
- * @param existingValues
65031
+ * @param cache
65031
65032
  * @returns
65032
65033
  *
65033
65034
  * @internal
65034
65035
  */
65035
- buildPropertyCacheSync(result, existingValues) {
65036
- if (!existingValues) {
65037
- existingValues = new Map();
65038
- }
65036
+ buildPropertyCacheSync() {
65037
+ const cache = new Map();
65039
65038
  const baseClass = this.getBaseClassSync();
65040
65039
  if (baseClass) {
65041
- ECClass.mergeProperties(result, existingValues, baseClass.getPropertiesSync(), false);
65040
+ for (const property of baseClass.getPropertiesSync()) {
65041
+ if (!cache.has(property.name.toUpperCase())) {
65042
+ cache.set(property.name.toUpperCase(), property);
65043
+ }
65044
+ }
65042
65045
  }
65043
- if (!this._properties)
65044
- return;
65045
- ECClass.mergeProperties(result, existingValues, [...this._properties.values()], true);
65046
+ if (this._properties) {
65047
+ this._properties.forEach(property => {
65048
+ cache.set(property.name.toUpperCase(), property);
65049
+ });
65050
+ }
65051
+ return cache;
65046
65052
  }
65047
65053
  /**
65048
65054
  * Clears all caches on this object. This is called implicitly for this class,
@@ -65063,10 +65069,9 @@ class ECClass extends _SchemaItem__WEBPACK_IMPORTED_MODULE_9__.SchemaItem {
65063
65069
  return this._properties && this._properties.size > 0 ? this._properties.values() : [];
65064
65070
  }
65065
65071
  if (!this._mergedPropertyCache) {
65066
- this._mergedPropertyCache = [];
65067
- this.buildPropertyCacheSync(this._mergedPropertyCache, undefined);
65072
+ this._mergedPropertyCache = this.buildPropertyCacheSync();
65068
65073
  }
65069
- return this._mergedPropertyCache;
65074
+ return this._mergedPropertyCache.values();
65070
65075
  }
65071
65076
  /**
65072
65077
  * Quick way to check whether this class has any local properties without having to use the iterable
@@ -65687,44 +65692,64 @@ class EntityClass extends _Class__WEBPACK_IMPORTED_MODULE_4__.ECClass {
65687
65692
  }
65688
65693
  /**
65689
65694
  *
65690
- * @param result
65691
- * @param existingValues
65695
+ * @param cache
65696
+ * @returns
65697
+ *
65692
65698
  * @internal
65693
65699
  */
65694
- async buildPropertyCache(result, existingValues) {
65695
- if (!existingValues) {
65696
- existingValues = new Map();
65697
- }
65700
+ async buildPropertyCache() {
65701
+ const cache = new Map();
65698
65702
  const baseClass = await this.baseClass;
65699
65703
  if (baseClass) {
65700
- _Class__WEBPACK_IMPORTED_MODULE_4__.ECClass.mergeProperties(result, existingValues, await baseClass.getProperties(), false);
65704
+ for (const property of await baseClass.getProperties()) {
65705
+ if (!cache.has(property.name.toUpperCase()))
65706
+ cache.set(property.name.toUpperCase(), property);
65707
+ }
65701
65708
  }
65702
65709
  for (const mixin of this.mixins) {
65703
- const resolvedMixin = await mixin;
65704
- _Class__WEBPACK_IMPORTED_MODULE_4__.ECClass.mergeProperties(result, existingValues, await resolvedMixin.getProperties(), false);
65710
+ const mixinObj = await mixin;
65711
+ const mixinProps = mixinObj.getPropertiesSync();
65712
+ for (const property of mixinProps) {
65713
+ if (!cache.has(property.name.toUpperCase()))
65714
+ cache.set(property.name.toUpperCase(), property);
65715
+ }
65716
+ }
65717
+ const localProps = await this.getProperties(true);
65718
+ if (localProps) {
65719
+ for (const property of localProps) {
65720
+ cache.set(property.name.toUpperCase(), property);
65721
+ }
65705
65722
  }
65706
- const localProps = await this.getProperties();
65707
- _Class__WEBPACK_IMPORTED_MODULE_4__.ECClass.mergeProperties(result, existingValues, localProps, true);
65723
+ return cache;
65708
65724
  }
65709
65725
  /**
65710
65726
  *
65711
- * @param result
65712
- * @param existingValues
65727
+ * @param cache
65713
65728
  * @internal
65714
65729
  */
65715
- buildPropertyCacheSync(result, existingValues) {
65716
- if (!existingValues) {
65717
- existingValues = new Map();
65718
- }
65730
+ buildPropertyCacheSync() {
65731
+ const cache = new Map();
65719
65732
  const baseClass = this.getBaseClassSync();
65720
65733
  if (baseClass) {
65721
- _Class__WEBPACK_IMPORTED_MODULE_4__.ECClass.mergeProperties(result, existingValues, baseClass.getPropertiesSync(), false);
65734
+ Array.from(baseClass.getPropertiesSync()).forEach((property) => {
65735
+ if (!cache.has(property.name.toUpperCase()))
65736
+ cache.set(property.name.toUpperCase(), property);
65737
+ });
65722
65738
  }
65723
65739
  for (const mixin of this.getMixinsSync()) {
65724
- _Class__WEBPACK_IMPORTED_MODULE_4__.ECClass.mergeProperties(result, existingValues, mixin.getPropertiesSync(), false);
65740
+ const mixinProps = mixin.getPropertiesSync();
65741
+ for (const property of mixinProps) {
65742
+ if (!cache.has(property.name.toUpperCase()))
65743
+ cache.set(property.name.toUpperCase(), property);
65744
+ }
65725
65745
  }
65726
65746
  const localProps = this.getPropertiesSync(true);
65727
- _Class__WEBPACK_IMPORTED_MODULE_4__.ECClass.mergeProperties(result, existingValues, localProps, true);
65747
+ if (localProps) {
65748
+ Array.from(localProps).forEach(property => {
65749
+ cache.set(property.name.toUpperCase(), property);
65750
+ });
65751
+ }
65752
+ return cache;
65728
65753
  }
65729
65754
  /**
65730
65755
  *
@@ -72013,20 +72038,16 @@ class ECSchemaRpcLocater {
72013
72038
  return undefined;
72014
72039
  }
72015
72040
  /**
72016
- * Attempts to get a schema from the schema rpc locater. Yields undefined if no matching schema is found.
72017
- * @param schemaKey Key to look up
72018
- * @param matchType How to match key against candidate schemas
72019
- * @param context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.
72041
+ * This method is not supported for locating schemas over RPC/HTTP.
72042
+ * Use the asynchronous `getSchema` method instead.
72043
+ * @param _schemaKey Key to look up
72044
+ * @param _matchType How to match key against candidate schemas
72045
+ * @param _context The SchemaContext that will control the lifetime of the schema and holds the schema's references, if they exist.
72046
+ * @throws Error Always throws an error indicating this method is not supported.
72047
+ * @deprecated in 5.0 Use the asynchronous `getSchema` method for schema retrieval.
72020
72048
  */
72021
- getSchemaSync(schemaKey, matchType, context) {
72022
- const schemaJson = _ECSchemaRpcInterface__WEBPACK_IMPORTED_MODULE_1__.ECSchemaRpcInterface.getClient().getSchemaJSON(this.token, schemaKey.name).then((props) => {
72023
- return props;
72024
- });
72025
- const schema = _itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_0__.Schema.fromJsonSync(schemaJson, context || new _itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_0__.SchemaContext());
72026
- if (schema !== undefined && schema.schemaKey.matches(schemaKey, matchType)) {
72027
- return schema;
72028
- }
72029
- return undefined;
72049
+ getSchemaSync(_schemaKey, _matchType, _context) {
72050
+ throw new Error("getSchemaSync is not supported. Use the asynchronous getSchema method instead.");
72030
72051
  }
72031
72052
  }
72032
72053
 
@@ -74241,6 +74262,8 @@ class AccuDraw {
74241
74262
  onFieldKeyinStatusChange(_index) { }
74242
74263
  /** Called to request focus change to the specified input field */
74243
74264
  setFocusItem(_index) { }
74265
+ /** Called to get the item field that currently has input focus */
74266
+ getFocusItem() { return undefined; }
74244
74267
  static getMinPolarMag(origin) {
74245
74268
  return (1.0e-12 * (1.0 + origin.magnitude()));
74246
74269
  }
@@ -84141,6 +84164,8 @@ __webpack_require__.r(__webpack_exports__);
84141
84164
  /* harmony import */ var _ViewState__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ViewState */ "../../core/frontend/lib/esm/ViewState.js");
84142
84165
  /* harmony import */ var _common_internal_Symbols__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./common/internal/Symbols */ "../../core/frontend/lib/esm/common/internal/Symbols.js");
84143
84166
  /* harmony import */ var _IpcApp__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./IpcApp */ "../../core/frontend/lib/esm/IpcApp.js");
84167
+ /* harmony import */ var _itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @itwin/ecschema-metadata */ "../../core/ecschema-metadata/lib/esm/ecschema-metadata.js");
84168
+ /* harmony import */ var _itwin_ecschema_rpcinterface_common__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @itwin/ecschema-rpcinterface-common */ "../../core/ecschema-rpc/common/lib/esm/ecschema-rpc-interface.js");
84144
84169
  /*---------------------------------------------------------------------------------------------
84145
84170
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
84146
84171
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -84163,6 +84188,8 @@ __webpack_require__.r(__webpack_exports__);
84163
84188
 
84164
84189
 
84165
84190
 
84191
+
84192
+
84166
84193
  const loggerCategory = _common_FrontendLoggerCategory__WEBPACK_IMPORTED_MODULE_3__.FrontendLoggerCategory.IModelConnection;
84167
84194
  /** A connection to a [IModelDb]($backend) hosted on the backend.
84168
84195
  * @public
@@ -84245,6 +84272,7 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
84245
84272
  * @deprecated in 5.0.0. If you need font Ids on the front-end for some reason, write an Ipc method that queries [IModelDb.fonts]($backend).
84246
84273
  */
84247
84274
  fontMap; // eslint-disable-line @typescript-eslint/no-deprecated
84275
+ _schemaContext;
84248
84276
  /** Load the FontMap for this IModelConnection.
84249
84277
  * @returns Returns a Promise<FontMap> that is fulfilled when the FontMap member of this IModelConnection is valid.
84250
84278
  * @deprecated in 5.0.0. If you need font Ids on the front-end for some reason, write an Ipc method that queries [IModelDb.fonts]($backend).
@@ -84633,6 +84661,24 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
84633
84661
  }
84634
84662
  return ("number" === typeof this._projectCenterAltitude) ? this._projectCenterAltitude : undefined;
84635
84663
  }
84664
+ /**
84665
+ * Gets the context that allows accessing the metadata (see `@itwin/ecschema-metadata` package) of this iModel.
84666
+ * The context is created lazily when this property is accessed for the first time, with an `ECSchemaRpcLocater` registered as a fallback locater, enabling users to register their own locater that'd take more priority.
84667
+ * This means to correctly access schema context, client-side applications must register `ECSchemaRpcInterface` following instructions for [RPC configuration]($docs/learning/rpcinterface/#client-side-configuration).
84668
+ * Server-side applications would also [configure RPC]($docs/learning/rpcinterface/#server-side-configuration) as needed.
84669
+ *
84670
+ * @note While a `BlankConnection` returns a valid `schemaContext`, it has an invalid locater registered by default, and will throw an error when trying to call it's methods.
84671
+ * @beta
84672
+ */
84673
+ get schemaContext() {
84674
+ if (this._schemaContext === undefined) {
84675
+ const context = new _itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_15__.SchemaContext();
84676
+ const locater = new _itwin_ecschema_rpcinterface_common__WEBPACK_IMPORTED_MODULE_16__.ECSchemaRpcLocater(this._getRpcProps());
84677
+ context.addFallbackLocater(locater);
84678
+ this._schemaContext = context;
84679
+ }
84680
+ return this._schemaContext;
84681
+ }
84636
84682
  }
84637
84683
  /** A connection that exists without an iModel. Useful for connecting to Reality Data services.
84638
84684
  * @note This class exists because our display system requires an IModelConnection type even if only reality data is drawn.
@@ -89350,8 +89396,18 @@ class ViewAttachments {
89350
89396
  get isEmpty() {
89351
89397
  return 0 === this._attachments.length;
89352
89398
  }
89353
- get areAllTileTreesLoaded() {
89354
- return this._attachments.every((x) => x.areAllTileTreesLoaded);
89399
+ areAllTileTreesLoaded(displayedExtents) {
89400
+ return this._attachments.every((x) => {
89401
+ const placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Placement2d.fromJSON(x.viewAttachmentProps.placement);
89402
+ const attachmentRange = placement.calculateRange();
89403
+ if (!attachmentRange.intersectsRangeXY(displayedExtents))
89404
+ return true;
89405
+ return x.areAllTileTreesLoaded;
89406
+ });
89407
+ }
89408
+ /** Strictly for testing purposes */
89409
+ areAllAttachmentsLoaded() {
89410
+ return this._attachments.every((attachment) => attachment.areAllTileTreesLoaded);
89355
89411
  }
89356
89412
  discloseTileTrees(trees) {
89357
89413
  for (const attachment of this._attachments)
@@ -89530,7 +89586,19 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
89530
89586
  this._attachments = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._attachments);
89531
89587
  }
89532
89588
  get areAllTileTreesLoaded() {
89533
- return super.areAllTileTreesLoaded && (!this._attachments || this._attachments.areAllTileTreesLoaded);
89589
+ let displayedExtents = this._viewedExtents;
89590
+ const frustum = this.calculateFrustum();
89591
+ if (frustum) {
89592
+ displayedExtents = frustum.toRange();
89593
+ }
89594
+ return super.areAllTileTreesLoaded && (!this._attachments || this._attachments.areAllTileTreesLoaded(displayedExtents));
89595
+ }
89596
+ /** @internal Strictly for testing */
89597
+ areAllAttachmentsLoaded() {
89598
+ if (this._attachments) {
89599
+ return this._attachments.areAllAttachmentsLoaded();
89600
+ }
89601
+ return true;
89534
89602
  }
89535
89603
  /** Create a sheet border decoration graphic. */
89536
89604
  createBorder(width, height, context) {
@@ -91605,16 +91673,21 @@ class RenderContext {
91605
91673
  * @public
91606
91674
  */
91607
91675
  class DynamicsContext extends RenderContext {
91608
- _dynamics;
91676
+ _foreground;
91677
+ _overlay;
91609
91678
  /** Add a graphic to the list of dynamic graphics to be drawn in this context's [[Viewport]]. */
91610
91679
  addGraphic(graphic) {
91611
- if (undefined === this._dynamics)
91612
- this._dynamics = [];
91613
- this._dynamics.push(graphic);
91680
+ this.add(graphic, false);
91681
+ }
91682
+ /** @internal */
91683
+ add(graphic, isOverlay) {
91684
+ const key = isOverlay ? "_overlay" : "_foreground";
91685
+ const list = this[key] ?? (this[key] = []);
91686
+ list.push(graphic);
91614
91687
  }
91615
91688
  /** @internal */
91616
91689
  changeDynamics() {
91617
- this.viewport.changeDynamics(this._dynamics);
91690
+ this.viewport.changeDynamics(this._foreground, this._overlay);
91618
91691
  }
91619
91692
  /** Create a builder for producing a [[RenderGraphic]] appropriate for rendering within this context's [[Viewport]].
91620
91693
  * @param options Options describing how to create the builder.
@@ -92718,10 +92791,10 @@ class ViewManager {
92718
92791
  this.inDynamicsMode = false;
92719
92792
  const cursorVp = _IModelApp__WEBPACK_IMPORTED_MODULE_1__.IModelApp.toolAdmin.cursorView;
92720
92793
  if (cursorVp)
92721
- cursorVp.changeDynamics(undefined);
92794
+ cursorVp.changeDynamics(undefined, undefined);
92722
92795
  for (const vp of this._viewports) {
92723
92796
  if (vp !== cursorVp)
92724
- vp.changeDynamics(undefined);
92797
+ vp.changeDynamics(undefined, undefined);
92725
92798
  }
92726
92799
  }
92727
92800
  /** @internal */
@@ -97019,8 +97092,8 @@ class Viewport {
97019
97092
  return this.view.is3d() && this.view.isCameraOn;
97020
97093
  }
97021
97094
  /** @internal */
97022
- changeDynamics(dynamics) {
97023
- this.target.changeDynamics(dynamics);
97095
+ changeDynamics(dynamics, overlay) {
97096
+ this.target.changeDynamics(dynamics, overlay);
97024
97097
  this.invalidateDecorations();
97025
97098
  }
97026
97099
  _assigningFlashedId = false;
@@ -108160,12 +108233,7 @@ __webpack_require__.r(__webpack_exports__);
108160
108233
  * @internal
108161
108234
  */
108162
108235
  async function loadScript(jsUrl) {
108163
- // const module = await import(/* webpackIgnore: true */jsUrl);
108164
- // Webpack gives a warning:
108165
- // "Critical dependency: the request of a dependency is an expression"
108166
- // Because tsc transpiles "await import" to "require" (when compiled to is CommonJS).
108167
- // So use FunctionConstructor to avoid tsc.
108168
- const module = await Function("x", "return import(x)")(jsUrl);
108236
+ const module = await __webpack_require__("../../core/frontend/lib/esm/extension/providers lazy recursive")(jsUrl);
108169
108237
  return execute(module);
108170
108238
  }
108171
108239
  /** attempts to execute an extension module */
@@ -108615,7 +108683,7 @@ var MockRender;
108615
108683
  get analysisFraction() { return 0; }
108616
108684
  set analysisFraction(_fraction) { }
108617
108685
  changeScene(_scene) { }
108618
- changeDynamics(_dynamics) { }
108686
+ changeDynamics(_foreground, _overlay) { }
108619
108687
  changeDecorations(_decs) { }
108620
108688
  changeRenderPlan(_plan) { }
108621
108689
  drawFrame(_sceneTime) { }
@@ -117958,7 +118026,7 @@ class MeshGraphic extends _Graphic__WEBPACK_IMPORTED_MODULE_2__.Graphic {
117958
118026
  }
117959
118027
  unionRange(range) {
117960
118028
  if (this._instances)
117961
- range.extendRange(range);
118029
+ range.extendRange(this._instances.range);
117962
118030
  else
117963
118031
  range.extendRange(this._meshRange);
117964
118032
  }
@@ -120705,9 +120773,8 @@ class RenderCommands {
120705
120773
  this.addGraphics(gfx.foreground);
120706
120774
  this.addBackgroundMapGraphics(gfx.background);
120707
120775
  this.addOverlayGraphics(gfx.overlays);
120708
- const dynamics = gfx.dynamics;
120709
- if (dynamics && dynamics.length > 0)
120710
- this.addDecorations(dynamics);
120776
+ this.addGraphics(gfx.foregroundDynamics);
120777
+ this.addOverlayGraphics(gfx.overlayDynamics);
120711
120778
  const dec = gfx.decorations;
120712
120779
  if (undefined !== dec) {
120713
120780
  this.addBackground(dec.viewBackground);
@@ -127665,8 +127732,8 @@ class Target extends _render_RenderTarget__WEBPACK_IMPORTED_MODULE_7__.RenderTar
127665
127732
  this.changeDrapesOrClassifiers(this._planarClassifiers, planarClassifiers);
127666
127733
  this._planarClassifiers = planarClassifiers;
127667
127734
  }
127668
- changeDynamics(dynamics) {
127669
- this.graphics.dynamics = dynamics;
127735
+ changeDynamics(foreground, overlay) {
127736
+ this.graphics.changeDynamics(foreground, overlay);
127670
127737
  }
127671
127738
  overrideFeatureSymbology(ovr) {
127672
127739
  this.uniforms.branch.overrideFeatureSymbology(ovr);
@@ -128547,26 +128614,29 @@ class TargetGraphics {
128547
128614
  foreground = [];
128548
128615
  background = [];
128549
128616
  overlays = [];
128550
- _dynamics;
128617
+ foregroundDynamics = [];
128618
+ overlayDynamics = [];
128551
128619
  _decorations;
128552
128620
  [Symbol.dispose]() {
128553
128621
  this.foreground.length = this.background.length = this.overlays.length = 0;
128554
- this._dynamics = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.disposeArray)(this._dynamics);
128622
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.disposeArray)(this.foregroundDynamics);
128623
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.disposeArray)(this.overlayDynamics);
128555
128624
  this._decorations = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._decorations);
128556
128625
  }
128557
128626
  get isDisposed() {
128558
128627
  return 0 === this.foreground.length && 0 === this.background.length && 0 === this.overlays.length
128559
- && undefined === this._dynamics && undefined === this._decorations;
128628
+ && 0 === this.foregroundDynamics.length && 0 === this.overlayDynamics.length && !this._decorations;
128560
128629
  }
128561
128630
  changeScene(scene) {
128562
128631
  this.foreground = scene.foreground;
128563
128632
  this.background = scene.background;
128564
128633
  this.overlays = scene.overlay;
128565
128634
  }
128566
- get dynamics() { return this._dynamics; }
128567
- set dynamics(dynamics) {
128568
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.disposeArray)(this._dynamics);
128569
- this._dynamics = dynamics;
128635
+ changeDynamics(foreground, overlay) {
128636
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.disposeArray)(this.foregroundDynamics);
128637
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.disposeArray)(this.overlayDynamics);
128638
+ this.foregroundDynamics = foreground ?? [];
128639
+ this.overlayDynamics = overlay ?? [];
128570
128640
  }
128571
128641
  get decorations() { return this._decorations; }
128572
128642
  set decorations(decorations) {
@@ -141101,6 +141171,7 @@ class GraphicsCollectorDrawArgs extends _tile_internal__WEBPACK_IMPORTED_MODULE_
141101
141171
  return undefined;
141102
141172
  return new GraphicsCollectorDrawArgs(planes, worldToViewMap, collector, args);
141103
141173
  }
141174
+ get shouldCollectClassifierGraphics() { return false; }
141104
141175
  }
141105
141176
 
141106
141177
 
@@ -141371,6 +141442,7 @@ class IModelTile extends _tile_internal__WEBPACK_IMPORTED_MODULE_4__.Tile {
141371
141442
  if (format !== _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.TileFormat.IModel)
141372
141443
  return content;
141373
141444
  const sizeMultiplier = this.hasSizeMultiplier ? this.sizeMultiplier : undefined;
141445
+ const ecefTransform = this.tree.iModel.isGeoLocated ? this.tree.iModel.getEcefTransform() : _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Transform.createIdentity();
141374
141446
  try {
141375
141447
  content = await this.iModelTree.decoder.decode({
141376
141448
  stream: streamBuffer,
@@ -141379,7 +141451,7 @@ class IModelTile extends _tile_internal__WEBPACK_IMPORTED_MODULE_4__.Tile {
141379
141451
  isCanceled,
141380
141452
  sizeMultiplier,
141381
141453
  tileData: {
141382
- ecefTransform: this.tree.iModel.ecefLocation?.getTransform() ?? _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Transform.createIdentity(),
141454
+ ecefTransform,
141383
141455
  range: this.range,
141384
141456
  layerClassifiers: this.tree.layerHandler?.layerClassifiers,
141385
141457
  },
@@ -142088,7 +142160,8 @@ class IModelTileTree extends _tile_internal__WEBPACK_IMPORTED_MODULE_6__.TileTre
142088
142160
  draw(args) {
142089
142161
  const tiles = this.selectTiles(args);
142090
142162
  this._rootTile.draw(args, tiles, this._numStaticTilesSelected);
142091
- this._layerHandler.collectClassifierGraphics(args, tiles);
142163
+ if (args.shouldCollectClassifierGraphics)
142164
+ this._layerHandler.collectClassifierGraphics(args, tiles);
142092
142165
  }
142093
142166
  prune() {
142094
142167
  const olderThan = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BeTimePoint.now().minus(this.expirationTime);
@@ -143220,14 +143293,20 @@ class LayerTileTreeReferenceHandler {
143220
143293
  removals.push(context.viewport.displayStyle.settings.onMapImageryChanged.addListener((imagery) => {
143221
143294
  this.setBaseLayerSettings(imagery.backgroundBase);
143222
143295
  this.setLayerSettings(imagery.backgroundLayers);
143223
- this.clearLayers();
143224
143296
  }));
143225
143297
  }
143226
143298
  removals.push(context.viewport.onChangeView.addListener((vp, previousViewState) => {
143227
143299
  if ((0,_tile_internal__WEBPACK_IMPORTED_MODULE_1__.compareMapLayer)(previousViewState, vp.view)) {
143228
143300
  this.setBaseLayerSettings(mapImagery.backgroundBase);
143229
143301
  this.setLayerSettings(mapImagery.backgroundLayers);
143230
- this.clearLayers();
143302
+ }
143303
+ }));
143304
+ removals.push(context.viewport.onViewedModelsChanged.addListener((viewport) => {
143305
+ const layers = viewport.displayStyle.settings.mapImagery.backgroundLayers;
143306
+ if (layers.length > 0) {
143307
+ this.setBaseLayerSettings(mapImagery.backgroundBase);
143308
+ this.setLayerSettings(mapImagery.backgroundLayers);
143309
+ viewport.invalidateScene();
143231
143310
  }
143232
143311
  }));
143233
143312
  }
@@ -145895,8 +145974,9 @@ class RealityTileLoader {
145895
145974
  isCanceled = () => !tile.isLoading;
145896
145975
  const { is3d, yAxisUp, iModel, modelId } = tile.realityRoot;
145897
145976
  let reader;
145977
+ const ecefTransform = tile.tree.iModel.isGeoLocated ? tile.tree.iModel.getEcefTransform() : _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Transform.createIdentity();
145898
145978
  const tileData = {
145899
- ecefTransform: tile.tree.iModel.ecefLocation?.getTransform() ?? _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Transform.createIdentity(),
145979
+ ecefTransform,
145900
145980
  range: tile.range,
145901
145981
  layerClassifiers: tile.tree.layerHandler?.layerClassifiers,
145902
145982
  };
@@ -157211,7 +157291,7 @@ class RealityTileTree extends _internal__WEBPACK_IMPORTED_MODULE_6__.TileTree {
157211
157291
  sortIndices = selectedTiles.map((_x, i) => i);
157212
157292
  sortIndices.sort((a, b) => selectedTiles[a].depth - selectedTiles[b].depth);
157213
157293
  }
157214
- if (!(args instanceof _internal__WEBPACK_IMPORTED_MODULE_6__.GraphicsCollectorDrawArgs))
157294
+ if (args.shouldCollectClassifierGraphics)
157215
157295
  this.collectClassifierGraphics(args, selectedTiles);
157216
157296
  (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(selectedTiles.length === displayedTileDescendants.length);
157217
157297
  for (let i = 0; i < selectedTiles.length; i++) {
@@ -159365,6 +159445,8 @@ class TileDrawArgs {
159365
159445
  processSelectedTiles(_tiles) { }
159366
159446
  /* @internal */
159367
159447
  get maxRealityTreeSelectionCount() { return undefined; }
159448
+ /* @internal */
159449
+ get shouldCollectClassifierGraphics() { return true; }
159368
159450
  }
159369
159451
 
159370
159452
 
@@ -162665,6 +162747,18 @@ class MapCartoRectangle extends _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_0_
162665
162747
  scratchMercatorFractionRange.high.y = tilingScheme.latitudeToYFraction(this.high.y);
162666
162748
  return scratchMercatorFractionRange;
162667
162749
  }
162750
+ /**
162751
+ * Compute rectangle with angles specified in degrees.
162752
+ * @beta
162753
+ */
162754
+ toDegrees() {
162755
+ return {
162756
+ north: _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_0__.Angle.radiansToDegrees(this.north),
162757
+ south: _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_0__.Angle.radiansToDegrees(this.south),
162758
+ east: _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_0__.Angle.radiansToDegrees(this.east),
162759
+ west: _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_0__.Angle.radiansToDegrees(this.west),
162760
+ };
162761
+ }
162668
162762
  }
162669
162763
 
162670
162764
 
@@ -163331,7 +163425,7 @@ class MapLayerImageryProvider {
163331
163425
  }
163332
163426
  }
163333
163427
  /** @internal */
163334
- async makeTileRequest(url, timeoutMs) {
163428
+ async makeTileRequest(url, timeoutMs, authorization) {
163335
163429
  // We want to complete the first request before letting other requests go;
163336
163430
  // this done to avoid flooding server with requests missing credentials
163337
163431
  if (!this._firstRequestPromise)
@@ -163340,7 +163434,7 @@ class MapLayerImageryProvider {
163340
163434
  await this._firstRequestPromise;
163341
163435
  let response;
163342
163436
  try {
163343
- response = await this.makeRequest(url, timeoutMs);
163437
+ response = await this.makeRequest(url, timeoutMs, authorization);
163344
163438
  }
163345
163439
  finally {
163346
163440
  this.onFirstRequestCompleted.raiseEvent();
@@ -163350,11 +163444,15 @@ class MapLayerImageryProvider {
163350
163444
  return response;
163351
163445
  }
163352
163446
  /** @internal */
163353
- async makeRequest(url, timeoutMs) {
163447
+ async makeRequest(url, timeoutMs, authorization) {
163354
163448
  let response;
163355
163449
  let headers;
163356
163450
  let hasCreds = false;
163357
- if (this._settings.userName && this._settings.password) {
163451
+ if (authorization) {
163452
+ headers = new Headers();
163453
+ headers.set("Authorization", authorization);
163454
+ }
163455
+ else if (this._settings.userName && this._settings.password) {
163358
163456
  hasCreds = true;
163359
163457
  headers = new Headers();
163360
163458
  this.setRequestAuthorization(headers);
@@ -166160,6 +166258,18 @@ class QuadId {
166160
166258
  (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.compareNumbers)(this.row, other.row) ||
166161
166259
  (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.compareNumbers)(this.column, other.column);
166162
166260
  }
166261
+ /** Creates a QuadId from a JSON representation */
166262
+ static fromJSON(props) {
166263
+ return new QuadId(props.level, props.column, props.row);
166264
+ }
166265
+ /** Convert this QuadId to a JSON representation */
166266
+ static toJSON(props) {
166267
+ return {
166268
+ level: props.level,
166269
+ column: props.column,
166270
+ row: props.row,
166271
+ };
166272
+ }
166163
166273
  }
166164
166274
 
166165
166275
 
@@ -168000,6 +168110,7 @@ class AccuDrawViewportUI extends _AccuDraw__WEBPACK_IMPORTED_MODULE_1__.AccuDraw
168000
168110
  this._controls.overlay.remove();
168001
168111
  this._controls = undefined;
168002
168112
  this.unsuspendToolTips();
168113
+ this.removedControlRect();
168003
168114
  }
168004
168115
  createControlDiv() {
168005
168116
  const div = document.createElement("div");
@@ -168087,6 +168198,10 @@ class AccuDrawViewportUI extends _AccuDraw__WEBPACK_IMPORTED_MODULE_1__.AccuDraw
168087
168198
  style.outlineWidth = button.outlineWidth;
168088
168199
  return itemLock;
168089
168200
  }
168201
+ /** Called after the controls have been removed from the view. */
168202
+ removedControlRect() { }
168203
+ /** Called after the position of the controls in the supplied view is updated. */
168204
+ changedControlRect(_rect, _vp) { }
168090
168205
  /** Use to override the position of the controls in the supplied view. */
168091
168206
  modifyControlRect(_rect, _vp) { }
168092
168207
  /** Return the ViewRect currently occupied by the controls in the supplied view. */
@@ -168183,6 +168298,8 @@ class AccuDrawViewportUI extends _AccuDraw__WEBPACK_IMPORTED_MODULE_1__.AccuDraw
168183
168298
  return; // Keep showing at last valid location...
168184
168299
  this._controls.div.style.left = `${controlRect.left}px`;
168185
168300
  this._controls.div.style.top = `${controlRect.top}px`;
168301
+ this.changedControlRect(controlRect, vp);
168302
+ return;
168186
168303
  }
168187
168304
  get _isFocusHome() {
168188
168305
  return (document.body === document.activeElement);
@@ -168205,6 +168322,13 @@ class AccuDrawViewportUI extends _AccuDraw__WEBPACK_IMPORTED_MODULE_1__.AccuDraw
168205
168322
  // Indicate when keyboard shortcuts can't be used (i.e. focus not at AccuDraw or Home) by changing compass to monochrome...
168206
168323
  return (this._isFocusHome || this._isFocusAccuDraw);
168207
168324
  }
168325
+ /** Get the item field that currently has input focus.
168326
+ */
168327
+ getFocusItem() {
168328
+ if (!this._isFocusAccuDraw)
168329
+ return undefined;
168330
+ return this._focusItem;
168331
+ }
168208
168332
  /** Request to set focus to the specified AccuDraw input field to start entering values.
168209
168333
  * The focused input field will be indicated by the background color.
168210
168334
  */
@@ -175037,6 +175161,7 @@ class CurrentInputState {
175037
175161
  lastButton = _Tool__WEBPACK_IMPORTED_MODULE_13__.BeButton.Data;
175038
175162
  inputSource = _Tool__WEBPACK_IMPORTED_MODULE_13__.InputSource.Unknown;
175039
175163
  lastMotion = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d();
175164
+ lastMotionEvent;
175040
175165
  lastWheelEvent;
175041
175166
  lastTouchStart;
175042
175167
  touchTapTimer;
@@ -175054,7 +175179,7 @@ class CurrentInputState {
175054
175179
  onStartDrag(button) { this.button[button].isDragging = true; }
175055
175180
  onInstallTool() {
175056
175181
  this.clearKeyQualifiers();
175057
- this.lastWheelEvent = undefined;
175182
+ this.lastWheelEvent = this.lastMotionEvent = undefined;
175058
175183
  this.lastTouchStart = this.touchTapTimer = this.touchTapCount = undefined;
175059
175184
  }
175060
175185
  clearKeyQualifiers() { this.qualifiers = _Tool__WEBPACK_IMPORTED_MODULE_13__.BeModifierKeys.None; }
@@ -175329,6 +175454,9 @@ class ToolAdmin {
175329
175454
  this.clearMotionPromises();
175330
175455
  // make sure tools don't think the cursor is still in this viewport.
175331
175456
  this.onMouseLeave(vp);
175457
+ // Invalidate last motion if for this viewport...
175458
+ if (this.currentInputState.lastMotionEvent?.viewport === vp)
175459
+ this.currentInputState.lastMotionEvent = undefined;
175332
175460
  // Remove any events associated with this viewport.
175333
175461
  ToolAdmin._toolEvents = ToolAdmin._toolEvents.filter((ev) => ev.vp !== vp);
175334
175462
  }
@@ -175692,6 +175820,7 @@ class ToolAdmin {
175692
175820
  toolPromise.then(() => {
175693
175821
  if (undefined === this._toolMotionPromise)
175694
175822
  return; // Only early return if canceled, result from a previous motion is preferable to showing nothing...
175823
+ this.currentInputState.lastMotionEvent = motion; // Save to use for simulation motion...
175695
175824
  // Update decorations when dynamics are inactive...
175696
175825
  if (!_IModelApp__WEBPACK_IMPORTED_MODULE_5__.IModelApp.viewManager.inDynamicsMode) {
175697
175826
  vp.invalidateDecorations();
@@ -176433,7 +176562,8 @@ class ToolAdmin {
176433
176562
  }
176434
176563
  /** Can be called by tools to invoke their [[InteractiveTool.onDynamicFrame]] method without requiring a motion event. */
176435
176564
  simulateMotionEvent() {
176436
- this.updateDynamics(undefined, undefined, true);
176565
+ // NOTE: Prefer last resolved motion over current cursor location which could be out of the view, or moved from last AccuSnap etc.
176566
+ this.updateDynamics(this.currentInputState.lastMotionEvent, undefined, true);
176437
176567
  }
176438
176568
  /** @internal */
176439
176569
  setIncompatibleViewportCursor(restore) {
@@ -184833,7 +184963,8 @@ class BSpline2dNd extends _curve_GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geom
184833
184963
  knots;
184834
184964
  /** flat array of coordinate data, blocked by poleDimension and row */
184835
184965
  coffs;
184836
- /** Number of components per pole.
184966
+ /**
184967
+ * Number of components per pole.
184837
184968
  * * 3 for conventional xyz surface
184838
184969
  * * 4 for weighted (wx, wy, wz, w) surface.
184839
184970
  */
@@ -203964,7 +204095,7 @@ __webpack_require__.r(__webpack_exports__);
203964
204095
  /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
203965
204096
  /* harmony import */ var _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geometry4d/MomentData */ "../../core/geometry/lib/esm/geometry4d/MomentData.js");
203966
204097
  /* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
203967
- /* harmony import */ var _Loop__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
204098
+ /* harmony import */ var _RegionOps__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./RegionOps */ "../../core/geometry/lib/esm/curve/RegionOps.js");
203968
204099
  /* harmony import */ var _StrokeOptions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./StrokeOptions */ "../../core/geometry/lib/esm/curve/StrokeOptions.js");
203969
204100
  /*---------------------------------------------------------------------------------------------
203970
204101
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
@@ -203985,15 +204116,15 @@ class RegionMomentsXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
203985
204116
  _activeMomentData;
203986
204117
  _point0 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Point3d.create();
203987
204118
  _point1 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Point3d.create();
203988
- /** Accumulate (independent) integrations over
203989
- * * origin to chord of the arc.
203990
- * * origin to the "cap" between the chord and arc.
204119
+ /**
204120
+ * Accumulate (independent) integrations over:
204121
+ * * The area between the arc and the chord connecting its endpoints.
204122
+ * * The triangle with vertices: origin, arc start, arc end.
203991
204123
  */
203992
204124
  handleArc3d(arc) {
203993
204125
  const momentData = this._activeMomentData;
203994
204126
  const sweepRadians = arc.sweep.sweepRadians;
203995
204127
  const alphaRadians = sweepRadians * 0.5;
203996
- // from https://apps.dtic.mil/dtic/tr/fulltext/u2/274936.pdf page 71 for radius = 1
203997
204128
  let s = Math.sin(alphaRadians);
203998
204129
  let c = Math.cos(alphaRadians);
203999
204130
  let s1 = Math.sin(sweepRadians);
@@ -204020,12 +204151,12 @@ class RegionMomentsXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
204020
204151
  const pointC = arc.fractionToPoint(1.0);
204021
204152
  momentData.accumulateTriangleMomentsXY(undefined, pointB, pointC);
204022
204153
  }
204023
- /** Accumulate integrals over the (triangular) areas from the origin to each line segment */
204154
+ /** Accumulate integrals over the (triangular) areas from the origin to each line segment. */
204024
204155
  handleLineString3d(ls) {
204025
204156
  const momentData = this._activeMomentData;
204026
204157
  momentData.accumulateTriangleToLineStringMomentsXY(undefined, ls.packedPoints);
204027
204158
  }
204028
- /** Accumulate integrals over the (triangular) area from the origin to this line segment */
204159
+ /** Accumulate integrals over the (triangular) area from the origin to this line segment. */
204029
204160
  handleLineSegment3d(segment) {
204030
204161
  const momentData = this._activeMomentData;
204031
204162
  segment.startPoint(this._point0);
@@ -204041,57 +204172,31 @@ class RegionMomentsXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
204041
204172
  this._activeMomentData = undefined;
204042
204173
  return momentData;
204043
204174
  }
204044
- /**
204045
- * ASSUMPTIONS FOR ORIENTATION AND CONTAINMENT ISSUES
204046
- * * Largest area is outer
204047
- * * All others are interior (and not overlapping)
204048
- * Hence
204049
- * * Outer area sign must be positive -- negate all integrations as needed
204050
- * * Outer area signs must be positive -- negate all integrations as needed
204051
- * @param region
204052
- */
204053
- handleParityRegion(region) {
204054
- const allChildMoments = [];
204055
- let maxAbsArea = 0.0;
204056
- let largestChildMoments;
204057
- for (const child of region.children) {
204058
- if (child instanceof _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop) {
204059
- const childMoments = this.handleLoop(child);
204175
+ handleAnyRegion(region) {
204176
+ const summedMoments = _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_3__.MomentData.create();
204177
+ // guarantee there is no overlapping children
204178
+ const merged = _RegionOps__WEBPACK_IMPORTED_MODULE_4__.RegionOps.regionBooleanXY(region, undefined, _RegionOps__WEBPACK_IMPORTED_MODULE_4__.RegionBinaryOpType.Union);
204179
+ if (merged) {
204180
+ for (const child of merged.children) {
204181
+ const childMoments = child.dispatchToGeometryHandler(this);
204060
204182
  if (childMoments) {
204061
- allChildMoments.push(childMoments);
204062
- const q = Math.abs(childMoments.quantitySum);
204063
- if (q > maxAbsArea) {
204064
- maxAbsArea = q;
204065
- largestChildMoments = childMoments;
204066
- }
204183
+ const sign0 = childMoments.signFactor(1.0);
204184
+ summedMoments.accumulateProducts(childMoments, sign0);
204067
204185
  }
204068
204186
  }
204069
204187
  }
204070
- if (largestChildMoments) {
204071
- const summedMoments = _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_3__.MomentData.create();
204072
- const sign0 = largestChildMoments.signFactor(1.0);
204073
- summedMoments.accumulateProducts(largestChildMoments, sign0);
204074
- for (const childMoments of allChildMoments) {
204075
- if (childMoments !== largestChildMoments) {
204076
- const sign1 = childMoments.signFactor(-1.0);
204077
- summedMoments.accumulateProducts(childMoments, sign1);
204078
- }
204079
- }
204080
- return summedMoments;
204188
+ else {
204189
+ return undefined;
204081
204190
  }
204082
- return undefined;
204191
+ return summedMoments;
204192
+ }
204193
+ /** Accumulate integrals from origin to the components of the parity region. */
204194
+ handleParityRegion(region) {
204195
+ return this.handleAnyRegion(region);
204083
204196
  }
204084
- /** Accumulate (as simple addition) products over each component of the union region. */
204197
+ /** Accumulate integrals from origin to the components of the union region. */
204085
204198
  handleUnionRegion(region) {
204086
- const summedMoments = _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_3__.MomentData.create();
204087
- for (const child of region.children) {
204088
- const childMoments = child.dispatchToGeometryHandler(this);
204089
- if (childMoments) {
204090
- const sign0 = childMoments.signFactor(1.0);
204091
- summedMoments.accumulateProducts(childMoments, sign0);
204092
- }
204093
- }
204094
- return summedMoments;
204199
+ return this.handleAnyRegion(region);
204095
204200
  }
204096
204201
  _strokeOptions;
204097
204202
  getStrokeOptions() {
@@ -204103,9 +204208,9 @@ class RegionMomentsXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
204103
204208
  this._strokeOptions = options;
204104
204209
  return options;
204105
204210
  }
204106
- /** Single curve primitive (not loop . . .).
204107
- * * stroke the curve
204108
- * * accumulate stroke array.
204211
+ /**
204212
+ * Handle a single curve primitive (not loop).
204213
+ * * Stroke the curve and accumulate stroke array.
204109
204214
  */
204110
204215
  handleCurvePrimitive(cp) {
204111
204216
  const strokes = _LineString3d__WEBPACK_IMPORTED_MODULE_6__.LineString3d.create();
@@ -204113,12 +204218,18 @@ class RegionMomentsXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
204113
204218
  cp.emitStrokes(strokes, options);
204114
204219
  this.handleLineString3d(strokes);
204115
204220
  }
204116
- /** handle strongly typed BSplineCurve3d as generic curve primitive */
204117
- handleBSplineCurve3d(g) { return this.handleCurvePrimitive(g); }
204118
- /** handle strongly typed BSplineCurve3dH as generic curve primitive */
204119
- handleBSplineCurve3dH(g) { return this.handleCurvePrimitive(g); }
204120
- /** handle strongly typed TransitionSpiral as generic curve primitive */
204121
- handleTransitionSpiral(g) { return this.handleCurvePrimitive(g); }
204221
+ /** Handle strongly typed BSplineCurve3d as generic curve primitive. */
204222
+ handleBSplineCurve3d(g) {
204223
+ return this.handleCurvePrimitive(g);
204224
+ }
204225
+ /** Handle strongly typed BSplineCurve3dH as generic curve primitive. */
204226
+ handleBSplineCurve3dH(g) {
204227
+ return this.handleCurvePrimitive(g);
204228
+ }
204229
+ /** Handle strongly typed TransitionSpiral as generic curve primitive. */
204230
+ handleTransitionSpiral(g) {
204231
+ return this.handleCurvePrimitive(g);
204232
+ }
204122
204233
  }
204123
204234
 
204124
204235
 
@@ -204138,41 +204249,44 @@ __webpack_require__.r(__webpack_exports__);
204138
204249
  /* harmony export */ RegionOps: () => (/* binding */ RegionOps)
204139
204250
  /* harmony export */ });
204140
204251
  /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
204141
- /* harmony import */ var _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../geometry3d/GrowableXYZArray */ "../../core/geometry/lib/esm/geometry3d/GrowableXYZArray.js");
204142
- /* harmony import */ var _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geometry3d/IndexedXYZCollection */ "../../core/geometry/lib/esm/geometry3d/IndexedXYZCollection.js");
204143
- /* harmony import */ var _geometry3d_Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../geometry3d/Point3dArrayCarrier */ "../../core/geometry/lib/esm/geometry3d/Point3dArrayCarrier.js");
204144
- /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
204145
- /* harmony import */ var _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ../geometry3d/PolygonOps */ "../../core/geometry/lib/esm/geometry3d/PolygonOps.js");
204146
- /* harmony import */ var _geometry3d_PolylineCompressionByEdgeOffset__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../geometry3d/PolylineCompressionByEdgeOffset */ "../../core/geometry/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js");
204147
- /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
204148
- /* harmony import */ var _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ../geometry3d/SortablePolygon */ "../../core/geometry/lib/esm/geometry3d/SortablePolygon.js");
204149
- /* harmony import */ var _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ../geometry3d/Transform */ "../../core/geometry/lib/esm/geometry3d/Transform.js");
204252
+ /* harmony import */ var _geometry3d_FrameBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geometry3d/FrameBuilder */ "../../core/geometry/lib/esm/geometry3d/FrameBuilder.js");
204253
+ /* harmony import */ var _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../geometry3d/GrowableXYZArray */ "../../core/geometry/lib/esm/geometry3d/GrowableXYZArray.js");
204254
+ /* harmony import */ var _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geometry3d/IndexedXYZCollection */ "../../core/geometry/lib/esm/geometry3d/IndexedXYZCollection.js");
204255
+ /* harmony import */ var _geometry3d_Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ../geometry3d/Point3dArrayCarrier */ "../../core/geometry/lib/esm/geometry3d/Point3dArrayCarrier.js");
204256
+ /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
204257
+ /* harmony import */ var _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ../geometry3d/PolygonOps */ "../../core/geometry/lib/esm/geometry3d/PolygonOps.js");
204258
+ /* harmony import */ var _geometry3d_PolylineCompressionByEdgeOffset__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../geometry3d/PolylineCompressionByEdgeOffset */ "../../core/geometry/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js");
204259
+ /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
204260
+ /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
204261
+ /* harmony import */ var _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ../geometry3d/SortablePolygon */ "../../core/geometry/lib/esm/geometry3d/SortablePolygon.js");
204262
+ /* harmony import */ var _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ../geometry3d/Transform */ "../../core/geometry/lib/esm/geometry3d/Transform.js");
204150
204263
  /* harmony import */ var _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../geometry4d/MomentData */ "../../core/geometry/lib/esm/geometry4d/MomentData.js");
204151
- /* harmony import */ var _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../polyface/PolyfaceBuilder */ "../../core/geometry/lib/esm/polyface/PolyfaceBuilder.js");
204152
- /* harmony import */ var _topology_Graph__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../topology/Graph */ "../../core/geometry/lib/esm/topology/Graph.js");
204153
- /* harmony import */ var _topology_HalfEdgeGraphSearch__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../topology/HalfEdgeGraphSearch */ "../../core/geometry/lib/esm/topology/HalfEdgeGraphSearch.js");
204154
- /* harmony import */ var _topology_Merging__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ../topology/Merging */ "../../core/geometry/lib/esm/topology/Merging.js");
204155
- /* harmony import */ var _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../topology/Triangulation */ "../../core/geometry/lib/esm/topology/Triangulation.js");
204156
- /* harmony import */ var _CurveCollection__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./CurveCollection */ "../../core/geometry/lib/esm/curve/CurveCollection.js");
204157
- /* harmony import */ var _CurveCurve__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./CurveCurve */ "../../core/geometry/lib/esm/curve/CurveCurve.js");
204158
- /* harmony import */ var _CurveOps__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./CurveOps */ "../../core/geometry/lib/esm/curve/CurveOps.js");
204159
- /* harmony import */ var _CurvePrimitive__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./CurvePrimitive */ "../../core/geometry/lib/esm/curve/CurvePrimitive.js");
204264
+ /* harmony import */ var _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../polyface/PolyfaceBuilder */ "../../core/geometry/lib/esm/polyface/PolyfaceBuilder.js");
204265
+ /* harmony import */ var _topology_Graph__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../topology/Graph */ "../../core/geometry/lib/esm/topology/Graph.js");
204266
+ /* harmony import */ var _topology_HalfEdgeGraphSearch__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../topology/HalfEdgeGraphSearch */ "../../core/geometry/lib/esm/topology/HalfEdgeGraphSearch.js");
204267
+ /* harmony import */ var _topology_Merging__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ../topology/Merging */ "../../core/geometry/lib/esm/topology/Merging.js");
204268
+ /* harmony import */ var _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../topology/Triangulation */ "../../core/geometry/lib/esm/topology/Triangulation.js");
204269
+ /* harmony import */ var _CurveCollection__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./CurveCollection */ "../../core/geometry/lib/esm/curve/CurveCollection.js");
204270
+ /* harmony import */ var _CurveCurve__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./CurveCurve */ "../../core/geometry/lib/esm/curve/CurveCurve.js");
204271
+ /* harmony import */ var _CurveOps__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./CurveOps */ "../../core/geometry/lib/esm/curve/CurveOps.js");
204272
+ /* harmony import */ var _CurvePrimitive__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./CurvePrimitive */ "../../core/geometry/lib/esm/curve/CurvePrimitive.js");
204160
204273
  /* harmony import */ var _CurveWireMomentsXYZ__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./CurveWireMomentsXYZ */ "../../core/geometry/lib/esm/curve/CurveWireMomentsXYZ.js");
204161
- /* harmony import */ var _GeometryQuery__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./GeometryQuery */ "../../core/geometry/lib/esm/curve/GeometryQuery.js");
204162
- /* harmony import */ var _internalContexts_ChainCollectorContext__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./internalContexts/ChainCollectorContext */ "../../core/geometry/lib/esm/curve/internalContexts/ChainCollectorContext.js");
204163
- /* harmony import */ var _internalContexts_PolygonOffsetContext__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./internalContexts/PolygonOffsetContext */ "../../core/geometry/lib/esm/curve/internalContexts/PolygonOffsetContext.js");
204164
- /* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
204165
- /* harmony import */ var _Loop__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
204166
- /* harmony import */ var _OffsetOptions__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./OffsetOptions */ "../../core/geometry/lib/esm/curve/OffsetOptions.js");
204167
- /* harmony import */ var _ParityRegion__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ParityRegion */ "../../core/geometry/lib/esm/curve/ParityRegion.js");
204168
- /* harmony import */ var _Path__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./Path */ "../../core/geometry/lib/esm/curve/Path.js");
204169
- /* harmony import */ var _Query_ConsolidateAdjacentPrimitivesContext__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./Query/ConsolidateAdjacentPrimitivesContext */ "../../core/geometry/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js");
204170
- /* harmony import */ var _Query_CurveSplitContext__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Query/CurveSplitContext */ "../../core/geometry/lib/esm/curve/Query/CurveSplitContext.js");
204171
- /* harmony import */ var _Query_InOutTests__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Query/InOutTests */ "../../core/geometry/lib/esm/curve/Query/InOutTests.js");
204172
- /* harmony import */ var _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Query/PlanarSubdivision */ "../../core/geometry/lib/esm/curve/Query/PlanarSubdivision.js");
204274
+ /* harmony import */ var _GeometryQuery__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./GeometryQuery */ "../../core/geometry/lib/esm/curve/GeometryQuery.js");
204275
+ /* harmony import */ var _internalContexts_ChainCollectorContext__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./internalContexts/ChainCollectorContext */ "../../core/geometry/lib/esm/curve/internalContexts/ChainCollectorContext.js");
204276
+ /* harmony import */ var _internalContexts_PolygonOffsetContext__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./internalContexts/PolygonOffsetContext */ "../../core/geometry/lib/esm/curve/internalContexts/PolygonOffsetContext.js");
204277
+ /* harmony import */ var _internalContexts_TransferWithSplitArcs__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./internalContexts/TransferWithSplitArcs */ "../../core/geometry/lib/esm/curve/internalContexts/TransferWithSplitArcs.js");
204278
+ /* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
204279
+ /* harmony import */ var _Loop__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
204280
+ /* harmony import */ var _OffsetOptions__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./OffsetOptions */ "../../core/geometry/lib/esm/curve/OffsetOptions.js");
204281
+ /* harmony import */ var _ParityRegion__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ParityRegion */ "../../core/geometry/lib/esm/curve/ParityRegion.js");
204282
+ /* harmony import */ var _Path__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Path */ "../../core/geometry/lib/esm/curve/Path.js");
204283
+ /* harmony import */ var _Query_ConsolidateAdjacentPrimitivesContext__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./Query/ConsolidateAdjacentPrimitivesContext */ "../../core/geometry/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js");
204284
+ /* harmony import */ var _Query_CurveSplitContext__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./Query/CurveSplitContext */ "../../core/geometry/lib/esm/curve/Query/CurveSplitContext.js");
204285
+ /* harmony import */ var _Query_InOutTests__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./Query/InOutTests */ "../../core/geometry/lib/esm/curve/Query/InOutTests.js");
204286
+ /* harmony import */ var _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Query/PlanarSubdivision */ "../../core/geometry/lib/esm/curve/Query/PlanarSubdivision.js");
204173
204287
  /* harmony import */ var _RegionMomentsXY__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./RegionMomentsXY */ "../../core/geometry/lib/esm/curve/RegionMomentsXY.js");
204174
- /* harmony import */ var _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./RegionOpsClassificationSweeps */ "../../core/geometry/lib/esm/curve/RegionOpsClassificationSweeps.js");
204175
- /* harmony import */ var _UnionRegion__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./UnionRegion */ "../../core/geometry/lib/esm/curve/UnionRegion.js");
204288
+ /* harmony import */ var _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./RegionOpsClassificationSweeps */ "../../core/geometry/lib/esm/curve/RegionOpsClassificationSweeps.js");
204289
+ /* harmony import */ var _UnionRegion__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./UnionRegion */ "../../core/geometry/lib/esm/curve/UnionRegion.js");
204176
204290
  /*---------------------------------------------------------------------------------------------
204177
204291
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
204178
204292
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -204212,6 +204326,9 @@ __webpack_require__.r(__webpack_exports__);
204212
204326
 
204213
204327
 
204214
204328
 
204329
+
204330
+
204331
+
204215
204332
 
204216
204333
 
204217
204334
 
@@ -204242,13 +204359,16 @@ var RegionBinaryOpType;
204242
204359
  class RegionOps {
204243
204360
  /**
204244
204361
  * Return moment sums for a loop, parity region, or union region.
204362
+ * * The input region should lie in a plane parallel to the xy-plane, as z-coords will be ignored.
204245
204363
  * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with
204246
- * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`
204247
- * @param root any Loop, ParityRegion, or UnionRegion.
204364
+ * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes(rawMomentData.origin, rawMomentData.sums);`
204365
+ * * `rawMomentData.origin` is the centroid of `region`.
204366
+ * * `rawMomentData.sums.weight()` is the signed area of `region`.
204367
+ * @param region any [[Loop]], [[ParityRegion]], or [[UnionRegion]].
204248
204368
  */
204249
- static computeXYAreaMoments(root) {
204369
+ static computeXYAreaMoments(region) {
204250
204370
  const handler = new _RegionMomentsXY__WEBPACK_IMPORTED_MODULE_0__.RegionMomentsXY();
204251
- const result = root.dispatchToGeometryHandler(handler);
204371
+ const result = region.dispatchToGeometryHandler(handler);
204252
204372
  if (result instanceof _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_1__.MomentData) {
204253
204373
  result.shiftOriginAndSumsToCentroidOfSums();
204254
204374
  return result;
@@ -204257,8 +204377,8 @@ class RegionOps {
204257
204377
  }
204258
204378
  /**
204259
204379
  * Return an area tolerance for a given xy-range and optional distance tolerance.
204260
- * @param range range of planar region to tolerance
204261
- * @param distanceTolerance optional absolute distance tolerance
204380
+ * @param range range of planar region to tolerance.
204381
+ * @param distanceTolerance optional absolute distance tolerance.
204262
204382
  */
204263
204383
  static computeXYAreaTolerance(range, distanceTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance) {
204264
204384
  // if A = bh and e is distance tolerance, then A' := (b+e/2)(h+e/2) = A + e/2(b+h+e/2), so A'-A = e/2(b+h+e/2).
@@ -204267,12 +204387,13 @@ class RegionOps {
204267
204387
  }
204268
204388
  /**
204269
204389
  * Return a (signed) xy area for a region.
204390
+ * * The input region should lie in a plane parallel to the xy-plane, as z-coords will be ignored.
204270
204391
  * * The area is negative if and only if the region is oriented clockwise with respect to the positive z-axis.
204271
- * @param root any Loop, ParityRegion, or UnionRegion.
204392
+ * @param region any [[Loop]], [[ParityRegion]], or [[UnionRegion]].
204272
204393
  */
204273
- static computeXYArea(root) {
204394
+ static computeXYArea(region) {
204274
204395
  const handler = new _RegionMomentsXY__WEBPACK_IMPORTED_MODULE_0__.RegionMomentsXY();
204275
- const result = root.dispatchToGeometryHandler(handler);
204396
+ const result = region.dispatchToGeometryHandler(handler);
204276
204397
  if (result instanceof _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_1__.MomentData) {
204277
204398
  return result.quantitySum;
204278
204399
  }
@@ -204280,49 +204401,88 @@ class RegionOps {
204280
204401
  }
204281
204402
  /**
204282
204403
  * Return MomentData with the sums of wire moments.
204404
+ * * The input curve should lie in a plane parallel to the xy-plane, as z-coords will be ignored.
204283
204405
  * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with
204284
- * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`
204285
- * @param root any CurveCollection or CurvePrimitive.
204406
+ * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`
204407
+ * * `rawMomentData.origin` is the wire centroid of `curve`.
204408
+ * * `rawMomentData.sums.weight()` is the signed length of `curve`.
204409
+ * @param curve any [[CurveCollection]] or [[CurvePrimitive]].
204286
204410
  */
204287
- static computeXYZWireMomentSums(root) {
204411
+ static computeXYZWireMomentSums(curve) {
204288
204412
  const handler = new _CurveWireMomentsXYZ__WEBPACK_IMPORTED_MODULE_3__.CurveWireMomentsXYZ();
204289
- handler.visitLeaves(root);
204413
+ handler.visitLeaves(curve);
204290
204414
  const result = handler.momentData;
204291
204415
  result.shiftOriginAndSumsToCentroidOfSums();
204292
204416
  return result;
204293
204417
  }
204418
+ /**
204419
+ * Return a [[Ray3d]] with:
204420
+ * * `origin` is the centroid of the region,
204421
+ * * `direction` is a unit vector perpendicular to the region plane,
204422
+ * * `a` is the region area.
204423
+ * @param region the region to process. Can lie in any plane.
204424
+ * @param result optional pre-allocated result to populate and return.
204425
+ */
204426
+ static centroidAreaNormal(region, result) {
204427
+ const localToWorld = _geometry3d_FrameBuilder__WEBPACK_IMPORTED_MODULE_4__.FrameBuilder.createRightHandedFrame(undefined, region);
204428
+ if (!localToWorld)
204429
+ return undefined;
204430
+ const normal = localToWorld.matrix.columnZ(result?.direction);
204431
+ const regionIsXY = normal.isParallelTo(_geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Vector3d.unitZ(), true);
204432
+ let regionXY = region;
204433
+ if (!regionIsXY) { // rotate the region to be parallel to the xy-plane
204434
+ regionXY = region.cloneTransformed(localToWorld.inverse());
204435
+ if (!regionXY)
204436
+ return undefined;
204437
+ }
204438
+ const momentData = RegionOps.computeXYAreaMoments(regionXY);
204439
+ if (!momentData)
204440
+ return undefined;
204441
+ const centroid = momentData.origin.clone(result?.origin);
204442
+ if (!regionIsXY) // rotate centroid back (area is unchanged)
204443
+ localToWorld.multiplyPoint3d(centroid, centroid);
204444
+ let area = momentData.sums.weight();
204445
+ if (area < 0.0) {
204446
+ area = -area;
204447
+ normal.scale(-1.0, normal);
204448
+ }
204449
+ if (!result)
204450
+ result = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_6__.Ray3d.createCapture(centroid, normal);
204451
+ result.a = area;
204452
+ return result;
204453
+ }
204294
204454
  /**
204295
204455
  * Create loops in the graph.
204296
204456
  * @internal
204297
204457
  */
204298
204458
  static addLoopsToGraph(graph, data, announceIsolatedLoop) {
204299
- if (data instanceof _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop) {
204459
+ if (data instanceof _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop) {
204300
204460
  const points = data.getPackedStrokes();
204301
204461
  if (points)
204302
204462
  this.addLoopsToGraph(graph, points, announceIsolatedLoop);
204303
204463
  }
204304
- else if (data instanceof _ParityRegion__WEBPACK_IMPORTED_MODULE_5__.ParityRegion) {
204464
+ else if (data instanceof _ParityRegion__WEBPACK_IMPORTED_MODULE_8__.ParityRegion) {
204305
204465
  for (const child of data.children) {
204306
204466
  const points = child.getPackedStrokes();
204307
204467
  if (points)
204308
204468
  this.addLoopsToGraph(graph, points, announceIsolatedLoop);
204309
204469
  }
204310
204470
  }
204311
- else if (data instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__.IndexedXYZCollection) {
204312
- const loopSeed = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.directCreateFaceLoopFromCoordinates(graph, data);
204471
+ else if (data instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_9__.IndexedXYZCollection) {
204472
+ const loopSeed = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.directCreateFaceLoopFromCoordinates(graph, data);
204313
204473
  if (loopSeed !== undefined)
204314
204474
  announceIsolatedLoop(graph, loopSeed);
204315
204475
  }
204316
204476
  else if (Array.isArray(data)) {
204317
204477
  if (data.length > 0) {
204318
- if (_geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_8__.Point3d.isAnyImmediatePointType(data[0])) {
204319
- const loopSeed = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.directCreateFaceLoopFromCoordinates(graph, data);
204478
+ if (_geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d.isAnyImmediatePointType(data[0])) {
204479
+ const loopSeed = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.directCreateFaceLoopFromCoordinates(graph, data);
204320
204480
  if (loopSeed !== undefined)
204321
204481
  announceIsolatedLoop(graph, loopSeed);
204322
204482
  }
204323
- else if (data[0] instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__.IndexedXYZCollection) {
204483
+ else if (data[0] instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_9__.IndexedXYZCollection) {
204324
204484
  for (const loop of data) {
204325
- const loopSeed = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.directCreateFaceLoopFromCoordinates(graph, loop);
204485
+ const loopSeed = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.directCreateFaceLoopFromCoordinates(graph, loop);
204326
204486
  if (loopSeed !== undefined)
204327
204487
  announceIsolatedLoop(graph, loopSeed);
204328
204488
  }
@@ -204362,10 +204522,10 @@ class RegionOps {
204362
204522
  static finishGraphToPolyface(graph, triangulate) {
204363
204523
  if (graph) {
204364
204524
  if (triangulate) {
204365
- _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.triangulateAllPositiveAreaFaces(graph);
204366
- _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.flipTriangles(graph);
204525
+ _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.triangulateAllPositiveAreaFaces(graph);
204526
+ _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.flipTriangles(graph);
204367
204527
  }
204368
- return _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_9__.PolyfaceBuilder.graphToPolyface(graph);
204528
+ return _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_11__.PolyfaceBuilder.graphToPolyface(graph);
204369
204529
  }
204370
204530
  return undefined;
204371
204531
  }
@@ -204379,7 +204539,7 @@ class RegionOps {
204379
204539
  * @param triangulate whether to triangulate the result
204380
204540
  */
204381
204541
  static polygonXYAreaIntersectLoopsToPolyface(loopsA, loopsB, triangulate = false) {
204382
- const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB, (inA, inB) => (inA && inB), this._graphCheckPointFunction);
204542
+ const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB, (inA, inB) => (inA && inB), this._graphCheckPointFunction);
204383
204543
  return this.finishGraphToPolyface(graph, triangulate);
204384
204544
  }
204385
204545
  /**
@@ -204392,7 +204552,7 @@ class RegionOps {
204392
204552
  * @param triangulate whether to triangulate the result
204393
204553
  */
204394
204554
  static polygonXYAreaUnionLoopsToPolyface(loopsA, loopsB, triangulate = false) {
204395
- const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB, (inA, inB) => (inA || inB), this._graphCheckPointFunction);
204555
+ const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB, (inA, inB) => (inA || inB), this._graphCheckPointFunction);
204396
204556
  return this.finishGraphToPolyface(graph, triangulate);
204397
204557
  }
204398
204558
  /**
@@ -204405,7 +204565,7 @@ class RegionOps {
204405
204565
  * @param triangulate whether to triangulate the result
204406
204566
  */
204407
204567
  static polygonXYAreaDifferenceLoopsToPolyface(loopsA, loopsB, triangulate = false) {
204408
- const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB, (inA, inB) => (inA && !inB), this._graphCheckPointFunction);
204568
+ const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB, (inA, inB) => (inA && !inB), this._graphCheckPointFunction);
204409
204569
  return this.finishGraphToPolyface(graph, triangulate);
204410
204570
  }
204411
204571
  /**
@@ -204420,10 +204580,10 @@ class RegionOps {
204420
204580
  * to connect interior loops to exterior loops.
204421
204581
  */
204422
204582
  static regionBooleanXY(loopsA, loopsB, operation, mergeTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance) {
204423
- // Always return UnionRegion for now. But keep return type as AnyRegion:
204424
- // in the future, we might return the *simplest* region type.
204425
- const result = _UnionRegion__WEBPACK_IMPORTED_MODULE_11__.UnionRegion.create();
204426
- const context = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionBooleanContext.create(_RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionGroupOpType.Union, _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionGroupOpType.Union);
204583
+ // Always return UnionRegion for now, but keep return type as AnyRegion.
204584
+ // In the future, we might return the *simplest* region type.
204585
+ const result = _UnionRegion__WEBPACK_IMPORTED_MODULE_13__.UnionRegion.create();
204586
+ const context = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionBooleanContext.create(_RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionGroupOpType.Union, _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionGroupOpType.Union);
204427
204587
  context.addMembers(loopsA, loopsB);
204428
204588
  context.annotateAndMergeCurvesInGraph(mergeTolerance);
204429
204589
  const range = context.groupA.range().union(context.groupB.range());
@@ -204435,7 +204595,7 @@ class RegionOps {
204435
204595
  if (Math.abs(area) < areaTol)
204436
204596
  return;
204437
204597
  if (faceType === 1) {
204438
- const loop = _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_12__.PlanarSubdivision.createLoopInFace(face);
204598
+ const loop = _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_14__.PlanarSubdivision.createLoopInFace(face);
204439
204599
  if (loop)
204440
204600
  result.tryAddChild(loop);
204441
204601
  }
@@ -204455,7 +204615,7 @@ class RegionOps {
204455
204615
  * @param triangulate whether to triangulate the result
204456
204616
  */
204457
204617
  static polygonBooleanXYToPolyface(inputA, operation, inputB, triangulate = false) {
204458
- const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionOpsFaceToFaceSearch.doBinaryBooleanBetweenMultiLoopInputs(inputA, _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionGroupOpType.Union, operation, inputB, _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionGroupOpType.Union, true);
204618
+ const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionOpsFaceToFaceSearch.doBinaryBooleanBetweenMultiLoopInputs(inputA, _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionGroupOpType.Union, operation, inputB, _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionGroupOpType.Union, true);
204459
204619
  return this.finishGraphToPolyface(graph, triangulate);
204460
204620
  }
204461
204621
  /**
@@ -204470,18 +204630,18 @@ class RegionOps {
204470
204630
  * @param inputB second set of loops
204471
204631
  */
204472
204632
  static polygonBooleanXYToLoops(inputA, operation, inputB) {
204473
- const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionOpsFaceToFaceSearch.doBinaryBooleanBetweenMultiLoopInputs(inputA, _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionGroupOpType.Union, operation, inputB, _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionGroupOpType.Union, true);
204633
+ const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionOpsFaceToFaceSearch.doBinaryBooleanBetweenMultiLoopInputs(inputA, _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionGroupOpType.Union, operation, inputB, _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionGroupOpType.Union, true);
204474
204634
  if (!graph)
204475
204635
  return undefined;
204476
- const loopEdges = _topology_HalfEdgeGraphSearch__WEBPACK_IMPORTED_MODULE_13__.HalfEdgeGraphSearch.collectExtendedBoundaryLoopsInGraph(graph, _topology_Graph__WEBPACK_IMPORTED_MODULE_14__.HalfEdgeMask.EXTERIOR);
204636
+ const loopEdges = _topology_HalfEdgeGraphSearch__WEBPACK_IMPORTED_MODULE_15__.HalfEdgeGraphSearch.collectExtendedBoundaryLoopsInGraph(graph, _topology_Graph__WEBPACK_IMPORTED_MODULE_16__.HalfEdgeMask.EXTERIOR);
204477
204637
  const allLoops = [];
204478
204638
  for (const graphLoop of loopEdges) {
204479
- const points = new _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__.GrowableXYZArray();
204639
+ const points = new _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_17__.GrowableXYZArray();
204480
204640
  for (const edge of graphLoop)
204481
204641
  points.pushXYZ(edge.x, edge.y, edge.z);
204482
204642
  points.pushWrap(1);
204483
- const loop = _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop.create();
204484
- loop.tryAddChild(_LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d.createCapture(points));
204643
+ const loop = _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop.create();
204644
+ loop.tryAddChild(_LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d.createCapture(points));
204485
204645
  allLoops.push(loop);
204486
204646
  }
204487
204647
  return RegionOps.sortOuterAndHoleLoopsXY(allLoops);
@@ -204499,7 +204659,7 @@ class RegionOps {
204499
204659
  * object.
204500
204660
  */
204501
204661
  static constructPolygonWireXYOffset(points, wrap, offsetDistanceOrOptions) {
204502
- const context = new _internalContexts_PolygonOffsetContext__WEBPACK_IMPORTED_MODULE_17__.PolygonWireOffsetContext();
204662
+ const context = new _internalContexts_PolygonOffsetContext__WEBPACK_IMPORTED_MODULE_19__.PolygonWireOffsetContext();
204503
204663
  return context.constructPolygonWireXYOffset(points, wrap, offsetDistanceOrOptions);
204504
204664
  }
204505
204665
  /**
@@ -204511,8 +204671,8 @@ class RegionOps {
204511
204671
  * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.
204512
204672
  */
204513
204673
  static constructCurveXYOffset(curves, offsetDistanceOrOptions) {
204514
- const offsetOptions = _OffsetOptions__WEBPACK_IMPORTED_MODULE_18__.OffsetOptions.create(offsetDistanceOrOptions);
204515
- return _CurveOps__WEBPACK_IMPORTED_MODULE_19__.CurveOps.constructCurveXYOffset(curves, offsetOptions);
204674
+ const offsetOptions = _OffsetOptions__WEBPACK_IMPORTED_MODULE_20__.OffsetOptions.create(offsetDistanceOrOptions);
204675
+ return _CurveOps__WEBPACK_IMPORTED_MODULE_21__.CurveOps.constructCurveXYOffset(curves, offsetOptions);
204516
204676
  }
204517
204677
  /**
204518
204678
  * Test if point (x,y) is IN, OUT or ON a region.
@@ -204522,7 +204682,7 @@ class RegionOps {
204522
204682
  * @param y y coordinate of point to test
204523
204683
  */
204524
204684
  static testPointInOnOutRegionXY(curves, x, y) {
204525
- return _Query_InOutTests__WEBPACK_IMPORTED_MODULE_20__.PointInOnOutContext.testPointInOnOutRegionXY(curves, x, y);
204685
+ return _Query_InOutTests__WEBPACK_IMPORTED_MODULE_22__.PointInOnOutContext.testPointInOnOutRegionXY(curves, x, y);
204526
204686
  }
204527
204687
  /**
204528
204688
  * Create curve collection of subtype determined by gaps between the input curves.
@@ -204546,11 +204706,11 @@ class RegionOps {
204546
204706
  maxGap = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.maxXY(maxGap, curves[i].endPoint().distance(curves[i + 1].startPoint()));
204547
204707
  let collection;
204548
204708
  if (_Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isSmallMetricDistance(maxGap)) {
204549
- collection = wrap ? _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop.create() : _Path__WEBPACK_IMPORTED_MODULE_21__.Path.create();
204709
+ collection = wrap ? _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop.create() : _Path__WEBPACK_IMPORTED_MODULE_23__.Path.create();
204550
204710
  isPath = true;
204551
204711
  }
204552
204712
  else {
204553
- collection = _CurveCollection__WEBPACK_IMPORTED_MODULE_22__.BagOfCurves.create();
204713
+ collection = _CurveCollection__WEBPACK_IMPORTED_MODULE_24__.BagOfCurves.create();
204554
204714
  }
204555
204715
  for (const c of curves)
204556
204716
  collection.tryAddChild(c);
@@ -204576,7 +204736,7 @@ class RegionOps {
204576
204736
  * @param cutterCurves input curves to intersect with `curvesToCut`
204577
204737
  */
204578
204738
  static cloneCurvesWithXYSplits(curvesToCut, cutterCurves) {
204579
- return _Query_CurveSplitContext__WEBPACK_IMPORTED_MODULE_23__.CurveSplitContext.cloneCurvesWithXYSplits(curvesToCut, cutterCurves);
204739
+ return _Query_CurveSplitContext__WEBPACK_IMPORTED_MODULE_25__.CurveSplitContext.cloneCurvesWithXYSplits(curvesToCut, cutterCurves);
204580
204740
  }
204581
204741
  /**
204582
204742
  * Create paths assembled from many curves.
@@ -204587,11 +204747,11 @@ class RegionOps {
204587
204747
  static splitToPathsBetweenBreaks(source, makeClones) {
204588
204748
  if (source === undefined)
204589
204749
  return undefined;
204590
- if (source instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_24__.CurvePrimitive)
204750
+ if (source instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_26__.CurvePrimitive)
204591
204751
  return source;
204592
204752
  // source is a collection . ..
204593
204753
  const primitives = source.collectCurvePrimitives();
204594
- const chainCollector = new _internalContexts_ChainCollectorContext__WEBPACK_IMPORTED_MODULE_25__.ChainCollectorContext(makeClones);
204754
+ const chainCollector = new _internalContexts_ChainCollectorContext__WEBPACK_IMPORTED_MODULE_27__.ChainCollectorContext(makeClones);
204595
204755
  for (const primitive of primitives) {
204596
204756
  chainCollector.announceCurvePrimitive(primitive);
204597
204757
  }
@@ -204607,7 +204767,7 @@ class RegionOps {
204607
204767
  * @returns object with named chains, insideOffsets, outsideOffsets
204608
204768
  */
204609
204769
  static collectInsideAndOutsideOffsets(fragments, offsetDistance, gapTolerance) {
204610
- return _CurveOps__WEBPACK_IMPORTED_MODULE_19__.CurveOps.collectInsideAndOutsideXYOffsets(fragments, offsetDistance, gapTolerance);
204770
+ return _CurveOps__WEBPACK_IMPORTED_MODULE_21__.CurveOps.collectInsideAndOutsideXYOffsets(fragments, offsetDistance, gapTolerance);
204611
204771
  }
204612
204772
  /**
204613
204773
  * Restructure curve fragments as Paths and Loops.
@@ -204616,7 +204776,7 @@ class RegionOps {
204616
204776
  * @returns chains, possibly wrapped in a [[BagOfCurves]].
204617
204777
  */
204618
204778
  static collectChains(fragments, gapTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance) {
204619
- return _CurveOps__WEBPACK_IMPORTED_MODULE_19__.CurveOps.collectChains(fragments, gapTolerance);
204779
+ return _CurveOps__WEBPACK_IMPORTED_MODULE_21__.CurveOps.collectChains(fragments, gapTolerance);
204620
204780
  }
204621
204781
  /**
204622
204782
  * Find all intersections among curves in `curvesToCut` against the boundaries of `region` and return fragments
@@ -204628,17 +204788,17 @@ class RegionOps {
204628
204788
  const result = { insideParts: [], outsideParts: [], coincidentParts: [] };
204629
204789
  const pathWithIntersectionMarkup = RegionOps.cloneCurvesWithXYSplits(curvesToCut, region);
204630
204790
  const splitPaths = RegionOps.splitToPathsBetweenBreaks(pathWithIntersectionMarkup, true);
204631
- if (splitPaths instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_22__.CurveCollection) {
204791
+ if (splitPaths instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_24__.CurveCollection) {
204632
204792
  for (const child of splitPaths.children) {
204633
- const pointOnChild = _CurveCollection__WEBPACK_IMPORTED_MODULE_22__.CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(child);
204793
+ const pointOnChild = _CurveCollection__WEBPACK_IMPORTED_MODULE_24__.CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(child);
204634
204794
  if (pointOnChild) {
204635
204795
  const inOnOut = RegionOps.testPointInOnOutRegionXY(region, pointOnChild.point.x, pointOnChild.point.y);
204636
204796
  pushToInOnOutArrays(child, inOnOut, result.outsideParts, result.coincidentParts, result.insideParts);
204637
204797
  }
204638
204798
  }
204639
204799
  }
204640
- else if (splitPaths instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_24__.CurvePrimitive) {
204641
- const pointOnChild = _CurveCollection__WEBPACK_IMPORTED_MODULE_22__.CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(splitPaths);
204800
+ else if (splitPaths instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_26__.CurvePrimitive) {
204801
+ const pointOnChild = _CurveCollection__WEBPACK_IMPORTED_MODULE_24__.CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(splitPaths);
204642
204802
  if (pointOnChild) {
204643
204803
  const inOnOut = RegionOps.testPointInOnOutRegionXY(region, pointOnChild.point.x, pointOnChild.point.y);
204644
204804
  pushToInOnOutArrays(splitPaths, inOnOut, result.outsideParts, result.coincidentParts, result.insideParts);
@@ -204662,10 +204822,10 @@ class RegionOps {
204662
204822
  * normal in z column. If not a rectangle, return undefined.
204663
204823
  */
204664
204824
  static rectangleEdgeTransform(data, requireClosurePoint = true) {
204665
- if (data instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d) {
204825
+ if (data instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d) {
204666
204826
  return this.rectangleEdgeTransform(data.packedPoints);
204667
204827
  }
204668
- else if (data instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__.IndexedXYZCollection) {
204828
+ else if (data instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_9__.IndexedXYZCollection) {
204669
204829
  let dataToUse;
204670
204830
  if (requireClosurePoint && data.length === 5) {
204671
204831
  if (!_Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isSmallMetricDistance(data.distanceIndexIndex(0, 4)))
@@ -204679,8 +204839,8 @@ class RegionOps {
204679
204839
  return undefined;
204680
204840
  }
204681
204841
  else {
204682
- dataToUse = _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__.GrowableXYZArray.create(data);
204683
- _geometry3d_PolylineCompressionByEdgeOffset__WEBPACK_IMPORTED_MODULE_26__.PolylineCompressionContext.compressInPlaceByShortEdgeLength(dataToUse, _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance);
204842
+ dataToUse = _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_17__.GrowableXYZArray.create(data);
204843
+ _geometry3d_PolylineCompressionByEdgeOffset__WEBPACK_IMPORTED_MODULE_28__.PolylineCompressionContext.compressInPlaceByShortEdgeLength(dataToUse, _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance);
204684
204844
  if (dataToUse.length < (requireClosurePoint ? 5 : 4))
204685
204845
  return undefined;
204686
204846
  }
@@ -204691,19 +204851,19 @@ class RegionOps {
204691
204851
  if (normalVector.normalizeInPlace()
204692
204852
  && vector12.isAlmostEqual(vector03)
204693
204853
  && vector01.isPerpendicularTo(vector03)) {
204694
- return _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_27__.Transform.createOriginAndMatrixColumns(dataToUse.getPoint3dAtUncheckedPointIndex(0), vector01, vector03, normalVector);
204854
+ return _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_29__.Transform.createOriginAndMatrixColumns(dataToUse.getPoint3dAtUncheckedPointIndex(0), vector01, vector03, normalVector);
204695
204855
  }
204696
204856
  }
204697
204857
  else if (Array.isArray(data)) {
204698
- return this.rectangleEdgeTransform(new _geometry3d_Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_28__.Point3dArrayCarrier(data), requireClosurePoint);
204858
+ return this.rectangleEdgeTransform(new _geometry3d_Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_30__.Point3dArrayCarrier(data), requireClosurePoint);
204699
204859
  }
204700
- else if (data instanceof _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop && data.children.length === 1 && data.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d) {
204860
+ else if (data instanceof _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop && data.children.length === 1 && data.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d) {
204701
204861
  return this.rectangleEdgeTransform(data.children[0].packedPoints, true);
204702
204862
  }
204703
- else if (data instanceof _Path__WEBPACK_IMPORTED_MODULE_21__.Path && data.children.length === 1 && data.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d) {
204863
+ else if (data instanceof _Path__WEBPACK_IMPORTED_MODULE_23__.Path && data.children.length === 1 && data.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d) {
204704
204864
  return this.rectangleEdgeTransform(data.children[0].packedPoints, requireClosurePoint);
204705
204865
  }
204706
- else if (data instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_22__.CurveChain) {
204866
+ else if (data instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_24__.CurveChain) {
204707
204867
  if (!data.checkForNonLinearPrimitives()) {
204708
204868
  // const linestring = LineString3d.create();
204709
204869
  const strokes = data.getPackedStrokes();
@@ -204727,7 +204887,7 @@ class RegionOps {
204727
204887
  * @param options options for tolerance and selective simplification.
204728
204888
  */
204729
204889
  static consolidateAdjacentPrimitives(curves, options) {
204730
- const context = new _Query_ConsolidateAdjacentPrimitivesContext__WEBPACK_IMPORTED_MODULE_29__.ConsolidateAdjacentCurvePrimitivesContext(options);
204890
+ const context = new _Query_ConsolidateAdjacentPrimitivesContext__WEBPACK_IMPORTED_MODULE_31__.ConsolidateAdjacentCurvePrimitivesContext(options);
204731
204891
  curves.dispatchToGeometryHandler(context);
204732
204892
  }
204733
204893
  /**
@@ -204745,14 +204905,14 @@ class RegionOps {
204745
204905
  static sortOuterAndHoleLoopsXY(loops) {
204746
204906
  const loopAndArea = [];
204747
204907
  for (const candidate of loops) {
204748
- if (candidate instanceof _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop)
204749
- _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_30__.SortablePolygon.pushLoop(loopAndArea, candidate);
204750
- else if (candidate instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__.IndexedXYZCollection) {
204751
- const loop = _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop.createPolygon(candidate);
204752
- _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_30__.SortablePolygon.pushLoop(loopAndArea, loop);
204908
+ if (candidate instanceof _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop)
204909
+ _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_32__.SortablePolygon.pushLoop(loopAndArea, candidate);
204910
+ else if (candidate instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_9__.IndexedXYZCollection) {
204911
+ const loop = _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop.createPolygon(candidate);
204912
+ _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_32__.SortablePolygon.pushLoop(loopAndArea, loop);
204753
204913
  }
204754
204914
  }
204755
- return _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_30__.SortablePolygon.sortAsAnyRegion(loopAndArea);
204915
+ return _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_32__.SortablePolygon.sortAsAnyRegion(loopAndArea);
204756
204916
  }
204757
204917
  /**
204758
204918
  * Find all xy-areas bounded by the unstructured, possibly intersecting curves.
@@ -204765,7 +204925,7 @@ class RegionOps {
204765
204925
  * SignedLoops object.
204766
204926
  * @param curvesAndRegions Any collection of curves. Each Loop/ParityRegion/UnionRegion contributes its curve
204767
204927
  * primitives.
204768
- * @param tolerance optional distance tolerance for coincidence
204928
+ * @param tolerance optional distance tolerance for coincidence.
204769
204929
  * @returns array of [[SignedLoops]], each entry of which describes the faces in a single connected component:
204770
204930
  * * `positiveAreaLoops` contains "interior" loops, _including holes in ParityRegion input_. These loops have
204771
204931
  * positive area and counterclockwise orientation.
@@ -204775,12 +204935,13 @@ class RegionOps {
204775
204935
  * to the edge and a constituent curve in each.
204776
204936
  */
204777
204937
  static constructAllXYRegionLoops(curvesAndRegions, tolerance = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance) {
204778
- const primitives = RegionOps.collectCurvePrimitives(curvesAndRegions, undefined, true, true);
204938
+ let primitives = RegionOps.collectCurvePrimitives(curvesAndRegions, undefined, true, true);
204939
+ primitives = _internalContexts_TransferWithSplitArcs__WEBPACK_IMPORTED_MODULE_33__.TransferWithSplitArcs.clone(_CurveCollection__WEBPACK_IMPORTED_MODULE_24__.BagOfCurves.create(...primitives)).children;
204779
204940
  const range = this.curveArrayRange(primitives);
204780
204941
  const areaTol = this.computeXYAreaTolerance(range, tolerance);
204781
- const intersections = _CurveCurve__WEBPACK_IMPORTED_MODULE_31__.CurveCurve.allIntersectionsAmongPrimitivesXY(primitives, tolerance);
204782
- const graph = _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_12__.PlanarSubdivision.assembleHalfEdgeGraph(primitives, intersections, tolerance);
204783
- return _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_12__.PlanarSubdivision.collectSignedLoopSetsInHalfEdgeGraph(graph, areaTol);
204942
+ const intersections = _CurveCurve__WEBPACK_IMPORTED_MODULE_34__.CurveCurve.allIntersectionsAmongPrimitivesXY(primitives, tolerance);
204943
+ const graph = _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_14__.PlanarSubdivision.assembleHalfEdgeGraph(primitives, intersections, tolerance);
204944
+ return _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_14__.PlanarSubdivision.collectSignedLoopSetsInHalfEdgeGraph(graph, areaTol);
204784
204945
  }
204785
204946
  /**
204786
204947
  * Collect all `CurvePrimitives` in loosely typed input.
@@ -204795,10 +204956,10 @@ class RegionOps {
204795
204956
  */
204796
204957
  static collectCurvePrimitives(candidates, collectorArray, smallestPossiblePrimitives = false, explodeLinestrings = false) {
204797
204958
  const results = collectorArray === undefined ? [] : collectorArray;
204798
- if (candidates instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_24__.CurvePrimitive) {
204959
+ if (candidates instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_26__.CurvePrimitive) {
204799
204960
  candidates.collectCurvePrimitives(results, smallestPossiblePrimitives, explodeLinestrings);
204800
204961
  }
204801
- else if (candidates instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_22__.CurveCollection) {
204962
+ else if (candidates instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_24__.CurveCollection) {
204802
204963
  candidates.collectCurvePrimitives(results, smallestPossiblePrimitives, explodeLinestrings);
204803
204964
  }
204804
204965
  else if (Array.isArray(candidates)) {
@@ -204817,7 +204978,7 @@ class RegionOps {
204817
204978
  static expandLineStrings(candidates) {
204818
204979
  const result = [];
204819
204980
  for (const c of candidates) {
204820
- if (c instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d) {
204981
+ if (c instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d) {
204821
204982
  for (let i = 0; i + 1 < c.packedPoints.length; i++) {
204822
204983
  const q = c.getIndexedSegment(i);
204823
204984
  if (q !== undefined)
@@ -204836,16 +204997,16 @@ class RegionOps {
204836
204997
  * @param worldToLocal transform to apply to data before computing its range
204837
204998
  */
204838
204999
  static curveArrayRange(data, worldToLocal) {
204839
- const range = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_32__.Range3d.create();
204840
- if (data instanceof _GeometryQuery__WEBPACK_IMPORTED_MODULE_33__.GeometryQuery)
205000
+ const range = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_35__.Range3d.create();
205001
+ if (data instanceof _GeometryQuery__WEBPACK_IMPORTED_MODULE_36__.GeometryQuery)
204841
205002
  data.extendRange(range, worldToLocal);
204842
205003
  else if (Array.isArray(data)) {
204843
205004
  for (const c of data) {
204844
- if (c instanceof _GeometryQuery__WEBPACK_IMPORTED_MODULE_33__.GeometryQuery)
205005
+ if (c instanceof _GeometryQuery__WEBPACK_IMPORTED_MODULE_36__.GeometryQuery)
204845
205006
  c.extendRange(range, worldToLocal);
204846
- else if (c instanceof _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_8__.Point3d)
205007
+ else if (c instanceof _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d)
204847
205008
  range.extendPoint(c, worldToLocal);
204848
- else if (c instanceof _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__.GrowableXYZArray)
205009
+ else if (c instanceof _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_17__.GrowableXYZArray)
204849
205010
  range.extendRange(c.getRange(worldToLocal));
204850
205011
  else if (Array.isArray(c))
204851
205012
  range.extendRange(this.curveArrayRange(c, worldToLocal));
@@ -204864,37 +205025,37 @@ class RegionOps {
204864
205025
  if (polygons.length === 0)
204865
205026
  return undefined;
204866
205027
  const firstEntry = polygons[0];
204867
- if (_geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_8__.Point3d.isAnyImmediatePointType(firstEntry)) {
204868
- graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.createTriangulatedGraphFromSingleLoop(polygons);
205028
+ if (_geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d.isAnyImmediatePointType(firstEntry)) {
205029
+ graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.createTriangulatedGraphFromSingleLoop(polygons);
204869
205030
  }
204870
205031
  else if (polygons.length > 1) {
204871
205032
  let writablePolygons;
204872
- if (firstEntry instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__.IndexedReadWriteXYZCollection) {
205033
+ if (firstEntry instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_9__.IndexedReadWriteXYZCollection) {
204873
205034
  writablePolygons = polygons;
204874
205035
  }
204875
205036
  else {
204876
205037
  writablePolygons = [];
204877
205038
  for (const polygon of polygons)
204878
- writablePolygons.push(_geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__.GrowableXYZArray.create(polygon));
205039
+ writablePolygons.push(_geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_17__.GrowableXYZArray.create(polygon));
204879
205040
  }
204880
- const sortedPolygons = _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_34__.PolygonOps.sortOuterAndHoleLoopsXY(writablePolygons);
205041
+ const sortedPolygons = _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_37__.PolygonOps.sortOuterAndHoleLoopsXY(writablePolygons);
204881
205042
  if (sortedPolygons.length === 1) { // below requires exactly one outer loop!
204882
- if (graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.createTriangulatedGraphFromLoops(sortedPolygons[0]))
204883
- _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.flipTriangles(graph);
205043
+ if (graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.createTriangulatedGraphFromLoops(sortedPolygons[0]))
205044
+ _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.flipTriangles(graph);
204884
205045
  }
204885
205046
  }
204886
205047
  else {
204887
- graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.createTriangulatedGraphFromSingleLoop(firstEntry);
205048
+ graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.createTriangulatedGraphFromSingleLoop(firstEntry);
204888
205049
  }
204889
205050
  }
204890
205051
  else {
204891
- graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.createTriangulatedGraphFromSingleLoop(polygons);
205052
+ graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.createTriangulatedGraphFromSingleLoop(polygons);
204892
205053
  }
204893
205054
  if (!graph) {
204894
205055
  // Last resort: try full merge. Conveniently, multiple polygons are processed with parity logic.
204895
- if (graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionOpsFaceToFaceSearch.doPolygonBoolean(polygons, [], (inA, _inB) => inA)) {
204896
- if (_topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.triangulateAllPositiveAreaFaces(graph))
204897
- _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.flipTriangles(graph);
205056
+ if (graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionOpsFaceToFaceSearch.doPolygonBoolean(polygons, [], (inA, _inB) => inA)) {
205057
+ if (_topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.triangulateAllPositiveAreaFaces(graph))
205058
+ _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.flipTriangles(graph);
204898
205059
  }
204899
205060
  }
204900
205061
  return graph;
@@ -204904,13 +205065,13 @@ class RegionOps {
204904
205065
  const strokedComponent = component.cloneStroked(options);
204905
205066
  // package the stroked region as polygons
204906
205067
  const polygons = [];
204907
- if (strokedComponent instanceof _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop) {
204908
- if (strokedComponent.children.length > 0 && strokedComponent.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d)
205068
+ if (strokedComponent instanceof _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop) {
205069
+ if (strokedComponent.children.length > 0 && strokedComponent.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d)
204909
205070
  polygons.push(strokedComponent.children[0].packedPoints); // expect only 1
204910
205071
  }
204911
- else if (strokedComponent instanceof _ParityRegion__WEBPACK_IMPORTED_MODULE_5__.ParityRegion) {
205072
+ else if (strokedComponent instanceof _ParityRegion__WEBPACK_IMPORTED_MODULE_8__.ParityRegion) {
204912
205073
  for (const strokedLoop of strokedComponent.children) {
204913
- if (strokedLoop.children.length > 0 && strokedLoop.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d)
205074
+ if (strokedLoop.children.length > 0 && strokedLoop.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d)
204914
205075
  polygons.push(strokedLoop.children[0].packedPoints); // expect only 1
204915
205076
  }
204916
205077
  }
@@ -204940,7 +205101,7 @@ class RegionOps {
204940
205101
  */
204941
205102
  static facetRegionXY(region, options) {
204942
205103
  let graph;
204943
- if (region instanceof _UnionRegion__WEBPACK_IMPORTED_MODULE_11__.UnionRegion) {
205104
+ if (region instanceof _UnionRegion__WEBPACK_IMPORTED_MODULE_13__.UnionRegion) {
204944
205105
  for (const child of region.children) {
204945
205106
  const childGraph = RegionOps.triangulateRegionComponent(child, options);
204946
205107
  if (childGraph) {
@@ -204962,8 +205123,8 @@ class RegionOps {
204962
205123
  if (!graph)
204963
205124
  return undefined;
204964
205125
  if (options?.maximizeConvexFacets)
204965
- _topology_Merging__WEBPACK_IMPORTED_MODULE_35__.HalfEdgeGraphOps.expandConvexFaces(graph);
204966
- return _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_9__.PolyfaceBuilder.graphToPolyface(graph, options);
205126
+ _topology_Merging__WEBPACK_IMPORTED_MODULE_38__.HalfEdgeGraphOps.expandConvexFaces(graph);
205127
+ return _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_11__.PolyfaceBuilder.graphToPolyface(graph, options);
204967
205128
  }
204968
205129
  /**
204969
205130
  * Decompose a polygon with optional holes into an array of convex polygons.
@@ -204976,11 +205137,11 @@ class RegionOps {
204976
205137
  if (!graph)
204977
205138
  return undefined;
204978
205139
  if (maximize)
204979
- _topology_Merging__WEBPACK_IMPORTED_MODULE_35__.HalfEdgeGraphOps.expandConvexFaces(graph);
205140
+ _topology_Merging__WEBPACK_IMPORTED_MODULE_38__.HalfEdgeGraphOps.expandConvexFaces(graph);
204980
205141
  const convexPolygons = [];
204981
205142
  graph.announceFaceLoops((_graph, seed) => {
204982
- if (!seed.isMaskSet(_topology_Graph__WEBPACK_IMPORTED_MODULE_14__.HalfEdgeMask.EXTERIOR))
204983
- convexPolygons.push(_geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__.GrowableXYZArray.create(seed.collectAroundFace((node) => { return node.getPoint3d(); })));
205143
+ if (!seed.isMaskSet(_topology_Graph__WEBPACK_IMPORTED_MODULE_16__.HalfEdgeMask.EXTERIOR))
205144
+ convexPolygons.push(_geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_17__.GrowableXYZArray.create(seed.collectAroundFace((node) => { return node.getPoint3d(); })));
204984
205145
  return true;
204985
205146
  });
204986
205147
  return convexPolygons;
@@ -205030,24 +205191,25 @@ __webpack_require__.r(__webpack_exports__);
205030
205191
  /* harmony export */ RegionOpsFaceToFaceSearch: () => (/* binding */ RegionOpsFaceToFaceSearch)
205031
205192
  /* harmony export */ });
205032
205193
  /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
205033
- /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
205194
+ /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
205034
205195
  /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
205035
- /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
205196
+ /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
205036
205197
  /* harmony import */ var _topology_Graph__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../topology/Graph */ "../../core/geometry/lib/esm/topology/Graph.js");
205037
205198
  /* harmony import */ var _topology_HalfEdgeGraphSearch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../topology/HalfEdgeGraphSearch */ "../../core/geometry/lib/esm/topology/HalfEdgeGraphSearch.js");
205038
205199
  /* harmony import */ var _topology_Merging__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../topology/Merging */ "../../core/geometry/lib/esm/topology/Merging.js");
205039
205200
  /* harmony import */ var _topology_RegularizeFace__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../topology/RegularizeFace */ "../../core/geometry/lib/esm/topology/RegularizeFace.js");
205040
- /* harmony import */ var _Arc3d__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Arc3d */ "../../core/geometry/lib/esm/curve/Arc3d.js");
205041
- /* harmony import */ var _CurveCurve__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./CurveCurve */ "../../core/geometry/lib/esm/curve/CurveCurve.js");
205042
- /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
205201
+ /* harmony import */ var _Arc3d__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./Arc3d */ "../../core/geometry/lib/esm/curve/Arc3d.js");
205202
+ /* harmony import */ var _CurveCurve__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./CurveCurve */ "../../core/geometry/lib/esm/curve/CurveCurve.js");
205203
+ /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
205043
205204
  /* harmony import */ var _GeometryQuery__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./GeometryQuery */ "../../core/geometry/lib/esm/curve/GeometryQuery.js");
205044
- /* harmony import */ var _internalContexts_PlaneAltitudeRangeContext__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./internalContexts/PlaneAltitudeRangeContext */ "../../core/geometry/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js");
205045
- /* harmony import */ var _LineSegment3d__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./LineSegment3d */ "../../core/geometry/lib/esm/curve/LineSegment3d.js");
205205
+ /* harmony import */ var _internalContexts_PlaneAltitudeRangeContext__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./internalContexts/PlaneAltitudeRangeContext */ "../../core/geometry/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js");
205206
+ /* harmony import */ var _internalContexts_TransferWithSplitArcs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./internalContexts/TransferWithSplitArcs */ "../../core/geometry/lib/esm/curve/internalContexts/TransferWithSplitArcs.js");
205207
+ /* harmony import */ var _LineSegment3d__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./LineSegment3d */ "../../core/geometry/lib/esm/curve/LineSegment3d.js");
205046
205208
  /* harmony import */ var _Loop__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
205047
205209
  /* harmony import */ var _ParityRegion__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ParityRegion */ "../../core/geometry/lib/esm/curve/ParityRegion.js");
205048
- /* harmony import */ var _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Query/PlanarSubdivision */ "../../core/geometry/lib/esm/curve/Query/PlanarSubdivision.js");
205210
+ /* harmony import */ var _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./Query/PlanarSubdivision */ "../../core/geometry/lib/esm/curve/Query/PlanarSubdivision.js");
205049
205211
  /* harmony import */ var _RegionOps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RegionOps */ "../../core/geometry/lib/esm/curve/RegionOps.js");
205050
- /* harmony import */ var _UnionRegion__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./UnionRegion */ "../../core/geometry/lib/esm/curve/UnionRegion.js");
205212
+ /* harmony import */ var _UnionRegion__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./UnionRegion */ "../../core/geometry/lib/esm/curve/UnionRegion.js");
205051
205213
  /*---------------------------------------------------------------------------------------------
205052
205214
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
205053
205215
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -205074,6 +205236,7 @@ __webpack_require__.r(__webpack_exports__);
205074
205236
 
205075
205237
 
205076
205238
 
205239
+
205077
205240
  /**
205078
205241
  * base class for callbacks during region sweeps.
205079
205242
  * * At start of a component, `startComponent(node)` is called announcing a representative node on the outermost face.
@@ -205390,8 +205553,7 @@ class RegionGroup {
205390
205553
  }
205391
205554
  return range;
205392
205555
  }
205393
- /** Ask if the current _numIn count qualifies as an "in" for this operation type.
205394
- */
205556
+ /** Ask if the current _numIn count qualifies as an "in" for this operation type. */
205395
205557
  getInOut() {
205396
205558
  // UNION is true if one or more members are IN
205397
205559
  if (this.groupOpType === RegionGroupOpType.Union)
@@ -205407,11 +205569,12 @@ class RegionGroup {
205407
205569
  // push new members into the group.
205408
205570
  addMember(data, allowLineSegment = false) {
205409
205571
  if (data instanceof _Loop__WEBPACK_IMPORTED_MODULE_8__.Loop || data instanceof _ParityRegion__WEBPACK_IMPORTED_MODULE_9__.ParityRegion) {
205410
- const cleanerData = data.clone();
205572
+ let cleanerData = data.clone();
205411
205573
  _RegionOps__WEBPACK_IMPORTED_MODULE_1__.RegionOps.consolidateAdjacentPrimitives(cleanerData);
205574
+ cleanerData = _internalContexts_TransferWithSplitArcs__WEBPACK_IMPORTED_MODULE_10__.TransferWithSplitArcs.clone(cleanerData);
205412
205575
  this.members.push(new RegionGroupMember(cleanerData, this));
205413
205576
  }
205414
- else if (data instanceof _UnionRegion__WEBPACK_IMPORTED_MODULE_10__.UnionRegion) {
205577
+ else if (data instanceof _UnionRegion__WEBPACK_IMPORTED_MODULE_11__.UnionRegion) {
205415
205578
  for (const child of data.children) {
205416
205579
  this.addMember(child);
205417
205580
  }
@@ -205421,7 +205584,7 @@ class RegionGroup {
205421
205584
  this.addMember(item);
205422
205585
  }
205423
205586
  }
205424
- else if (allowLineSegment && data instanceof _LineSegment3d__WEBPACK_IMPORTED_MODULE_11__.LineSegment3d) {
205587
+ else if (allowLineSegment && data instanceof _LineSegment3d__WEBPACK_IMPORTED_MODULE_12__.LineSegment3d) {
205425
205588
  this.members.push(new RegionGroupMember(data, this));
205426
205589
  }
205427
205590
  }
@@ -205438,22 +205601,22 @@ class RegionGroup {
205438
205601
  /**
205439
205602
  * A `RegionBooleanContext` carries structure and operations for binary operations between two sets of regions.
205440
205603
  * * In the binary operation OP (union, intersection, parity, difference), the left and right operands
205441
- * are each a composite union, difference, or parity among multiple inputs, i.e.
205604
+ * are each a composite union, difference, or parity among multiple inputs, i.e.,
205442
205605
  * * (operationA among Ai) OP (operationB among Bi)
205443
205606
  * * where the Ai are one set of regions, being combined by operationA
205444
- * * and the Bi are the another set of regions, being combined by operationB
205445
- * * Each group of Ai and Bi is a `RegionGroup`
205607
+ * * and the Bi are the another set of regions, being combined by operationB.
205608
+ * * Each group of Ai and Bi is a `RegionGroup`.
205446
205609
  * * This is an extremely delicate structure.
205447
205610
  * * Members are public because of the unique variety of queries, but should only be used for queries.
205448
205611
  * * The graph and curves in the booleans are connected by an extended pointer chain:
205449
- * * (HalfEdge in Graph).edgeTag points to a CurveLocationDetail
205450
- * * (CurveLocationDetail).curve points to a curve
205451
- * * (Curve).parent points to RegionGroupMember
205452
- * * (RegionGroupMember) points to RegionGroup
205453
- * * (RegionGroup) points to RegionBooleanBinaryContext
205454
- * * So..when a graph sweep crosses an edge,
205455
- * * the chain leads to a parity count in the RegionGroupMember
205456
- * * that can change the number of members active in the RegionGroup
205612
+ * * (HalfEdge in Graph).edgeTag points to a CurveLocationDetail.
205613
+ * * (CurveLocationDetail).curve points to a curve.
205614
+ * * (Curve).parent points to RegionGroupMember.
205615
+ * * (RegionGroupMember) points to RegionGroup.
205616
+ * * (RegionGroup) points to RegionBooleanBinaryContext.
205617
+ * * So when a graph sweep crosses an edge
205618
+ * * the chain leads to a parity count in the RegionGroupMember.
205619
+ * * that can change the number of members active in the RegionGroup.
205457
205620
  * * which can change the state of the context.
205458
205621
  * @internal
205459
205622
  */
@@ -205468,7 +205631,7 @@ class RegionBooleanContext {
205468
205631
  this.groupA = new RegionGroup(this, groupTypeA);
205469
205632
  this.groupB = new RegionGroup(this, groupTypeB);
205470
205633
  this.extraGeometry = new RegionGroup(this, RegionGroupOpType.NonBounding);
205471
- this.binaryOp = _RegionOps__WEBPACK_IMPORTED_MODULE_1__.RegionBinaryOpType.Union; // it will be revised on can calls.
205634
+ this.binaryOp = _RegionOps__WEBPACK_IMPORTED_MODULE_1__.RegionBinaryOpType.Union; // revised in runClassificationSweep
205472
205635
  }
205473
205636
  /**
205474
205637
  * Create a context with both A and B groups empty.
@@ -205487,7 +205650,7 @@ class RegionBooleanContext {
205487
205650
  this.addConnectives();
205488
205651
  }
205489
205652
  _workSegment;
205490
- static _bridgeDirection = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_12__.Vector3d.createNormalized(1.0, -0.12328974132467); // magic unit direction to minimize vertex hits
205653
+ static _bridgeDirection = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_13__.Vector3d.createNormalized(1.0, -0.12328974132467); // magic unit direction to minimize vertex hits
205491
205654
  /**
205492
205655
  * The sweep operations require access to all geometry by edge crossings and face walk.
205493
205656
  * If input loops are non-overlapping, there may be disconnected islands not reachable.
@@ -205502,7 +205665,7 @@ class RegionBooleanContext {
205502
205665
  const rangeAB = rangeA.union(rangeB);
205503
205666
  const areaTol = _RegionOps__WEBPACK_IMPORTED_MODULE_1__.RegionOps.computeXYAreaTolerance(rangeAB);
205504
205667
  let margin = 0.1;
205505
- this._workSegment = _internalContexts_PlaneAltitudeRangeContext__WEBPACK_IMPORTED_MODULE_13__.PlaneAltitudeRangeContext.findExtremePointsInDirection(rangeAB.corners(), RegionBooleanContext._bridgeDirection, this._workSegment);
205668
+ this._workSegment = _internalContexts_PlaneAltitudeRangeContext__WEBPACK_IMPORTED_MODULE_14__.PlaneAltitudeRangeContext.findExtremePointsInDirection(rangeAB.corners(), RegionBooleanContext._bridgeDirection, this._workSegment);
205506
205669
  if (this._workSegment)
205507
205670
  margin *= this._workSegment.point0Ref.distanceXY(this._workSegment.point1Ref); // how much further to extend each bridge ray
205508
205671
  const maxPoints = [];
@@ -205510,7 +205673,7 @@ class RegionBooleanContext {
205510
205673
  const area = _RegionOps__WEBPACK_IMPORTED_MODULE_1__.RegionOps.computeXYArea(region);
205511
205674
  if (area === undefined || Math.abs(area) < areaTol)
205512
205675
  return; // avoid bridging trivial faces
205513
- this._workSegment = _internalContexts_PlaneAltitudeRangeContext__WEBPACK_IMPORTED_MODULE_13__.PlaneAltitudeRangeContext.findExtremePointsInDirection(region, RegionBooleanContext._bridgeDirection, this._workSegment);
205676
+ this._workSegment = _internalContexts_PlaneAltitudeRangeContext__WEBPACK_IMPORTED_MODULE_14__.PlaneAltitudeRangeContext.findExtremePointsInDirection(region, RegionBooleanContext._bridgeDirection, this._workSegment);
205514
205677
  if (this._workSegment)
205515
205678
  maxPoints.push(this._workSegment.point1Ref);
205516
205679
  };
@@ -205525,17 +205688,17 @@ class RegionBooleanContext {
205525
205688
  }
205526
205689
  }
205527
205690
  }
205528
- const ray = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_14__.Ray3d.createZero();
205691
+ const ray = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_15__.Ray3d.createZero();
205529
205692
  for (const p of maxPoints) {
205530
- // Make a line from...
205531
- // 1) exactly the max point of the loops to
205532
- // 2) a point clearly outside the big range
205533
- // If p came from some inner loop this will...
205534
- // 1) create a bridge from the inner loop through any containing loops (always)
205535
- // 2) avoid crossing any containing loop at a vertex. (with high probability, but not absolutely always)
205536
- const bridgeLength = margin + _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_14__.Ray3d.create(p, RegionBooleanContext._bridgeDirection, ray).intersectionWithRange3d(rangeAB).high;
205537
- const outside = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_12__.Point3d.createAdd2Scaled(p, 1.0, RegionBooleanContext._bridgeDirection, bridgeLength);
205538
- const bridgeLine = _LineSegment3d__WEBPACK_IMPORTED_MODULE_11__.LineSegment3d.createXYXY(p.x, p.y, outside.x, outside.y);
205693
+ // Make a line from
205694
+ // 1) exactly the max point of the loops to
205695
+ // 2) a point clearly outside the big range
205696
+ // If p came from some inner loop this will
205697
+ // 1) create a bridge from the inner loop through any containing loops (always)
205698
+ // 2) avoid crossing any containing loop at a vertex. (with high probability, but not absolutely always)
205699
+ const bridgeLength = margin + _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_15__.Ray3d.create(p, RegionBooleanContext._bridgeDirection, ray).intersectionWithRange3d(rangeAB).high;
205700
+ const outside = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_13__.Point3d.createAdd2Scaled(p, 1.0, RegionBooleanContext._bridgeDirection, bridgeLength);
205701
+ const bridgeLine = _LineSegment3d__WEBPACK_IMPORTED_MODULE_12__.LineSegment3d.createXYXY(p.x, p.y, outside.x, outside.y);
205539
205702
  this.extraGeometry.addMember(bridgeLine, true);
205540
205703
  }
205541
205704
  }
@@ -205549,7 +205712,7 @@ class RegionBooleanContext {
205549
205712
  */
205550
205713
  annotateAndMergeCurvesInGraph(mergeTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_7__.Geometry.smallMetricDistance) {
205551
205714
  const allPrimitives = [];
205552
- // ASSUME loops have fine-grained types -- no linestrings !!
205715
+ // ASSUME loops have fine-grained types (no linestrings)
205553
205716
  for (const group of [this.groupA, this.groupB, this.extraGeometry]) {
205554
205717
  for (const member of group.members) {
205555
205718
  let k = allPrimitives.length;
@@ -205560,9 +205723,8 @@ class RegionBooleanContext {
205560
205723
  }
205561
205724
  }
205562
205725
  }
205563
- // const range = RegionOps.curveArrayRange(allPrimitives);
205564
- const intersections = _CurveCurve__WEBPACK_IMPORTED_MODULE_15__.CurveCurve.allIntersectionsAmongPrimitivesXY(allPrimitives, mergeTolerance);
205565
- const graph = _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_16__.PlanarSubdivision.assembleHalfEdgeGraph(allPrimitives, intersections, mergeTolerance);
205726
+ const intersections = _CurveCurve__WEBPACK_IMPORTED_MODULE_16__.CurveCurve.allIntersectionsAmongPrimitivesXY(allPrimitives, mergeTolerance);
205727
+ const graph = _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_17__.PlanarSubdivision.assembleHalfEdgeGraph(allPrimitives, intersections, mergeTolerance);
205566
205728
  this.graph = graph;
205567
205729
  this.faceAreaFunction = faceAreaFromCurvedEdgeData;
205568
205730
  }
@@ -205653,7 +205815,7 @@ class RegionBooleanContext {
205653
205815
  const data = node.edgeTag;
205654
205816
  if (data instanceof RegionGroupMember)
205655
205817
  return updateRegionGroupMemberState(data);
205656
- if (data instanceof _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_17__.CurveLocationDetail) {
205818
+ if (data instanceof _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_18__.CurveLocationDetail) {
205657
205819
  // We trust that the caller has linked from the graph node to a curve which has a RegionGroupMember as its parent.
205658
205820
  const member = data.curve.parent;
205659
205821
  if (member instanceof RegionGroupMember)
@@ -205708,10 +205870,10 @@ function areaUnderPartialCurveXY(detail, xyStart, xyEnd, referencePoint) {
205708
205870
  }
205709
205871
  let areaToChord = 0.0;
205710
205872
  if (detail && detail.curve && detail.hasFraction1) {
205711
- if (detail.curve instanceof _LineSegment3d__WEBPACK_IMPORTED_MODULE_11__.LineSegment3d) {
205873
+ if (detail.curve instanceof _LineSegment3d__WEBPACK_IMPORTED_MODULE_12__.LineSegment3d) {
205712
205874
  // ah .. nothing to do for a line segment
205713
205875
  }
205714
- else if (detail.curve instanceof _Arc3d__WEBPACK_IMPORTED_MODULE_18__.Arc3d) {
205876
+ else if (detail.curve instanceof _Arc3d__WEBPACK_IMPORTED_MODULE_19__.Arc3d) {
205715
205877
  areaToChord = detail.curve.areaToChordXY(detail.fraction, detail.fraction1);
205716
205878
  }
205717
205879
  }
@@ -212380,6 +212542,52 @@ class SumLengthsContext extends _CurveProcessor__WEBPACK_IMPORTED_MODULE_0__.Rec
212380
212542
  }
212381
212543
 
212382
212544
 
212545
+ /***/ }),
212546
+
212547
+ /***/ "../../core/geometry/lib/esm/curve/internalContexts/TransferWithSplitArcs.js":
212548
+ /*!***********************************************************************************!*\
212549
+ !*** ../../core/geometry/lib/esm/curve/internalContexts/TransferWithSplitArcs.js ***!
212550
+ \***********************************************************************************/
212551
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
212552
+
212553
+ "use strict";
212554
+ __webpack_require__.r(__webpack_exports__);
212555
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
212556
+ /* harmony export */ TransferWithSplitArcs: () => (/* binding */ TransferWithSplitArcs)
212557
+ /* harmony export */ });
212558
+ /* harmony import */ var _Arc3d__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Arc3d */ "../../core/geometry/lib/esm/curve/Arc3d.js");
212559
+ /* harmony import */ var _CloneCurvesContext__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CloneCurvesContext */ "../../core/geometry/lib/esm/curve/internalContexts/CloneCurvesContext.js");
212560
+ /*---------------------------------------------------------------------------------------------
212561
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
212562
+ * See LICENSE.md in the project root for license terms and full copyright notice.
212563
+ *--------------------------------------------------------------------------------------------*/
212564
+ /** @packageDocumentation
212565
+ * @module Curve
212566
+ */
212567
+
212568
+
212569
+ /**
212570
+ * Algorithmic class for shallow-copying a CurveCollection with each full-sweep arc replaced by two half-sweep arcs.
212571
+ * * Often useful for building graphs from loops.
212572
+ * @internal
212573
+ */
212574
+ class TransferWithSplitArcs extends _CloneCurvesContext__WEBPACK_IMPORTED_MODULE_0__.CloneCurvesContext {
212575
+ constructor() {
212576
+ super(undefined);
212577
+ }
212578
+ doClone(primitive) {
212579
+ if (primitive instanceof _Arc3d__WEBPACK_IMPORTED_MODULE_1__.Arc3d && primitive.sweep.isFullCircle) // replace full arc with two half arcs
212580
+ return [primitive.clonePartialCurve(0.0, 0.5), primitive.clonePartialCurve(0.5, 1)];
212581
+ return primitive;
212582
+ }
212583
+ static clone(target) {
212584
+ const context = new TransferWithSplitArcs();
212585
+ target.announceToCurveProcessor(context);
212586
+ return context._result;
212587
+ }
212588
+ }
212589
+
212590
+
212383
212591
  /***/ }),
212384
212592
 
212385
212593
  /***/ "../../core/geometry/lib/esm/curve/internalContexts/TransformInPlaceContext.js":
@@ -228747,9 +228955,9 @@ class Vector3d extends XYZ {
228747
228955
  if (dot < 0.0 && !oppositeIsParallel)
228748
228956
  return false;
228749
228957
  const cross2 = this.crossProductMagnitudeSquared(other);
228750
- /* a2,b2,cross2 are squared lengths of respective vectors */
228751
- /* cross2 = sin^2(theta) * a2 * b2 */
228752
- /* For small theta, sin^2(theta)~~theta^2 */
228958
+ // a2,b2,cross2 are squared lengths of respective vectors
228959
+ // cross2 = sin^2(theta) * a2 * b2
228960
+ // For small theta, sin^2(theta) ~ theta^2
228753
228961
  return cross2 <= radianSquaredTol * a2 * b2;
228754
228962
  }
228755
228963
  /**
@@ -230704,26 +230912,28 @@ class PolygonOps {
230704
230912
  return s;
230705
230913
  }
230706
230914
  /**
230707
- * Return a Ray3d with (assuming the polygon is planar and not self-intersecting):
230708
- * * `origin` at the centroid of the (3D) polygon,
230709
- * * `direction` is the unit vector perpendicular to the plane,
230710
- * * `a` is the area.
230711
- * @param points
230915
+ * Return a [[Ray3d]] with:
230916
+ * * `origin` is the centroid of the polygon,
230917
+ * * `direction` is a unit vector perpendicular to the polygon plane,
230918
+ * * `a` is the polygon area.
230919
+ * @param points the polygon vertices in order. Points can lie in any plane. First and last point do not have to be equal.
230920
+ * @param result optional pre-allocated result to populate and return.
230712
230921
  */
230713
- static centroidAreaNormal(points) {
230922
+ static centroidAreaNormal(points, result) {
230714
230923
  if (Array.isArray(points)) {
230715
230924
  const carrier = new _Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_5__.Point3dArrayCarrier(points);
230716
- return this.centroidAreaNormal(carrier);
230925
+ return this.centroidAreaNormal(carrier, result);
230717
230926
  }
230718
230927
  const n = points.length;
230719
230928
  if (n === 3) {
230720
- const normal = points.crossProductIndexIndexIndex(0, 1, 2);
230929
+ const normal = points.crossProductIndexIndexIndex(0, 1, 2, result?.direction);
230721
230930
  const a = 0.5 * normal.magnitude();
230722
- const centroid = points.getPoint3dAtCheckedPointIndex(0);
230931
+ const centroid = points.getPoint3dAtCheckedPointIndex(0, result?.origin);
230723
230932
  points.accumulateScaledXYZ(1, 1.0, centroid);
230724
230933
  points.accumulateScaledXYZ(2, 1.0, centroid);
230725
230934
  centroid.scaleInPlace(1.0 / 3.0);
230726
- const result = _Ray3d__WEBPACK_IMPORTED_MODULE_3__.Ray3d.createCapture(centroid, normal);
230935
+ if (!result)
230936
+ result = _Ray3d__WEBPACK_IMPORTED_MODULE_3__.Ray3d.createCapture(centroid, normal);
230727
230937
  if (result.tryNormalizeInPlaceWithAreaWeight(a))
230728
230938
  return result;
230729
230939
  return undefined;
@@ -230741,22 +230951,24 @@ class PolygonOps {
230741
230951
  points.vectorXYAndZIndex(origin, 1, vector0);
230742
230952
  let cross = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Vector3d.create();
230743
230953
  const centroidSum = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Vector3d.createZero();
230744
- const normalSum = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Vector3d.createZero();
230954
+ const normal = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Vector3d.createZero(result?.direction);
230745
230955
  let signedTriangleArea;
230746
- // This will work with or without closure edge. If closure is given, the last vector is 000.
230956
+ // This will work with or without closure edge. If closure is given, the last vector is 000.
230747
230957
  for (let i = 2; i < n; i++) {
230748
230958
  points.vectorXYAndZIndex(origin, i, vector1);
230749
230959
  cross = vector0.crossProduct(vector1, cross);
230750
230960
  signedTriangleArea = areaNormal.dotProduct(cross); // well, actually twice the area.
230751
- normalSum.addInPlace(cross); // this grows to twice the area
230961
+ normal.addInPlace(cross); // this grows to twice the area
230752
230962
  const b = signedTriangleArea / 6.0;
230753
230963
  centroidSum.plus2Scaled(vector0, b, vector1, b, centroidSum);
230754
230964
  vector0.setFrom(vector1);
230755
230965
  }
230756
- const area = 0.5 * normalSum.magnitude();
230966
+ const area = 0.5 * normal.magnitude();
230757
230967
  const inverseArea = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.conditionalDivideFraction(1, area);
230758
230968
  if (inverseArea !== undefined) {
230759
- const result = _Ray3d__WEBPACK_IMPORTED_MODULE_3__.Ray3d.createCapture(origin.plusScaled(centroidSum, inverseArea), normalSum);
230969
+ const centroid = origin.plusScaled(centroidSum, inverseArea, result?.origin);
230970
+ if (!result)
230971
+ result = _Ray3d__WEBPACK_IMPORTED_MODULE_3__.Ray3d.createCapture(centroid, normal);
230760
230972
  result.tryNormalizeInPlaceWithAreaWeight(area);
230761
230973
  return result;
230762
230974
  }
@@ -237730,19 +237942,19 @@ class Matrix4d {
237730
237942
  this._coffs[15] += scale * beta;
237731
237943
  }
237732
237944
  /**
237733
- * Multiply and replace contents of this matrix by A*this*AT where
237734
- * * A is a pure translation with final column [x,y,z,1]
237735
- * * this is this matrix.
237736
- * * AT is the transpose of A.
237737
- * @param ax x part of translation
237738
- * @param ay y part of translation
237739
- * @param az z part of translation
237945
+ * Multiply and replace contents of ` this` matrix by `A*this*AT` where
237946
+ * * `A` is a pure translation with final column [x,y,z,1].
237947
+ * * `this` is this matrix.
237948
+ * * `AT` is the transpose of A.
237949
+ * @param ax x part of translation.
237950
+ * @param ay y part of translation.
237951
+ * @param az z part of translation.
237740
237952
  */
237741
237953
  multiplyTranslationSandwichInPlace(ax, ay, az) {
237742
237954
  const bx = this._coffs[3];
237743
237955
  const by = this._coffs[7];
237744
237956
  const bz = this._coffs[11];
237745
- // matrixB can be non-symmetric!!
237957
+ // matrixB can be non-symmetric
237746
237958
  const cx = this._coffs[12];
237747
237959
  const cy = this._coffs[13];
237748
237960
  const cz = this._coffs[14];
@@ -237765,7 +237977,7 @@ class Matrix4d {
237765
237977
  this._coffs[12] += axBeta;
237766
237978
  this._coffs[13] += ayBeta;
237767
237979
  this._coffs[14] += azBeta;
237768
- // coffs[15] is unchanged !!!
237980
+ // coffs[15] is unchanged
237769
237981
  }
237770
237982
  }
237771
237983
 
@@ -237816,8 +238028,8 @@ __webpack_require__.r(__webpack_exports__);
237816
238028
  * * e.g. entry 03 is summed x.
237817
238029
  * * In this level:
237818
238030
  * * the `absoluteQuantity` member is undefined.
237819
- * * the `localToWorldMap` and `radiiOfGyration` are created by have undefined contents.
237820
- * * Second level: after a call to inertiaProductsToPrincipalAxes, the `localToWorldMap`, `absoluteQuantity` and
238031
+ * * the `localToWorldMap` and `radiiOfGyration` are created but have undefined contents.
238032
+ * * Second level: after a call to `inertiaProductsToPrincipalAxes`, the `localToWorldMap`, `absoluteQuantity` and
237821
238033
  * `radiiOfGyration` are filled in.
237822
238034
  * @public
237823
238035
  */
@@ -237837,18 +238049,35 @@ class MomentData {
237837
238049
  * * This set up with its inverse already constructed.
237838
238050
  */
237839
238051
  localToWorldMap;
238052
+ /** Radii of gyration (square roots of principal second moments). */
238053
+ radiusOfGyration;
238054
+ /**
238055
+ * Principal quantity (e.g. length, area, or volume). This is undefined in raw moments, and becomes defined by
238056
+ * inertiaProductsToPrincipalAxes.
238057
+ */
238058
+ absoluteQuantity;
237840
238059
  // private variables
237841
238060
  static _vectorA;
237842
238061
  static _vectorB;
237843
238062
  static _vectorC;
237844
238063
  _point0 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Point3d.create();
237845
238064
  _point1 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Point3d.create();
238065
+ /** Constructor. */
238066
+ constructor() {
238067
+ this.origin = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Point3d.createZero();
238068
+ this.needOrigin = false;
238069
+ this.sums = _Matrix4d__WEBPACK_IMPORTED_MODULE_1__.Matrix4d.createZero();
238070
+ this.localToWorldMap = _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_2__.Transform.createIdentity();
238071
+ this.radiusOfGyration = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create();
238072
+ this.absoluteQuantity = 0.1; // so optimizer sees its type
238073
+ this.absoluteQuantity = undefined;
238074
+ }
237846
238075
  /**
237847
238076
  * Return the lower-right (3,3) entry in the sums.
237848
238077
  * * This is the quantity (i.e. length, area, or volume) summed.
237849
238078
  */
237850
238079
  get quantitySum() {
237851
- return this.sums.atIJ(3, 3);
238080
+ return this.sums.weight();
237852
238081
  }
237853
238082
  /**
237854
238083
  * Return a scale factor to make these sums match the target orientation sign.
@@ -237879,23 +238108,6 @@ class MomentData {
237879
238108
  this.needOrigin = false;
237880
238109
  }
237881
238110
  }
237882
- /** Radii of gyration (square roots of principal second moments). */
237883
- radiusOfGyration;
237884
- /**
237885
- * Principal quantity (e.g. length, area, or volume). This is undefined in raw moments, and becomes defined by
237886
- * inertiaProductsToPrincipalAxes.
237887
- */
237888
- absoluteQuantity;
237889
- /** Constructor. */
237890
- constructor() {
237891
- this.origin = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Point3d.createZero();
237892
- this.sums = _Matrix4d__WEBPACK_IMPORTED_MODULE_1__.Matrix4d.createZero();
237893
- this.localToWorldMap = _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_2__.Transform.createIdentity();
237894
- this.radiusOfGyration = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create();
237895
- this.needOrigin = false;
237896
- this.absoluteQuantity = 0.1; // so optimizer sees its type
237897
- this.absoluteQuantity = undefined;
237898
- }
237899
238111
  /**
237900
238112
  * Create moments with optional origin.
237901
238113
  * * Origin and needOrigin are quirky.
@@ -237939,7 +238151,7 @@ class MomentData {
237939
238151
  axes.setColumnsPoint4dXYZ(points[0], points[1], points[2]);
237940
238152
  if (axes.determinant() < 0)
237941
238153
  axes.scaleColumnsInPlace(-1.0, -1.0, -1.0);
237942
- // prefer x and z positive -- y falls wherever . ..
238154
+ // prefer x and z positive; y falls wherever
237943
238155
  if (axes.at(0, 0) < 0.0)
237944
238156
  axes.scaleColumnsInPlace(-1.0, -1.0, 1.0);
237945
238157
  if (axes.at(2, 2) < 0.0)
@@ -237964,7 +238176,8 @@ class MomentData {
237964
238176
  * * Hence x axis is long direction.
237965
238177
  * * Hence planar data generates large moment as Z.
237966
238178
  * @param origin The origin used for the inertia products.
237967
- * @param inertiaProducts The inertia products: sums or integrals of [xx,xy,xz,xw; yx,yy, yz,yw; zx,zy,zz,zw; wx,wy,wz,w].
238179
+ * @param inertiaProducts The inertia products: sums or integrals of
238180
+ * [xx,xy,xz,xw; yx,yy,yz,yw; zx,zy,zz,zw; wx,wy,wz,w].
237968
238181
  */
237969
238182
  static inertiaProductsToPrincipalAxes(origin, inertiaProducts) {
237970
238183
  const moments = new MomentData();
@@ -238008,23 +238221,21 @@ class MomentData {
238008
238221
  */
238009
238222
  static areEquivalentPrincipalAxes(dataA, dataB) {
238010
238223
  if (dataA && dataB
238011
- && _Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.isSameCoordinate(dataA.quantitySum, dataB.quantitySum)) { // um.. need different tolerance for area, volume?)
238224
+ && _Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.isSameCoordinate(dataA.quantitySum, dataB.quantitySum)) { // TODO: need different tolerance for area, volume?
238012
238225
  if (dataA.localToWorldMap.getOrigin().isAlmostEqual(dataB.localToWorldMap.getOrigin())
238013
238226
  && dataA.radiusOfGyration.isAlmostEqual(dataB.radiusOfGyration)) {
238014
238227
  if (_Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.isSameCoordinate(dataA.radiusOfGyration.x, dataA.radiusOfGyration.y)) {
238015
- // We have at least xy symmetry ....
238228
+ // we have at least xy symmetry
238016
238229
  if (_Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.isSameCoordinate(dataA.radiusOfGyration.x, dataA.radiusOfGyration.z))
238017
238230
  return true;
238018
- // just xy.
238019
- // allow opposite z directions.
238020
- // If the z's are aligned, x an dy can spin freely.
238231
+ // just xy; allow opposite z directions; if the z's are aligned, x and y can spin freely
238021
238232
  const zA = dataA.localToWorldMap.matrix.columnZ();
238022
238233
  const zB = dataB.localToWorldMap.matrix.columnZ();
238023
238234
  if (zA.isParallelTo(zB, true))
238024
238235
  return true;
238025
238236
  return false;
238026
238237
  }
238027
- // no symmetry. Test all three axes.
238238
+ // no symmetry; test all three axes
238028
238239
  const vectorA = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create();
238029
238240
  const vectorB = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create();
238030
238241
  for (let i = 0; i < 3; i++) {
@@ -238054,7 +238265,7 @@ class MomentData {
238054
238265
  }
238055
238266
  /** Revise the accumulated sums to be "around the centroid". */
238056
238267
  shiftOriginAndSumsToCentroidOfSums() {
238057
- const xyz = this.sums.columnW().realPoint();
238268
+ const xyz = this.sums.columnW().realPoint(); // centroid of the geometry
238058
238269
  if (xyz) {
238059
238270
  this.shiftOriginAndSumsByXYZ(xyz.x, xyz.y, xyz.z);
238060
238271
  return true;
@@ -238063,9 +238274,9 @@ class MomentData {
238063
238274
  }
238064
238275
  /**
238065
238276
  * Revise the accumulated sums.
238066
- * * add ax,ay,ax to the origin coordinates.
238067
- * * apply the negative translation to the sums.
238068
- */
238277
+ * * Add (ax,ay,az) to the origin coordinates.
238278
+ * * Apply the negative translation to the sums.
238279
+ */
238069
238280
  shiftOriginAndSumsByXYZ(ax, ay, az) {
238070
238281
  this.origin.addXYZInPlace(ax, ay, az);
238071
238282
  this.sums.multiplyTranslationSandwichInPlace(-ax, -ay, -az);
@@ -238075,23 +238286,24 @@ class MomentData {
238075
238286
  this.shiftOriginAndSumsByXYZ(newOrigin.x - this.origin.x, newOrigin.y - this.origin.y, newOrigin.z - this.origin.z);
238076
238287
  }
238077
238288
  /**
238078
- * Compute moments of a triangle from the origin to the given line.
238079
- * Accumulate them to this.sums.
238080
- * * If `pointA` is undefined, use `this.origin` as pointA.
238081
- * * If `this.needOrigin` is set, pointB is used
238082
- */
238289
+ * Compute moments of a triangle from the origin. Accumulate them to `this.sums`.
238290
+ * * If `this.needOrigin` is set, `this.origin` is set to `pointB`.
238291
+ * * If `pointA` is undefined, use `this.origin` as `pointA`.
238292
+ */
238083
238293
  accumulateTriangleMomentsXY(pointA, pointB, pointC) {
238084
238294
  this.setOriginXYZIfNeeded(pointB.x, pointB.y, 0.0);
238085
238295
  const x0 = this.origin.x;
238086
238296
  const y0 = this.origin.y;
238087
- const vectorA = MomentData._vectorA =
238088
- pointA !== undefined ? _Point4d__WEBPACK_IMPORTED_MODULE_5__.Point4d.create(pointA.x - x0, pointA.y - y0, 0.0, 1.0, MomentData._vectorA)
238089
- : _Point4d__WEBPACK_IMPORTED_MODULE_5__.Point4d.create(this.origin.x, this.origin.y, 0.0, 1.0, MomentData._vectorA);
238297
+ const vectorA = MomentData._vectorA = (pointA !== undefined) ?
238298
+ _Point4d__WEBPACK_IMPORTED_MODULE_5__.Point4d.create(pointA.x - x0, pointA.y - y0, 0.0, 1.0, MomentData._vectorA) :
238299
+ _Point4d__WEBPACK_IMPORTED_MODULE_5__.Point4d.create(0.0, 0.0, 0.0, 1.0, MomentData._vectorA);
238090
238300
  const vectorB = MomentData._vectorB = _Point4d__WEBPACK_IMPORTED_MODULE_5__.Point4d.create(pointB.x - x0, pointB.y - y0, 0.0, 1.0, MomentData._vectorB);
238091
238301
  const vectorC = MomentData._vectorC = _Point4d__WEBPACK_IMPORTED_MODULE_5__.Point4d.create(pointC.x - x0, pointC.y - y0, 0.0, 1.0, MomentData._vectorC);
238092
- // accumulate Return product integrals I(0<=u<=1) I (0<=v<= u) (w*W + u *U + v * V)(w*W + u *U + v * V)^ du dv
238093
- // where w = 1-u-v
238094
- // W = column vector (point00.x, point00.y, point00.z, 1.0) etc.
238302
+ // Below we calculate 16 double integrals: \iint_T [x y 0 1]^ [x y 0 1] dT over triangle T=(A,B,C).
238303
+ // Each accumulates contributions from 9 scaled outer products. Integration computations use the barycentric
238304
+ // change of variables [B-A C-A][u,v]^ = [x,y]^ with Jacobian detJ = B-A x C-A = twice the area of T.
238305
+ // This converts the integration domain from T to the triangle bounded by u=0, v=0 and v=1-u, yielding e.g.,
238306
+ // \iint_T x^2 dT = detJ \int_0^1 \int_0^{1-u} u^2 dv du = detJ / 12, and similarly \iint_T xy dT = detJ / 24.
238095
238307
  const detJ = _Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.crossProductXYXY(vectorB.x - vectorA.x, vectorB.y - vectorA.y, vectorC.x - vectorA.x, vectorC.y - vectorA.y);
238096
238308
  if (detJ !== 0.0) {
238097
238309
  const r1_12 = detJ / 12.0;
@@ -238107,7 +238319,7 @@ class MomentData {
238107
238319
  this.sums.addScaledOuterProductInPlace(vectorC, vectorC, r1_12);
238108
238320
  }
238109
238321
  }
238110
- /** Add scaled outer product of (4d, unit weight) point to this.sums. */
238322
+ /** Add scaled outer product of (4d, unit weight) point to `this.sums`. */
238111
238323
  accumulateScaledOuterProduct(point, scaleFactor) {
238112
238324
  this.setOriginXYZIfNeeded(point.x, point.y, 0.0);
238113
238325
  const vectorA = MomentData._vectorA = _Point4d__WEBPACK_IMPORTED_MODULE_5__.Point4d.create(point.x - this.origin.x, point.y - this.origin.y, point.z - this.origin.z, 1.0, MomentData._vectorA);
@@ -238130,16 +238342,15 @@ class MomentData {
238130
238342
  this.sums.addScaledOuterProductInPlace(vectorB, vectorB, r1_3);
238131
238343
  }
238132
238344
  /**
238133
- * Compute moments of triangles from a base point to the given linestring.
238134
- * Accumulate them to this.sums.
238135
- * * If `pointA` is undefined, use `this.origin` as pointA.
238136
- * * If `this.needOrigin` is set, the first point of the array is captured as local origin for subsequent sums.
238137
- *
238345
+ * Compute moments of triangles from a base point to the given linestring. Accumulate them to `this.sums`.
238346
+ * * If `this.needOrigin` is set, `this.origin` is set to the first point of the array.
238347
+ * * If `sweepBase` is undefined, use `this.origin` as `sweepBase`.
238138
238348
  */
238139
238349
  accumulateTriangleToLineStringMomentsXY(sweepBase, points) {
238140
238350
  const n = points.length;
238141
238351
  if (n > 1) {
238142
238352
  points.getPoint3dAtUncheckedPointIndex(0, this._point0);
238353
+ // The linestring forms a polygon with sweepBase. Integrate over this polygon using Shoelace algorithm.
238143
238354
  for (let i = 1; i < n; i++) {
238144
238355
  points.getPoint3dAtUncheckedPointIndex(i, this._point1);
238145
238356
  this.accumulateTriangleMomentsXY(sweepBase, this._point0, this._point1);
@@ -238148,17 +238359,17 @@ class MomentData {
238148
238359
  }
238149
238360
  }
238150
238361
  /**
238151
- * * Assemble XX, YY, XY products into a full matrix form [xx,xy,0,0; xy,yy,0,0;0,0,0,0;0,0,0,1].
238152
- * * Sandwich this between transforms with columns [vectorU, vectorV, 0000, origin]. (Column weights 0001) (only xy
238153
- * parts of vectors).
238154
- * * scale by detJ for the xy-only determinant of the vectors.
238362
+ * Assemble XX, YY, XY products into a full matrix form [xx,xy,0,0; xy,yy,0,0; 0,0,0,0; 0,0,0,1].
238363
+ * * Sandwich this between transforms with columns [vectorU, vectorV, 0000, origin].
238364
+ * (column weights 0001; only xy parts of vectors).
238365
+ * * Scale by detJ for the xy-only determinant of the vectors.
238155
238366
  * @param productXX
238156
238367
  * @param productXY
238157
238368
  * @param productYY
238158
- * @param area Area in caller's system.
238159
- * @param origin Caller's origin.
238160
- * @param vectorU Caller's U axis (not necessarily unit).
238161
- * @param vectorV Caller's V axis (not necessarily unit).
238369
+ * @param area area in caller's system.
238370
+ * @param origin caller's origin.
238371
+ * @param vectorU caller's U axis (not necessarily unit).
238372
+ * @param vectorV caller's V axis (not necessarily unit).
238162
238373
  */
238163
238374
  accumulateXYProductsInCentroidalFrame(productXX, productXY, productYY, area, origin, vectorU, vectorV) {
238164
238375
  const centroidalProducts = _Matrix4d__WEBPACK_IMPORTED_MODULE_1__.Matrix4d.createRowValues(productXX, productXY, 0, 0, productXY, productYY, 0, 0, 0, 0, 0, 0, 0, 0, 0, area);
@@ -299498,10 +299709,10 @@ class Settings {
299498
299709
  });
299499
299710
  }
299500
299711
  toString() {
299501
- return `Configurations:
299502
- oidc client id: ${this.oidcClientId},
299503
- oidc scopes: ${this.oidcScopes},
299504
- applicationId: ${this.gprid},
299712
+ return `Configurations:
299713
+ oidc client id: ${this.oidcClientId},
299714
+ oidc scopes: ${this.oidcScopes},
299715
+ applicationId: ${this.gprid},
299505
299716
  log level: ${this.logLevel}`;
299506
299717
  }
299507
299718
  }
@@ -302237,6 +302448,28 @@ const getClassName = (obj) => {
302237
302448
  };
302238
302449
 
302239
302450
 
302451
+ /***/ }),
302452
+
302453
+ /***/ "../../core/frontend/lib/esm/extension/providers lazy recursive":
302454
+ /*!******************************************************************************!*\
302455
+ !*** ../../core/frontend/lib/esm/extension/providers/ lazy namespace object ***!
302456
+ \******************************************************************************/
302457
+ /***/ ((module) => {
302458
+
302459
+ function webpackEmptyAsyncContext(req) {
302460
+ // Here Promise.resolve().then() is used instead of new Promise() to prevent
302461
+ // uncaught exception popping up in devtools
302462
+ return Promise.resolve().then(() => {
302463
+ var e = new Error("Cannot find module '" + req + "'");
302464
+ e.code = 'MODULE_NOT_FOUND';
302465
+ throw e;
302466
+ });
302467
+ }
302468
+ webpackEmptyAsyncContext.keys = () => ([]);
302469
+ webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext;
302470
+ webpackEmptyAsyncContext.id = "../../core/frontend/lib/esm/extension/providers lazy recursive";
302471
+ module.exports = webpackEmptyAsyncContext;
302472
+
302240
302473
  /***/ }),
302241
302474
 
302242
302475
  /***/ "?088e":
@@ -312309,7 +312542,7 @@ var loadLanguages = instance.loadLanguages;
312309
312542
  /***/ ((module) => {
312310
312543
 
312311
312544
  "use strict";
312312
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.1.0-dev.1","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 && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers","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 ES2022 --outDir lib/esm","clean":"rimraf -g 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","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/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-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*"},"//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/eslint-plugin":"5.0.0-dev.1","@types/chai-as-promised":"^7","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.13.0","glob":"^10.3.12","playwright":"~1.47.1","rimraf":"^6.0.1","source-map-loader":"^5.0.0","typescript":"~5.6.2","typemoq":"^2.1.0","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//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/cloud-agnostic-core":"^2.2.4","@itwin/object-storage-core":"^2.3.0","@itwin/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
312545
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.1.0-dev.12","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 && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers","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 ES2022 --outDir lib/esm","clean":"rimraf -g 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","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/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-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*"},"//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/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*","@itwin/eslint-plugin":"5.0.0-dev.1","@types/chai-as-promised":"^7","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.13.0","glob":"^10.3.12","playwright":"~1.47.1","rimraf":"^6.0.1","source-map-loader":"^5.0.0","typescript":"~5.6.2","typemoq":"^2.1.0","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//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/cloud-agnostic-core":"^2.2.4","@itwin/object-storage-core":"^2.3.0","@itwin/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
312313
312546
 
312314
312547
  /***/ })
312315
312548