@itwin/ecschema-rpcinterface-tests 5.0.0-dev.114 → 5.0.0-dev.115

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.
@@ -185224,7 +185224,8 @@ class BSpline2dNd extends _curve_GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geom
185224
185224
  knots;
185225
185225
  /** flat array of coordinate data, blocked by poleDimension and row */
185226
185226
  coffs;
185227
- /** Number of components per pole.
185227
+ /**
185228
+ * Number of components per pole.
185228
185229
  * * 3 for conventional xyz surface
185229
185230
  * * 4 for weighted (wx, wy, wz, w) surface.
185230
185231
  */
@@ -191004,11 +191005,13 @@ class ClipUtilities {
191004
191005
  clippedLocalRegion.tryTransformInPlace(localToWorld);
191005
191006
  if (!result)
191006
191007
  result = (clippedLocalRegion instanceof _curve_UnionRegion__WEBPACK_IMPORTED_MODULE_8__.UnionRegion) ? clippedLocalRegion : _curve_UnionRegion__WEBPACK_IMPORTED_MODULE_8__.UnionRegion.create(clippedLocalRegion);
191007
- else if (!result.tryAddChild(clippedLocalRegion))
191008
- result.children.push(...clippedLocalRegion.children);
191008
+ if (clippedLocalRegion instanceof _curve_UnionRegion__WEBPACK_IMPORTED_MODULE_8__.UnionRegion)
191009
+ result.children.push(...clippedLocalRegion.children); // avoid nested UnionRegions
191010
+ else
191011
+ result.tryAddChild(clippedLocalRegion);
191009
191012
  }
191010
191013
  }
191011
- return result;
191014
+ return result ? _curve_RegionOps__WEBPACK_IMPORTED_MODULE_7__.RegionOps.simplifyRegionType(result) : undefined;
191012
191015
  }
191013
191016
  /**
191014
191017
  * Compute and return portions of the input curve or region that are within the clipper.
@@ -204396,9 +204399,10 @@ __webpack_require__.r(__webpack_exports__);
204396
204399
  /* harmony import */ var _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../geometry3d/GeometryHandler */ "../../core/geometry/lib/esm/geometry3d/GeometryHandler.js");
204397
204400
  /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
204398
204401
  /* harmony import */ var _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geometry4d/MomentData */ "../../core/geometry/lib/esm/geometry4d/MomentData.js");
204399
- /* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
204400
- /* harmony import */ var _Loop__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
204401
- /* harmony import */ var _StrokeOptions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./StrokeOptions */ "../../core/geometry/lib/esm/curve/StrokeOptions.js");
204402
+ /* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
204403
+ /* harmony import */ var _Loop__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
204404
+ /* harmony import */ var _RegionOps__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./RegionOps */ "../../core/geometry/lib/esm/curve/RegionOps.js");
204405
+ /* harmony import */ var _StrokeOptions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./StrokeOptions */ "../../core/geometry/lib/esm/curve/StrokeOptions.js");
204402
204406
  /*---------------------------------------------------------------------------------------------
204403
204407
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
204404
204408
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -204410,6 +204414,7 @@ __webpack_require__.r(__webpack_exports__);
204410
204414
 
204411
204415
 
204412
204416
 
204417
+
204413
204418
  /**
204414
204419
  * Implementation class for computing XY area moments.
204415
204420
  * @internal
@@ -204418,15 +204423,15 @@ class RegionMomentsXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
204418
204423
  _activeMomentData;
204419
204424
  _point0 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Point3d.create();
204420
204425
  _point1 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Point3d.create();
204421
- /** Accumulate (independent) integrations over
204422
- * * origin to chord of the arc.
204423
- * * origin to the "cap" between the chord and arc.
204426
+ /**
204427
+ * Accumulate (independent) integrations over:
204428
+ * * The area between the arc and the chord connecting its endpoints.
204429
+ * * The triangle with vertices: origin, arc start, arc end.
204424
204430
  */
204425
204431
  handleArc3d(arc) {
204426
204432
  const momentData = this._activeMomentData;
204427
204433
  const sweepRadians = arc.sweep.sweepRadians;
204428
204434
  const alphaRadians = sweepRadians * 0.5;
204429
- // from https://apps.dtic.mil/dtic/tr/fulltext/u2/274936.pdf page 71 for radius = 1
204430
204435
  let s = Math.sin(alphaRadians);
204431
204436
  let c = Math.cos(alphaRadians);
204432
204437
  let s1 = Math.sin(sweepRadians);
@@ -204453,12 +204458,12 @@ class RegionMomentsXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
204453
204458
  const pointC = arc.fractionToPoint(1.0);
204454
204459
  momentData.accumulateTriangleMomentsXY(undefined, pointB, pointC);
204455
204460
  }
204456
- /** Accumulate integrals over the (triangular) areas from the origin to each line segment */
204461
+ /** Accumulate integrals over the (triangular) areas from the origin to each line segment. */
204457
204462
  handleLineString3d(ls) {
204458
204463
  const momentData = this._activeMomentData;
204459
204464
  momentData.accumulateTriangleToLineStringMomentsXY(undefined, ls.packedPoints);
204460
204465
  }
204461
- /** Accumulate integrals over the (triangular) area from the origin to this line segment */
204466
+ /** Accumulate integrals over the (triangular) area from the origin to this line segment. */
204462
204467
  handleLineSegment3d(segment) {
204463
204468
  const momentData = this._activeMomentData;
204464
204469
  segment.startPoint(this._point0);
@@ -204474,50 +204479,15 @@ class RegionMomentsXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
204474
204479
  this._activeMomentData = undefined;
204475
204480
  return momentData;
204476
204481
  }
204477
- /**
204478
- * ASSUMPTIONS FOR ORIENTATION AND CONTAINMENT ISSUES
204479
- * * Largest area is outer
204480
- * * All others are interior (and not overlapping)
204481
- * Hence
204482
- * * Outer area sign must be positive -- negate all integrations as needed
204483
- * * Outer area signs must be positive -- negate all integrations as needed
204484
- * @param region
204485
- */
204486
- handleParityRegion(region) {
204487
- const allChildMoments = [];
204488
- let maxAbsArea = 0.0;
204489
- let largestChildMoments;
204490
- for (const child of region.children) {
204491
- if (child instanceof _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop) {
204492
- const childMoments = this.handleLoop(child);
204493
- if (childMoments) {
204494
- allChildMoments.push(childMoments);
204495
- const q = Math.abs(childMoments.quantitySum);
204496
- if (q > maxAbsArea) {
204497
- maxAbsArea = q;
204498
- largestChildMoments = childMoments;
204499
- }
204500
- }
204501
- }
204502
- }
204503
- if (largestChildMoments) {
204504
- const summedMoments = _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_3__.MomentData.create();
204505
- const sign0 = largestChildMoments.signFactor(1.0);
204506
- summedMoments.accumulateProducts(largestChildMoments, sign0);
204507
- for (const childMoments of allChildMoments) {
204508
- if (childMoments !== largestChildMoments) {
204509
- const sign1 = childMoments.signFactor(-1.0);
204510
- summedMoments.accumulateProducts(childMoments, sign1);
204511
- }
204512
- }
204513
- return summedMoments;
204514
- }
204515
- return undefined;
204516
- }
204517
- /** Accumulate (as simple addition) products over each component of the union region. */
204518
- handleUnionRegion(region) {
204482
+ handleAnyRegion(region) {
204483
+ // guarantee there is no overlapping children
204484
+ const merged = _RegionOps__WEBPACK_IMPORTED_MODULE_4__.RegionOps.regionBooleanXY(region, undefined, _RegionOps__WEBPACK_IMPORTED_MODULE_4__.RegionBinaryOpType.Union);
204485
+ if (!merged)
204486
+ return undefined;
204487
+ if (merged instanceof _Loop__WEBPACK_IMPORTED_MODULE_5__.Loop)
204488
+ return this.handleLoop(merged);
204519
204489
  const summedMoments = _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_3__.MomentData.create();
204520
- for (const child of region.children) {
204490
+ for (const child of merged.children) {
204521
204491
  const childMoments = child.dispatchToGeometryHandler(this);
204522
204492
  if (childMoments) {
204523
204493
  const sign0 = childMoments.signFactor(1.0);
@@ -204526,32 +204496,46 @@ class RegionMomentsXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTED_MODU
204526
204496
  }
204527
204497
  return summedMoments;
204528
204498
  }
204499
+ /** Accumulate integrals from origin to the components of the parity region. */
204500
+ handleParityRegion(region) {
204501
+ return this.handleAnyRegion(region);
204502
+ }
204503
+ /** Accumulate integrals from origin to the components of the union region. */
204504
+ handleUnionRegion(region) {
204505
+ return this.handleAnyRegion(region);
204506
+ }
204529
204507
  _strokeOptions;
204530
204508
  getStrokeOptions() {
204531
204509
  if (this._strokeOptions)
204532
204510
  return this._strokeOptions;
204533
- const options = _StrokeOptions__WEBPACK_IMPORTED_MODULE_5__.StrokeOptions.createForCurves();
204511
+ const options = _StrokeOptions__WEBPACK_IMPORTED_MODULE_6__.StrokeOptions.createForCurves();
204534
204512
  // this is unusually fine for stroking, but appropriate for sum.
204535
204513
  options.angleTol = _geometry3d_Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createDegrees(5.0);
204536
204514
  this._strokeOptions = options;
204537
204515
  return options;
204538
204516
  }
204539
- /** Single curve primitive (not loop . . .).
204540
- * * stroke the curve
204541
- * * accumulate stroke array.
204517
+ /**
204518
+ * Handle a single curve primitive (not loop).
204519
+ * * Stroke the curve and accumulate stroke array.
204542
204520
  */
204543
204521
  handleCurvePrimitive(cp) {
204544
- const strokes = _LineString3d__WEBPACK_IMPORTED_MODULE_6__.LineString3d.create();
204522
+ const strokes = _LineString3d__WEBPACK_IMPORTED_MODULE_7__.LineString3d.create();
204545
204523
  const options = this.getStrokeOptions();
204546
204524
  cp.emitStrokes(strokes, options);
204547
204525
  this.handleLineString3d(strokes);
204548
204526
  }
204549
- /** handle strongly typed BSplineCurve3d as generic curve primitive */
204550
- handleBSplineCurve3d(g) { return this.handleCurvePrimitive(g); }
204551
- /** handle strongly typed BSplineCurve3dH as generic curve primitive */
204552
- handleBSplineCurve3dH(g) { return this.handleCurvePrimitive(g); }
204553
- /** handle strongly typed TransitionSpiral as generic curve primitive */
204554
- handleTransitionSpiral(g) { return this.handleCurvePrimitive(g); }
204527
+ /** Handle strongly typed BSplineCurve3d as generic curve primitive. */
204528
+ handleBSplineCurve3d(g) {
204529
+ this.handleCurvePrimitive(g);
204530
+ }
204531
+ /** Handle strongly typed BSplineCurve3dH as generic curve primitive. */
204532
+ handleBSplineCurve3dH(g) {
204533
+ this.handleCurvePrimitive(g);
204534
+ }
204535
+ /** Handle strongly typed TransitionSpiral as generic curve primitive. */
204536
+ handleTransitionSpiral(g) {
204537
+ this.handleCurvePrimitive(g);
204538
+ }
204555
204539
  }
204556
204540
 
204557
204541
 
@@ -204571,41 +204555,44 @@ __webpack_require__.r(__webpack_exports__);
204571
204555
  /* harmony export */ RegionOps: () => (/* binding */ RegionOps)
204572
204556
  /* harmony export */ });
204573
204557
  /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
204574
- /* harmony import */ var _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../geometry3d/GrowableXYZArray */ "../../core/geometry/lib/esm/geometry3d/GrowableXYZArray.js");
204575
- /* harmony import */ var _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geometry3d/IndexedXYZCollection */ "../../core/geometry/lib/esm/geometry3d/IndexedXYZCollection.js");
204576
- /* harmony import */ var _geometry3d_Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../geometry3d/Point3dArrayCarrier */ "../../core/geometry/lib/esm/geometry3d/Point3dArrayCarrier.js");
204577
- /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
204578
- /* harmony import */ var _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ../geometry3d/PolygonOps */ "../../core/geometry/lib/esm/geometry3d/PolygonOps.js");
204579
- /* harmony import */ var _geometry3d_PolylineCompressionByEdgeOffset__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../geometry3d/PolylineCompressionByEdgeOffset */ "../../core/geometry/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js");
204580
- /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
204581
- /* harmony import */ var _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ../geometry3d/SortablePolygon */ "../../core/geometry/lib/esm/geometry3d/SortablePolygon.js");
204582
- /* harmony import */ var _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ../geometry3d/Transform */ "../../core/geometry/lib/esm/geometry3d/Transform.js");
204558
+ /* harmony import */ var _geometry3d_FrameBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geometry3d/FrameBuilder */ "../../core/geometry/lib/esm/geometry3d/FrameBuilder.js");
204559
+ /* harmony import */ var _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../geometry3d/GrowableXYZArray */ "../../core/geometry/lib/esm/geometry3d/GrowableXYZArray.js");
204560
+ /* harmony import */ var _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geometry3d/IndexedXYZCollection */ "../../core/geometry/lib/esm/geometry3d/IndexedXYZCollection.js");
204561
+ /* harmony import */ var _geometry3d_Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ../geometry3d/Point3dArrayCarrier */ "../../core/geometry/lib/esm/geometry3d/Point3dArrayCarrier.js");
204562
+ /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
204563
+ /* harmony import */ var _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ../geometry3d/PolygonOps */ "../../core/geometry/lib/esm/geometry3d/PolygonOps.js");
204564
+ /* harmony import */ var _geometry3d_PolylineCompressionByEdgeOffset__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../geometry3d/PolylineCompressionByEdgeOffset */ "../../core/geometry/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js");
204565
+ /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
204566
+ /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
204567
+ /* harmony import */ var _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ../geometry3d/SortablePolygon */ "../../core/geometry/lib/esm/geometry3d/SortablePolygon.js");
204568
+ /* harmony import */ var _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ../geometry3d/Transform */ "../../core/geometry/lib/esm/geometry3d/Transform.js");
204583
204569
  /* harmony import */ var _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../geometry4d/MomentData */ "../../core/geometry/lib/esm/geometry4d/MomentData.js");
204584
- /* harmony import */ var _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../polyface/PolyfaceBuilder */ "../../core/geometry/lib/esm/polyface/PolyfaceBuilder.js");
204585
- /* harmony import */ var _topology_Graph__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../topology/Graph */ "../../core/geometry/lib/esm/topology/Graph.js");
204586
- /* harmony import */ var _topology_HalfEdgeGraphSearch__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../topology/HalfEdgeGraphSearch */ "../../core/geometry/lib/esm/topology/HalfEdgeGraphSearch.js");
204587
- /* harmony import */ var _topology_Merging__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ../topology/Merging */ "../../core/geometry/lib/esm/topology/Merging.js");
204588
- /* harmony import */ var _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../topology/Triangulation */ "../../core/geometry/lib/esm/topology/Triangulation.js");
204589
- /* harmony import */ var _CurveCollection__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./CurveCollection */ "../../core/geometry/lib/esm/curve/CurveCollection.js");
204590
- /* harmony import */ var _CurveCurve__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./CurveCurve */ "../../core/geometry/lib/esm/curve/CurveCurve.js");
204591
- /* harmony import */ var _CurveOps__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./CurveOps */ "../../core/geometry/lib/esm/curve/CurveOps.js");
204592
- /* harmony import */ var _CurvePrimitive__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./CurvePrimitive */ "../../core/geometry/lib/esm/curve/CurvePrimitive.js");
204570
+ /* harmony import */ var _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../polyface/PolyfaceBuilder */ "../../core/geometry/lib/esm/polyface/PolyfaceBuilder.js");
204571
+ /* harmony import */ var _topology_Graph__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../topology/Graph */ "../../core/geometry/lib/esm/topology/Graph.js");
204572
+ /* harmony import */ var _topology_HalfEdgeGraphSearch__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../topology/HalfEdgeGraphSearch */ "../../core/geometry/lib/esm/topology/HalfEdgeGraphSearch.js");
204573
+ /* harmony import */ var _topology_Merging__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ../topology/Merging */ "../../core/geometry/lib/esm/topology/Merging.js");
204574
+ /* harmony import */ var _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../topology/Triangulation */ "../../core/geometry/lib/esm/topology/Triangulation.js");
204575
+ /* harmony import */ var _CurveCollection__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./CurveCollection */ "../../core/geometry/lib/esm/curve/CurveCollection.js");
204576
+ /* harmony import */ var _CurveCurve__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./CurveCurve */ "../../core/geometry/lib/esm/curve/CurveCurve.js");
204577
+ /* harmony import */ var _CurveOps__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./CurveOps */ "../../core/geometry/lib/esm/curve/CurveOps.js");
204578
+ /* harmony import */ var _CurvePrimitive__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./CurvePrimitive */ "../../core/geometry/lib/esm/curve/CurvePrimitive.js");
204593
204579
  /* harmony import */ var _CurveWireMomentsXYZ__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./CurveWireMomentsXYZ */ "../../core/geometry/lib/esm/curve/CurveWireMomentsXYZ.js");
204594
- /* harmony import */ var _GeometryQuery__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./GeometryQuery */ "../../core/geometry/lib/esm/curve/GeometryQuery.js");
204595
- /* harmony import */ var _internalContexts_ChainCollectorContext__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./internalContexts/ChainCollectorContext */ "../../core/geometry/lib/esm/curve/internalContexts/ChainCollectorContext.js");
204596
- /* harmony import */ var _internalContexts_PolygonOffsetContext__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./internalContexts/PolygonOffsetContext */ "../../core/geometry/lib/esm/curve/internalContexts/PolygonOffsetContext.js");
204597
- /* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
204598
- /* harmony import */ var _Loop__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
204599
- /* harmony import */ var _OffsetOptions__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./OffsetOptions */ "../../core/geometry/lib/esm/curve/OffsetOptions.js");
204600
- /* harmony import */ var _ParityRegion__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ParityRegion */ "../../core/geometry/lib/esm/curve/ParityRegion.js");
204601
- /* harmony import */ var _Path__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./Path */ "../../core/geometry/lib/esm/curve/Path.js");
204602
- /* harmony import */ var _Query_ConsolidateAdjacentPrimitivesContext__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./Query/ConsolidateAdjacentPrimitivesContext */ "../../core/geometry/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js");
204603
- /* harmony import */ var _Query_CurveSplitContext__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Query/CurveSplitContext */ "../../core/geometry/lib/esm/curve/Query/CurveSplitContext.js");
204604
- /* harmony import */ var _Query_InOutTests__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Query/InOutTests */ "../../core/geometry/lib/esm/curve/Query/InOutTests.js");
204605
- /* harmony import */ var _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Query/PlanarSubdivision */ "../../core/geometry/lib/esm/curve/Query/PlanarSubdivision.js");
204580
+ /* harmony import */ var _GeometryQuery__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./GeometryQuery */ "../../core/geometry/lib/esm/curve/GeometryQuery.js");
204581
+ /* harmony import */ var _internalContexts_ChainCollectorContext__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./internalContexts/ChainCollectorContext */ "../../core/geometry/lib/esm/curve/internalContexts/ChainCollectorContext.js");
204582
+ /* harmony import */ var _internalContexts_PolygonOffsetContext__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./internalContexts/PolygonOffsetContext */ "../../core/geometry/lib/esm/curve/internalContexts/PolygonOffsetContext.js");
204583
+ /* harmony import */ var _internalContexts_TransferWithSplitArcs__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./internalContexts/TransferWithSplitArcs */ "../../core/geometry/lib/esm/curve/internalContexts/TransferWithSplitArcs.js");
204584
+ /* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
204585
+ /* harmony import */ var _Loop__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
204586
+ /* harmony import */ var _OffsetOptions__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./OffsetOptions */ "../../core/geometry/lib/esm/curve/OffsetOptions.js");
204587
+ /* harmony import */ var _ParityRegion__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./ParityRegion */ "../../core/geometry/lib/esm/curve/ParityRegion.js");
204588
+ /* harmony import */ var _Path__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Path */ "../../core/geometry/lib/esm/curve/Path.js");
204589
+ /* harmony import */ var _Query_ConsolidateAdjacentPrimitivesContext__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./Query/ConsolidateAdjacentPrimitivesContext */ "../../core/geometry/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js");
204590
+ /* harmony import */ var _Query_CurveSplitContext__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./Query/CurveSplitContext */ "../../core/geometry/lib/esm/curve/Query/CurveSplitContext.js");
204591
+ /* harmony import */ var _Query_InOutTests__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./Query/InOutTests */ "../../core/geometry/lib/esm/curve/Query/InOutTests.js");
204592
+ /* harmony import */ var _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Query/PlanarSubdivision */ "../../core/geometry/lib/esm/curve/Query/PlanarSubdivision.js");
204606
204593
  /* harmony import */ var _RegionMomentsXY__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./RegionMomentsXY */ "../../core/geometry/lib/esm/curve/RegionMomentsXY.js");
204607
- /* harmony import */ var _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./RegionOpsClassificationSweeps */ "../../core/geometry/lib/esm/curve/RegionOpsClassificationSweeps.js");
204608
- /* harmony import */ var _UnionRegion__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./UnionRegion */ "../../core/geometry/lib/esm/curve/UnionRegion.js");
204594
+ /* harmony import */ var _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./RegionOpsClassificationSweeps */ "../../core/geometry/lib/esm/curve/RegionOpsClassificationSweeps.js");
204595
+ /* harmony import */ var _UnionRegion__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./UnionRegion */ "../../core/geometry/lib/esm/curve/UnionRegion.js");
204609
204596
  /*---------------------------------------------------------------------------------------------
204610
204597
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
204611
204598
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -204645,6 +204632,9 @@ __webpack_require__.r(__webpack_exports__);
204645
204632
 
204646
204633
 
204647
204634
 
204635
+
204636
+
204637
+
204648
204638
 
204649
204639
 
204650
204640
 
@@ -204676,13 +204666,16 @@ var RegionBinaryOpType;
204676
204666
  class RegionOps {
204677
204667
  /**
204678
204668
  * Return moment sums for a loop, parity region, or union region.
204669
+ * * The input region should lie in a plane parallel to the xy-plane, as z-coords will be ignored.
204679
204670
  * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with
204680
- * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`
204681
- * @param root any Loop, ParityRegion, or UnionRegion.
204671
+ * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes(rawMomentData.origin, rawMomentData.sums);`
204672
+ * * `rawMomentData.origin` is the centroid of `region`.
204673
+ * * `rawMomentData.sums.weight()` is the signed area of `region`.
204674
+ * @param region any [[Loop]], [[ParityRegion]], or [[UnionRegion]].
204682
204675
  */
204683
- static computeXYAreaMoments(root) {
204676
+ static computeXYAreaMoments(region) {
204684
204677
  const handler = new _RegionMomentsXY__WEBPACK_IMPORTED_MODULE_0__.RegionMomentsXY();
204685
- const result = root.dispatchToGeometryHandler(handler);
204678
+ const result = region.dispatchToGeometryHandler(handler);
204686
204679
  if (result instanceof _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_1__.MomentData) {
204687
204680
  result.shiftOriginAndSumsToCentroidOfSums();
204688
204681
  return result;
@@ -204691,8 +204684,8 @@ class RegionOps {
204691
204684
  }
204692
204685
  /**
204693
204686
  * Return an area tolerance for a given xy-range and optional distance tolerance.
204694
- * @param range range of planar region to tolerance
204695
- * @param distanceTolerance optional absolute distance tolerance
204687
+ * @param range range of planar region to tolerance.
204688
+ * @param distanceTolerance optional absolute distance tolerance.
204696
204689
  */
204697
204690
  static computeXYAreaTolerance(range, distanceTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance) {
204698
204691
  // 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).
@@ -204701,19 +204694,13 @@ class RegionOps {
204701
204694
  }
204702
204695
  /**
204703
204696
  * Return a (signed) xy area for a region.
204704
- <<<<<<< HEAD
204705
- * * The area is negative if and only if the region is oriented clockwise with respect to the positive z-axis.
204706
- * @param root any Loop, ParityRegion, or UnionRegion.
204707
- =======
204708
204697
  * * The input region should lie in a plane parallel to the xy-plane, as z-coords will be ignored.
204709
- * * For a non-self-intersecting Loop, the returned area is negative if and only if the Loop is oriented clockwise
204710
- * with respect to the positive z-axis.
204698
+ * * The area is negative if and only if the region is oriented clockwise with respect to the positive z-axis.
204711
204699
  * @param region any [[Loop]], [[ParityRegion]], or [[UnionRegion]].
204712
- >>>>>>> 168574b454 (Utilize `PolyfaceData.edgeMateIndex` to speed up some `Polyface` methods (#8095))
204713
204700
  */
204714
- static computeXYArea(root) {
204701
+ static computeXYArea(region) {
204715
204702
  const handler = new _RegionMomentsXY__WEBPACK_IMPORTED_MODULE_0__.RegionMomentsXY();
204716
- const result = root.dispatchToGeometryHandler(handler);
204703
+ const result = region.dispatchToGeometryHandler(handler);
204717
204704
  if (result instanceof _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_1__.MomentData) {
204718
204705
  return result.quantitySum;
204719
204706
  }
@@ -204721,49 +204708,88 @@ class RegionOps {
204721
204708
  }
204722
204709
  /**
204723
204710
  * Return MomentData with the sums of wire moments.
204711
+ * * The input curve should lie in a plane parallel to the xy-plane, as z-coords will be ignored.
204724
204712
  * * If `rawMomentData` is the MomentData returned by computeXYAreaMoments, convert to principal axes and moments with
204725
- * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`
204726
- * @param root any CurveCollection or CurvePrimitive.
204713
+ * call `principalMomentData = MomentData.inertiaProductsToPrincipalAxes (rawMomentData.origin, rawMomentData.sums);`
204714
+ * * `rawMomentData.origin` is the wire centroid of `curve`.
204715
+ * * `rawMomentData.sums.weight()` is the signed length of `curve`.
204716
+ * @param curve any [[CurveCollection]] or [[CurvePrimitive]].
204727
204717
  */
204728
- static computeXYZWireMomentSums(root) {
204718
+ static computeXYZWireMomentSums(curve) {
204729
204719
  const handler = new _CurveWireMomentsXYZ__WEBPACK_IMPORTED_MODULE_3__.CurveWireMomentsXYZ();
204730
- handler.visitLeaves(root);
204720
+ handler.visitLeaves(curve);
204731
204721
  const result = handler.momentData;
204732
204722
  result.shiftOriginAndSumsToCentroidOfSums();
204733
204723
  return result;
204734
204724
  }
204725
+ /**
204726
+ * Return a [[Ray3d]] with:
204727
+ * * `origin` is the centroid of the region,
204728
+ * * `direction` is a unit vector perpendicular to the region plane,
204729
+ * * `a` is the region area.
204730
+ * @param region the region to process. Can lie in any plane.
204731
+ * @param result optional pre-allocated result to populate and return.
204732
+ */
204733
+ static centroidAreaNormal(region, result) {
204734
+ const localToWorld = _geometry3d_FrameBuilder__WEBPACK_IMPORTED_MODULE_4__.FrameBuilder.createRightHandedFrame(undefined, region);
204735
+ if (!localToWorld)
204736
+ return undefined;
204737
+ const normal = localToWorld.matrix.columnZ(result?.direction);
204738
+ const regionIsXY = normal.isParallelTo(_geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Vector3d.unitZ(), true);
204739
+ let regionXY = region;
204740
+ if (!regionIsXY) { // rotate the region to be parallel to the xy-plane
204741
+ regionXY = region.cloneTransformed(localToWorld.inverse());
204742
+ if (!regionXY)
204743
+ return undefined;
204744
+ }
204745
+ const momentData = RegionOps.computeXYAreaMoments(regionXY);
204746
+ if (!momentData)
204747
+ return undefined;
204748
+ const centroid = momentData.origin.clone(result?.origin);
204749
+ if (!regionIsXY) // rotate centroid back (area is unchanged)
204750
+ localToWorld.multiplyPoint3d(centroid, centroid);
204751
+ let area = momentData.sums.weight();
204752
+ if (area < 0.0) {
204753
+ area = -area;
204754
+ normal.scale(-1.0, normal);
204755
+ }
204756
+ if (!result)
204757
+ result = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_6__.Ray3d.createCapture(centroid, normal);
204758
+ result.a = area;
204759
+ return result;
204760
+ }
204735
204761
  /**
204736
204762
  * Create loops in the graph.
204737
204763
  * @internal
204738
204764
  */
204739
204765
  static addLoopsToGraph(graph, data, announceIsolatedLoop) {
204740
- if (data instanceof _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop) {
204766
+ if (data instanceof _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop) {
204741
204767
  const points = data.getPackedStrokes();
204742
204768
  if (points)
204743
204769
  this.addLoopsToGraph(graph, points, announceIsolatedLoop);
204744
204770
  }
204745
- else if (data instanceof _ParityRegion__WEBPACK_IMPORTED_MODULE_5__.ParityRegion) {
204771
+ else if (data instanceof _ParityRegion__WEBPACK_IMPORTED_MODULE_8__.ParityRegion) {
204746
204772
  for (const child of data.children) {
204747
204773
  const points = child.getPackedStrokes();
204748
204774
  if (points)
204749
204775
  this.addLoopsToGraph(graph, points, announceIsolatedLoop);
204750
204776
  }
204751
204777
  }
204752
- else if (data instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__.IndexedXYZCollection) {
204753
- const loopSeed = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.directCreateFaceLoopFromCoordinates(graph, data);
204778
+ else if (data instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_9__.IndexedXYZCollection) {
204779
+ const loopSeed = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.directCreateFaceLoopFromCoordinates(graph, data);
204754
204780
  if (loopSeed !== undefined)
204755
204781
  announceIsolatedLoop(graph, loopSeed);
204756
204782
  }
204757
204783
  else if (Array.isArray(data)) {
204758
204784
  if (data.length > 0) {
204759
- if (_geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_8__.Point3d.isAnyImmediatePointType(data[0])) {
204760
- const loopSeed = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.directCreateFaceLoopFromCoordinates(graph, data);
204785
+ if (_geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d.isAnyImmediatePointType(data[0])) {
204786
+ const loopSeed = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.directCreateFaceLoopFromCoordinates(graph, data);
204761
204787
  if (loopSeed !== undefined)
204762
204788
  announceIsolatedLoop(graph, loopSeed);
204763
204789
  }
204764
- else if (data[0] instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__.IndexedXYZCollection) {
204790
+ else if (data[0] instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_9__.IndexedXYZCollection) {
204765
204791
  for (const loop of data) {
204766
- const loopSeed = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.directCreateFaceLoopFromCoordinates(graph, loop);
204792
+ const loopSeed = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.directCreateFaceLoopFromCoordinates(graph, loop);
204767
204793
  if (loopSeed !== undefined)
204768
204794
  announceIsolatedLoop(graph, loopSeed);
204769
204795
  }
@@ -204803,10 +204829,10 @@ class RegionOps {
204803
204829
  static finishGraphToPolyface(graph, triangulate) {
204804
204830
  if (graph) {
204805
204831
  if (triangulate) {
204806
- _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.triangulateAllPositiveAreaFaces(graph);
204807
- _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.flipTriangles(graph);
204832
+ _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.triangulateAllPositiveAreaFaces(graph);
204833
+ _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.flipTriangles(graph);
204808
204834
  }
204809
- return _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_9__.PolyfaceBuilder.graphToPolyface(graph);
204835
+ return _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_11__.PolyfaceBuilder.graphToPolyface(graph);
204810
204836
  }
204811
204837
  return undefined;
204812
204838
  }
@@ -204820,7 +204846,7 @@ class RegionOps {
204820
204846
  * @param triangulate whether to triangulate the result
204821
204847
  */
204822
204848
  static polygonXYAreaIntersectLoopsToPolyface(loopsA, loopsB, triangulate = false) {
204823
- const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB, (inA, inB) => (inA && inB), this._graphCheckPointFunction);
204849
+ const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB, (inA, inB) => (inA && inB), this._graphCheckPointFunction);
204824
204850
  return this.finishGraphToPolyface(graph, triangulate);
204825
204851
  }
204826
204852
  /**
@@ -204833,7 +204859,7 @@ class RegionOps {
204833
204859
  * @param triangulate whether to triangulate the result
204834
204860
  */
204835
204861
  static polygonXYAreaUnionLoopsToPolyface(loopsA, loopsB, triangulate = false) {
204836
- const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB, (inA, inB) => (inA || inB), this._graphCheckPointFunction);
204862
+ const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB, (inA, inB) => (inA || inB), this._graphCheckPointFunction);
204837
204863
  return this.finishGraphToPolyface(graph, triangulate);
204838
204864
  }
204839
204865
  /**
@@ -204846,9 +204872,31 @@ class RegionOps {
204846
204872
  * @param triangulate whether to triangulate the result
204847
204873
  */
204848
204874
  static polygonXYAreaDifferenceLoopsToPolyface(loopsA, loopsB, triangulate = false) {
204849
- const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB, (inA, inB) => (inA && !inB), this._graphCheckPointFunction);
204875
+ const graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionOpsFaceToFaceSearch.doPolygonBoolean(loopsA, loopsB, (inA, inB) => (inA && !inB), this._graphCheckPointFunction);
204850
204876
  return this.finishGraphToPolyface(graph, triangulate);
204851
204877
  }
204878
+ /**
204879
+ * Simplify the type of the region by stripping redundant parent(s).
204880
+ * * No Boolean operations are performed.
204881
+ * * Invalid inputs (such as childless regions) are not corrected.
204882
+ * @param region region to simplify
204883
+ * @returns
204884
+ * * For a [[UnionRegion]] with exactly one child, return it if it is a [[Loop]],
204885
+ * or if it is a [[ParityRegion]] with multiple children, otherwise return the `ParityRegion`'s `Loop`.
204886
+ * * For a `ParityRegion` with exactly one `Loop`, return it.
204887
+ * * All other inputs returned unchanged.
204888
+ */
204889
+ static simplifyRegionType(region) {
204890
+ if (region instanceof _UnionRegion__WEBPACK_IMPORTED_MODULE_13__.UnionRegion) {
204891
+ if (region.children.length === 1)
204892
+ return this.simplifyRegionType(region.children[0]);
204893
+ }
204894
+ else if (region instanceof _ParityRegion__WEBPACK_IMPORTED_MODULE_8__.ParityRegion) {
204895
+ if (region.children.length === 1)
204896
+ return region.children[0];
204897
+ }
204898
+ return region;
204899
+ }
204852
204900
  /**
204853
204901
  * Return areas defined by a boolean operation.
204854
204902
  * @note For best results, input regions should have correctly oriented loops. See [[sortOuterAndHoleLoopsXY]].
@@ -204862,10 +204910,8 @@ class RegionOps {
204862
204910
  * to connect interior loops to exterior loops.
204863
204911
  */
204864
204912
  static regionBooleanXY(loopsA, loopsB, operation, mergeTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance) {
204865
- // Always return UnionRegion for now. But keep return type as AnyRegion:
204866
- // in the future, we might return the *simplest* region type.
204867
- const result = _UnionRegion__WEBPACK_IMPORTED_MODULE_11__.UnionRegion.create();
204868
- const context = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionBooleanContext.create(_RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionGroupOpType.Union, _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionGroupOpType.Union);
204913
+ const result = _UnionRegion__WEBPACK_IMPORTED_MODULE_13__.UnionRegion.create();
204914
+ const context = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionBooleanContext.create(_RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionGroupOpType.Union, _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionGroupOpType.Union);
204869
204915
  context.addMembers(loopsA, loopsB);
204870
204916
  context.annotateAndMergeCurvesInGraph(mergeTolerance);
204871
204917
  const range = context.groupA.range().union(context.groupB.range());
@@ -204877,12 +204923,12 @@ class RegionOps {
204877
204923
  if (Math.abs(area) < areaTol)
204878
204924
  return;
204879
204925
  if (faceType === 1) {
204880
- const loop = _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_12__.PlanarSubdivision.createLoopInFace(face);
204926
+ const loop = _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_14__.PlanarSubdivision.createLoopInFace(face);
204881
204927
  if (loop)
204882
204928
  result.tryAddChild(loop);
204883
204929
  }
204884
204930
  });
204885
- return result;
204931
+ return result ? this.simplifyRegionType(result) : undefined;
204886
204932
  }
204887
204933
  /**
204888
204934
  * Return a polyface whose facets are a boolean operation between the input regions.
@@ -204897,7 +204943,7 @@ class RegionOps {
204897
204943
  * @param triangulate whether to triangulate the result
204898
204944
  */
204899
204945
  static polygonBooleanXYToPolyface(inputA, operation, inputB, triangulate = false) {
204900
- 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);
204946
+ 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);
204901
204947
  return this.finishGraphToPolyface(graph, triangulate);
204902
204948
  }
204903
204949
  /**
@@ -204912,18 +204958,18 @@ class RegionOps {
204912
204958
  * @param inputB second set of loops
204913
204959
  */
204914
204960
  static polygonBooleanXYToLoops(inputA, operation, inputB) {
204915
- 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);
204961
+ 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);
204916
204962
  if (!graph)
204917
204963
  return undefined;
204918
- const loopEdges = _topology_HalfEdgeGraphSearch__WEBPACK_IMPORTED_MODULE_13__.HalfEdgeGraphSearch.collectExtendedBoundaryLoopsInGraph(graph, _topology_Graph__WEBPACK_IMPORTED_MODULE_14__.HalfEdgeMask.EXTERIOR);
204964
+ const loopEdges = _topology_HalfEdgeGraphSearch__WEBPACK_IMPORTED_MODULE_15__.HalfEdgeGraphSearch.collectExtendedBoundaryLoopsInGraph(graph, _topology_Graph__WEBPACK_IMPORTED_MODULE_16__.HalfEdgeMask.EXTERIOR);
204919
204965
  const allLoops = [];
204920
204966
  for (const graphLoop of loopEdges) {
204921
- const points = new _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__.GrowableXYZArray();
204967
+ const points = new _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_17__.GrowableXYZArray();
204922
204968
  for (const edge of graphLoop)
204923
204969
  points.pushXYZ(edge.x, edge.y, edge.z);
204924
204970
  points.pushWrap(1);
204925
- const loop = _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop.create();
204926
- loop.tryAddChild(_LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d.createCapture(points));
204971
+ const loop = _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop.create();
204972
+ loop.tryAddChild(_LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d.createCapture(points));
204927
204973
  allLoops.push(loop);
204928
204974
  }
204929
204975
  return RegionOps.sortOuterAndHoleLoopsXY(allLoops);
@@ -204941,7 +204987,7 @@ class RegionOps {
204941
204987
  * object.
204942
204988
  */
204943
204989
  static constructPolygonWireXYOffset(points, wrap, offsetDistanceOrOptions) {
204944
- const context = new _internalContexts_PolygonOffsetContext__WEBPACK_IMPORTED_MODULE_17__.PolygonWireOffsetContext();
204990
+ const context = new _internalContexts_PolygonOffsetContext__WEBPACK_IMPORTED_MODULE_19__.PolygonWireOffsetContext();
204945
204991
  return context.constructPolygonWireXYOffset(points, wrap, offsetDistanceOrOptions);
204946
204992
  }
204947
204993
  /**
@@ -204953,8 +204999,8 @@ class RegionOps {
204953
204999
  * @param offsetDistanceOrOptions offset distance (positive to left of curve, negative to right) or options object.
204954
205000
  */
204955
205001
  static constructCurveXYOffset(curves, offsetDistanceOrOptions) {
204956
- const offsetOptions = _OffsetOptions__WEBPACK_IMPORTED_MODULE_18__.OffsetOptions.create(offsetDistanceOrOptions);
204957
- return _CurveOps__WEBPACK_IMPORTED_MODULE_19__.CurveOps.constructCurveXYOffset(curves, offsetOptions);
205002
+ const offsetOptions = _OffsetOptions__WEBPACK_IMPORTED_MODULE_20__.OffsetOptions.create(offsetDistanceOrOptions);
205003
+ return _CurveOps__WEBPACK_IMPORTED_MODULE_21__.CurveOps.constructCurveXYOffset(curves, offsetOptions);
204958
205004
  }
204959
205005
  /**
204960
205006
  * Test if point (x,y) is IN, OUT or ON a region.
@@ -204964,7 +205010,7 @@ class RegionOps {
204964
205010
  * @param y y coordinate of point to test
204965
205011
  */
204966
205012
  static testPointInOnOutRegionXY(curves, x, y) {
204967
- return _Query_InOutTests__WEBPACK_IMPORTED_MODULE_20__.PointInOnOutContext.testPointInOnOutRegionXY(curves, x, y);
205013
+ return _Query_InOutTests__WEBPACK_IMPORTED_MODULE_22__.PointInOnOutContext.testPointInOnOutRegionXY(curves, x, y);
204968
205014
  }
204969
205015
  /**
204970
205016
  * Create curve collection of subtype determined by gaps between the input curves.
@@ -204988,11 +205034,11 @@ class RegionOps {
204988
205034
  maxGap = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.maxXY(maxGap, curves[i].endPoint().distance(curves[i + 1].startPoint()));
204989
205035
  let collection;
204990
205036
  if (_Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isSmallMetricDistance(maxGap)) {
204991
- collection = wrap ? _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop.create() : _Path__WEBPACK_IMPORTED_MODULE_21__.Path.create();
205037
+ collection = wrap ? _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop.create() : _Path__WEBPACK_IMPORTED_MODULE_23__.Path.create();
204992
205038
  isPath = true;
204993
205039
  }
204994
205040
  else {
204995
- collection = _CurveCollection__WEBPACK_IMPORTED_MODULE_22__.BagOfCurves.create();
205041
+ collection = _CurveCollection__WEBPACK_IMPORTED_MODULE_24__.BagOfCurves.create();
204996
205042
  }
204997
205043
  for (const c of curves)
204998
205044
  collection.tryAddChild(c);
@@ -205018,7 +205064,7 @@ class RegionOps {
205018
205064
  * @param cutterCurves input curves to intersect with `curvesToCut`
205019
205065
  */
205020
205066
  static cloneCurvesWithXYSplits(curvesToCut, cutterCurves) {
205021
- return _Query_CurveSplitContext__WEBPACK_IMPORTED_MODULE_23__.CurveSplitContext.cloneCurvesWithXYSplits(curvesToCut, cutterCurves);
205067
+ return _Query_CurveSplitContext__WEBPACK_IMPORTED_MODULE_25__.CurveSplitContext.cloneCurvesWithXYSplits(curvesToCut, cutterCurves);
205022
205068
  }
205023
205069
  /**
205024
205070
  * Create paths assembled from many curves.
@@ -205029,11 +205075,11 @@ class RegionOps {
205029
205075
  static splitToPathsBetweenBreaks(source, makeClones) {
205030
205076
  if (source === undefined)
205031
205077
  return undefined;
205032
- if (source instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_24__.CurvePrimitive)
205078
+ if (source instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_26__.CurvePrimitive)
205033
205079
  return source;
205034
205080
  // source is a collection . ..
205035
205081
  const primitives = source.collectCurvePrimitives();
205036
- const chainCollector = new _internalContexts_ChainCollectorContext__WEBPACK_IMPORTED_MODULE_25__.ChainCollectorContext(makeClones);
205082
+ const chainCollector = new _internalContexts_ChainCollectorContext__WEBPACK_IMPORTED_MODULE_27__.ChainCollectorContext(makeClones);
205037
205083
  for (const primitive of primitives) {
205038
205084
  chainCollector.announceCurvePrimitive(primitive);
205039
205085
  }
@@ -205049,7 +205095,7 @@ class RegionOps {
205049
205095
  * @returns object with named chains, insideOffsets, outsideOffsets
205050
205096
  */
205051
205097
  static collectInsideAndOutsideOffsets(fragments, offsetDistance, gapTolerance) {
205052
- return _CurveOps__WEBPACK_IMPORTED_MODULE_19__.CurveOps.collectInsideAndOutsideXYOffsets(fragments, offsetDistance, gapTolerance);
205098
+ return _CurveOps__WEBPACK_IMPORTED_MODULE_21__.CurveOps.collectInsideAndOutsideXYOffsets(fragments, offsetDistance, gapTolerance);
205053
205099
  }
205054
205100
  /**
205055
205101
  * Restructure curve fragments as Paths and Loops.
@@ -205058,7 +205104,7 @@ class RegionOps {
205058
205104
  * @returns chains, possibly wrapped in a [[BagOfCurves]].
205059
205105
  */
205060
205106
  static collectChains(fragments, gapTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance) {
205061
- return _CurveOps__WEBPACK_IMPORTED_MODULE_19__.CurveOps.collectChains(fragments, gapTolerance);
205107
+ return _CurveOps__WEBPACK_IMPORTED_MODULE_21__.CurveOps.collectChains(fragments, gapTolerance);
205062
205108
  }
205063
205109
  /**
205064
205110
  * Find all intersections among curves in `curvesToCut` against the boundaries of `region` and return fragments
@@ -205070,17 +205116,17 @@ class RegionOps {
205070
205116
  const result = { insideParts: [], outsideParts: [], coincidentParts: [] };
205071
205117
  const pathWithIntersectionMarkup = RegionOps.cloneCurvesWithXYSplits(curvesToCut, region);
205072
205118
  const splitPaths = RegionOps.splitToPathsBetweenBreaks(pathWithIntersectionMarkup, true);
205073
- if (splitPaths instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_22__.CurveCollection) {
205119
+ if (splitPaths instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_24__.CurveCollection) {
205074
205120
  for (const child of splitPaths.children) {
205075
- const pointOnChild = _CurveCollection__WEBPACK_IMPORTED_MODULE_22__.CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(child);
205121
+ const pointOnChild = _CurveCollection__WEBPACK_IMPORTED_MODULE_24__.CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(child);
205076
205122
  if (pointOnChild) {
205077
205123
  const inOnOut = RegionOps.testPointInOnOutRegionXY(region, pointOnChild.point.x, pointOnChild.point.y);
205078
205124
  pushToInOnOutArrays(child, inOnOut, result.outsideParts, result.coincidentParts, result.insideParts);
205079
205125
  }
205080
205126
  }
205081
205127
  }
205082
- else if (splitPaths instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_24__.CurvePrimitive) {
205083
- const pointOnChild = _CurveCollection__WEBPACK_IMPORTED_MODULE_22__.CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(splitPaths);
205128
+ else if (splitPaths instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_26__.CurvePrimitive) {
205129
+ const pointOnChild = _CurveCollection__WEBPACK_IMPORTED_MODULE_24__.CurveCollection.createCurveLocationDetailOnAnyCurvePrimitive(splitPaths);
205084
205130
  if (pointOnChild) {
205085
205131
  const inOnOut = RegionOps.testPointInOnOutRegionXY(region, pointOnChild.point.x, pointOnChild.point.y);
205086
205132
  pushToInOnOutArrays(splitPaths, inOnOut, result.outsideParts, result.coincidentParts, result.insideParts);
@@ -205104,10 +205150,10 @@ class RegionOps {
205104
205150
  * normal in z column. If not a rectangle, return undefined.
205105
205151
  */
205106
205152
  static rectangleEdgeTransform(data, requireClosurePoint = true) {
205107
- if (data instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d) {
205153
+ if (data instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d) {
205108
205154
  return this.rectangleEdgeTransform(data.packedPoints);
205109
205155
  }
205110
- else if (data instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__.IndexedXYZCollection) {
205156
+ else if (data instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_9__.IndexedXYZCollection) {
205111
205157
  let dataToUse;
205112
205158
  if (requireClosurePoint && data.length === 5) {
205113
205159
  if (!_Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isSmallMetricDistance(data.distanceIndexIndex(0, 4)))
@@ -205121,8 +205167,8 @@ class RegionOps {
205121
205167
  return undefined;
205122
205168
  }
205123
205169
  else {
205124
- dataToUse = _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__.GrowableXYZArray.create(data);
205125
- _geometry3d_PolylineCompressionByEdgeOffset__WEBPACK_IMPORTED_MODULE_26__.PolylineCompressionContext.compressInPlaceByShortEdgeLength(dataToUse, _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance);
205170
+ dataToUse = _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_17__.GrowableXYZArray.create(data);
205171
+ _geometry3d_PolylineCompressionByEdgeOffset__WEBPACK_IMPORTED_MODULE_28__.PolylineCompressionContext.compressInPlaceByShortEdgeLength(dataToUse, _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance);
205126
205172
  if (dataToUse.length < (requireClosurePoint ? 5 : 4))
205127
205173
  return undefined;
205128
205174
  }
@@ -205133,19 +205179,19 @@ class RegionOps {
205133
205179
  if (normalVector.normalizeInPlace()
205134
205180
  && vector12.isAlmostEqual(vector03)
205135
205181
  && vector01.isPerpendicularTo(vector03)) {
205136
- return _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_27__.Transform.createOriginAndMatrixColumns(dataToUse.getPoint3dAtUncheckedPointIndex(0), vector01, vector03, normalVector);
205182
+ return _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_29__.Transform.createOriginAndMatrixColumns(dataToUse.getPoint3dAtUncheckedPointIndex(0), vector01, vector03, normalVector);
205137
205183
  }
205138
205184
  }
205139
205185
  else if (Array.isArray(data)) {
205140
- return this.rectangleEdgeTransform(new _geometry3d_Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_28__.Point3dArrayCarrier(data), requireClosurePoint);
205186
+ return this.rectangleEdgeTransform(new _geometry3d_Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_30__.Point3dArrayCarrier(data), requireClosurePoint);
205141
205187
  }
205142
- else if (data instanceof _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop && data.children.length === 1 && data.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d) {
205188
+ else if (data instanceof _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop && data.children.length === 1 && data.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d) {
205143
205189
  return this.rectangleEdgeTransform(data.children[0].packedPoints, true);
205144
205190
  }
205145
- else if (data instanceof _Path__WEBPACK_IMPORTED_MODULE_21__.Path && data.children.length === 1 && data.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d) {
205191
+ else if (data instanceof _Path__WEBPACK_IMPORTED_MODULE_23__.Path && data.children.length === 1 && data.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d) {
205146
205192
  return this.rectangleEdgeTransform(data.children[0].packedPoints, requireClosurePoint);
205147
205193
  }
205148
- else if (data instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_22__.CurveChain) {
205194
+ else if (data instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_24__.CurveChain) {
205149
205195
  if (!data.checkForNonLinearPrimitives()) {
205150
205196
  // const linestring = LineString3d.create();
205151
205197
  const strokes = data.getPackedStrokes();
@@ -205169,7 +205215,7 @@ class RegionOps {
205169
205215
  * @param options options for tolerance and selective simplification.
205170
205216
  */
205171
205217
  static consolidateAdjacentPrimitives(curves, options) {
205172
- const context = new _Query_ConsolidateAdjacentPrimitivesContext__WEBPACK_IMPORTED_MODULE_29__.ConsolidateAdjacentCurvePrimitivesContext(options);
205218
+ const context = new _Query_ConsolidateAdjacentPrimitivesContext__WEBPACK_IMPORTED_MODULE_31__.ConsolidateAdjacentCurvePrimitivesContext(options);
205173
205219
  curves.dispatchToGeometryHandler(context);
205174
205220
  }
205175
205221
  /**
@@ -205188,14 +205234,14 @@ class RegionOps {
205188
205234
  static sortOuterAndHoleLoopsXY(loops) {
205189
205235
  const loopAndArea = [];
205190
205236
  for (const candidate of loops) {
205191
- if (candidate instanceof _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop)
205192
- _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_30__.SortablePolygon.pushLoop(loopAndArea, candidate);
205193
- else if (candidate instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__.IndexedXYZCollection) {
205194
- const loop = _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop.createPolygon(candidate);
205195
- _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_30__.SortablePolygon.pushLoop(loopAndArea, loop);
205237
+ if (candidate instanceof _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop)
205238
+ _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_32__.SortablePolygon.pushLoop(loopAndArea, candidate);
205239
+ else if (candidate instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_9__.IndexedXYZCollection) {
205240
+ const loop = _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop.createPolygon(candidate);
205241
+ _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_32__.SortablePolygon.pushLoop(loopAndArea, loop);
205196
205242
  }
205197
205243
  }
205198
- return _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_30__.SortablePolygon.sortAsAnyRegion(loopAndArea);
205244
+ return _geometry3d_SortablePolygon__WEBPACK_IMPORTED_MODULE_32__.SortablePolygon.sortAsAnyRegion(loopAndArea);
205199
205245
  }
205200
205246
  /**
205201
205247
  * Find all xy-areas bounded by the unstructured, possibly intersecting curves.
@@ -205218,12 +205264,13 @@ class RegionOps {
205218
205264
  * to the edge and a constituent curve in each.
205219
205265
  */
205220
205266
  static constructAllXYRegionLoops(curvesAndRegions, tolerance = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance) {
205221
- const primitives = RegionOps.collectCurvePrimitives(curvesAndRegions, undefined, true, true);
205267
+ let primitives = RegionOps.collectCurvePrimitives(curvesAndRegions, undefined, true, true);
205268
+ primitives = _internalContexts_TransferWithSplitArcs__WEBPACK_IMPORTED_MODULE_33__.TransferWithSplitArcs.clone(_CurveCollection__WEBPACK_IMPORTED_MODULE_24__.BagOfCurves.create(...primitives)).children;
205222
205269
  const range = this.curveArrayRange(primitives);
205223
205270
  const areaTol = this.computeXYAreaTolerance(range, tolerance);
205224
- const intersections = _CurveCurve__WEBPACK_IMPORTED_MODULE_31__.CurveCurve.allIntersectionsAmongPrimitivesXY(primitives, tolerance);
205225
- const graph = _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_12__.PlanarSubdivision.assembleHalfEdgeGraph(primitives, intersections, tolerance);
205226
- return _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_12__.PlanarSubdivision.collectSignedLoopSetsInHalfEdgeGraph(graph, areaTol);
205271
+ const intersections = _CurveCurve__WEBPACK_IMPORTED_MODULE_34__.CurveCurve.allIntersectionsAmongPrimitivesXY(primitives, tolerance);
205272
+ const graph = _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_14__.PlanarSubdivision.assembleHalfEdgeGraph(primitives, intersections, tolerance);
205273
+ return _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_14__.PlanarSubdivision.collectSignedLoopSetsInHalfEdgeGraph(graph, areaTol);
205227
205274
  }
205228
205275
  /**
205229
205276
  * Collect all `CurvePrimitives` in loosely typed input.
@@ -205238,10 +205285,10 @@ class RegionOps {
205238
205285
  */
205239
205286
  static collectCurvePrimitives(candidates, collectorArray, smallestPossiblePrimitives = false, explodeLinestrings = false) {
205240
205287
  const results = collectorArray === undefined ? [] : collectorArray;
205241
- if (candidates instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_24__.CurvePrimitive) {
205288
+ if (candidates instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_26__.CurvePrimitive) {
205242
205289
  candidates.collectCurvePrimitives(results, smallestPossiblePrimitives, explodeLinestrings);
205243
205290
  }
205244
- else if (candidates instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_22__.CurveCollection) {
205291
+ else if (candidates instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_24__.CurveCollection) {
205245
205292
  candidates.collectCurvePrimitives(results, smallestPossiblePrimitives, explodeLinestrings);
205246
205293
  }
205247
205294
  else if (Array.isArray(candidates)) {
@@ -205260,7 +205307,7 @@ class RegionOps {
205260
205307
  static expandLineStrings(candidates) {
205261
205308
  const result = [];
205262
205309
  for (const c of candidates) {
205263
- if (c instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d) {
205310
+ if (c instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d) {
205264
205311
  for (let i = 0; i + 1 < c.packedPoints.length; i++) {
205265
205312
  const q = c.getIndexedSegment(i);
205266
205313
  if (q !== undefined)
@@ -205279,16 +205326,16 @@ class RegionOps {
205279
205326
  * @param worldToLocal transform to apply to data before computing its range
205280
205327
  */
205281
205328
  static curveArrayRange(data, worldToLocal) {
205282
- const range = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_32__.Range3d.create();
205283
- if (data instanceof _GeometryQuery__WEBPACK_IMPORTED_MODULE_33__.GeometryQuery)
205329
+ const range = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_35__.Range3d.create();
205330
+ if (data instanceof _GeometryQuery__WEBPACK_IMPORTED_MODULE_36__.GeometryQuery)
205284
205331
  data.extendRange(range, worldToLocal);
205285
205332
  else if (Array.isArray(data)) {
205286
205333
  for (const c of data) {
205287
- if (c instanceof _GeometryQuery__WEBPACK_IMPORTED_MODULE_33__.GeometryQuery)
205334
+ if (c instanceof _GeometryQuery__WEBPACK_IMPORTED_MODULE_36__.GeometryQuery)
205288
205335
  c.extendRange(range, worldToLocal);
205289
- else if (c instanceof _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_8__.Point3d)
205336
+ else if (c instanceof _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d)
205290
205337
  range.extendPoint(c, worldToLocal);
205291
- else if (c instanceof _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__.GrowableXYZArray)
205338
+ else if (c instanceof _geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_17__.GrowableXYZArray)
205292
205339
  range.extendRange(c.getRange(worldToLocal));
205293
205340
  else if (Array.isArray(c))
205294
205341
  range.extendRange(this.curveArrayRange(c, worldToLocal));
@@ -205307,37 +205354,37 @@ class RegionOps {
205307
205354
  if (polygons.length === 0)
205308
205355
  return undefined;
205309
205356
  const firstEntry = polygons[0];
205310
- if (_geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_8__.Point3d.isAnyImmediatePointType(firstEntry)) {
205311
- graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.createTriangulatedGraphFromSingleLoop(polygons);
205357
+ if (_geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d.isAnyImmediatePointType(firstEntry)) {
205358
+ graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.createTriangulatedGraphFromSingleLoop(polygons);
205312
205359
  }
205313
205360
  else if (polygons.length > 1) {
205314
205361
  let writablePolygons;
205315
- if (firstEntry instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_6__.IndexedReadWriteXYZCollection) {
205362
+ if (firstEntry instanceof _geometry3d_IndexedXYZCollection__WEBPACK_IMPORTED_MODULE_9__.IndexedReadWriteXYZCollection) {
205316
205363
  writablePolygons = polygons;
205317
205364
  }
205318
205365
  else {
205319
205366
  writablePolygons = [];
205320
205367
  for (const polygon of polygons)
205321
- writablePolygons.push(_geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__.GrowableXYZArray.create(polygon));
205368
+ writablePolygons.push(_geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_17__.GrowableXYZArray.create(polygon));
205322
205369
  }
205323
- const sortedPolygons = _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_34__.PolygonOps.sortOuterAndHoleLoopsXY(writablePolygons);
205370
+ const sortedPolygons = _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_37__.PolygonOps.sortOuterAndHoleLoopsXY(writablePolygons);
205324
205371
  if (sortedPolygons.length === 1) { // below requires exactly one outer loop!
205325
- if (graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.createTriangulatedGraphFromLoops(sortedPolygons[0]))
205326
- _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.flipTriangles(graph);
205372
+ if (graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.createTriangulatedGraphFromLoops(sortedPolygons[0]))
205373
+ _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.flipTriangles(graph);
205327
205374
  }
205328
205375
  }
205329
205376
  else {
205330
- graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.createTriangulatedGraphFromSingleLoop(firstEntry);
205377
+ graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.createTriangulatedGraphFromSingleLoop(firstEntry);
205331
205378
  }
205332
205379
  }
205333
205380
  else {
205334
- graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.createTriangulatedGraphFromSingleLoop(polygons);
205381
+ graph = _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.createTriangulatedGraphFromSingleLoop(polygons);
205335
205382
  }
205336
205383
  if (!graph) {
205337
205384
  // Last resort: try full merge. Conveniently, multiple polygons are processed with parity logic.
205338
- if (graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_10__.RegionOpsFaceToFaceSearch.doPolygonBoolean(polygons, [], (inA, _inB) => inA)) {
205339
- if (_topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.triangulateAllPositiveAreaFaces(graph))
205340
- _topology_Triangulation__WEBPACK_IMPORTED_MODULE_7__.Triangulator.flipTriangles(graph);
205385
+ if (graph = _RegionOpsClassificationSweeps__WEBPACK_IMPORTED_MODULE_12__.RegionOpsFaceToFaceSearch.doPolygonBoolean(polygons, [], (inA, _inB) => inA)) {
205386
+ if (_topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.triangulateAllPositiveAreaFaces(graph))
205387
+ _topology_Triangulation__WEBPACK_IMPORTED_MODULE_10__.Triangulator.flipTriangles(graph);
205341
205388
  }
205342
205389
  }
205343
205390
  return graph;
@@ -205347,13 +205394,13 @@ class RegionOps {
205347
205394
  const strokedComponent = component.cloneStroked(options);
205348
205395
  // package the stroked region as polygons
205349
205396
  const polygons = [];
205350
- if (strokedComponent instanceof _Loop__WEBPACK_IMPORTED_MODULE_4__.Loop) {
205351
- if (strokedComponent.children.length > 0 && strokedComponent.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d)
205397
+ if (strokedComponent instanceof _Loop__WEBPACK_IMPORTED_MODULE_7__.Loop) {
205398
+ if (strokedComponent.children.length > 0 && strokedComponent.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d)
205352
205399
  polygons.push(strokedComponent.children[0].packedPoints); // expect only 1
205353
205400
  }
205354
- else if (strokedComponent instanceof _ParityRegion__WEBPACK_IMPORTED_MODULE_5__.ParityRegion) {
205401
+ else if (strokedComponent instanceof _ParityRegion__WEBPACK_IMPORTED_MODULE_8__.ParityRegion) {
205355
205402
  for (const strokedLoop of strokedComponent.children) {
205356
- if (strokedLoop.children.length > 0 && strokedLoop.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_16__.LineString3d)
205403
+ if (strokedLoop.children.length > 0 && strokedLoop.children[0] instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_18__.LineString3d)
205357
205404
  polygons.push(strokedLoop.children[0].packedPoints); // expect only 1
205358
205405
  }
205359
205406
  }
@@ -205381,7 +205428,7 @@ class RegionOps {
205381
205428
  */
205382
205429
  static facetRegionXY(region, options) {
205383
205430
  let graph;
205384
- if (region instanceof _UnionRegion__WEBPACK_IMPORTED_MODULE_11__.UnionRegion) {
205431
+ if (region instanceof _UnionRegion__WEBPACK_IMPORTED_MODULE_13__.UnionRegion) {
205385
205432
  for (const child of region.children) {
205386
205433
  const childGraph = RegionOps.triangulateRegionComponent(child, options);
205387
205434
  if (childGraph) {
@@ -205403,8 +205450,8 @@ class RegionOps {
205403
205450
  if (!graph)
205404
205451
  return undefined;
205405
205452
  if (options?.maximizeConvexFacets)
205406
- _topology_Merging__WEBPACK_IMPORTED_MODULE_35__.HalfEdgeGraphOps.expandConvexFaces(graph);
205407
- return _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_9__.PolyfaceBuilder.graphToPolyface(graph, options);
205453
+ _topology_Merging__WEBPACK_IMPORTED_MODULE_38__.HalfEdgeGraphOps.expandConvexFaces(graph);
205454
+ return _polyface_PolyfaceBuilder__WEBPACK_IMPORTED_MODULE_11__.PolyfaceBuilder.graphToPolyface(graph, options);
205408
205455
  }
205409
205456
  /**
205410
205457
  * Decompose a polygon with optional holes into an array of convex polygons.
@@ -205417,11 +205464,11 @@ class RegionOps {
205417
205464
  if (!graph)
205418
205465
  return undefined;
205419
205466
  if (maximize)
205420
- _topology_Merging__WEBPACK_IMPORTED_MODULE_35__.HalfEdgeGraphOps.expandConvexFaces(graph);
205467
+ _topology_Merging__WEBPACK_IMPORTED_MODULE_38__.HalfEdgeGraphOps.expandConvexFaces(graph);
205421
205468
  const convexPolygons = [];
205422
205469
  graph.announceFaceLoops((_graph, seed) => {
205423
- if (!seed.isMaskSet(_topology_Graph__WEBPACK_IMPORTED_MODULE_14__.HalfEdgeMask.EXTERIOR))
205424
- convexPolygons.push(_geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_15__.GrowableXYZArray.create(seed.collectAroundFace((node) => { return node.getPoint3d(); })));
205470
+ if (!seed.isMaskSet(_topology_Graph__WEBPACK_IMPORTED_MODULE_16__.HalfEdgeMask.EXTERIOR))
205471
+ convexPolygons.push(_geometry3d_GrowableXYZArray__WEBPACK_IMPORTED_MODULE_17__.GrowableXYZArray.create(seed.collectAroundFace((node) => { return node.getPoint3d(); })));
205425
205472
  return true;
205426
205473
  });
205427
205474
  return convexPolygons;
@@ -205473,24 +205520,25 @@ __webpack_require__.r(__webpack_exports__);
205473
205520
  /* harmony export */ RegionOpsFaceToFaceSearch: () => (/* binding */ RegionOpsFaceToFaceSearch)
205474
205521
  /* harmony export */ });
205475
205522
  /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
205476
- /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
205523
+ /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
205477
205524
  /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
205478
- /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
205525
+ /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
205479
205526
  /* harmony import */ var _topology_Graph__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../topology/Graph */ "../../core/geometry/lib/esm/topology/Graph.js");
205480
205527
  /* harmony import */ var _topology_HalfEdgeGraphSearch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../topology/HalfEdgeGraphSearch */ "../../core/geometry/lib/esm/topology/HalfEdgeGraphSearch.js");
205481
205528
  /* harmony import */ var _topology_Merging__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../topology/Merging */ "../../core/geometry/lib/esm/topology/Merging.js");
205482
205529
  /* harmony import */ var _topology_RegularizeFace__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../topology/RegularizeFace */ "../../core/geometry/lib/esm/topology/RegularizeFace.js");
205483
- /* harmony import */ var _Arc3d__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Arc3d */ "../../core/geometry/lib/esm/curve/Arc3d.js");
205484
- /* harmony import */ var _CurveCurve__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./CurveCurve */ "../../core/geometry/lib/esm/curve/CurveCurve.js");
205485
- /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
205530
+ /* harmony import */ var _Arc3d__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./Arc3d */ "../../core/geometry/lib/esm/curve/Arc3d.js");
205531
+ /* harmony import */ var _CurveCurve__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./CurveCurve */ "../../core/geometry/lib/esm/curve/CurveCurve.js");
205532
+ /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
205486
205533
  /* harmony import */ var _GeometryQuery__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./GeometryQuery */ "../../core/geometry/lib/esm/curve/GeometryQuery.js");
205487
- /* harmony import */ var _internalContexts_PlaneAltitudeRangeContext__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./internalContexts/PlaneAltitudeRangeContext */ "../../core/geometry/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js");
205488
- /* harmony import */ var _LineSegment3d__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./LineSegment3d */ "../../core/geometry/lib/esm/curve/LineSegment3d.js");
205534
+ /* harmony import */ var _internalContexts_PlaneAltitudeRangeContext__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./internalContexts/PlaneAltitudeRangeContext */ "../../core/geometry/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js");
205535
+ /* harmony import */ var _internalContexts_TransferWithSplitArcs__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./internalContexts/TransferWithSplitArcs */ "../../core/geometry/lib/esm/curve/internalContexts/TransferWithSplitArcs.js");
205536
+ /* harmony import */ var _LineSegment3d__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./LineSegment3d */ "../../core/geometry/lib/esm/curve/LineSegment3d.js");
205489
205537
  /* harmony import */ var _Loop__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
205490
205538
  /* harmony import */ var _ParityRegion__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ParityRegion */ "../../core/geometry/lib/esm/curve/ParityRegion.js");
205491
- /* harmony import */ var _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Query/PlanarSubdivision */ "../../core/geometry/lib/esm/curve/Query/PlanarSubdivision.js");
205539
+ /* harmony import */ var _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./Query/PlanarSubdivision */ "../../core/geometry/lib/esm/curve/Query/PlanarSubdivision.js");
205492
205540
  /* harmony import */ var _RegionOps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RegionOps */ "../../core/geometry/lib/esm/curve/RegionOps.js");
205493
- /* harmony import */ var _UnionRegion__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./UnionRegion */ "../../core/geometry/lib/esm/curve/UnionRegion.js");
205541
+ /* harmony import */ var _UnionRegion__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./UnionRegion */ "../../core/geometry/lib/esm/curve/UnionRegion.js");
205494
205542
  /*---------------------------------------------------------------------------------------------
205495
205543
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
205496
205544
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -205517,6 +205565,7 @@ __webpack_require__.r(__webpack_exports__);
205517
205565
 
205518
205566
 
205519
205567
 
205568
+
205520
205569
  /**
205521
205570
  * base class for callbacks during region sweeps.
205522
205571
  * * At start of a component, `startComponent(node)` is called announcing a representative node on the outermost face.
@@ -205833,8 +205882,7 @@ class RegionGroup {
205833
205882
  }
205834
205883
  return range;
205835
205884
  }
205836
- /** Ask if the current _numIn count qualifies as an "in" for this operation type.
205837
- */
205885
+ /** Ask if the current _numIn count qualifies as an "in" for this operation type. */
205838
205886
  getInOut() {
205839
205887
  // UNION is true if one or more members are IN
205840
205888
  if (this.groupOpType === RegionGroupOpType.Union)
@@ -205850,11 +205898,12 @@ class RegionGroup {
205850
205898
  // push new members into the group.
205851
205899
  addMember(data, allowLineSegment = false) {
205852
205900
  if (data instanceof _Loop__WEBPACK_IMPORTED_MODULE_8__.Loop || data instanceof _ParityRegion__WEBPACK_IMPORTED_MODULE_9__.ParityRegion) {
205853
- const cleanerData = data.clone();
205901
+ let cleanerData = data.clone();
205854
205902
  _RegionOps__WEBPACK_IMPORTED_MODULE_1__.RegionOps.consolidateAdjacentPrimitives(cleanerData);
205903
+ cleanerData = _internalContexts_TransferWithSplitArcs__WEBPACK_IMPORTED_MODULE_10__.TransferWithSplitArcs.clone(cleanerData);
205855
205904
  this.members.push(new RegionGroupMember(cleanerData, this));
205856
205905
  }
205857
- else if (data instanceof _UnionRegion__WEBPACK_IMPORTED_MODULE_10__.UnionRegion) {
205906
+ else if (data instanceof _UnionRegion__WEBPACK_IMPORTED_MODULE_11__.UnionRegion) {
205858
205907
  for (const child of data.children) {
205859
205908
  this.addMember(child);
205860
205909
  }
@@ -205864,7 +205913,7 @@ class RegionGroup {
205864
205913
  this.addMember(item);
205865
205914
  }
205866
205915
  }
205867
- else if (allowLineSegment && data instanceof _LineSegment3d__WEBPACK_IMPORTED_MODULE_11__.LineSegment3d) {
205916
+ else if (allowLineSegment && data instanceof _LineSegment3d__WEBPACK_IMPORTED_MODULE_12__.LineSegment3d) {
205868
205917
  this.members.push(new RegionGroupMember(data, this));
205869
205918
  }
205870
205919
  }
@@ -205881,22 +205930,22 @@ class RegionGroup {
205881
205930
  /**
205882
205931
  * A `RegionBooleanContext` carries structure and operations for binary operations between two sets of regions.
205883
205932
  * * In the binary operation OP (union, intersection, parity, difference), the left and right operands
205884
- * are each a composite union, difference, or parity among multiple inputs, i.e.
205933
+ * are each a composite union, difference, or parity among multiple inputs, i.e.,
205885
205934
  * * (operationA among Ai) OP (operationB among Bi)
205886
205935
  * * where the Ai are one set of regions, being combined by operationA
205887
- * * and the Bi are the another set of regions, being combined by operationB
205888
- * * Each group of Ai and Bi is a `RegionGroup`
205936
+ * * and the Bi are the another set of regions, being combined by operationB.
205937
+ * * Each group of Ai and Bi is a `RegionGroup`.
205889
205938
  * * This is an extremely delicate structure.
205890
205939
  * * Members are public because of the unique variety of queries, but should only be used for queries.
205891
205940
  * * The graph and curves in the booleans are connected by an extended pointer chain:
205892
- * * (HalfEdge in Graph).edgeTag points to a CurveLocationDetail
205893
- * * (CurveLocationDetail).curve points to a curve
205894
- * * (Curve).parent points to RegionGroupMember
205895
- * * (RegionGroupMember) points to RegionGroup
205896
- * * (RegionGroup) points to RegionBooleanBinaryContext
205897
- * * So..when a graph sweep crosses an edge,
205898
- * * the chain leads to a parity count in the RegionGroupMember
205899
- * * that can change the number of members active in the RegionGroup
205941
+ * * (HalfEdge in Graph).edgeTag points to a CurveLocationDetail.
205942
+ * * (CurveLocationDetail).curve points to a curve.
205943
+ * * (Curve).parent points to RegionGroupMember.
205944
+ * * (RegionGroupMember) points to RegionGroup.
205945
+ * * (RegionGroup) points to RegionBooleanBinaryContext.
205946
+ * * So when a graph sweep crosses an edge
205947
+ * * the chain leads to a parity count in the RegionGroupMember.
205948
+ * * that can change the number of members active in the RegionGroup.
205900
205949
  * * which can change the state of the context.
205901
205950
  * @internal
205902
205951
  */
@@ -205911,7 +205960,7 @@ class RegionBooleanContext {
205911
205960
  this.groupA = new RegionGroup(this, groupTypeA);
205912
205961
  this.groupB = new RegionGroup(this, groupTypeB);
205913
205962
  this.extraGeometry = new RegionGroup(this, RegionGroupOpType.NonBounding);
205914
- this.binaryOp = _RegionOps__WEBPACK_IMPORTED_MODULE_1__.RegionBinaryOpType.Union; // it will be revised on can calls.
205963
+ this.binaryOp = _RegionOps__WEBPACK_IMPORTED_MODULE_1__.RegionBinaryOpType.Union; // revised in runClassificationSweep
205915
205964
  }
205916
205965
  /**
205917
205966
  * Create a context with both A and B groups empty.
@@ -205930,7 +205979,7 @@ class RegionBooleanContext {
205930
205979
  this.addConnectives();
205931
205980
  }
205932
205981
  _workSegment;
205933
- static _bridgeDirection = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_12__.Vector3d.createNormalized(1.0, -0.12328974132467); // magic unit direction to minimize vertex hits
205982
+ static _bridgeDirection = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_13__.Vector3d.createNormalized(1.0, -0.12328974132467); // magic unit direction to minimize vertex hits
205934
205983
  /**
205935
205984
  * The sweep operations require access to all geometry by edge crossings and face walk.
205936
205985
  * If input loops are non-overlapping, there may be disconnected islands not reachable.
@@ -205945,7 +205994,7 @@ class RegionBooleanContext {
205945
205994
  const rangeAB = rangeA.union(rangeB);
205946
205995
  const areaTol = _RegionOps__WEBPACK_IMPORTED_MODULE_1__.RegionOps.computeXYAreaTolerance(rangeAB);
205947
205996
  let margin = 0.1;
205948
- this._workSegment = _internalContexts_PlaneAltitudeRangeContext__WEBPACK_IMPORTED_MODULE_13__.PlaneAltitudeRangeContext.findExtremePointsInDirection(rangeAB.corners(), RegionBooleanContext._bridgeDirection, this._workSegment);
205997
+ this._workSegment = _internalContexts_PlaneAltitudeRangeContext__WEBPACK_IMPORTED_MODULE_14__.PlaneAltitudeRangeContext.findExtremePointsInDirection(rangeAB.corners(), RegionBooleanContext._bridgeDirection, this._workSegment);
205949
205998
  if (this._workSegment)
205950
205999
  margin *= this._workSegment.point0Ref.distanceXY(this._workSegment.point1Ref); // how much further to extend each bridge ray
205951
206000
  const maxPoints = [];
@@ -205953,7 +206002,7 @@ class RegionBooleanContext {
205953
206002
  const area = _RegionOps__WEBPACK_IMPORTED_MODULE_1__.RegionOps.computeXYArea(region);
205954
206003
  if (area === undefined || Math.abs(area) < areaTol)
205955
206004
  return; // avoid bridging trivial faces
205956
- this._workSegment = _internalContexts_PlaneAltitudeRangeContext__WEBPACK_IMPORTED_MODULE_13__.PlaneAltitudeRangeContext.findExtremePointsInDirection(region, RegionBooleanContext._bridgeDirection, this._workSegment);
206005
+ this._workSegment = _internalContexts_PlaneAltitudeRangeContext__WEBPACK_IMPORTED_MODULE_14__.PlaneAltitudeRangeContext.findExtremePointsInDirection(region, RegionBooleanContext._bridgeDirection, this._workSegment);
205957
206006
  if (this._workSegment)
205958
206007
  maxPoints.push(this._workSegment.point1Ref);
205959
206008
  };
@@ -205968,17 +206017,17 @@ class RegionBooleanContext {
205968
206017
  }
205969
206018
  }
205970
206019
  }
205971
- const ray = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_14__.Ray3d.createZero();
206020
+ const ray = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_15__.Ray3d.createZero();
205972
206021
  for (const p of maxPoints) {
205973
- // Make a line from...
205974
- // 1) exactly the max point of the loops to
205975
- // 2) a point clearly outside the big range
205976
- // If p came from some inner loop this will...
205977
- // 1) create a bridge from the inner loop through any containing loops (always)
205978
- // 2) avoid crossing any containing loop at a vertex. (with high probability, but not absolutely always)
205979
- const bridgeLength = margin + _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_14__.Ray3d.create(p, RegionBooleanContext._bridgeDirection, ray).intersectionWithRange3d(rangeAB).high;
205980
- const outside = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_12__.Point3d.createAdd2Scaled(p, 1.0, RegionBooleanContext._bridgeDirection, bridgeLength);
205981
- const bridgeLine = _LineSegment3d__WEBPACK_IMPORTED_MODULE_11__.LineSegment3d.createXYXY(p.x, p.y, outside.x, outside.y);
206022
+ // Make a line from
206023
+ // 1) exactly the max point of the loops to
206024
+ // 2) a point clearly outside the big range
206025
+ // If p came from some inner loop this will
206026
+ // 1) create a bridge from the inner loop through any containing loops (always)
206027
+ // 2) avoid crossing any containing loop at a vertex. (with high probability, but not absolutely always)
206028
+ const bridgeLength = margin + _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_15__.Ray3d.create(p, RegionBooleanContext._bridgeDirection, ray).intersectionWithRange3d(rangeAB).high;
206029
+ const outside = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_13__.Point3d.createAdd2Scaled(p, 1.0, RegionBooleanContext._bridgeDirection, bridgeLength);
206030
+ const bridgeLine = _LineSegment3d__WEBPACK_IMPORTED_MODULE_12__.LineSegment3d.createXYXY(p.x, p.y, outside.x, outside.y);
205982
206031
  this.extraGeometry.addMember(bridgeLine, true);
205983
206032
  }
205984
206033
  }
@@ -205992,7 +206041,7 @@ class RegionBooleanContext {
205992
206041
  */
205993
206042
  annotateAndMergeCurvesInGraph(mergeTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_7__.Geometry.smallMetricDistance) {
205994
206043
  const allPrimitives = [];
205995
- // ASSUME loops have fine-grained types -- no linestrings !!
206044
+ // ASSUME loops have fine-grained types (no linestrings)
205996
206045
  for (const group of [this.groupA, this.groupB, this.extraGeometry]) {
205997
206046
  for (const member of group.members) {
205998
206047
  let k = allPrimitives.length;
@@ -206003,9 +206052,8 @@ class RegionBooleanContext {
206003
206052
  }
206004
206053
  }
206005
206054
  }
206006
- // const range = RegionOps.curveArrayRange(allPrimitives);
206007
- const intersections = _CurveCurve__WEBPACK_IMPORTED_MODULE_15__.CurveCurve.allIntersectionsAmongPrimitivesXY(allPrimitives, mergeTolerance);
206008
- const graph = _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_16__.PlanarSubdivision.assembleHalfEdgeGraph(allPrimitives, intersections, mergeTolerance);
206055
+ const intersections = _CurveCurve__WEBPACK_IMPORTED_MODULE_16__.CurveCurve.allIntersectionsAmongPrimitivesXY(allPrimitives, mergeTolerance);
206056
+ const graph = _Query_PlanarSubdivision__WEBPACK_IMPORTED_MODULE_17__.PlanarSubdivision.assembleHalfEdgeGraph(allPrimitives, intersections, mergeTolerance);
206009
206057
  this.graph = graph;
206010
206058
  this.faceAreaFunction = faceAreaFromCurvedEdgeData;
206011
206059
  }
@@ -206096,7 +206144,7 @@ class RegionBooleanContext {
206096
206144
  const data = node.edgeTag;
206097
206145
  if (data instanceof RegionGroupMember)
206098
206146
  return updateRegionGroupMemberState(data);
206099
- if (data instanceof _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_17__.CurveLocationDetail) {
206147
+ if (data instanceof _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_18__.CurveLocationDetail) {
206100
206148
  // We trust that the caller has linked from the graph node to a curve which has a RegionGroupMember as its parent.
206101
206149
  const member = data.curve.parent;
206102
206150
  if (member instanceof RegionGroupMember)
@@ -206151,10 +206199,10 @@ function areaUnderPartialCurveXY(detail, xyStart, xyEnd, referencePoint) {
206151
206199
  }
206152
206200
  let areaToChord = 0.0;
206153
206201
  if (detail && detail.curve && detail.hasFraction1) {
206154
- if (detail.curve instanceof _LineSegment3d__WEBPACK_IMPORTED_MODULE_11__.LineSegment3d) {
206202
+ if (detail.curve instanceof _LineSegment3d__WEBPACK_IMPORTED_MODULE_12__.LineSegment3d) {
206155
206203
  // ah .. nothing to do for a line segment
206156
206204
  }
206157
- else if (detail.curve instanceof _Arc3d__WEBPACK_IMPORTED_MODULE_18__.Arc3d) {
206205
+ else if (detail.curve instanceof _Arc3d__WEBPACK_IMPORTED_MODULE_19__.Arc3d) {
206158
206206
  areaToChord = detail.curve.areaToChordXY(detail.fraction, detail.fraction1);
206159
206207
  }
206160
206208
  }
@@ -208696,6 +208744,8 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
208696
208744
  // The line segment in question might be (a) a full line segment or (b) a fragment within a linestring.
208697
208745
  // The fraction and extend parameters allow all combinations to be passed in.
208698
208746
  dispatchSegmentArc(cpA, extendA0, pointA0, fractionA0, pointA1, fractionA1, extendA1, arc, extendB0, extendB1, reversed) {
208747
+ const tol2 = this._coincidentGeometryContext.tolerance * this._coincidentGeometryContext.tolerance;
208748
+ let dist2;
208699
208749
  // Arc: X = C + cU + sV
208700
208750
  // Line: contains points A0,A1
208701
208751
  // Arc point colinear with line if det (A0, A1, X) = 0
@@ -208706,6 +208756,10 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
208706
208756
  // project back to line.
208707
208757
  if (this._worldToLocalPerspective) {
208708
208758
  const data = arc.toTransformedPoint4d(this._worldToLocalPerspective);
208759
+ const radians0 = data.sweep.fractionToRadians(0);
208760
+ const pointB0H = data.center.plus2Scaled(data.vector0, Math.cos(radians0), data.vector90, Math.sin(radians0));
208761
+ const radians1 = data.sweep.fractionToRadians(1);
208762
+ const pointB1H = data.center.plus2Scaled(data.vector0, Math.cos(radians1), data.vector90, Math.sin(radians1));
208709
208763
  const pointA0H = this._worldToLocalPerspective.multiplyPoint3d(pointA0, 1);
208710
208764
  const pointA1H = this._worldToLocalPerspective.multiplyPoint3d(pointA1, 1);
208711
208765
  const alpha = _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.tripleProductPoint4dXYW(pointA0H, pointA1H, data.center);
@@ -208715,19 +208769,31 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
208715
208769
  const sines = new _geometry3d_GrowableFloat64Array__WEBPACK_IMPORTED_MODULE_9__.GrowableFloat64Array(2);
208716
208770
  const radians = new _geometry3d_GrowableFloat64Array__WEBPACK_IMPORTED_MODULE_9__.GrowableFloat64Array(2);
208717
208771
  const numRoots = _numerics_Polynomials__WEBPACK_IMPORTED_MODULE_10__.AnalyticRoots.appendImplicitLineUnitCircleIntersections(alpha, beta, gamma, cosines, sines, radians);
208772
+ if (numRoots <= 0)
208773
+ return;
208718
208774
  for (let i = 0; i < numRoots; i++) {
208719
208775
  const arcPoint = data.center.plus2Scaled(data.vector0, cosines.atUncheckedIndex(i), data.vector90, sines.atUncheckedIndex(i));
208720
- const arcFraction = data.sweep.radiansToSignedFraction(radians.atUncheckedIndex(i), extendB0);
208776
+ let arcFraction = data.sweep.radiansToSignedFraction(radians.atUncheckedIndex(i), extendB0);
208721
208777
  const lineFraction = _numerics_SmallSystem__WEBPACK_IMPORTED_MODULE_8__.SmallSystem.lineSegment3dHXYClosestPointUnbounded(pointA0H, pointA1H, arcPoint);
208722
- if (lineFraction !== undefined &&
208723
- this.acceptFraction(extendA0, lineFraction, extendA1) &&
208724
- this.acceptFraction(extendB0, arcFraction, extendB1)) {
208725
- this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1, arcFraction, arc, 0, 1, reversed);
208778
+ if (lineFraction !== undefined) {
208779
+ if (this.acceptFraction(extendA0, lineFraction, extendA1) && this.acceptFraction(extendB0, arcFraction, extendB1)) {
208780
+ this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1, arcFraction, arc, 0, 1, reversed);
208781
+ }
208782
+ else { // check for endpoint intersections beyond parametric tolerance but within point tolerance
208783
+ const pointAH = lineFraction < 0.5 ? pointA0H : pointA1H;
208784
+ const pointBH = (arcFraction = data.sweep.fractionToSignedPeriodicFraction(arcFraction)) < 0.5 ? pointB0H : pointB1H;
208785
+ if ((dist2 = pointAH.realDistanceSquaredXY(pointBH)) !== undefined && _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.isDistanceWithinTol(dist2, tol2))
208786
+ this.recordPointWithLocalFractions(lineFraction < 0.5 ? 0 : 1, cpA, fractionA0, fractionA1, arcFraction < 0.5 ? 0 : 1, arc, 0, 1, reversed);
208787
+ }
208726
208788
  }
208727
208789
  }
208728
208790
  }
208729
208791
  else {
208730
208792
  const data = arc.toTransformedVectors(this._worldToLocalAffine);
208793
+ const radians0 = data.sweep.fractionToRadians(0);
208794
+ const pointB0Local = data.center.plus2Scaled(data.vector0, Math.cos(radians0), data.vector90, Math.sin(radians0));
208795
+ const radians1 = data.sweep.fractionToRadians(1);
208796
+ const pointB1Local = data.center.plus2Scaled(data.vector0, Math.cos(radians1), data.vector90, Math.sin(radians1));
208731
208797
  let pointA0Local = pointA0;
208732
208798
  let pointA1Local = pointA1;
208733
208799
  if (this._worldToLocalAffine) {
@@ -208741,16 +208807,22 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
208741
208807
  const sines = new _geometry3d_GrowableFloat64Array__WEBPACK_IMPORTED_MODULE_9__.GrowableFloat64Array(2);
208742
208808
  const radians = new _geometry3d_GrowableFloat64Array__WEBPACK_IMPORTED_MODULE_9__.GrowableFloat64Array(2);
208743
208809
  const numRoots = _numerics_Polynomials__WEBPACK_IMPORTED_MODULE_10__.AnalyticRoots.appendImplicitLineUnitCircleIntersections(alpha, beta, gamma, cosines, sines, radians);
208744
- const lineFractionTol = 1.0e-10; // TODO: why are we loosening tolerances here?
208745
- const arcFractionTol = 1.0e-7;
208810
+ if (numRoots <= 0)
208811
+ return;
208746
208812
  for (let i = 0; i < numRoots; i++) {
208747
208813
  const arcPoint = data.center.plus2Scaled(data.vector0, cosines.atUncheckedIndex(i), data.vector90, sines.atUncheckedIndex(i));
208748
- const arcFraction = data.sweep.radiansToSignedFraction(radians.atUncheckedIndex(i), extendB0);
208814
+ let arcFraction = data.sweep.radiansToSignedFraction(radians.atUncheckedIndex(i), extendB0);
208749
208815
  const lineFraction = _numerics_SmallSystem__WEBPACK_IMPORTED_MODULE_8__.SmallSystem.lineSegment3dXYClosestPointUnbounded(pointA0Local, pointA1Local, arcPoint);
208750
- if (lineFraction !== undefined &&
208751
- this.acceptFraction(extendA0, lineFraction, extendA1, lineFractionTol) &&
208752
- this.acceptFraction(extendB0, arcFraction, extendB1, arcFractionTol)) {
208753
- this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1, arcFraction, arc, 0, 1, reversed);
208816
+ if (lineFraction !== undefined) {
208817
+ if (this.acceptFraction(extendA0, lineFraction, extendA1) && this.acceptFraction(extendB0, arcFraction, extendB1)) {
208818
+ this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1, arcFraction, arc, 0, 1, reversed);
208819
+ }
208820
+ else { // check for endpoint intersections beyond parametric tolerance but within point tolerance
208821
+ const pointALocal = lineFraction < 0.5 ? pointA0Local : pointA1Local;
208822
+ const pointBLocal = (arcFraction = data.sweep.fractionToSignedPeriodicFraction(arcFraction)) < 0.5 ? pointB0Local : pointB1Local;
208823
+ if ((dist2 = pointALocal.distanceSquaredXY(pointBLocal)) !== undefined && _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.isDistanceWithinTol(dist2, tol2))
208824
+ this.recordPointWithLocalFractions(lineFraction < 0.5 ? 0 : 1, cpA, fractionA0, fractionA1, arcFraction < 0.5 ? 0 : 1, arc, 0, 1, reversed);
208825
+ }
208754
208826
  }
208755
208827
  }
208756
208828
  }
@@ -212823,6 +212895,52 @@ class SumLengthsContext extends _CurveProcessor__WEBPACK_IMPORTED_MODULE_0__.Rec
212823
212895
  }
212824
212896
 
212825
212897
 
212898
+ /***/ }),
212899
+
212900
+ /***/ "../../core/geometry/lib/esm/curve/internalContexts/TransferWithSplitArcs.js":
212901
+ /*!***********************************************************************************!*\
212902
+ !*** ../../core/geometry/lib/esm/curve/internalContexts/TransferWithSplitArcs.js ***!
212903
+ \***********************************************************************************/
212904
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
212905
+
212906
+ "use strict";
212907
+ __webpack_require__.r(__webpack_exports__);
212908
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
212909
+ /* harmony export */ TransferWithSplitArcs: () => (/* binding */ TransferWithSplitArcs)
212910
+ /* harmony export */ });
212911
+ /* harmony import */ var _Arc3d__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Arc3d */ "../../core/geometry/lib/esm/curve/Arc3d.js");
212912
+ /* harmony import */ var _CloneCurvesContext__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CloneCurvesContext */ "../../core/geometry/lib/esm/curve/internalContexts/CloneCurvesContext.js");
212913
+ /*---------------------------------------------------------------------------------------------
212914
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
212915
+ * See LICENSE.md in the project root for license terms and full copyright notice.
212916
+ *--------------------------------------------------------------------------------------------*/
212917
+ /** @packageDocumentation
212918
+ * @module Curve
212919
+ */
212920
+
212921
+
212922
+ /**
212923
+ * Algorithmic class for shallow-copying a CurveCollection with each full-sweep arc replaced by two half-sweep arcs.
212924
+ * * Often useful for building graphs from loops.
212925
+ * @internal
212926
+ */
212927
+ class TransferWithSplitArcs extends _CloneCurvesContext__WEBPACK_IMPORTED_MODULE_0__.CloneCurvesContext {
212928
+ constructor() {
212929
+ super(undefined);
212930
+ }
212931
+ doClone(primitive) {
212932
+ if (primitive instanceof _Arc3d__WEBPACK_IMPORTED_MODULE_1__.Arc3d && primitive.sweep.isFullCircle) // replace full arc with two half arcs
212933
+ return [primitive.clonePartialCurve(0.0, 0.5), primitive.clonePartialCurve(0.5, 1)];
212934
+ return primitive;
212935
+ }
212936
+ static clone(target) {
212937
+ const context = new TransferWithSplitArcs();
212938
+ target.announceToCurveProcessor(context);
212939
+ return context._result;
212940
+ }
212941
+ }
212942
+
212943
+
212826
212944
  /***/ }),
212827
212945
 
212828
212946
  /***/ "../../core/geometry/lib/esm/curve/internalContexts/TransformInPlaceContext.js":
@@ -216320,8 +216438,10 @@ class AngleSweep {
216320
216438
  * @param fraction fraction of the sweep.
216321
216439
  * @param radians0 start angle of sweep (in radians).
216322
216440
  * @param radians1 end angle of sweep (in radians).
216323
- * @param toNegativeFraction return an exterior fraction period-shifted to within one period of the start (true) or
216324
- * end (false) of the sweep.
216441
+ * @param toNegativeFraction exterior fraction handling:
216442
+ * * if true, return `fraction` period-shifted to within one period of the start
216443
+ * * if false, return `fraction` period-shifted to within one period of the end
216444
+ * * if undefined, return the period-shift of `fraction` closest to [0,1].
216325
216445
  * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is
216326
216446
  * returned unchanged.
216327
216447
  */
@@ -216335,16 +216455,25 @@ class AngleSweep {
216335
216455
  fraction = fraction % period; // period-shifted equivalent fraction closest to 0 with same sign as fraction
216336
216456
  if (fraction + period < 1)
216337
216457
  fraction += period; // it's really an interior fraction
216338
- if (_Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isIn01(fraction) || (toNegativeFraction && fraction < 0) || (!toNegativeFraction && fraction > 1))
216458
+ if (_Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isIn01(fraction))
216339
216459
  return fraction;
216340
- return toNegativeFraction ? fraction - period : fraction + period; // shift to other side of sweep
216460
+ if (toNegativeFraction === true)
216461
+ return fraction < 0 ? fraction : fraction - period;
216462
+ if (toNegativeFraction === false)
216463
+ return fraction > 1 ? fraction : fraction + period;
216464
+ const fractionDistFrom01 = fraction < 0 ? -fraction : fraction - 1;
216465
+ const fraction2 = fraction < 0 ? fraction + period : fraction - period; // period-shift with opposite sign
216466
+ const fraction2DistFrom01 = fraction2 < 0 ? -fraction2 : fraction2 - 1;
216467
+ return fractionDistFrom01 < fraction2DistFrom01 ? fraction : fraction2; // choose the period-shift closer to [0,1]
216341
216468
  }
216342
216469
  /**
216343
216470
  * Convert a sweep fraction to the equivalent period-shifted fraction inside this sweep, or within one period of
216344
216471
  * zero on the desired side.
216345
216472
  * @param fraction fraction of the sweep.
216346
- * @param toNegativeFraction return an exterior fraction period-shifted to within one period of the start (true) or
216347
- * end (false) of the sweep.
216473
+ * @param toNegativeFraction exterior fraction handling:
216474
+ * * if true, return `fraction` period-shifted to within one period of the start
216475
+ * * if false, return `fraction` period-shifted to within one period of the end
216476
+ * * if undefined, return the period-shift of `fraction` closest to [0,1].
216348
216477
  * @returns period-shifted fraction. If `fraction` is already in [0,1], or the sweep is empty, then `fraction` is
216349
216478
  * returned unchanged.
216350
216479
  */
@@ -229233,9 +229362,9 @@ class Vector3d extends XYZ {
229233
229362
  if (dot < 0.0 && !oppositeIsParallel)
229234
229363
  return false;
229235
229364
  const cross2 = this.crossProductMagnitudeSquared(other);
229236
- /* a2,b2,cross2 are squared lengths of respective vectors */
229237
- /* cross2 = sin^2(theta) * a2 * b2 */
229238
- /* For small theta, sin^2(theta)~~theta^2 */
229365
+ // a2,b2,cross2 are squared lengths of respective vectors
229366
+ // cross2 = sin^2(theta) * a2 * b2
229367
+ // For small theta, sin^2(theta) ~ theta^2
229239
229368
  return cross2 <= radianSquaredTol * a2 * b2;
229240
229369
  }
229241
229370
  /**
@@ -231230,26 +231359,28 @@ class PolygonOps {
231230
231359
  return s;
231231
231360
  }
231232
231361
  /**
231233
- * Return a Ray3d with (assuming the polygon is planar and not self-intersecting):
231234
- * * `origin` at the centroid of the (3D) polygon,
231235
- * * `direction` is the unit vector perpendicular to the plane,
231236
- * * `a` is the area.
231237
- * @param points
231362
+ * Return a [[Ray3d]] with:
231363
+ * * `origin` is the centroid of the polygon,
231364
+ * * `direction` is a unit vector perpendicular to the polygon plane,
231365
+ * * `a` is the polygon area.
231366
+ * @param points the polygon vertices in order. Points can lie in any plane. First and last point do not have to be equal.
231367
+ * @param result optional pre-allocated result to populate and return.
231238
231368
  */
231239
- static centroidAreaNormal(points) {
231369
+ static centroidAreaNormal(points, result) {
231240
231370
  if (Array.isArray(points)) {
231241
231371
  const carrier = new _Point3dArrayCarrier__WEBPACK_IMPORTED_MODULE_5__.Point3dArrayCarrier(points);
231242
- return this.centroidAreaNormal(carrier);
231372
+ return this.centroidAreaNormal(carrier, result);
231243
231373
  }
231244
231374
  const n = points.length;
231245
231375
  if (n === 3) {
231246
- const normal = points.crossProductIndexIndexIndex(0, 1, 2);
231376
+ const normal = points.crossProductIndexIndexIndex(0, 1, 2, result?.direction);
231247
231377
  const a = 0.5 * normal.magnitude();
231248
- const centroid = points.getPoint3dAtCheckedPointIndex(0);
231378
+ const centroid = points.getPoint3dAtCheckedPointIndex(0, result?.origin);
231249
231379
  points.accumulateScaledXYZ(1, 1.0, centroid);
231250
231380
  points.accumulateScaledXYZ(2, 1.0, centroid);
231251
231381
  centroid.scaleInPlace(1.0 / 3.0);
231252
- const result = _Ray3d__WEBPACK_IMPORTED_MODULE_3__.Ray3d.createCapture(centroid, normal);
231382
+ if (!result)
231383
+ result = _Ray3d__WEBPACK_IMPORTED_MODULE_3__.Ray3d.createCapture(centroid, normal);
231253
231384
  if (result.tryNormalizeInPlaceWithAreaWeight(a))
231254
231385
  return result;
231255
231386
  return undefined;
@@ -231267,22 +231398,24 @@ class PolygonOps {
231267
231398
  points.vectorXYAndZIndex(origin, 1, vector0);
231268
231399
  let cross = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Vector3d.create();
231269
231400
  const centroidSum = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Vector3d.createZero();
231270
- const normalSum = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Vector3d.createZero();
231401
+ const normal = _Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Vector3d.createZero(result?.direction);
231271
231402
  let signedTriangleArea;
231272
- // This will work with or without closure edge. If closure is given, the last vector is 000.
231403
+ // This will work with or without closure edge. If closure is given, the last vector is 000.
231273
231404
  for (let i = 2; i < n; i++) {
231274
231405
  points.vectorXYAndZIndex(origin, i, vector1);
231275
231406
  cross = vector0.crossProduct(vector1, cross);
231276
231407
  signedTriangleArea = areaNormal.dotProduct(cross); // well, actually twice the area.
231277
- normalSum.addInPlace(cross); // this grows to twice the area
231408
+ normal.addInPlace(cross); // this grows to twice the area
231278
231409
  const b = signedTriangleArea / 6.0;
231279
231410
  centroidSum.plus2Scaled(vector0, b, vector1, b, centroidSum);
231280
231411
  vector0.setFrom(vector1);
231281
231412
  }
231282
- const area = 0.5 * normalSum.magnitude();
231413
+ const area = 0.5 * normal.magnitude();
231283
231414
  const inverseArea = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.conditionalDivideFraction(1, area);
231284
231415
  if (inverseArea !== undefined) {
231285
- const result = _Ray3d__WEBPACK_IMPORTED_MODULE_3__.Ray3d.createCapture(origin.plusScaled(centroidSum, inverseArea), normalSum);
231416
+ const centroid = origin.plusScaled(centroidSum, inverseArea, result?.origin);
231417
+ if (!result)
231418
+ result = _Ray3d__WEBPACK_IMPORTED_MODULE_3__.Ray3d.createCapture(centroid, normal);
231286
231419
  result.tryNormalizeInPlaceWithAreaWeight(area);
231287
231420
  return result;
231288
231421
  }
@@ -238307,19 +238440,19 @@ class Matrix4d {
238307
238440
  this._coffs[15] += scale * beta;
238308
238441
  }
238309
238442
  /**
238310
- * Multiply and replace contents of this matrix by A*this*AT where
238311
- * * A is a pure translation with final column [x,y,z,1]
238312
- * * this is this matrix.
238313
- * * AT is the transpose of A.
238314
- * @param ax x part of translation
238315
- * @param ay y part of translation
238316
- * @param az z part of translation
238443
+ * Multiply and replace contents of ` this` matrix by `A*this*AT` where
238444
+ * * `A` is a pure translation with final column [x,y,z,1].
238445
+ * * `this` is this matrix.
238446
+ * * `AT` is the transpose of A.
238447
+ * @param ax x part of translation.
238448
+ * @param ay y part of translation.
238449
+ * @param az z part of translation.
238317
238450
  */
238318
238451
  multiplyTranslationSandwichInPlace(ax, ay, az) {
238319
238452
  const bx = this._coffs[3];
238320
238453
  const by = this._coffs[7];
238321
238454
  const bz = this._coffs[11];
238322
- // matrixB can be non-symmetric!!
238455
+ // matrixB can be non-symmetric
238323
238456
  const cx = this._coffs[12];
238324
238457
  const cy = this._coffs[13];
238325
238458
  const cz = this._coffs[14];
@@ -238342,7 +238475,7 @@ class Matrix4d {
238342
238475
  this._coffs[12] += axBeta;
238343
238476
  this._coffs[13] += ayBeta;
238344
238477
  this._coffs[14] += azBeta;
238345
- // coffs[15] is unchanged !!!
238478
+ // coffs[15] is unchanged
238346
238479
  }
238347
238480
  }
238348
238481
 
@@ -238393,8 +238526,8 @@ __webpack_require__.r(__webpack_exports__);
238393
238526
  * * e.g. entry 03 is summed x.
238394
238527
  * * In this level:
238395
238528
  * * the `absoluteQuantity` member is undefined.
238396
- * * the `localToWorldMap` and `radiiOfGyration` are created by have undefined contents.
238397
- * * Second level: after a call to inertiaProductsToPrincipalAxes, the `localToWorldMap`, `absoluteQuantity` and
238529
+ * * the `localToWorldMap` and `radiiOfGyration` are created but have undefined contents.
238530
+ * * Second level: after a call to `inertiaProductsToPrincipalAxes`, the `localToWorldMap`, `absoluteQuantity` and
238398
238531
  * `radiiOfGyration` are filled in.
238399
238532
  * @public
238400
238533
  */
@@ -238414,18 +238547,35 @@ class MomentData {
238414
238547
  * * This set up with its inverse already constructed.
238415
238548
  */
238416
238549
  localToWorldMap;
238550
+ /** Radii of gyration (square roots of principal second moments). */
238551
+ radiusOfGyration;
238552
+ /**
238553
+ * Principal quantity (e.g. length, area, or volume). This is undefined in raw moments, and becomes defined by
238554
+ * inertiaProductsToPrincipalAxes.
238555
+ */
238556
+ absoluteQuantity;
238417
238557
  // private variables
238418
238558
  static _vectorA;
238419
238559
  static _vectorB;
238420
238560
  static _vectorC;
238421
238561
  _point0 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Point3d.create();
238422
238562
  _point1 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Point3d.create();
238563
+ /** Constructor. */
238564
+ constructor() {
238565
+ this.origin = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Point3d.createZero();
238566
+ this.needOrigin = false;
238567
+ this.sums = _Matrix4d__WEBPACK_IMPORTED_MODULE_1__.Matrix4d.createZero();
238568
+ this.localToWorldMap = _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_2__.Transform.createIdentity();
238569
+ this.radiusOfGyration = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create();
238570
+ this.absoluteQuantity = 0.1; // so optimizer sees its type
238571
+ this.absoluteQuantity = undefined;
238572
+ }
238423
238573
  /**
238424
238574
  * Return the lower-right (3,3) entry in the sums.
238425
238575
  * * This is the quantity (i.e. length, area, or volume) summed.
238426
238576
  */
238427
238577
  get quantitySum() {
238428
- return this.sums.atIJ(3, 3);
238578
+ return this.sums.weight();
238429
238579
  }
238430
238580
  /**
238431
238581
  * Return a scale factor to make these sums match the target orientation sign.
@@ -238456,23 +238606,6 @@ class MomentData {
238456
238606
  this.needOrigin = false;
238457
238607
  }
238458
238608
  }
238459
- /** Radii of gyration (square roots of principal second moments). */
238460
- radiusOfGyration;
238461
- /**
238462
- * Principal quantity (e.g. length, area, or volume). This is undefined in raw moments, and becomes defined by
238463
- * inertiaProductsToPrincipalAxes.
238464
- */
238465
- absoluteQuantity;
238466
- /** Constructor. */
238467
- constructor() {
238468
- this.origin = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Point3d.createZero();
238469
- this.sums = _Matrix4d__WEBPACK_IMPORTED_MODULE_1__.Matrix4d.createZero();
238470
- this.localToWorldMap = _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_2__.Transform.createIdentity();
238471
- this.radiusOfGyration = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create();
238472
- this.needOrigin = false;
238473
- this.absoluteQuantity = 0.1; // so optimizer sees its type
238474
- this.absoluteQuantity = undefined;
238475
- }
238476
238609
  /**
238477
238610
  * Create moments with optional origin.
238478
238611
  * * Origin and needOrigin are quirky.
@@ -238516,7 +238649,7 @@ class MomentData {
238516
238649
  axes.setColumnsPoint4dXYZ(points[0], points[1], points[2]);
238517
238650
  if (axes.determinant() < 0)
238518
238651
  axes.scaleColumnsInPlace(-1.0, -1.0, -1.0);
238519
- // prefer x and z positive -- y falls wherever . ..
238652
+ // prefer x and z positive; y falls wherever
238520
238653
  if (axes.at(0, 0) < 0.0)
238521
238654
  axes.scaleColumnsInPlace(-1.0, -1.0, 1.0);
238522
238655
  if (axes.at(2, 2) < 0.0)
@@ -238541,7 +238674,8 @@ class MomentData {
238541
238674
  * * Hence x axis is long direction.
238542
238675
  * * Hence planar data generates large moment as Z.
238543
238676
  * @param origin The origin used for the inertia products.
238544
- * @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].
238677
+ * @param inertiaProducts The inertia products: sums or integrals of
238678
+ * [xx,xy,xz,xw; yx,yy,yz,yw; zx,zy,zz,zw; wx,wy,wz,w].
238545
238679
  */
238546
238680
  static inertiaProductsToPrincipalAxes(origin, inertiaProducts) {
238547
238681
  const moments = new MomentData();
@@ -238585,23 +238719,21 @@ class MomentData {
238585
238719
  */
238586
238720
  static areEquivalentPrincipalAxes(dataA, dataB) {
238587
238721
  if (dataA && dataB
238588
- && _Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.isSameCoordinate(dataA.quantitySum, dataB.quantitySum)) { // um.. need different tolerance for area, volume?)
238722
+ && _Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.isSameCoordinate(dataA.quantitySum, dataB.quantitySum)) { // TODO: need different tolerance for area, volume?
238589
238723
  if (dataA.localToWorldMap.getOrigin().isAlmostEqual(dataB.localToWorldMap.getOrigin())
238590
238724
  && dataA.radiusOfGyration.isAlmostEqual(dataB.radiusOfGyration)) {
238591
238725
  if (_Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.isSameCoordinate(dataA.radiusOfGyration.x, dataA.radiusOfGyration.y)) {
238592
- // We have at least xy symmetry ....
238726
+ // we have at least xy symmetry
238593
238727
  if (_Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.isSameCoordinate(dataA.radiusOfGyration.x, dataA.radiusOfGyration.z))
238594
238728
  return true;
238595
- // just xy.
238596
- // allow opposite z directions.
238597
- // If the z's are aligned, x an dy can spin freely.
238729
+ // just xy; allow opposite z directions; if the z's are aligned, x and y can spin freely
238598
238730
  const zA = dataA.localToWorldMap.matrix.columnZ();
238599
238731
  const zB = dataB.localToWorldMap.matrix.columnZ();
238600
238732
  if (zA.isParallelTo(zB, true))
238601
238733
  return true;
238602
238734
  return false;
238603
238735
  }
238604
- // no symmetry. Test all three axes.
238736
+ // no symmetry; test all three axes
238605
238737
  const vectorA = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create();
238606
238738
  const vectorB = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create();
238607
238739
  for (let i = 0; i < 3; i++) {
@@ -238631,7 +238763,7 @@ class MomentData {
238631
238763
  }
238632
238764
  /** Revise the accumulated sums to be "around the centroid". */
238633
238765
  shiftOriginAndSumsToCentroidOfSums() {
238634
- const xyz = this.sums.columnW().realPoint();
238766
+ const xyz = this.sums.columnW().realPoint(); // centroid of the geometry
238635
238767
  if (xyz) {
238636
238768
  this.shiftOriginAndSumsByXYZ(xyz.x, xyz.y, xyz.z);
238637
238769
  return true;
@@ -238640,9 +238772,9 @@ class MomentData {
238640
238772
  }
238641
238773
  /**
238642
238774
  * Revise the accumulated sums.
238643
- * * add ax,ay,ax to the origin coordinates.
238644
- * * apply the negative translation to the sums.
238645
- */
238775
+ * * Add (ax,ay,az) to the origin coordinates.
238776
+ * * Apply the negative translation to the sums.
238777
+ */
238646
238778
  shiftOriginAndSumsByXYZ(ax, ay, az) {
238647
238779
  this.origin.addXYZInPlace(ax, ay, az);
238648
238780
  this.sums.multiplyTranslationSandwichInPlace(-ax, -ay, -az);
@@ -238652,23 +238784,24 @@ class MomentData {
238652
238784
  this.shiftOriginAndSumsByXYZ(newOrigin.x - this.origin.x, newOrigin.y - this.origin.y, newOrigin.z - this.origin.z);
238653
238785
  }
238654
238786
  /**
238655
- * Compute moments of a triangle from the origin to the given line.
238656
- * Accumulate them to this.sums.
238657
- * * If `pointA` is undefined, use `this.origin` as pointA.
238658
- * * If `this.needOrigin` is set, pointB is used
238659
- */
238787
+ * Compute moments of a triangle from the origin. Accumulate them to `this.sums`.
238788
+ * * If `this.needOrigin` is set, `this.origin` is set to `pointB`.
238789
+ * * If `pointA` is undefined, use `this.origin` as `pointA`.
238790
+ */
238660
238791
  accumulateTriangleMomentsXY(pointA, pointB, pointC) {
238661
238792
  this.setOriginXYZIfNeeded(pointB.x, pointB.y, 0.0);
238662
238793
  const x0 = this.origin.x;
238663
238794
  const y0 = this.origin.y;
238664
- const vectorA = MomentData._vectorA =
238665
- pointA !== undefined ? _Point4d__WEBPACK_IMPORTED_MODULE_5__.Point4d.create(pointA.x - x0, pointA.y - y0, 0.0, 1.0, MomentData._vectorA)
238666
- : _Point4d__WEBPACK_IMPORTED_MODULE_5__.Point4d.create(this.origin.x, this.origin.y, 0.0, 1.0, MomentData._vectorA);
238795
+ const vectorA = MomentData._vectorA = (pointA !== undefined) ?
238796
+ _Point4d__WEBPACK_IMPORTED_MODULE_5__.Point4d.create(pointA.x - x0, pointA.y - y0, 0.0, 1.0, MomentData._vectorA) :
238797
+ _Point4d__WEBPACK_IMPORTED_MODULE_5__.Point4d.create(0.0, 0.0, 0.0, 1.0, MomentData._vectorA);
238667
238798
  const vectorB = MomentData._vectorB = _Point4d__WEBPACK_IMPORTED_MODULE_5__.Point4d.create(pointB.x - x0, pointB.y - y0, 0.0, 1.0, MomentData._vectorB);
238668
238799
  const vectorC = MomentData._vectorC = _Point4d__WEBPACK_IMPORTED_MODULE_5__.Point4d.create(pointC.x - x0, pointC.y - y0, 0.0, 1.0, MomentData._vectorC);
238669
- // 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
238670
- // where w = 1-u-v
238671
- // W = column vector (point00.x, point00.y, point00.z, 1.0) etc.
238800
+ // Below we calculate 16 double integrals: \iint_T [x y 0 1]^ [x y 0 1] dT over triangle T=(A,B,C).
238801
+ // Each accumulates contributions from 9 scaled outer products. Integration computations use the barycentric
238802
+ // change of variables [B-A C-A][u,v]^ = [x,y]^ with Jacobian detJ = B-A x C-A = twice the area of T.
238803
+ // This converts the integration domain from T to the triangle bounded by u=0, v=0 and v=1-u, yielding e.g.,
238804
+ // \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.
238672
238805
  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);
238673
238806
  if (detJ !== 0.0) {
238674
238807
  const r1_12 = detJ / 12.0;
@@ -238684,7 +238817,7 @@ class MomentData {
238684
238817
  this.sums.addScaledOuterProductInPlace(vectorC, vectorC, r1_12);
238685
238818
  }
238686
238819
  }
238687
- /** Add scaled outer product of (4d, unit weight) point to this.sums. */
238820
+ /** Add scaled outer product of (4d, unit weight) point to `this.sums`. */
238688
238821
  accumulateScaledOuterProduct(point, scaleFactor) {
238689
238822
  this.setOriginXYZIfNeeded(point.x, point.y, 0.0);
238690
238823
  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);
@@ -238707,16 +238840,15 @@ class MomentData {
238707
238840
  this.sums.addScaledOuterProductInPlace(vectorB, vectorB, r1_3);
238708
238841
  }
238709
238842
  /**
238710
- * Compute moments of triangles from a base point to the given linestring.
238711
- * Accumulate them to this.sums.
238712
- * * If `pointA` is undefined, use `this.origin` as pointA.
238713
- * * If `this.needOrigin` is set, the first point of the array is captured as local origin for subsequent sums.
238714
- *
238843
+ * Compute moments of triangles from a base point to the given linestring. Accumulate them to `this.sums`.
238844
+ * * If `this.needOrigin` is set, `this.origin` is set to the first point of the array.
238845
+ * * If `sweepBase` is undefined, use `this.origin` as `sweepBase`.
238715
238846
  */
238716
238847
  accumulateTriangleToLineStringMomentsXY(sweepBase, points) {
238717
238848
  const n = points.length;
238718
238849
  if (n > 1) {
238719
238850
  points.getPoint3dAtUncheckedPointIndex(0, this._point0);
238851
+ // The linestring forms a polygon with sweepBase. Integrate over this polygon using Shoelace algorithm.
238720
238852
  for (let i = 1; i < n; i++) {
238721
238853
  points.getPoint3dAtUncheckedPointIndex(i, this._point1);
238722
238854
  this.accumulateTriangleMomentsXY(sweepBase, this._point0, this._point1);
@@ -238725,17 +238857,17 @@ class MomentData {
238725
238857
  }
238726
238858
  }
238727
238859
  /**
238728
- * * 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].
238729
- * * Sandwich this between transforms with columns [vectorU, vectorV, 0000, origin]. (Column weights 0001) (only xy
238730
- * parts of vectors).
238731
- * * scale by detJ for the xy-only determinant of the vectors.
238860
+ * 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].
238861
+ * * Sandwich this between transforms with columns [vectorU, vectorV, 0000, origin].
238862
+ * (column weights 0001; only xy parts of vectors).
238863
+ * * Scale by detJ for the xy-only determinant of the vectors.
238732
238864
  * @param productXX
238733
238865
  * @param productXY
238734
238866
  * @param productYY
238735
- * @param area Area in caller's system.
238736
- * @param origin Caller's origin.
238737
- * @param vectorU Caller's U axis (not necessarily unit).
238738
- * @param vectorV Caller's V axis (not necessarily unit).
238867
+ * @param area area in caller's system.
238868
+ * @param origin caller's origin.
238869
+ * @param vectorU caller's U axis (not necessarily unit).
238870
+ * @param vectorV caller's V axis (not necessarily unit).
238739
238871
  */
238740
238872
  accumulateXYProductsInCentroidalFrame(productXX, productXY, productYY, area, origin, vectorU, vectorV) {
238741
238873
  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);
@@ -239048,8 +239180,7 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
239048
239180
  distanceSquaredXYZW(other) {
239049
239181
  return _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.hypotenuseSquaredXYZW(other.xyzw[0] - this.xyzw[0], other.xyzw[1] - this.xyzw[1], other.xyzw[2] - this.xyzw[2], other.xyzw[3] - this.xyzw[3]);
239050
239182
  }
239051
- /** Return the distance between the instance and other after normalizing by weights
239052
- */
239183
+ /** Return the xy distance between the instance and `other` after normalizing by weights */
239053
239184
  realDistanceXY(other) {
239054
239185
  const wA = this.w;
239055
239186
  const wB = other.w;
@@ -239057,6 +239188,14 @@ class Point4d extends _geometry3d_Plane3d__WEBPACK_IMPORTED_MODULE_0__.Plane3d {
239057
239188
  return undefined;
239058
239189
  return _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.hypotenuseXY(other.xyzw[0] / wB - this.xyzw[0] / wA, other.xyzw[1] / wB - this.xyzw[1] / wA);
239059
239190
  }
239191
+ /** Return the xy squared distance between the instance and `other` after normalizing by weights */
239192
+ realDistanceSquaredXY(other) {
239193
+ const wA = this.w;
239194
+ const wB = other.w;
239195
+ if (_Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isSmallMetricDistance(wA) || _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isSmallMetricDistance(wB))
239196
+ return undefined;
239197
+ return _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.hypotenuseSquaredXY(other.xyzw[0] / wB - this.xyzw[0] / wA, other.xyzw[1] / wB - this.xyzw[1] / wA);
239198
+ }
239060
239199
  /** Return the largest absolute distance between corresponding components
239061
239200
  * * x,y,z,w all participate without normalization.
239062
239201
  */
@@ -247422,7 +247561,7 @@ class IndexedPolyfaceVisitor extends _PolyfaceData__WEBPACK_IMPORTED_MODULE_0__.
247422
247561
  */
247423
247562
  class IndexedPolyfaceSubsetVisitor extends IndexedPolyfaceVisitor {
247424
247563
  _facetIndices;
247425
- _currentSubsetIndex; // index within _facetIndices, or -1 after construction
247564
+ _currentSubsetIndex; // index within _facetIndices
247426
247565
  _nextSubsetIndex; // index within _facetIndices
247427
247566
  constructor(polyface, facetIndices, numWrap) {
247428
247567
  super(polyface, numWrap);
@@ -313019,7 +313158,7 @@ var loadLanguages = instance.loadLanguages;
313019
313158
  /***/ ((module) => {
313020
313159
 
313021
313160
  "use strict";
313022
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.0.0-dev.114","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"}}');
313161
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.0.0-dev.115","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"}}');
313023
313162
 
313024
313163
  /***/ })
313025
313164