@itwin/rpcinterface-full-stack-tests 3.5.0-dev.35 → 3.5.0-dev.41

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.
@@ -97626,6 +97626,20 @@ class AccuSnap {
97626
97626
  const currSnap = this.getCurrSnapDetail();
97627
97627
  return !currSnap ? false : currSnap.isHot;
97628
97628
  }
97629
+ /** Optional ids to never flash. Useful for tools like "trim curve" that won't want a flashed segment to obscure a result preview.
97630
+ * @note Cleared when a primitive or view tool is started and saved/restored when a primitive tool is suspended/unsuspended.
97631
+ * @public
97632
+ */
97633
+ neverFlash(ids) {
97634
+ if (undefined === ids) {
97635
+ this.toolState.neverFlash = undefined;
97636
+ return;
97637
+ }
97638
+ const newIds = new Set();
97639
+ for (const id of _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.iterable(ids))
97640
+ newIds.add(id);
97641
+ this.toolState.neverFlash = (0 !== newIds.size ? newIds : undefined);
97642
+ }
97629
97643
  /** @internal */
97630
97644
  destroy() {
97631
97645
  this.currHit = undefined;
@@ -97855,6 +97869,8 @@ class AccuSnap {
97855
97869
  return false;
97856
97870
  if (hit.isModelHit || hit.isMapHit)
97857
97871
  return false; // Avoid annoying flashing of reality models.
97872
+ if (this.toolState.neverFlash && this.toolState.neverFlash.has(hit.sourceId))
97873
+ return false;
97858
97874
  const snap = AccuSnap.toSnapDetail(hit);
97859
97875
  return !snap || snap.isHot || this._settings.hiliteColdHits;
97860
97876
  }
@@ -97884,7 +97900,10 @@ class AccuSnap {
97884
97900
  }
97885
97901
  return hit;
97886
97902
  }
97887
- initCmdState() { this.toolState.suspended = 0; }
97903
+ initCmdState() {
97904
+ this.toolState.suspended = 0;
97905
+ this.toolState.neverFlash = undefined;
97906
+ }
97888
97907
  /** @internal */
97889
97908
  suspend(doSuspend) {
97890
97909
  const previousDoSnapping = this._doSnapping;
@@ -98288,8 +98307,11 @@ class AccuSnap {
98288
98307
  return;
98289
98308
  }
98290
98309
  const hit = _IModelApp__WEBPACK_IMPORTED_MODULE_4__.IModelApp.tentativePoint.getCurrSnap();
98291
- if (hit && !(hit.isModelHit || hit.isMapHit)) // Don't hilite reality models.
98292
- hit.draw(context);
98310
+ if (!hit || hit.isModelHit || hit.isMapHit)
98311
+ return; // Don't hilite reality models.
98312
+ if (this.toolState.neverFlash && this.toolState.neverFlash.has(hit.sourceId))
98313
+ return;
98314
+ hit.draw(context);
98293
98315
  }
98294
98316
  /** @internal */
98295
98317
  decorate(context) {
@@ -98383,6 +98405,7 @@ class TentativeOrAccuSnap {
98383
98405
  this.enabled = other.enabled;
98384
98406
  this.locate = other.locate;
98385
98407
  this.suspended = other.suspended;
98408
+ this.neverFlash = other.neverFlash;
98386
98409
  }
98387
98410
  clone() {
98388
98411
  const val = new ToolState();
@@ -179649,7 +179672,8 @@ var EditManipulator;
179649
179672
  init() {
179650
179673
  // Set this.receivedDownEvent to still get up events sent to this tool instance when installed from another tool's down event (ex. onModelStartDrag).
179651
179674
  this.receivedDownEvent = true;
179652
- // Override inherited tool state from suspended primitive tool...
179675
+ // Override inherited tool state from suspended primitive tool.
179676
+ _IModelApp__WEBPACK_IMPORTED_MODULE_2__.IModelApp.accuSnap.onStartTool();
179653
179677
  if (this.wantAccuSnap)
179654
179678
  this.initLocateElements(false, true, undefined, _Tool__WEBPACK_IMPORTED_MODULE_3__.CoordinateLockOverrides.None);
179655
179679
  else
@@ -185358,6 +185382,7 @@ class ToolAdmin {
185358
185382
  }
185359
185383
  if (_IModelApp__WEBPACK_IMPORTED_MODULE_5__.IModelApp.accuDraw.onPreButtonEvent(ev))
185360
185384
  return;
185385
+ let updateDynamics = false;
185361
185386
  switch (ev.button) {
185362
185387
  case _Tool__WEBPACK_IMPORTED_MODULE_13__.BeButton.Data: {
185363
185388
  if (undefined === tool) {
@@ -185375,10 +185400,7 @@ class ToolAdmin {
185375
185400
  // Lock tool to target model of this view on first data button
185376
185401
  if (tool instanceof _PrimitiveTool__WEBPACK_IMPORTED_MODULE_12__.PrimitiveTool)
185377
185402
  tool.autoLockTarget();
185378
- // Process the active tool's pending hints from onDataButtonDown before calling updateDynamics...
185379
- _IModelApp__WEBPACK_IMPORTED_MODULE_5__.IModelApp.accuDraw.processHints();
185380
- // Update tool dynamics. Use last data button location which was potentially adjusted by onDataButtonDown and not current event
185381
- this.updateDynamics(undefined, true, true);
185403
+ updateDynamics = true; // AccuDraw.onPostButtonEvent needs to process the active tool's pending hints from onDataButtonDown before calling updateDynamics...
185382
185404
  break;
185383
185405
  }
185384
185406
  case _Tool__WEBPACK_IMPORTED_MODULE_13__.BeButton.Reset: {
@@ -185408,6 +185430,10 @@ class ToolAdmin {
185408
185430
  }
185409
185431
  _IModelApp__WEBPACK_IMPORTED_MODULE_5__.IModelApp.tentativePoint.onButtonEvent(ev);
185410
185432
  _IModelApp__WEBPACK_IMPORTED_MODULE_5__.IModelApp.accuDraw.onPostButtonEvent(ev);
185433
+ if (!updateDynamics)
185434
+ return;
185435
+ // Update tool dynamics. Use last data button location which was potentially adjusted by onDataButtonDown and not current event
185436
+ this.updateDynamics(undefined, true, true);
185411
185437
  }
185412
185438
  async onButtonDown(vp, pt2d, button, inputSource) {
185413
185439
  const filtered = this.filterViewport(vp);
@@ -191725,7 +191751,7 @@ class BSplineCurve3dBase extends _curve_CurvePrimitive__WEBPACK_IMPORTED_MODULE_
191725
191751
  * * If the space point is exactly on the curve, this is the reverse of fractionToPoint.
191726
191752
  * * Since CurvePrimitive should always have start and end available as candidate points, this method should always succeed
191727
191753
  * @param spacePoint point in space
191728
- * @param extend true to extend the curve (if possible)
191754
+ * @param _extend ignored. A BSplineCurve3dBase cannot be extended.
191729
191755
  * @returns Returns a CurveLocationDetail structure that holds the details of the close point.
191730
191756
  */
191731
191757
  closestPoint(spacePoint, _extend) {
@@ -196168,11 +196194,13 @@ class KnotVector {
196168
196194
  /** Convert localFraction within the interval following an indexed knot to a knot value. */
196169
196195
  baseKnotFractionToKnot(knotIndex0, localFraction) {
196170
196196
  const knot0 = this.knots[knotIndex0];
196197
+ localFraction = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.clamp(localFraction, 0, 1);
196171
196198
  return knot0 + localFraction * (this.knots[knotIndex0 + 1] - knot0);
196172
196199
  }
196173
196200
  /** Convert localFraction within an indexed bezier span to a knot value. */
196174
196201
  spanFractionToKnot(spanIndex, localFraction) {
196175
196202
  const k = this.spanIndexToLeftKnotIndex(spanIndex);
196203
+ localFraction = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.clamp(localFraction, 0, 1);
196176
196204
  return this.knots[k] + localFraction * (this.knots[k + 1] - this.knots[k]);
196177
196205
  }
196178
196206
  /** Convert localFraction within an indexed bezier span to fraction of active knot range. */
@@ -196182,6 +196210,7 @@ class KnotVector {
196182
196210
  }
196183
196211
  /** Return fraction of active knot range to knot value. */
196184
196212
  fractionToKnot(fraction) {
196213
+ fraction = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.clamp(fraction, 0, 1); // B-splines are not extendable
196185
196214
  return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.interpolate(this.knots[this.degree - 1], fraction, this.knots[this.knots.length - this.degree]);
196186
196215
  }
196187
196216
  /**
@@ -203425,9 +203454,9 @@ class PathFragment {
203425
203454
  }
203426
203455
  /** Convert chainDistance to true chidFraction, using detailed moveSignedDistanceFromFraction
203427
203456
  */
203428
- chainDistanceToAccurateChildFraction(chainDistance) {
203457
+ chainDistanceToAccurateChildFraction(chainDistance, allowExtrapolation) {
203429
203458
  // The fragments are really expected to do good mappings in their distance range ...
203430
- const childDetail = this.childCurve.moveSignedDistanceFromFraction(this.childFraction0, chainDistance - this.chainDistance0, false);
203459
+ const childDetail = this.childCurve.moveSignedDistanceFromFraction(this.childFraction0, chainDistance - this.chainDistance0, allowExtrapolation !== null && allowExtrapolation !== void 0 ? allowExtrapolation : false);
203431
203460
  return childDetail.fraction;
203432
203461
  }
203433
203462
  /** Return the scale factor to map childCurve fraction derivatives to chain fraction derivatives
@@ -203450,12 +203479,16 @@ class PathFragment {
203450
203479
  this.chainDistance0 = totalDistance - d1;
203451
203480
  this.chainDistance1 = totalDistance - d0;
203452
203481
  }
203482
+ /** @deprecated Use childFractionToChainDistance */
203483
+ childFractionTChainDistance(fraction) {
203484
+ return this.childFractionToChainDistance(fraction);
203485
+ }
203453
203486
  /**
203454
203487
  * convert a fractional position on the childCurve to distance in the chain space.
203455
203488
  * * Return value is SIGNED -- will be negative when fraction < this.childFraction0.
203456
203489
  * @param fraction fraction along the curve within this fragment
203457
203490
  */
203458
- childFractionTChainDistance(fraction) {
203491
+ childFractionToChainDistance(fraction) {
203459
203492
  let d = this.childCurve.curveLengthBetweenFractions(this.childFraction0, fraction);
203460
203493
  if (fraction < this.childFraction0)
203461
203494
  d = -d;
@@ -203488,7 +203521,7 @@ class DistanceIndexConstructionContext {
203488
203521
  let f1;
203489
203522
  for (let i = 1, f0 = fraction0; i <= numStrokes; i++, f0 = f1) {
203490
203523
  f1 = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.interpolate(fraction0, i / numStrokes, fraction1);
203491
- point0.interpolate(fraction1, point1, fragmentPoint1);
203524
+ point0.interpolate(f1, point1, fragmentPoint1);
203492
203525
  d0 = this._accumulatedDistance;
203493
203526
  this._accumulatedDistance += (Math.abs(f1 - f0) * point0.distance(point1));
203494
203527
  this._fragments.push(new PathFragment(f0, f1, d0, this._accumulatedDistance, cp, _geometry3d_Range__WEBPACK_IMPORTED_MODULE_1__.Range3d.create(fragmentPoint0, fragmentPoint1)));
@@ -203556,37 +203589,41 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
203556
203589
  return CurveChainWithDistanceIndex.createCapture(c);
203557
203590
  }
203558
203591
  /** Return a deep clone */
203559
- clonePartialCurve(_fractionA, _fractionB) {
203560
- if (_fractionA === _fractionB)
203592
+ clonePartialCurve(fractionA, fractionB) {
203593
+ if (fractionA === fractionB)
203561
203594
  return undefined;
203562
- let fractionA = _fractionA;
203563
- let fractionB = _fractionB;
203564
- const reversed = _fractionA > _fractionB;
203595
+ let fracA = fractionA;
203596
+ let fracB = fractionB;
203597
+ const reversed = fractionA > fractionB;
203565
203598
  if (reversed) {
203566
- fractionA = _fractionB;
203567
- fractionB = _fractionA;
203599
+ fracA = fractionB;
203600
+ fracB = fractionA;
203568
203601
  }
203569
- const chainDistanceA = fractionA * this._totalLength;
203570
- const chainDistanceB = fractionB * this._totalLength;
203571
- const newPath = _Path__WEBPACK_IMPORTED_MODULE_4__.Path.create();
203602
+ const chainDistanceA = fracA * this._totalLength;
203603
+ const chainDistanceB = fracB * this._totalLength;
203572
203604
  const fragmentA = this.chainDistanceToFragment(chainDistanceA, true);
203605
+ if (undefined === fragmentA)
203606
+ return undefined;
203573
203607
  const fragmentB = this.chainDistanceToFragment(chainDistanceB, true);
203574
- if (!fragmentA || !fragmentB)
203608
+ if (undefined === fragmentB)
203575
203609
  return undefined;
203576
- const childCurveIndexA = this._path.childIndex(fragmentA.childCurve);
203577
- const childCurveIndexB = this._path.childIndex(fragmentB.childCurve);
203578
- const childFractionA = fragmentA.chainDistanceToAccurateChildFraction(chainDistanceA);
203579
- const childFractionB = fragmentB.chainDistanceToAccurateChildFraction(chainDistanceB);
203580
- if (childCurveIndexA === undefined || childCurveIndexB === undefined)
203610
+ const childCurveIndexA = this._path.childIndex(fragmentA.childCurve, true);
203611
+ if (undefined === childCurveIndexA)
203581
203612
  return undefined;
203613
+ const childCurveIndexB = this._path.childIndex(fragmentB.childCurve, true);
203614
+ if (undefined === childCurveIndexB)
203615
+ return undefined;
203616
+ const childFractionA = fragmentA.chainDistanceToAccurateChildFraction(chainDistanceA, true);
203617
+ const childFractionB = fragmentB.chainDistanceToAccurateChildFraction(chainDistanceB, true);
203582
203618
  // add a (possibly reversed) partial clone to newPath
203619
+ const newPath = _Path__WEBPACK_IMPORTED_MODULE_4__.Path.create();
203583
203620
  const addPartialChild = (childCurve, childFraction0, childFraction1, reversedClone) => {
203584
- if (fractionA === fractionB)
203621
+ if (childFraction0 === childFraction1)
203585
203622
  return false;
203586
203623
  let newCurve;
203587
- if (fractionA === 0.0 && fractionB === 1.0) {
203624
+ if (childFraction0 === 0.0 && childFraction1 === 1.0) {
203588
203625
  newCurve = childCurve.clone();
203589
- if (reversed)
203626
+ if (reversedClone)
203590
203627
  newCurve.reverseInPlace();
203591
203628
  }
203592
203629
  else {
@@ -203717,7 +203754,7 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
203717
203754
  }
203718
203755
  /**
203719
203756
  * Capture (not clone) a path into a new `CurveChainWithDistanceIndex`
203720
- * @param primitives primitive array to be CAPTURED (not cloned)
203757
+ * @param path primitive array to be CAPTURED (not cloned)
203721
203758
  */
203722
203759
  static createCapture(path, options) {
203723
203760
  const fragments = DistanceIndexConstructionContext.createPathFragmentIndex(path, options);
@@ -203814,7 +203851,7 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
203814
203851
  const chainDistance = fraction * this._totalLength;
203815
203852
  const fragment = this.chainDistanceToFragment(chainDistance, true);
203816
203853
  if (fragment) {
203817
- const childFraction = fragment.chainDistanceToAccurateChildFraction(chainDistance);
203854
+ const childFraction = fragment.chainDistanceToAccurateChildFraction(chainDistance, true);
203818
203855
  return fragment.childCurve.fractionToPoint(childFraction, result);
203819
203856
  }
203820
203857
  // no fragment found. Use _fragments[0]
@@ -203832,7 +203869,7 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
203832
203869
  fractionToPointAndDerivative(fraction, result) {
203833
203870
  const distanceAlongPath = fraction * this._totalLength;
203834
203871
  const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
203835
- const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath);
203872
+ const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
203836
203873
  result = fragment.childCurve.fractionToPointAndDerivative(curveFraction, result);
203837
203874
  const a = this._totalLength / result.direction.magnitude();
203838
203875
  result.direction.scaleInPlace(a);
@@ -203847,7 +203884,7 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
203847
203884
  fractionToPointAndUnitTangent(fraction, result) {
203848
203885
  const distanceAlongPath = fraction * this._totalLength;
203849
203886
  const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
203850
- const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath);
203887
+ const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
203851
203888
  result = fragment.childCurve.fractionToPointAndDerivative(curveFraction, result);
203852
203889
  result.direction.normalizeInPlace();
203853
203890
  return result;
@@ -203862,7 +203899,7 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
203862
203899
  const totalLength = this._totalLength;
203863
203900
  const distanceAlongPath = fraction * totalLength;
203864
203901
  const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
203865
- const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath);
203902
+ const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
203866
203903
  result = fragment.childCurve.fractionToPointAnd2Derivatives(curveFraction, result);
203867
203904
  if (!result)
203868
203905
  return undefined;
@@ -203991,7 +204028,7 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
203991
204028
  return undefined;
203992
204029
  const fragment = this.curveAndChildFractionToFragment(childDetail.curve, childDetail.fraction);
203993
204030
  if (fragment) {
203994
- const chainDistance = fragment.childFractionTChainDistance(childDetail.fraction);
204031
+ const chainDistance = fragment.childFractionToChainDistance(childDetail.fraction);
203995
204032
  const chainFraction = this.chainDistanceToChainFraction(chainDistance);
203996
204033
  const chainDetail = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_7__.CurveLocationDetail.createCurveFractionPoint(this, chainFraction, childDetail.point);
203997
204034
  chainDetail.childDetail = childDetail;
@@ -204053,6 +204090,7 @@ __webpack_require__.r(__webpack_exports__);
204053
204090
  /* harmony import */ var _internalContexts_SumLengthsContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./internalContexts/SumLengthsContext */ "../../core/geometry/lib/esm/curve/internalContexts/SumLengthsContext.js");
204054
204091
  /* harmony import */ var _internalContexts_TransformInPlaceContext__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./internalContexts/TransformInPlaceContext */ "../../core/geometry/lib/esm/curve/internalContexts/TransformInPlaceContext.js");
204055
204092
  /* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
204093
+ /* harmony import */ var _ProxyCurve__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./ProxyCurve */ "../../core/geometry/lib/esm/curve/ProxyCurve.js");
204056
204094
  /*---------------------------------------------------------------------------------------------
204057
204095
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
204058
204096
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -204071,6 +204109,7 @@ __webpack_require__.r(__webpack_exports__);
204071
204109
 
204072
204110
 
204073
204111
 
204112
+
204074
204113
  /**
204075
204114
  * A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:
204076
204115
  * - `CurveChain` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive ` joining head-to-tail. The two instantiable forms of `CurveChain` are
@@ -204295,12 +204334,23 @@ class CurveChain extends CurveCollection {
204295
204334
  curve.reverseInPlace();
204296
204335
  this._curves.reverse();
204297
204336
  }
204298
- /** Return the index where target is found in the array of children */
204299
- childIndex(target) {
204337
+ /** Return the index where target is found in the array of children
204338
+ * @param alsoSearchProxies whether to also check proxy curves of the children
204339
+ */
204340
+ childIndex(target, alsoSearchProxies) {
204300
204341
  for (let i = 0; i < this._curves.length; i++) {
204301
204342
  if (this._curves[i] === target)
204302
204343
  return i;
204303
204344
  }
204345
+ if (alsoSearchProxies !== null && alsoSearchProxies !== void 0 ? alsoSearchProxies : false) {
204346
+ for (let i = 0; i < this._curves.length; i++) {
204347
+ const childCurve = this._curves[i];
204348
+ if (childCurve instanceof _ProxyCurve__WEBPACK_IMPORTED_MODULE_11__.ProxyCurve) {
204349
+ if (childCurve.proxyCurve === target)
204350
+ return i;
204351
+ }
204352
+ }
204353
+ }
204304
204354
  return undefined;
204305
204355
  }
204306
204356
  /** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive.
@@ -207911,19 +207961,26 @@ __webpack_require__.r(__webpack_exports__);
207911
207961
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
207912
207962
  /* harmony export */ "CurvePrimitive": () => (/* binding */ CurvePrimitive)
207913
207963
  /* harmony export */ });
207914
- /* harmony import */ var _curve_Query_StrokeCountMap__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../curve/Query/StrokeCountMap */ "../../core/geometry/lib/esm/curve/Query/StrokeCountMap.js");
207915
- /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
207916
- /* harmony import */ var _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../geometry3d/Matrix3d */ "../../core/geometry/lib/esm/geometry3d/Matrix3d.js");
207917
- /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
207918
- /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
207919
- /* harmony import */ var _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geometry3d/Transform */ "../../core/geometry/lib/esm/geometry3d/Transform.js");
207920
- /* harmony import */ var _numerics_BezierPolynomials__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../numerics/BezierPolynomials */ "../../core/geometry/lib/esm/numerics/BezierPolynomials.js");
207921
- /* harmony import */ var _numerics_Newton__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../numerics/Newton */ "../../core/geometry/lib/esm/numerics/Newton.js");
207922
- /* harmony import */ var _numerics_Quadrature__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../numerics/Quadrature */ "../../core/geometry/lib/esm/numerics/Quadrature.js");
207923
- /* harmony import */ var _CurveExtendMode__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./CurveExtendMode */ "../../core/geometry/lib/esm/curve/CurveExtendMode.js");
207924
- /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
207925
- /* harmony import */ var _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./GeometryQuery */ "../../core/geometry/lib/esm/curve/GeometryQuery.js");
207926
- /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
207964
+ /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
207965
+ /* harmony import */ var _curve_Query_StrokeCountMap__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../curve/Query/StrokeCountMap */ "../../core/geometry/lib/esm/curve/Query/StrokeCountMap.js");
207966
+ /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
207967
+ /* harmony import */ var _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geometry3d/Matrix3d */ "../../core/geometry/lib/esm/geometry3d/Matrix3d.js");
207968
+ /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
207969
+ /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
207970
+ /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
207971
+ /* harmony import */ var _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geometry3d/Transform */ "../../core/geometry/lib/esm/geometry3d/Transform.js");
207972
+ /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
207973
+ /* harmony import */ var _GeometryQuery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GeometryQuery */ "../../core/geometry/lib/esm/curve/GeometryQuery.js");
207974
+ /* harmony import */ var _internalContexts_AppendPlaneIntersectionStrokeHandler__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./internalContexts/AppendPlaneIntersectionStrokeHandler */ "../../core/geometry/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js");
207975
+ /* harmony import */ var _internalContexts_ClosestPointStrokeHandler__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./internalContexts/ClosestPointStrokeHandler */ "../../core/geometry/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js");
207976
+ /* harmony import */ var _internalContexts_CurveLengthContext__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./internalContexts/CurveLengthContext */ "../../core/geometry/lib/esm/curve/internalContexts/CurveLengthContext.js");
207977
+ /*---------------------------------------------------------------------------------------------
207978
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
207979
+ * See LICENSE.md in the project root for license terms and full copyright notice.
207980
+ *--------------------------------------------------------------------------------------------*/
207981
+ /** @packageDocumentation
207982
+ * @module Curve
207983
+ */
207927
207984
 
207928
207985
 
207929
207986
 
@@ -207951,7 +208008,7 @@ __webpack_require__.r(__webpack_exports__);
207951
208008
  * For fractions outside 0..1, the curve primitive class may either (a) return the near endpoint or (b) evaluate an extended curve.
207952
208009
  * @public
207953
208010
  */
207954
- class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.GeometryQuery {
208011
+ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_1__.GeometryQuery {
207955
208012
  constructor() {
207956
208013
  super();
207957
208014
  /** String name for schema properties */
@@ -207977,7 +208034,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
207977
208034
  const cross = data.vectorU.crossProduct(data.vectorV);
207978
208035
  const a = cross.magnitude();
207979
208036
  const b = data.vectorU.magnitude();
207980
- return _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.conditionalDivideFraction(a, b * b * b);
208037
+ return _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.conditionalDivideFraction(a, b * b * b);
207981
208038
  }
207982
208039
  /** Construct a frenet frame:
207983
208040
  * * origin at the point on the curve
@@ -207989,14 +208046,14 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
207989
208046
  const plane = this.fractionToPointAnd2Derivatives(fraction);
207990
208047
  if (!plane)
207991
208048
  return undefined;
207992
- let axes = _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createRigidFromColumns(plane.vectorU, plane.vectorV, _Geometry__WEBPACK_IMPORTED_MODULE_1__.AxisOrder.XYZ);
208049
+ let axes = _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_3__.Matrix3d.createRigidFromColumns(plane.vectorU, plane.vectorV, _Geometry__WEBPACK_IMPORTED_MODULE_2__.AxisOrder.XYZ);
207993
208050
  if (axes)
207994
- return _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_3__.Transform.createRefs(plane.origin, axes, result);
208051
+ return _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_4__.Transform.createRefs(plane.origin, axes, result);
207995
208052
  // 2nd derivative not distinct -- do arbitrary headsUP ...
207996
- const perpVector = _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createPerpendicularVectorFavorXYPlane(plane.vectorU, plane.vectorV);
207997
- axes = _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createRigidFromColumns(plane.vectorU, perpVector, _Geometry__WEBPACK_IMPORTED_MODULE_1__.AxisOrder.XYZ);
208053
+ const perpVector = _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_3__.Matrix3d.createPerpendicularVectorFavorXYPlane(plane.vectorU, plane.vectorV);
208054
+ axes = _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_3__.Matrix3d.createRigidFromColumns(plane.vectorU, perpVector, _Geometry__WEBPACK_IMPORTED_MODULE_2__.AxisOrder.XYZ);
207998
208055
  if (axes)
207999
- return _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_3__.Transform.createRefs(plane.origin, axes, result);
208056
+ return _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_4__.Transform.createRefs(plane.origin, axes, result);
208000
208057
  return undefined;
208001
208058
  }
208002
208059
  /** Construct signed distance from a point on the curve to its center of curvature (in xy only).
@@ -208012,7 +208069,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208012
208069
  const b = plane.vectorU.magnitude();
208013
208070
  if (b === 0.0)
208014
208071
  return 0.0;
208015
- const r = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.conditionalDivideCoordinate(b * b * b, cross);
208072
+ const r = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.conditionalDivideCoordinate(b * b * b, cross);
208016
208073
  if (r !== undefined)
208017
208074
  return r;
208018
208075
  return 0.0;
@@ -208031,7 +208088,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208031
208088
  * * Curve length is always positive.
208032
208089
  */
208033
208090
  curveLength() {
208034
- const context = new CurveLengthContext();
208091
+ const context = new _internalContexts_CurveLengthContext__WEBPACK_IMPORTED_MODULE_5__.CurveLengthContext();
208035
208092
  this.emitStrokableParts(context);
208036
208093
  return context.getSum();
208037
208094
  }
@@ -208051,7 +208108,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208051
208108
  const totalLength = this.curveLength();
208052
208109
  return Math.abs((fraction1 - fraction0) * totalLength);
208053
208110
  }
208054
- const context = new CurveLengthContext(fraction0, fraction1);
208111
+ const context = new _internalContexts_CurveLengthContext__WEBPACK_IMPORTED_MODULE_5__.CurveLengthContext(fraction0, fraction1);
208055
208112
  this.emitStrokableParts(context);
208056
208113
  return Math.abs(context.getSum());
208057
208114
  }
@@ -208068,11 +208125,11 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208068
208125
  */
208069
208126
  rangeBetweenFractionsByClone(fraction0, fraction1, transform) {
208070
208127
  if (fraction0 === fraction1)
208071
- return _geometry3d_Range__WEBPACK_IMPORTED_MODULE_4__.Range3d.create(this.fractionToPoint(fraction0));
208128
+ return _geometry3d_Range__WEBPACK_IMPORTED_MODULE_6__.Range3d.create(this.fractionToPoint(fraction0));
208072
208129
  const fragment = this.clonePartialCurve(fraction0, fraction1);
208073
208130
  if (fragment)
208074
208131
  return fragment.range(transform);
208075
- return _geometry3d_Range__WEBPACK_IMPORTED_MODULE_4__.Range3d.createNull();
208132
+ return _geometry3d_Range__WEBPACK_IMPORTED_MODULE_6__.Range3d.createNull();
208076
208133
  }
208077
208134
  /**
208078
208135
  * Returns an approximate range based on a fixed number of evaluations
@@ -208086,8 +208143,8 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208086
208143
  * @param extrapolationFactor if positive, evaluate again at interval midpoints and apply this fraction multiplier to any increase in size.
208087
208144
  */
208088
208145
  rangeBetweenFractionsByCount(fraction0, fraction1, count, transform, extrapolationFactor = 0.0) {
208089
- const range = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_4__.Range3d.createNull();
208090
- const workPoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d.create();
208146
+ const range = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_6__.Range3d.createNull();
208147
+ const workPoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__.Point3d.create();
208091
208148
  range.extendPoint(this.startPoint(workPoint));
208092
208149
  range.extendPoint(this.endPoint(workPoint));
208093
208150
  // Evaluate at count fractions (fraction0 + i * fractionStep)
@@ -208137,7 +208194,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208137
208194
  fraction0 = fraction1;
208138
208195
  fraction1 = fSave;
208139
208196
  }
208140
- const context = new CurveLengthContext(fraction0, fraction1, numGauss);
208197
+ const context = new _internalContexts_CurveLengthContext__WEBPACK_IMPORTED_MODULE_5__.CurveLengthContext(fraction0, fraction1, numGauss);
208141
208198
  context.announceIntervalForUniformStepStrokes(this, numInterval, fraction0, fraction1);
208142
208199
  return Math.abs(context.getSum());
208143
208200
  }
@@ -208146,9 +208203,8 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208146
208203
  * * (Attempt to) find a position on the curve at a signed distance from start fraction.
208147
208204
  * * Return the position as a CurveLocationDetail.
208148
208205
  * * In the `CurveLocationDetail`, record:
208149
- * * `fractional` position
208150
- * * `fraction` = coordinates of the point
208151
- * * `search
208206
+ * * `fraction` = fractional position
208207
+ * * `point` = coordinates of the point
208152
208208
  * * `a` = (signed!) distance moved. If `allowExtension` is false and the move reached the start or end of the curve, this distance is smaller than the requested signedDistance.
208153
208209
  * * `curveSearchStatus` indicates one of:
208154
208210
  * * `error` (unusual) computation failed not supported for this curve.
@@ -208177,11 +208233,11 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208177
208233
  // We are in luck! simple proportions determine it all !!!
208178
208234
  // (for example, a LineSegment3d or a circular arc)
208179
208235
  const totalLength = this.curveLength();
208180
- const signedFractionMove = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.conditionalDivideFraction(signedDistance, totalLength);
208236
+ const signedFractionMove = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.conditionalDivideFraction(signedDistance, totalLength);
208181
208237
  if (signedFractionMove === undefined) {
208182
- return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createCurveFractionPointDistanceCurveSearchStatus(this, startFraction, this.fractionToPoint(startFraction), 0.0, _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveSearchStatus.error);
208238
+ return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createCurveFractionPointDistanceCurveSearchStatus(this, startFraction, this.fractionToPoint(startFraction), 0.0, _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveSearchStatus.error);
208183
208239
  }
208184
- return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, startFraction + signedFractionMove, signedDistance, result);
208240
+ return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, startFraction + signedFractionMove, signedDistance, result);
208185
208241
  }
208186
208242
  return this.moveSignedDistanceFromFractionGeneric(startFraction, signedDistance, allowExtension, result);
208187
208243
  }
@@ -208203,19 +208259,45 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208203
208259
  * @param result
208204
208260
  */
208205
208261
  moveSignedDistanceFromFractionGeneric(startFraction, signedDistance, allowExtension, result) {
208206
- const limitFraction = signedDistance > 0.0 ? 1.0 : 0.0;
208262
+ let limitFraction;
208263
+ const slackFraction = 0.1; // slack to use when integration would otherwise have no room to work
208264
+ if (signedDistance === 0.0)
208265
+ return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result); // no movement, just evaluate at startFraction
208266
+ if (signedDistance > 0.0) {
208267
+ limitFraction = 1.0;
208268
+ if (startFraction >= 1.0) {
208269
+ const newStartFraction = 1.0 - slackFraction;
208270
+ signedDistance += this.curveLengthBetweenFractions(newStartFraction, startFraction);
208271
+ startFraction = newStartFraction;
208272
+ }
208273
+ }
208274
+ else { // signedDistance < 0.0
208275
+ limitFraction = 0.0;
208276
+ if (startFraction <= 0.0) {
208277
+ const newStartFraction = 0.0 + slackFraction;
208278
+ signedDistance -= this.curveLengthBetweenFractions(startFraction, newStartFraction);
208279
+ startFraction = newStartFraction;
208280
+ }
208281
+ }
208282
+ const availableLength = this.curveLengthBetweenFractions(startFraction, limitFraction);
208283
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(availableLength > 0.0);
208207
208284
  const absDistance = Math.abs(signedDistance);
208208
- const directionFactor = signedDistance < 0.0 ? -1.0 : 1.0;
208209
- const availableLength = this.curveLengthBetweenFractions(startFraction, limitFraction); // that is always positive
208210
208285
  if (availableLength < absDistance && !allowExtension)
208211
- return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, limitFraction, signedDistance, result);
208212
- const fractionStep = absDistance / availableLength;
208213
- let fractionB = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(startFraction, fractionStep, limitFraction);
208286
+ return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, limitFraction, signedDistance, result);
208287
+ const fractionStep = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.conditionalDivideCoordinate(absDistance, availableLength);
208288
+ if (undefined === fractionStep) {
208289
+ // no available length!
208290
+ result = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);
208291
+ result.curveSearchStatus = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveSearchStatus.error;
208292
+ return result;
208293
+ }
208294
+ const directionFactor = signedDistance < 0.0 ? -1.0 : 1.0;
208295
+ let fractionB = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.interpolate(startFraction, fractionStep, limitFraction);
208214
208296
  let fractionA = startFraction;
208215
208297
  let distanceA = 0.0;
208216
208298
  const tol = 1.0e-12 * availableLength;
208217
208299
  let numConverged = 0;
208218
- const tangent = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_7__.Ray3d.createXAxis();
208300
+ const tangent = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_9__.Ray3d.createXAxis();
208219
208301
  // on each loop entry:
208220
208302
  // fractionA is the most recent endOfInterval. (It may have been reached by a mixture of forward and backward step.)
208221
208303
  // distanceA is the distance to (the point at) fractionA
@@ -208244,10 +208326,9 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208244
208326
  distanceA = distance0B;
208245
208327
  }
208246
208328
  if (numConverged > 1)
208247
- return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createConditionalMoveSignedDistance(false, this, startFraction, fractionB, signedDistance, result);
208248
- result = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);
208249
- result.a = 0.0;
208250
- result.curveSearchStatus = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveSearchStatus.error;
208329
+ return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, fractionB, signedDistance, result);
208330
+ result = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);
208331
+ result.curveSearchStatus = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveSearchStatus.error;
208251
208332
  return result;
208252
208333
  }
208253
208334
  /**
@@ -208268,7 +208349,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208268
208349
  * @returns Returns a CurveLocationDetail structure that holds the details of the close point.
208269
208350
  */
208270
208351
  closestPoint(spacePoint, extend) {
208271
- const strokeHandler = new ClosestPointStrokeHandler(spacePoint, extend);
208352
+ const strokeHandler = new _internalContexts_ClosestPointStrokeHandler__WEBPACK_IMPORTED_MODULE_10__.ClosestPointStrokeHandler(spacePoint, extend);
208272
208353
  this.emitStrokableParts(strokeHandler);
208273
208354
  return strokeHandler.claimResult();
208274
208355
  }
@@ -208290,7 +208371,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208290
208371
  return undefined;
208291
208372
  }
208292
208373
  /**
208293
- * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return true
208374
+ * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return the scale factor.
208294
208375
  * * If distance-along-the-curve is not proportional, return undefined.
208295
208376
  * * When defined, the scale factor is always the length of the curve.
208296
208377
  * * This scale factor is typically available for these curve types:
@@ -208315,7 +208396,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208315
208396
  * @returns Return the number of CurveLocationDetail's added to the result array.
208316
208397
  */
208317
208398
  appendPlaneIntersectionPoints(plane, result) {
208318
- const strokeHandler = new AppendPlaneIntersectionStrokeHandler(plane, result);
208399
+ const strokeHandler = new _internalContexts_AppendPlaneIntersectionStrokeHandler__WEBPACK_IMPORTED_MODULE_11__.AppendPlaneIntersectionStrokeHandler(plane, result);
208319
208400
  const n0 = result.length;
208320
208401
  this.emitStrokableParts(strokeHandler);
208321
208402
  return result.length - n0;
@@ -208330,17 +208411,17 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208330
208411
  * @param startEndXYZTolerance if nonzero, adjust to endpoint with this tolerance.
208331
208412
  * @internal
208332
208413
  */
208333
- static snapAndRestrictDetails(details, allowExtend = true, applySnappedCoordinates = false, startEndFractionTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.smallAngleRadians, startEndXYZTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.smallMetricDistance) {
208414
+ static snapAndRestrictDetails(details, allowExtend = true, applySnappedCoordinates = false, startEndFractionTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallAngleRadians, startEndXYZTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance) {
208334
208415
  const n0 = details.length;
208335
208416
  let acceptIndex = 0;
208336
- const point0 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d.create();
208337
- const point1 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d.create();
208417
+ const point0 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__.Point3d.create();
208418
+ const point1 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__.Point3d.create();
208338
208419
  let snappedCoordinates;
208339
208420
  for (let candidateIndex = 0; candidateIndex < n0; candidateIndex++) {
208340
208421
  snappedCoordinates = undefined;
208341
208422
  const detail = details[candidateIndex];
208342
208423
  let fraction = detail.fraction;
208343
- let accept = allowExtend || _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isIn01(fraction);
208424
+ let accept = allowExtend || _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isIn01(fraction);
208344
208425
  if (detail.curve) {
208345
208426
  detail.curve.startPoint(point0);
208346
208427
  detail.curve.endPoint(point1);
@@ -208349,13 +208430,13 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208349
208430
  if (Math.abs(fraction) < startEndFractionTolerance) {
208350
208431
  fraction = 0.0;
208351
208432
  accept = true;
208352
- detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveIntervalRole.isolatedAtVertex;
208433
+ detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveIntervalRole.isolatedAtVertex;
208353
208434
  snappedCoordinates = point0;
208354
208435
  }
208355
208436
  if (Math.abs(fraction - 1.0) < startEndFractionTolerance) {
208356
208437
  fraction = 1.0;
208357
208438
  accept = true;
208358
- detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveIntervalRole.isolatedAtVertex;
208439
+ detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveIntervalRole.isolatedAtVertex;
208359
208440
  snappedCoordinates = point1;
208360
208441
  if (detail.curve)
208361
208442
  snappedCoordinates = detail.curve.startPoint(point1);
@@ -208365,12 +208446,12 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208365
208446
  // REMARK: always test both endpoints. If there is a cyclic fraction space, an intersection marked as "after" the end might have wrapped all the way to the beginning.
208366
208447
  if (detail.point.distance(point0) <= startEndXYZTolerance) {
208367
208448
  fraction = 0.0;
208368
- detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveIntervalRole.isolatedAtVertex;
208449
+ detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveIntervalRole.isolatedAtVertex;
208369
208450
  snappedCoordinates = point0;
208370
208451
  }
208371
208452
  else if (detail.point.distance(point1) <= startEndXYZTolerance) {
208372
208453
  fraction = 1.0;
208373
- detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveIntervalRole.isolatedAtVertex;
208454
+ detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveIntervalRole.isolatedAtVertex;
208374
208455
  snappedCoordinates = point1;
208375
208456
  }
208376
208457
  }
@@ -208407,7 +208488,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208407
208488
  computeAndAttachRecursiveStrokeCounts(options, parentMap) {
208408
208489
  const n = this.computeStrokeCountForOptions(options);
208409
208490
  const a = this.curveLength();
208410
- CurvePrimitive.installStrokeCountMap(this, _curve_Query_StrokeCountMap__WEBPACK_IMPORTED_MODULE_8__.StrokeCountMap.createWithCurvePrimitive(this, n, a, 0, a), parentMap);
208491
+ CurvePrimitive.installStrokeCountMap(this, _curve_Query_StrokeCountMap__WEBPACK_IMPORTED_MODULE_12__.StrokeCountMap.createWithCurvePrimitive(this, n, a, 0, a), parentMap);
208411
208492
  }
208412
208493
  /**
208413
208494
  * * evaluate strokes at fractions indicated in a StrokeCountMap.
@@ -208463,326 +208544,6 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
208463
208544
  return results;
208464
208545
  }
208465
208546
  }
208466
- /** Intermediate class for managing the parentCurve announcements from an IStrokeHandler */
208467
- class NewtonRotRStrokeHandler extends _numerics_Newton__WEBPACK_IMPORTED_MODULE_9__.NewtonEvaluatorRtoR {
208468
- constructor() {
208469
- super();
208470
- this._parentCurvePrimitive = undefined;
208471
- }
208472
- /** retain the parentCurvePrimitive.
208473
- * * Calling this method tells the handler that the parent curve is to be used for detail searches.
208474
- * * Example: Transition spiral search is based on linestring first, then the exact spiral.
208475
- * * Example: CurveChainWithDistanceIndex does NOT do this announcement -- the constituents act independently.
208476
- */
208477
- startParentCurvePrimitive(curve) { this._parentCurvePrimitive = curve; }
208478
- /** Forget the parentCurvePrimitive */
208479
- endParentCurvePrimitive(_curve) { this._parentCurvePrimitive = undefined; }
208480
- }
208481
- class AppendPlaneIntersectionStrokeHandler extends NewtonRotRStrokeHandler {
208482
- constructor(plane, intersections) {
208483
- super();
208484
- this._fractionA = 0;
208485
- this._functionA = 0;
208486
- // private derivativeA: number; <---- Not currently used
208487
- this._functionB = 0;
208488
- this._fractionB = 0;
208489
- this._derivativeB = 0;
208490
- this._numThisCurve = 0;
208491
- this._plane = plane;
208492
- this._intersections = intersections;
208493
- this.startCurvePrimitive(undefined);
208494
- this._ray = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_7__.Ray3d.createZero();
208495
- this._newtonSolver = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_9__.Newton1dUnboundedApproximateDerivative(this);
208496
- }
208497
- // Return the first defined curve among: this.parentCurvePrimitive, this.curve;
208498
- effectiveCurve() {
208499
- if (this._parentCurvePrimitive)
208500
- return this._parentCurvePrimitive;
208501
- return this._curve;
208502
- }
208503
- get getDerivativeB() { return this._derivativeB; } // <--- DerivativeB is not currently used anywhere. Provided getter to suppress lint error
208504
- startCurvePrimitive(curve) {
208505
- this._curve = curve;
208506
- this._fractionA = 0.0;
208507
- this._numThisCurve = 0;
208508
- this._functionA = 0.0;
208509
- // this.derivativeA = 0.0;
208510
- }
208511
- endCurvePrimitive() { }
208512
- announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
208513
- this.startCurvePrimitive(cp);
208514
- if (numStrokes < 1)
208515
- numStrokes = 1;
208516
- const df = 1.0 / numStrokes;
208517
- for (let i = 0; i <= numStrokes; i++) {
208518
- const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(fraction0, i * df, fraction1);
208519
- cp.fractionToPointAndDerivative(fraction, this._ray);
208520
- this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);
208521
- }
208522
- }
208523
- announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
208524
- const h0 = this._plane.altitude(point0);
208525
- const h1 = this._plane.altitude(point1);
208526
- if (h0 * h1 > 0.0)
208527
- return;
208528
- const fraction01 = _numerics_BezierPolynomials__WEBPACK_IMPORTED_MODULE_10__.Order2Bezier.solveCoffs(h0, h1);
208529
- // let numIntersection = 0;
208530
- if (fraction01 !== undefined) {
208531
- // numIntersection++;
208532
- const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(fraction0, fraction01, fraction1);
208533
- this._newtonSolver.setX(fraction);
208534
- if (this._newtonSolver.runIterations()) {
208535
- this.announceSolutionFraction(this._newtonSolver.getX());
208536
- }
208537
- // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));
208538
- }
208539
- }
208540
- announceSolutionFraction(fraction) {
208541
- const curve = this.effectiveCurve();
208542
- if (curve) {
208543
- this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);
208544
- this._intersections.push(_CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));
208545
- }
208546
- }
208547
- evaluate(fraction) {
208548
- const curve = this.effectiveCurve();
208549
- if (!curve)
208550
- return false;
208551
- this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));
208552
- return true;
208553
- }
208554
- /**
208555
- * * ASSUME both the "A" and "B" evaluations (fraction, function, and derivative) are known.
208556
- * * If function value changed sign between, interpolate an approximate root and improve it with
208557
- * the newton solver.
208558
- */
208559
- searchInterval() {
208560
- if (this._functionA * this._functionB > 0)
208561
- return;
208562
- if (this._functionA === 0)
208563
- this.announceSolutionFraction(this._fractionA);
208564
- if (this._functionB === 0)
208565
- this.announceSolutionFraction(this._fractionB);
208566
- if (this._functionA * this._functionB < 0) {
208567
- const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
208568
- if (fraction) {
208569
- this._newtonSolver.setX(fraction);
208570
- if (this._newtonSolver.runIterations())
208571
- this.announceSolutionFraction(this._newtonSolver.getX());
208572
- }
208573
- }
208574
- }
208575
- /** Evaluate and save _functionB, _derivativeB, and _fractionB. */
208576
- evaluateB(xyz, fraction, tangent) {
208577
- this._functionB = this._plane.altitude(xyz);
208578
- this._derivativeB = this._plane.velocity(tangent);
208579
- this._fractionB = fraction;
208580
- }
208581
- /**
208582
- * Announce point and tangent for evaluations.
208583
- * * The function evaluation is saved as the "B" function point.
208584
- * * The function point count is incremented
208585
- * * If function point count is greater than 1, the current interval is searched.
208586
- * * The just-evaluated point ("B") is saved as the "old" ("A") evaluation point.
208587
- * @param xyz
208588
- * @param fraction
208589
- * @param tangent
208590
- */
208591
- announcePointTangent(xyz, fraction, tangent) {
208592
- this.evaluateB(xyz, fraction, tangent);
208593
- if (this._numThisCurve++ > 0)
208594
- this.searchInterval();
208595
- this._functionA = this._functionB;
208596
- this._fractionA = this._fractionB;
208597
- }
208598
- }
208599
- class CurveLengthContext {
208600
- constructor(fraction0 = 0.0, fraction1 = 1.0, numGaussPoints = 5) {
208601
- this.startCurvePrimitive(undefined);
208602
- this._summedLength = 0.0;
208603
- this._ray = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_7__.Ray3d.createZero();
208604
- if (fraction0 < fraction1) {
208605
- this._fraction0 = fraction0;
208606
- this._fraction1 = fraction1;
208607
- }
208608
- else {
208609
- this._fraction0 = fraction1;
208610
- this._fraction1 = fraction0;
208611
- }
208612
- this._gaussMapper = new _numerics_Quadrature__WEBPACK_IMPORTED_MODULE_11__.GaussMapper(numGaussPoints);
208613
- }
208614
- tangentMagnitude(fraction) {
208615
- this._ray = this._curve.fractionToPointAndDerivative(fraction, this._ray);
208616
- return this._ray.direction.magnitude();
208617
- }
208618
- getSum() { return this._summedLength; }
208619
- startCurvePrimitive(curve) {
208620
- this._curve = curve;
208621
- }
208622
- startParentCurvePrimitive(_curve) { }
208623
- endParentCurvePrimitive(_curve) { }
208624
- endCurvePrimitive() { }
208625
- announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
208626
- if (fraction0 < this._fraction0)
208627
- fraction0 = this._fraction0;
208628
- if (fraction1 > this._fraction1)
208629
- fraction1 = this._fraction1;
208630
- if (fraction1 > fraction0) {
208631
- this.startCurvePrimitive(cp);
208632
- if (numStrokes < 1)
208633
- numStrokes = 1;
208634
- const df = 1.0 / numStrokes;
208635
- for (let i = 1; i <= numStrokes; i++) {
208636
- const fractionA = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(fraction0, (i - 1) * df, fraction1);
208637
- const fractionB = i === numStrokes ? fraction1 : _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(fraction0, (i) * df, fraction1);
208638
- const numGauss = this._gaussMapper.mapXAndW(fractionA, fractionB);
208639
- for (let k = 0; k < numGauss; k++) {
208640
- this._summedLength += this._gaussMapper.gaussW[k] * this.tangentMagnitude(this._gaussMapper.gaussX[k]);
208641
- }
208642
- }
208643
- }
208644
- }
208645
- announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
208646
- const segmentLength = point0.distance(point1);
208647
- if (this._fraction0 <= fraction0 && fraction1 <= this._fraction1)
208648
- this._summedLength += segmentLength;
208649
- else {
208650
- let g0 = fraction0;
208651
- let g1 = fraction1;
208652
- if (g0 < this._fraction0)
208653
- g0 = this._fraction0;
208654
- if (g1 > this._fraction1)
208655
- g1 = this._fraction1;
208656
- if (g1 > g0) {
208657
- this._summedLength += segmentLength * (g1 - g0) / (fraction1 - fraction0);
208658
- }
208659
- }
208660
- }
208661
- announcePointTangent(_xyz, _fraction, _tangent) {
208662
- // uh oh -- need to retain point for next interval
208663
- }
208664
- }
208665
- // context for searching for closest point .. .
208666
- class ClosestPointStrokeHandler extends NewtonRotRStrokeHandler {
208667
- constructor(spacePoint, extend) {
208668
- super();
208669
- this._fractionA = 0;
208670
- this._functionA = 0;
208671
- this._functionB = 0;
208672
- this._fractionB = 0;
208673
- this._numThisCurve = 0;
208674
- this._spacePoint = spacePoint;
208675
- this._workPoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d.create();
208676
- this._workRay = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_7__.Ray3d.createZero();
208677
- this._closestPoint = undefined;
208678
- this._extend = extend;
208679
- this.startCurvePrimitive(undefined);
208680
- this._newtonSolver = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_9__.Newton1dUnboundedApproximateDerivative(this);
208681
- }
208682
- claimResult() {
208683
- if (this._closestPoint) {
208684
- this._newtonSolver.setX(this._closestPoint.fraction);
208685
- this._curve = this._closestPoint.curve;
208686
- if (this._newtonSolver.runIterations()) {
208687
- let fraction = this._newtonSolver.getX();
208688
- fraction = _CurveExtendMode__WEBPACK_IMPORTED_MODULE_12__.CurveExtendOptions.correctFraction(this._extend, fraction);
208689
- this.announceSolutionFraction(fraction);
208690
- }
208691
- }
208692
- return this._closestPoint;
208693
- }
208694
- needPrimaryGeometryForStrokes() { return true; }
208695
- startCurvePrimitive(curve) {
208696
- this._curve = curve;
208697
- this._fractionA = 0.0;
208698
- this._numThisCurve = 0;
208699
- this._functionA = 0.0;
208700
- }
208701
- endCurvePrimitive() { }
208702
- announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
208703
- this.startCurvePrimitive(cp);
208704
- this.announceSolutionFraction(0.0); // test start point as closest
208705
- this.announceSolutionFraction(1.0); // test end point as closest
208706
- if (numStrokes < 1)
208707
- numStrokes = 1;
208708
- const df = 1.0 / numStrokes;
208709
- for (let i = 0; i <= numStrokes; i++) {
208710
- const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(fraction0, i * df, fraction1);
208711
- cp.fractionToPointAndDerivative(fraction, this._workRay);
208712
- this.announceRay(fraction, this._workRay);
208713
- }
208714
- }
208715
- announceCandidate(cp, fraction, point) {
208716
- const distance = this._spacePoint.distance(point);
208717
- if (this._closestPoint && distance > this._closestPoint.a)
208718
- return;
208719
- this._closestPoint = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);
208720
- this._closestPoint.a = distance;
208721
- if (this._parentCurvePrimitive !== undefined)
208722
- this._closestPoint.curve = this._parentCurvePrimitive;
208723
- }
208724
- announceSegmentInterval(cp, point0, point1, _numStrokes, fraction0, fraction1) {
208725
- let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);
208726
- // only consider extending the segment if the immediate caller says we are at endpoints ...
208727
- if (!this._extend)
208728
- localFraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.clampToStartEnd(localFraction, 0.0, 1.0);
208729
- else {
208730
- if (fraction0 !== 0.0)
208731
- localFraction = Math.max(localFraction, 0.0);
208732
- if (fraction1 !== 1.0)
208733
- localFraction = Math.min(localFraction, 1.0);
208734
- }
208735
- this._workPoint = point0.interpolate(localFraction, point1);
208736
- const globalFraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(fraction0, localFraction, fraction1);
208737
- this.announceCandidate(cp, globalFraction, this._workPoint);
208738
- }
208739
- searchInterval() {
208740
- if (this._functionA * this._functionB > 0)
208741
- return;
208742
- if (this._functionA === 0)
208743
- this.announceSolutionFraction(this._fractionA);
208744
- if (this._functionB === 0)
208745
- this.announceSolutionFraction(this._fractionB);
208746
- if (this._functionA * this._functionB < 0) {
208747
- const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
208748
- if (fraction) {
208749
- this._newtonSolver.setX(fraction);
208750
- if (this._newtonSolver.runIterations())
208751
- this.announceSolutionFraction(this._newtonSolver.getX());
208752
- }
208753
- }
208754
- }
208755
- evaluateB(fractionB, dataB) {
208756
- this._functionB = dataB.dotProductToPoint(this._spacePoint);
208757
- this._fractionB = fractionB;
208758
- }
208759
- announceSolutionFraction(fraction) {
208760
- if (this._curve)
208761
- this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));
208762
- }
208763
- evaluate(fraction) {
208764
- let curve = this._curve;
208765
- if (this._parentCurvePrimitive)
208766
- curve = this._parentCurvePrimitive;
208767
- if (curve) {
208768
- this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);
208769
- this.currentF = this._workRay.dotProductToPoint(this._spacePoint);
208770
- return true;
208771
- }
208772
- return false;
208773
- }
208774
- announceRay(fraction, data) {
208775
- this.evaluateB(fraction, data);
208776
- if (this._numThisCurve++ > 0)
208777
- this.searchInterval();
208778
- this._functionA = this._functionB;
208779
- this._fractionA = this._fractionB;
208780
- }
208781
- announcePointTangent(point, fraction, tangent) {
208782
- this._workRay.set(point, tangent);
208783
- this.announceRay(fraction, this._workRay);
208784
- }
208785
- }
208786
208547
 
208787
208548
 
208788
208549
  /***/ }),
@@ -210018,7 +209779,8 @@ class LineString3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePri
210018
209779
  /**
210019
209780
  * Convert a segment index and local fraction to a global fraction.
210020
209781
  * @param index index of segment being evaluated
210021
- * @param localFraction local fraction within that segment
209782
+ * @param localFraction local fraction in [0,1] within the segment
209783
+ * @return global fraction f in [0,1] such that the segment is parameterized by index/N <= f <= (index+1)/N.
210022
209784
  */
210023
209785
  segmentIndexAndLocalFractionToGlobalFraction(index, localFraction) {
210024
209786
  const numSegment = this._points.length - 1;
@@ -210026,6 +209788,25 @@ class LineString3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePri
210026
209788
  return 0.0;
210027
209789
  return (index + localFraction) / numSegment;
210028
209790
  }
209791
+ /**
209792
+ * Convert a global fraction to a segment index and local fraction.
209793
+ * @param globalFraction a fraction f in [0,1] in the linestring parameterization, where the i_th segment (0 <= i < N) is parameterized by i/N <= f <= (i+1)/N.
209794
+ */
209795
+ globalFractionToSegmentIndexAndLocalFraction(globalFraction) {
209796
+ const numSegment = this._points.length - 1;
209797
+ if (numSegment < 1)
209798
+ return { index: 0, fraction: 0.0 };
209799
+ const scaledGlobalFraction = globalFraction * numSegment;
209800
+ let segmentIndex;
209801
+ if (globalFraction < 0)
209802
+ segmentIndex = 0;
209803
+ else if (globalFraction > 1)
209804
+ segmentIndex = numSegment - 1;
209805
+ else // globalFraction in [0,1]
209806
+ segmentIndex = Math.floor(scaledGlobalFraction);
209807
+ const localFraction = scaledGlobalFraction - segmentIndex;
209808
+ return { index: segmentIndex, fraction: localFraction };
209809
+ }
210029
209810
  /** Return a frenet frame, using nearby points to estimate a plane. */
210030
209811
  fractionToFrenetFrame(fraction, result) {
210031
209812
  const n = this._points.length;
@@ -210259,7 +210040,6 @@ class LineString3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePri
210259
210040
  if (numPoints > 1) {
210260
210041
  let segmentFraction = 0;
210261
210042
  let d = 0;
210262
- const df = 1.0 / lastIndex;
210263
210043
  for (let i = 1; i < numPoints; i++) {
210264
210044
  segmentFraction = spacePoint.fractionOfProjectionToLine(this._points.getPoint3dAtUncheckedPointIndex(i - 1), this._points.getPoint3dAtUncheckedPointIndex(i));
210265
210045
  if (segmentFraction < 0) {
@@ -210273,7 +210053,7 @@ class LineString3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePri
210273
210053
  this._points.getPoint3dAtUncheckedPointIndex(i - 1).interpolate(segmentFraction, this._points.getPoint3dAtUncheckedPointIndex(i), result.pointQ);
210274
210054
  d = result.pointQ.distance(spacePoint);
210275
210055
  if (d < result.a) {
210276
- result.setFP((i - 1 + segmentFraction) * df, result.pointQ, undefined, d);
210056
+ result.setFP(this.segmentIndexAndLocalFractionToGlobalFraction(i - 1, segmentFraction), result.pointQ, undefined, d);
210277
210057
  }
210278
210058
  }
210279
210059
  }
@@ -210606,6 +210386,7 @@ class LineString3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePri
210606
210386
  }
210607
210387
  return status;
210608
210388
  }
210389
+ /** @param fraction used to interpolate between points at index and index + 1 */
210609
210390
  addResolvedPoint(index, fraction, dest) {
210610
210391
  const n = this._points.length;
210611
210392
  if (n === 0)
@@ -210646,49 +210427,36 @@ class LineString3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePri
210646
210427
  if (fractionB > 1)
210647
210428
  fractionB = 1;
210648
210429
  }
210649
- const numEdge = n - 1;
210650
- let indexA; // left index of first extended/partial segment of clone
210651
- let indexB; // left index of last extended/partial segment of clone
210652
210430
  let index0, index1; // range of original vertices to copy into clone
210653
- let localFractionA = fractionA;
210654
- let localFractionB = fractionB;
210431
+ const localA = this.globalFractionToSegmentIndexAndLocalFraction(fractionA);
210432
+ const localB = this.globalFractionToSegmentIndexAndLocalFraction(fractionB);
210655
210433
  if (fractionA < 0) {
210656
- indexA = 0;
210657
210434
  index0 = 1; // first original vertex is not in clone
210658
210435
  }
210659
210436
  else if (0 <= fractionA && fractionA <= 1) {
210660
- const gA = fractionA * numEdge;
210661
- indexA = Math.floor(gA);
210662
- localFractionA = gA - indexA;
210663
- index0 = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isSmallRelative(1 - localFractionA) ? indexA + 2 : indexA + 1;
210437
+ index0 = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isSmallRelative(1 - localA.fraction) ? localA.index + 2 : localA.index + 1;
210664
210438
  }
210665
210439
  else { // 1 < fractionA
210666
- indexA = n - 2;
210667
210440
  index0 = n; // no original vertices in clone
210668
210441
  }
210669
210442
  if (fractionB < 0) {
210670
- indexB = 0;
210671
210443
  index1 = -1; // no original vertices in clone
210672
210444
  }
210673
210445
  else if (0 <= fractionB && fractionB <= 1) {
210674
- const gB = fractionB * numEdge;
210675
- indexB = Math.floor(gB);
210676
- localFractionB = gB - indexB;
210677
- index1 = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isSmallRelative(localFractionB) ? indexB - 1 : indexB;
210446
+ index1 = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isSmallRelative(localB.fraction) ? localB.index - 1 : localB.index;
210678
210447
  }
210679
210448
  else { // 1 < fractionB
210680
- indexB = n - 2;
210681
210449
  index1 = n - 2; // last original vertex is not in clone
210682
210450
  }
210683
210451
  const result = LineString3d.create();
210684
- this.addResolvedPoint(indexA, localFractionA, result._points);
210452
+ this.addResolvedPoint(localA.index, localA.fraction, result._points);
210685
210453
  for (let index = index0; index <= index1; index++) {
210686
210454
  if (this._points.isIndexValid(index)) {
210687
210455
  this._points.getPoint3dAtUncheckedPointIndex(index, LineString3d._workPointA);
210688
210456
  result._points.push(LineString3d._workPointA);
210689
210457
  }
210690
210458
  }
210691
- this.addResolvedPoint(indexB, localFractionB, result._points);
210459
+ this.addResolvedPoint(localB.index, localB.fraction, result._points);
210692
210460
  return result;
210693
210461
  }
210694
210462
  /** Return (if possible) a specific segment of the linestring */
@@ -210799,7 +210567,7 @@ LineString3d._workPointA = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_
210799
210567
  LineString3d._workPointB = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__.Point3d.create();
210800
210568
  LineString3d._workPointC = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__.Point3d.create();
210801
210569
  LineString3d._workRay = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_7__.Ray3d.createXAxis();
210802
- LineString3d._indexPoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__.Point3d.create(); // private point for indexAndFractionToPoint.
210570
+ LineString3d._indexPoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__.Point3d.create(); // private point for addResolvedPoint
210803
210571
  /** An AnnotatedLineString3d is a linestring with additional surface-related data attached to each point
210804
210572
  * * This is useful in facet construction.
210805
210573
  * @internal
@@ -214786,6 +214554,165 @@ class UnionRegion extends _CurveCollection__WEBPACK_IMPORTED_MODULE_0__.CurveCol
214786
214554
  }
214787
214555
 
214788
214556
 
214557
+ /***/ }),
214558
+
214559
+ /***/ "../../core/geometry/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js":
214560
+ /*!**************************************************************************************************!*\
214561
+ !*** ../../core/geometry/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js ***!
214562
+ \**************************************************************************************************/
214563
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
214564
+
214565
+ "use strict";
214566
+ __webpack_require__.r(__webpack_exports__);
214567
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
214568
+ /* harmony export */ "AppendPlaneIntersectionStrokeHandler": () => (/* binding */ AppendPlaneIntersectionStrokeHandler)
214569
+ /* harmony export */ });
214570
+ /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
214571
+ /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
214572
+ /* harmony import */ var _numerics_BezierPolynomials__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../numerics/BezierPolynomials */ "../../core/geometry/lib/esm/numerics/BezierPolynomials.js");
214573
+ /* harmony import */ var _numerics_Newton__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../numerics/Newton */ "../../core/geometry/lib/esm/numerics/Newton.js");
214574
+ /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
214575
+ /* harmony import */ var _NewtonRtoRStrokeHandler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NewtonRtoRStrokeHandler */ "../../core/geometry/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js");
214576
+ /*---------------------------------------------------------------------------------------------
214577
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
214578
+ * See LICENSE.md in the project root for license terms and full copyright notice.
214579
+ *--------------------------------------------------------------------------------------------*/
214580
+ /** @packageDocumentation
214581
+ * @module Curve
214582
+ */
214583
+
214584
+
214585
+
214586
+
214587
+
214588
+
214589
+ /**
214590
+ * Context for computing intersections of a CurvePrimitive with a plane.
214591
+ * @internal
214592
+ */
214593
+ class AppendPlaneIntersectionStrokeHandler extends _NewtonRtoRStrokeHandler__WEBPACK_IMPORTED_MODULE_0__.NewtonRtoRStrokeHandler {
214594
+ constructor(plane, intersections) {
214595
+ super();
214596
+ this._fractionA = 0;
214597
+ this._functionA = 0;
214598
+ // private derivativeA: number; <---- Not currently used
214599
+ this._functionB = 0;
214600
+ this._fractionB = 0;
214601
+ this._derivativeB = 0;
214602
+ this._numThisCurve = 0;
214603
+ this._plane = plane;
214604
+ this._intersections = intersections;
214605
+ this.startCurvePrimitive(undefined);
214606
+ this._ray = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_1__.Ray3d.createZero();
214607
+ this._newtonSolver = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_2__.Newton1dUnboundedApproximateDerivative(this);
214608
+ }
214609
+ // Return the first defined curve among: this.parentCurvePrimitive, this.curve;
214610
+ effectiveCurve() {
214611
+ if (this._parentCurvePrimitive)
214612
+ return this._parentCurvePrimitive;
214613
+ return this._curve;
214614
+ }
214615
+ get getDerivativeB() {
214616
+ return this._derivativeB; // <--- _derivativeB is not currently used anywhere. Provided getter to suppress lint error
214617
+ }
214618
+ startCurvePrimitive(curve) {
214619
+ this._curve = curve;
214620
+ this._fractionA = 0.0;
214621
+ this._numThisCurve = 0;
214622
+ this._functionA = 0.0;
214623
+ // this.derivativeA = 0.0;
214624
+ }
214625
+ endCurvePrimitive() {
214626
+ }
214627
+ announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
214628
+ this.startCurvePrimitive(cp);
214629
+ if (numStrokes < 1)
214630
+ numStrokes = 1;
214631
+ const df = 1.0 / numStrokes;
214632
+ for (let i = 0; i <= numStrokes; i++) {
214633
+ const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.interpolate(fraction0, i * df, fraction1);
214634
+ cp.fractionToPointAndDerivative(fraction, this._ray);
214635
+ this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);
214636
+ }
214637
+ }
214638
+ announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
214639
+ const h0 = this._plane.altitude(point0);
214640
+ const h1 = this._plane.altitude(point1);
214641
+ if (h0 * h1 > 0.0)
214642
+ return;
214643
+ const fraction01 = _numerics_BezierPolynomials__WEBPACK_IMPORTED_MODULE_4__.Order2Bezier.solveCoffs(h0, h1);
214644
+ // let numIntersection = 0;
214645
+ if (fraction01 !== undefined) {
214646
+ // numIntersection++;
214647
+ const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.interpolate(fraction0, fraction01, fraction1);
214648
+ this._newtonSolver.setX(fraction);
214649
+ if (this._newtonSolver.runIterations()) {
214650
+ this.announceSolutionFraction(this._newtonSolver.getX());
214651
+ }
214652
+ // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));
214653
+ }
214654
+ }
214655
+ announceSolutionFraction(fraction) {
214656
+ const curve = this.effectiveCurve();
214657
+ if (curve) {
214658
+ this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);
214659
+ this._intersections.push(_CurveLocationDetail__WEBPACK_IMPORTED_MODULE_5__.CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));
214660
+ }
214661
+ }
214662
+ evaluate(fraction) {
214663
+ const curve = this.effectiveCurve();
214664
+ if (!curve)
214665
+ return false;
214666
+ this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));
214667
+ return true;
214668
+ }
214669
+ /**
214670
+ * * ASSUME both the "A" and "B" evaluations (fraction, function, and derivative) are known.
214671
+ * * If function value changed sign between, interpolate an approximate root and improve it with
214672
+ * the newton solver.
214673
+ */
214674
+ searchInterval() {
214675
+ if (this._functionA * this._functionB > 0)
214676
+ return;
214677
+ if (this._functionA === 0)
214678
+ this.announceSolutionFraction(this._fractionA);
214679
+ if (this._functionB === 0)
214680
+ this.announceSolutionFraction(this._fractionB);
214681
+ if (this._functionA * this._functionB < 0) {
214682
+ const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
214683
+ if (fraction) {
214684
+ this._newtonSolver.setX(fraction);
214685
+ if (this._newtonSolver.runIterations())
214686
+ this.announceSolutionFraction(this._newtonSolver.getX());
214687
+ }
214688
+ }
214689
+ }
214690
+ /** Evaluate and save _functionB, _derivativeB, and _fractionB. */
214691
+ evaluateB(xyz, fraction, tangent) {
214692
+ this._functionB = this._plane.altitude(xyz);
214693
+ this._derivativeB = this._plane.velocity(tangent);
214694
+ this._fractionB = fraction;
214695
+ }
214696
+ /**
214697
+ * Announce point and tangent for evaluations.
214698
+ * * The function evaluation is saved as the "B" function point.
214699
+ * * The function point count is incremented
214700
+ * * If function point count is greater than 1, the current interval is searched.
214701
+ * * The just-evaluated point ("B") is saved as the "old" ("A") evaluation point.
214702
+ * @param xyz
214703
+ * @param fraction
214704
+ * @param tangent
214705
+ */
214706
+ announcePointTangent(xyz, fraction, tangent) {
214707
+ this.evaluateB(xyz, fraction, tangent);
214708
+ if (this._numThisCurve++ > 0)
214709
+ this.searchInterval();
214710
+ this._functionA = this._functionB;
214711
+ this._fractionA = this._fractionB;
214712
+ }
214713
+ }
214714
+
214715
+
214789
214716
  /***/ }),
214790
214717
 
214791
214718
  /***/ "../../core/geometry/lib/esm/curve/internalContexts/CloneCurvesContext.js":
@@ -214917,6 +214844,169 @@ class CloneWithExpandedLineStrings extends _CloneCurvesContext__WEBPACK_IMPORTED
214917
214844
  }
214918
214845
 
214919
214846
 
214847
+ /***/ }),
214848
+
214849
+ /***/ "../../core/geometry/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js":
214850
+ /*!***************************************************************************************!*\
214851
+ !*** ../../core/geometry/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js ***!
214852
+ \***************************************************************************************/
214853
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
214854
+
214855
+ "use strict";
214856
+ __webpack_require__.r(__webpack_exports__);
214857
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
214858
+ /* harmony export */ "ClosestPointStrokeHandler": () => (/* binding */ ClosestPointStrokeHandler)
214859
+ /* harmony export */ });
214860
+ /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
214861
+ /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
214862
+ /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
214863
+ /* harmony import */ var _numerics_Newton__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../numerics/Newton */ "../../core/geometry/lib/esm/numerics/Newton.js");
214864
+ /* harmony import */ var _CurveExtendMode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../CurveExtendMode */ "../../core/geometry/lib/esm/curve/CurveExtendMode.js");
214865
+ /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
214866
+ /* harmony import */ var _NewtonRtoRStrokeHandler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NewtonRtoRStrokeHandler */ "../../core/geometry/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js");
214867
+ /*---------------------------------------------------------------------------------------------
214868
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
214869
+ * See LICENSE.md in the project root for license terms and full copyright notice.
214870
+ *--------------------------------------------------------------------------------------------*/
214871
+ /** @packageDocumentation
214872
+ * @module Curve
214873
+ */
214874
+
214875
+
214876
+
214877
+
214878
+
214879
+
214880
+
214881
+ /**
214882
+ * Context for searching for the closest point to a CurvePrimitive.
214883
+ * @internal
214884
+ */
214885
+ class ClosestPointStrokeHandler extends _NewtonRtoRStrokeHandler__WEBPACK_IMPORTED_MODULE_0__.NewtonRtoRStrokeHandler {
214886
+ constructor(spacePoint, extend) {
214887
+ super();
214888
+ this._fractionA = 0;
214889
+ this._functionA = 0;
214890
+ this._functionB = 0;
214891
+ this._fractionB = 0;
214892
+ this._numThisCurve = 0;
214893
+ this._spacePoint = spacePoint;
214894
+ this._workPoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Point3d.create();
214895
+ this._workRay = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_2__.Ray3d.createZero();
214896
+ this._closestPoint = undefined;
214897
+ this._extend = extend;
214898
+ this.startCurvePrimitive(undefined);
214899
+ this._newtonSolver = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_3__.Newton1dUnboundedApproximateDerivative(this);
214900
+ }
214901
+ claimResult() {
214902
+ if (this._closestPoint) {
214903
+ this._newtonSolver.setX(this._closestPoint.fraction);
214904
+ this._curve = this._closestPoint.curve;
214905
+ if (this._newtonSolver.runIterations()) {
214906
+ let fraction = this._newtonSolver.getX();
214907
+ fraction = _CurveExtendMode__WEBPACK_IMPORTED_MODULE_4__.CurveExtendOptions.correctFraction(this._extend, fraction);
214908
+ this.announceSolutionFraction(fraction);
214909
+ }
214910
+ }
214911
+ return this._closestPoint;
214912
+ }
214913
+ needPrimaryGeometryForStrokes() {
214914
+ return true;
214915
+ }
214916
+ startCurvePrimitive(curve) {
214917
+ this._curve = curve;
214918
+ this._fractionA = 0.0;
214919
+ this._numThisCurve = 0;
214920
+ this._functionA = 0.0;
214921
+ }
214922
+ endCurvePrimitive() {
214923
+ }
214924
+ announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
214925
+ this.startCurvePrimitive(cp);
214926
+ this.announceSolutionFraction(0.0); // test start point as closest
214927
+ this.announceSolutionFraction(1.0); // test end point as closest
214928
+ if (numStrokes < 1)
214929
+ numStrokes = 1;
214930
+ const df = 1.0 / numStrokes;
214931
+ for (let i = 0; i <= numStrokes; i++) {
214932
+ const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.interpolate(fraction0, i * df, fraction1);
214933
+ cp.fractionToPointAndDerivative(fraction, this._workRay);
214934
+ this.announceRay(fraction, this._workRay);
214935
+ }
214936
+ }
214937
+ announceCandidate(cp, fraction, point) {
214938
+ const distance = this._spacePoint.distance(point);
214939
+ if (this._closestPoint && distance > this._closestPoint.a)
214940
+ return;
214941
+ this._closestPoint = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);
214942
+ this._closestPoint.a = distance;
214943
+ if (this._parentCurvePrimitive !== undefined)
214944
+ this._closestPoint.curve = this._parentCurvePrimitive;
214945
+ }
214946
+ announceSegmentInterval(cp, point0, point1, _numStrokes, fraction0, fraction1) {
214947
+ let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);
214948
+ // only consider extending the segment if the immediate caller says we are at endpoints ...
214949
+ if (!this._extend)
214950
+ localFraction = _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.clampToStartEnd(localFraction, 0.0, 1.0);
214951
+ else {
214952
+ if (fraction0 !== 0.0)
214953
+ localFraction = Math.max(localFraction, 0.0);
214954
+ if (fraction1 !== 1.0)
214955
+ localFraction = Math.min(localFraction, 1.0);
214956
+ }
214957
+ this._workPoint = point0.interpolate(localFraction, point1);
214958
+ const globalFraction = _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.interpolate(fraction0, localFraction, fraction1);
214959
+ this.announceCandidate(cp, globalFraction, this._workPoint);
214960
+ }
214961
+ searchInterval() {
214962
+ if (this._functionA * this._functionB > 0)
214963
+ return;
214964
+ if (this._functionA === 0)
214965
+ this.announceSolutionFraction(this._fractionA);
214966
+ if (this._functionB === 0)
214967
+ this.announceSolutionFraction(this._fractionB);
214968
+ if (this._functionA * this._functionB < 0) {
214969
+ const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
214970
+ if (fraction) {
214971
+ this._newtonSolver.setX(fraction);
214972
+ if (this._newtonSolver.runIterations())
214973
+ this.announceSolutionFraction(this._newtonSolver.getX());
214974
+ }
214975
+ }
214976
+ }
214977
+ evaluateB(fractionB, dataB) {
214978
+ this._functionB = dataB.dotProductToPoint(this._spacePoint);
214979
+ this._fractionB = fractionB;
214980
+ }
214981
+ announceSolutionFraction(fraction) {
214982
+ if (this._curve)
214983
+ this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));
214984
+ }
214985
+ evaluate(fraction) {
214986
+ let curve = this._curve;
214987
+ if (this._parentCurvePrimitive)
214988
+ curve = this._parentCurvePrimitive;
214989
+ if (curve) {
214990
+ this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);
214991
+ this.currentF = this._workRay.dotProductToPoint(this._spacePoint);
214992
+ return true;
214993
+ }
214994
+ return false;
214995
+ }
214996
+ announceRay(fraction, data) {
214997
+ this.evaluateB(fraction, data);
214998
+ if (this._numThisCurve++ > 0)
214999
+ this.searchInterval();
215000
+ this._functionA = this._functionB;
215001
+ this._fractionA = this._fractionB;
215002
+ }
215003
+ announcePointTangent(point, fraction, tangent) {
215004
+ this._workRay.set(point, tangent);
215005
+ this.announceRay(fraction, this._workRay);
215006
+ }
215007
+ }
215008
+
215009
+
214920
215010
  /***/ }),
214921
215011
 
214922
215012
  /***/ "../../core/geometry/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js":
@@ -214966,6 +215056,110 @@ class CountLinearPartsSearchContext extends _CurveProcessor__WEBPACK_IMPORTED_MO
214966
215056
  }
214967
215057
 
214968
215058
 
215059
+ /***/ }),
215060
+
215061
+ /***/ "../../core/geometry/lib/esm/curve/internalContexts/CurveLengthContext.js":
215062
+ /*!********************************************************************************!*\
215063
+ !*** ../../core/geometry/lib/esm/curve/internalContexts/CurveLengthContext.js ***!
215064
+ \********************************************************************************/
215065
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
215066
+
215067
+ "use strict";
215068
+ __webpack_require__.r(__webpack_exports__);
215069
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
215070
+ /* harmony export */ "CurveLengthContext": () => (/* binding */ CurveLengthContext)
215071
+ /* harmony export */ });
215072
+ /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
215073
+ /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
215074
+ /* harmony import */ var _numerics_Quadrature__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../numerics/Quadrature */ "../../core/geometry/lib/esm/numerics/Quadrature.js");
215075
+ /*---------------------------------------------------------------------------------------------
215076
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
215077
+ * See LICENSE.md in the project root for license terms and full copyright notice.
215078
+ *--------------------------------------------------------------------------------------------*/
215079
+ /** @packageDocumentation
215080
+ * @module Curve
215081
+ */
215082
+
215083
+
215084
+
215085
+ /**
215086
+ * Context for computing the length of a CurvePrimitive.
215087
+ * @internal
215088
+ */
215089
+ class CurveLengthContext {
215090
+ constructor(fraction0 = 0.0, fraction1 = 1.0, numGaussPoints = 5) {
215091
+ this.startCurvePrimitive(undefined);
215092
+ this._summedLength = 0.0;
215093
+ this._ray = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_0__.Ray3d.createZero();
215094
+ if (fraction0 < fraction1) {
215095
+ this._fraction0 = fraction0;
215096
+ this._fraction1 = fraction1;
215097
+ }
215098
+ else {
215099
+ this._fraction0 = fraction1;
215100
+ this._fraction1 = fraction0;
215101
+ }
215102
+ this._gaussMapper = new _numerics_Quadrature__WEBPACK_IMPORTED_MODULE_1__.GaussMapper(numGaussPoints);
215103
+ }
215104
+ tangentMagnitude(fraction) {
215105
+ this._ray = this._curve.fractionToPointAndDerivative(fraction, this._ray);
215106
+ return this._ray.direction.magnitude();
215107
+ }
215108
+ /** Return the fraction0 installed at construction time. */
215109
+ get getFraction0() {
215110
+ return this._fraction0;
215111
+ }
215112
+ /** Return the fraction1 installed at construction time. */
215113
+ get getFraction1() {
215114
+ return this._fraction1;
215115
+ }
215116
+ getSum() {
215117
+ return this._summedLength;
215118
+ }
215119
+ startCurvePrimitive(curve) {
215120
+ this._curve = curve;
215121
+ }
215122
+ startParentCurvePrimitive(_curve) {
215123
+ }
215124
+ endParentCurvePrimitive(_curve) {
215125
+ }
215126
+ endCurvePrimitive() {
215127
+ }
215128
+ announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
215129
+ const range = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_2__.Range1d.createXX(fraction0, fraction1);
215130
+ range.intersectRangeXXInPlace(this._fraction0, this._fraction1);
215131
+ if (!range.isNull) {
215132
+ this.startCurvePrimitive(cp);
215133
+ if (numStrokes < 1)
215134
+ numStrokes = 1;
215135
+ const df = 1.0 / numStrokes;
215136
+ for (let i = 1; i <= numStrokes; i++) {
215137
+ const fractionA = range.fractionToPoint((i - 1) * df);
215138
+ const fractionB = i === numStrokes ? range.high : range.fractionToPoint(i * df);
215139
+ const numGauss = this._gaussMapper.mapXAndW(fractionA, fractionB);
215140
+ for (let k = 0; k < numGauss; k++) {
215141
+ this._summedLength += this._gaussMapper.gaussW[k] * this.tangentMagnitude(this._gaussMapper.gaussX[k]);
215142
+ }
215143
+ }
215144
+ }
215145
+ }
215146
+ announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
215147
+ const segmentLength = point0.distance(point1);
215148
+ if (this._fraction0 <= fraction0 && fraction1 <= this._fraction1)
215149
+ this._summedLength += segmentLength;
215150
+ else {
215151
+ const range = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_2__.Range1d.createXX(fraction0, fraction1);
215152
+ range.intersectRangeXXInPlace(this._fraction0, this._fraction1);
215153
+ if (!range.isNull)
215154
+ this._summedLength += segmentLength * range.length() / (fraction1 - fraction0);
215155
+ }
215156
+ }
215157
+ announcePointTangent(_xyz, _fraction, _tangent) {
215158
+ // uh oh -- need to retain point for next interval
215159
+ }
215160
+ }
215161
+
215162
+
214969
215163
  /***/ }),
214970
215164
 
214971
215165
  /***/ "../../core/geometry/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js":
@@ -215558,6 +215752,51 @@ class OffsetHelpers {
215558
215752
  }
215559
215753
 
215560
215754
 
215755
+ /***/ }),
215756
+
215757
+ /***/ "../../core/geometry/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js":
215758
+ /*!*************************************************************************************!*\
215759
+ !*** ../../core/geometry/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js ***!
215760
+ \*************************************************************************************/
215761
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
215762
+
215763
+ "use strict";
215764
+ __webpack_require__.r(__webpack_exports__);
215765
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
215766
+ /* harmony export */ "NewtonRtoRStrokeHandler": () => (/* binding */ NewtonRtoRStrokeHandler)
215767
+ /* harmony export */ });
215768
+ /* harmony import */ var _numerics_Newton__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../numerics/Newton */ "../../core/geometry/lib/esm/numerics/Newton.js");
215769
+ /*---------------------------------------------------------------------------------------------
215770
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
215771
+ * See LICENSE.md in the project root for license terms and full copyright notice.
215772
+ *--------------------------------------------------------------------------------------------*/
215773
+ /** @packageDocumentation
215774
+ * @module Curve
215775
+ */
215776
+
215777
+ /** Intermediate class for managing the parentCurve announcements from an IStrokeHandler.
215778
+ * @internal
215779
+ */
215780
+ class NewtonRtoRStrokeHandler extends _numerics_Newton__WEBPACK_IMPORTED_MODULE_0__.NewtonEvaluatorRtoR {
215781
+ constructor() {
215782
+ super();
215783
+ this._parentCurvePrimitive = undefined;
215784
+ }
215785
+ /** retain the parentCurvePrimitive.
215786
+ * * Calling this method tells the handler that the parent curve is to be used for detail searches.
215787
+ * * Example: Transition spiral search is based on linestring first, then the exact spiral.
215788
+ * * Example: CurveChainWithDistanceIndex does NOT do this announcement -- the constituents act independently.
215789
+ */
215790
+ startParentCurvePrimitive(curve) {
215791
+ this._parentCurvePrimitive = curve;
215792
+ }
215793
+ /** Forget the parentCurvePrimitive */
215794
+ endParentCurvePrimitive(_curve) {
215795
+ this._parentCurvePrimitive = undefined;
215796
+ }
215797
+ }
215798
+
215799
+
215561
215800
  /***/ }),
215562
215801
 
215563
215802
  /***/ "../../core/geometry/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js":
@@ -217248,15 +217487,16 @@ __webpack_require__.r(__webpack_exports__);
217248
217487
  /* harmony export */ });
217249
217488
  /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
217250
217489
  /* harmony import */ var _geometry3d_Segment1d__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../geometry3d/Segment1d */ "../../core/geometry/lib/esm/geometry3d/Segment1d.js");
217490
+ /* harmony import */ var _internalContexts_CurveLengthContext__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../internalContexts/CurveLengthContext */ "../../core/geometry/lib/esm/curve/internalContexts/CurveLengthContext.js");
217251
217491
  /* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
217252
217492
  /* harmony import */ var _StrokeOptions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../StrokeOptions */ "../../core/geometry/lib/esm/curve/StrokeOptions.js");
217493
+ /* harmony import */ var _AustralianRailCorpXYEvaluator__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./AustralianRailCorpXYEvaluator */ "../../core/geometry/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js");
217253
217494
  /* harmony import */ var _ClothoidSeries__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ClothoidSeries */ "../../core/geometry/lib/esm/curve/spiral/ClothoidSeries.js");
217254
217495
  /* harmony import */ var _CzechSpiralEvaluator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./CzechSpiralEvaluator */ "../../core/geometry/lib/esm/curve/spiral/CzechSpiralEvaluator.js");
217255
217496
  /* harmony import */ var _DirectHalfCosineSpiralEvaluator__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./DirectHalfCosineSpiralEvaluator */ "../../core/geometry/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js");
217256
- /* harmony import */ var _AustralianRailCorpXYEvaluator__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./AustralianRailCorpXYEvaluator */ "../../core/geometry/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js");
217257
- /* harmony import */ var _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TransitionSpiral3d */ "../../core/geometry/lib/esm/curve/spiral/TransitionSpiral3d.js");
217258
217497
  /* harmony import */ var _MXCubicAlongArcSpiralEvaluator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./MXCubicAlongArcSpiralEvaluator */ "../../core/geometry/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js");
217259
217498
  /* harmony import */ var _PolishCubicSpiralEvaluator__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./PolishCubicSpiralEvaluator */ "../../core/geometry/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js");
217499
+ /* harmony import */ var _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TransitionSpiral3d */ "../../core/geometry/lib/esm/curve/spiral/TransitionSpiral3d.js");
217260
217500
  /*---------------------------------------------------------------------------------------------
217261
217501
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
217262
217502
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -217275,6 +217515,7 @@ __webpack_require__.r(__webpack_exports__);
217275
217515
 
217276
217516
 
217277
217517
 
217518
+
217278
217519
  /**
217279
217520
  * DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have "direct" xy calculations without the integrations required
217280
217521
  * for IntegratedSpiral3d.
@@ -217625,13 +217866,19 @@ class DirectSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.Tr
217625
217866
  const n = this.computeStrokeCountForOptions(options);
217626
217867
  const activeStrokes = this.activeStrokes;
217627
217868
  dest.startParentCurvePrimitive(this);
217628
- if (n <= activeStrokes.numPoints()) {
217629
- // this.activeStrokes.emitStrokableParts(dest, options);
217630
- dest.announceIntervalForUniformStepStrokes(this, 2 * activeStrokes.numPoints(), 0.0, 1.0);
217631
- }
217632
- else {
217633
- dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);
217634
- }
217869
+ // hack: specify the extended range so we can compute length of an extended spiral
217870
+ let globalFraction0 = 0.0;
217871
+ let globalFraction1 = 1.0;
217872
+ if (dest instanceof _internalContexts_CurveLengthContext__WEBPACK_IMPORTED_MODULE_11__.CurveLengthContext) {
217873
+ if (dest.getFraction0 < 0.0)
217874
+ globalFraction0 = dest.getFraction0;
217875
+ if (dest.getFraction1 > 1.0)
217876
+ globalFraction1 = dest.getFraction1;
217877
+ }
217878
+ if (n <= activeStrokes.numPoints())
217879
+ dest.announceIntervalForUniformStepStrokes(this, 2 * activeStrokes.numPoints(), globalFraction0, globalFraction1);
217880
+ else
217881
+ dest.announceIntervalForUniformStepStrokes(this, n, globalFraction0, globalFraction1);
217635
217882
  dest.endParentCurvePrimitive(this);
217636
217883
  }
217637
217884
  /**
@@ -219234,38 +219481,53 @@ class Angle {
219234
219481
  * Test if two radians values are equivalent, allowing shift by full circle (i.e. by a multiple of `2*PI`)
219235
219482
  * @param radiansA first radians value
219236
219483
  * @param radiansB second radians value
219484
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
219237
219485
  */
219238
- static isAlmostEqualRadiansAllowPeriodShift(radiansA, radiansB) {
219239
- // try to get simple conclusions with un-shifted radians ...
219486
+ static isAlmostEqualRadiansAllowPeriodShift(radiansA, radiansB, radianTol = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians) {
219240
219487
  const delta = Math.abs(radiansA - radiansB);
219241
- if (delta <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians)
219488
+ if (delta <= radianTol)
219242
219489
  return true;
219243
219490
  const period = Math.PI * 2.0;
219244
- if (Math.abs(delta - period) <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians)
219491
+ if (Math.abs(delta - period) <= radianTol)
219245
219492
  return true;
219246
219493
  const numPeriod = Math.round(delta / period);
219247
219494
  const delta1 = delta - numPeriod * period;
219248
- return Math.abs(delta1) <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians;
219495
+ return Math.abs(delta1) <= radianTol;
219249
219496
  }
219250
219497
  /**
219251
- * Test if this angle and other are equivalent, allowing shift by full circle (i.e. by a multiple of 360 degrees)
219498
+ * Test if this angle and other are equivalent, allowing shift by full circle (i.e., multiples of `2 * PI`).
219499
+ * @param other the other angle
219500
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
219252
219501
  */
219253
- isAlmostEqualAllowPeriodShift(other) {
219254
- return Angle.isAlmostEqualRadiansAllowPeriodShift(this._radians, other._radians);
219502
+ isAlmostEqualAllowPeriodShift(other, radianTol = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians) {
219503
+ return Angle.isAlmostEqualRadiansAllowPeriodShift(this._radians, other._radians, radianTol);
219255
219504
  }
219256
219505
  /**
219257
- * Test if two this angle and other are almost equal, NOT allowing shift by full circle multiples of 360 degrees.
219506
+ * Test if two angle (in radians) almost equal, NOT allowing shift by full circle (i.e., multiples of `2 * PI`).
219507
+ * @param radiansA first radians value
219508
+ * @param radiansB second radians value
219509
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
219258
219510
  */
219259
- isAlmostEqualNoPeriodShift(other) { return Math.abs(this._radians - other._radians) < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians; }
219511
+ static isAlmostEqualRadiansNoPeriodShift(radiansA, radiansB, radianTol = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians) {
219512
+ return Math.abs(radiansA - radiansB) < radianTol;
219513
+ }
219260
219514
  /**
219261
- * Test if two angle (in radians) almost equal, NOT allowing shift by full circle multiples of `2 * PI`.
219262
- * * (Same test as isAlmostEqualRadiansNoPeriodShift)
219515
+ * Test if two this angle and other are almost equal, NOT allowing shift by full circle (i.e., multiples of `2 * PI`).
219516
+ * @param other the other angle
219517
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
219263
219518
  */
219264
- isAlmostEqual(other) { return this.isAlmostEqualNoPeriodShift(other); }
219519
+ isAlmostEqualNoPeriodShift(other, radianTol = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians) {
219520
+ return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians, other._radians, radianTol);
219521
+ }
219265
219522
  /**
219266
- * Test if two angle (in radians) almost equal, NOT allowing shift by full circle multiples of `2 * PI`.
219523
+ * Test if two this angle and other are almost equal, NOT allowing shift by full circle (i.e., multiples of `2 * PI`).
219524
+ * * This function is same as isAlmostEqualRadiansNoPeriodShift. Please use isAlmostEqualRadiansNoPeriodShift.
219525
+ * @param other the other angle
219526
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
219267
219527
  */
219268
- static isAlmostEqualRadiansNoPeriodShift(radiansA, radiansB) { return Math.abs(radiansA - radiansB) < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians; }
219528
+ isAlmostEqual(other, radianTol = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians) {
219529
+ return this.isAlmostEqualNoPeriodShift(other, radianTol);
219530
+ }
219269
219531
  /**
219270
219532
  * Test if dot product values indicate non-zero length perpendicular vectors.
219271
219533
  * @param dotUU dot product of vectorU with itself
@@ -225627,7 +225889,7 @@ class Matrix3d {
225627
225889
  * Factor this as a product C * U where C has mutually perpendicular columns and
225628
225890
  * U is orthogonal.
225629
225891
  * @param matrixC (allocate by caller, computed here)
225630
- * @param factor (allocate by caller, computed here)
225892
+ * @param matrixU (allocate by caller, computed here)
225631
225893
  */
225632
225894
  factorPerpendicularColumns(matrixC, matrixU) {
225633
225895
  matrixC.setFrom(this);
@@ -225646,6 +225908,46 @@ class Matrix3d {
225646
225908
  }
225647
225909
  return false;
225648
225910
  }
225911
+ /**
225912
+ * Factor this matrix M as a product M = V * D * U where V and U are orthogonal, and D is diagonal (scale matrix).
225913
+ * @param matrixV left orthogonal factor (allocate by caller, computed here)
225914
+ * @param scale diagonal entries of D (allocate by caller, computed here)
225915
+ * @param matrixU right orthogonal factor (allocate by caller, computed here)
225916
+ */
225917
+ factorOrthogonalScaleOrthogonal(matrixV, scale, matrixU) {
225918
+ const matrixVD = Matrix3d.createZero();
225919
+ if (!this.factorPerpendicularColumns(matrixVD, matrixU))
225920
+ return false;
225921
+ const column = [];
225922
+ column.push(matrixVD.getColumn(0));
225923
+ column.push(matrixVD.getColumn(1));
225924
+ column.push(matrixVD.getColumn(2));
225925
+ scale.set(column[0].magnitude(), column[1].magnitude(), column[2].magnitude());
225926
+ const det = matrixVD.determinant();
225927
+ if (det < 0)
225928
+ scale.z = -scale.z;
225929
+ const almostZero = 1.0e-15;
225930
+ const scaleXIsZero = Math.abs(scale.x) < almostZero;
225931
+ const scaleYIsZero = Math.abs(scale.y) < almostZero;
225932
+ const scaleZIsZero = Math.abs(scale.z) < almostZero;
225933
+ // ASSUME: any zero-magnitude column(s) of matrixVD are last
225934
+ if (!scaleXIsZero && !scaleYIsZero && !scaleZIsZero) { // full rank
225935
+ matrixV = matrixVD.scaleColumns(1 / scale.x, 1 / scale.y, 1 / scale.z, matrixV);
225936
+ }
225937
+ else if (!scaleXIsZero && !scaleYIsZero) { // rank 2
225938
+ column[0].scaleInPlace(1 / scale.x);
225939
+ column[1].scaleInPlace(1 / scale.y);
225940
+ column[2] = column[0].unitCrossProduct(column[1], column[2]);
225941
+ matrixV.setColumns(column[0], column[1], column[2]);
225942
+ }
225943
+ else if (!scaleXIsZero) { // rank 1
225944
+ matrixV = Matrix3d.createRigidHeadsUp(column[0], _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.XYZ, matrixV); // preserve column0
225945
+ }
225946
+ else { // rank 0
225947
+ matrixV.setIdentity();
225948
+ }
225949
+ return true;
225950
+ }
225649
225951
  /** Apply a jacobi step to lambda which evolves towards diagonal. */
225650
225952
  applySymmetricJacobi(i, j, lambda) {
225651
225953
  const uDotU = lambda.at(i, i);
@@ -226536,7 +226838,7 @@ class Matrix3d {
226536
226838
  this.inverseState = InverseMatrixState.unknown;
226537
226839
  }
226538
226840
  /** create a Matrix3d whose columns are scaled copies of this Matrix3d.
226539
- * @param scaleX scale factor for columns x
226841
+ * @param scaleX scale factor for column x
226540
226842
  * @param scaleY scale factor for column y
226541
226843
  * @param scaleZ scale factor for column z
226542
226844
  * @param result optional result.
@@ -226544,11 +226846,10 @@ class Matrix3d {
226544
226846
  scaleColumns(scaleX, scaleY, scaleZ, result) {
226545
226847
  return Matrix3d.createRowValues(this.coffs[0] * scaleX, this.coffs[1] * scaleY, this.coffs[2] * scaleZ, this.coffs[3] * scaleX, this.coffs[4] * scaleY, this.coffs[5] * scaleZ, this.coffs[6] * scaleX, this.coffs[7] * scaleY, this.coffs[8] * scaleZ, result);
226546
226848
  }
226547
- /** create a Matrix3d whose columns are scaled copies of this Matrix3d.
226548
- * @param scaleX scale factor for columns x
226849
+ /** Scale the columns of this Matrix3d.
226850
+ * @param scaleX scale factor for column x
226549
226851
  * @param scaleY scale factor for column y
226550
226852
  * @param scaleZ scale factor for column z
226551
- * @param result optional result.
226552
226853
  */
226553
226854
  scaleColumnsInPlace(scaleX, scaleY, scaleZ) {
226554
226855
  this.coffs[0] *= scaleX;
@@ -226724,7 +227025,9 @@ class Matrix3d {
226724
227025
  sumSkewSquares() {
226725
227026
  return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.hypotenuseSquaredXYZ(this.coffs[1] - this.coffs[3], this.coffs[2] - this.coffs[6], this.coffs[5] - this.coffs[7]);
226726
227027
  }
226727
- /** Test if the matrix is a pure rotation. */
227028
+ /** Test if the matrix is a pure rotation.
227029
+ * @param allowMirror whether to widen the test to return true if the matrix is orthogonal (a pure rotation or a mirror)
227030
+ */
226728
227031
  isRigid(allowMirror = false) {
226729
227032
  return this.testPerpendicularUnitRowsAndColumns() && (allowMirror || this.determinant() > 0);
226730
227033
  }
@@ -226794,18 +227097,29 @@ class Matrix3d {
226794
227097
  }
226795
227098
  return undefined;
226796
227099
  }
226797
- /** create a new orthogonal matrix (perpendicular columns, unit length, transpose is inverse).
226798
- * columns are taken from the source Matrix3d in order indicated by the axis order.
227100
+ /** Adjust the matrix in place so that:
227101
+ * * columns are perpendicular and have unit length
227102
+ * * transpose equals inverse
227103
+ * * mirroring is removed
227104
+ * @param axisOrder how to reorder the matrix columns
227105
+ * @return whether the instance is rigid on return
226799
227106
  */
226800
- static createRigidFromMatrix3d(source, axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.XYZ, result) {
226801
- result = source.clone(result);
226802
- const maxAbs = result.maxAbs();
227107
+ makeRigid(axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.XYZ) {
227108
+ const maxAbs = this.maxAbs();
226803
227109
  if (_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(maxAbs))
226804
- return undefined;
227110
+ return false;
226805
227111
  const scale = 1.0 / maxAbs;
226806
- result.scaleColumnsInPlace(scale, scale, scale);
226807
- result.axisOrderCrossProductsInPlace(axisOrder);
226808
- if (result.normalizeColumnsInPlace())
227112
+ this.scaleColumnsInPlace(scale, scale, scale);
227113
+ this.axisOrderCrossProductsInPlace(axisOrder);
227114
+ return this.normalizeColumnsInPlace();
227115
+ }
227116
+ /** Create a new orthogonal matrix (perpendicular columns, unit length, transpose is inverse).
227117
+ * * Columns are taken from the source Matrix3d in order indicated by the axis order.
227118
+ * * Mirroring in the matrix is removed.
227119
+ */
227120
+ static createRigidFromMatrix3d(source, axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.XYZ, result) {
227121
+ result = source.clone(result);
227122
+ if (result.makeRigid(axisOrder))
226809
227123
  return result;
226810
227124
  return undefined;
226811
227125
  }
@@ -228238,9 +228552,19 @@ class Vector2d extends XY {
228238
228552
  }
228239
228553
  /** vector cross product {this CROSS vectorB} */
228240
228554
  crossProduct(vectorB) { return this.x * vectorB.y - this.y * vectorB.x; }
228241
- /** return the (signed) angle from this to vectorB. This is positive if the shortest turn is counterclockwise, negative if clockwise. */
228555
+ /**
228556
+ * return the (radians as a simple number, not strongly typed Angle) signed angle from this to vectorB.
228557
+ * This is positive if the shortest turn is counterclockwise, negative if clockwise.
228558
+ */
228559
+ radiansTo(vectorB) {
228560
+ return Math.atan2(this.crossProduct(vectorB), this.dotProduct(vectorB));
228561
+ }
228562
+ /**
228563
+ * return the (strongly typed) signed angle from this to vectorB.
228564
+ * This is positive if the shortest turn is counterclockwise, negative if clockwise.
228565
+ */
228242
228566
  angleTo(vectorB) {
228243
- return _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.createAtan2(this.crossProduct(vectorB), this.dotProduct(vectorB));
228567
+ return _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.createRadians(this.radiansTo(vectorB));
228244
228568
  }
228245
228569
  /* smallerUnorientedAngleTo(vectorB: Vector2d): Angle { }
228246
228570
  signedAngleTo(vectorB: Vector2d, upVector: Vector2d): Angle { }
@@ -228250,16 +228574,21 @@ class Vector2d extends XY {
228250
228574
  isInCCWSector(vectorA: Vector2d, vectorB: Vector2d, upVector: Vector2d): boolean { }
228251
228575
  */
228252
228576
  /**
228253
- * Test if `this` and `other` area parallel, with angle tolerance `Geometry.smallAngleRadiansSquared`.
228577
+ * Test if this vector is parallel to other.
228578
+ * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
228579
+ * so if you have a distance or angle tolerance t, you should pass in t * t.
228254
228580
  * @param other second vector for comparison.
228255
- * @param oppositeIsParallel if true, treat vectors 180 opposite as parallel. If false, treat those as non-parallel.
228581
+ * @param oppositeIsParallel whether to consider diametrically opposed vectors as parallel.
228582
+ * @param options optional radian and distance tolerances.
228256
228583
  */
228257
- isParallelTo(other, oppositeIsParallel = false) {
228584
+ isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false, options) {
228585
+ var _a, _b;
228586
+ const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared;
228587
+ const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared;
228258
228588
  const a2 = this.magnitudeSquared();
228259
228589
  const b2 = other.magnitudeSquared();
228260
- // we know both are 0 or positive -- no need for
228261
- if (a2 < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared || b2 < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared)
228262
- return false;
228590
+ if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)
228591
+ return returnValueIfAnInputIsZeroLength;
228263
228592
  const dot = this.dotProduct(other);
228264
228593
  if (dot < 0.0 && !oppositeIsParallel)
228265
228594
  return false;
@@ -228267,14 +228596,26 @@ class Vector2d extends XY {
228267
228596
  /* a2,b2,cross2 are squared lengths of respective vectors */
228268
228597
  /* cross2 = sin^2(theta) * a2 * b2 */
228269
228598
  /* For small theta, sin^2(theta)~~theta^2 */
228270
- return cross * cross <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared * a2 * b2;
228599
+ return cross * cross <= radianSquaredTol * a2 * b2;
228271
228600
  }
228272
228601
  /**
228273
- * Returns `true` if `this` vector is perpendicular to `other`.
228274
- * @param other second vector.
228602
+ * Test if this vector is perpendicular to other.
228603
+ * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
228604
+ * so if you have a distance or angle tolerance t, you should pass in t * t.
228605
+ * @param other second vector in comparison.
228606
+ * @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.
228607
+ * @param options optional radian and distance tolerances.
228275
228608
  */
228276
- isPerpendicularTo(other) {
228277
- return _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.isPerpendicularDotSet(this.magnitudeSquared(), other.magnitudeSquared(), this.dotProduct(other));
228609
+ isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false, options) {
228610
+ var _a, _b;
228611
+ const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared;
228612
+ const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared;
228613
+ const aa = this.magnitudeSquared();
228614
+ const bb = other.magnitudeSquared();
228615
+ if (aa < distanceSquaredTol || bb < distanceSquaredTol)
228616
+ return returnValueIfAnInputIsZeroLength;
228617
+ const ab = this.dotProduct(other);
228618
+ return ab * ab <= radianSquaredTol * aa * bb;
228278
228619
  }
228279
228620
  }
228280
228621
 
@@ -228565,24 +228906,42 @@ __webpack_require__.r(__webpack_exports__);
228565
228906
  * @public
228566
228907
  */
228567
228908
  class XYZ {
228568
- constructor(x = 0, y = 0, z = 0) { this.x = x; this.y = y; this.z = z; }
228909
+ constructor(x = 0, y = 0, z = 0) {
228910
+ this.x = x;
228911
+ this.y = y;
228912
+ this.z = z;
228913
+ }
228569
228914
  /**
228570
228915
  * Set the x,y,z parts.
228571
228916
  * @param x (optional) x part
228572
228917
  * @param y (optional) y part
228573
228918
  * @param z (optional) z part
228574
228919
  */
228575
- set(x = 0, y = 0, z = 0) { this.x = x; this.y = y; this.z = z; }
228920
+ set(x = 0, y = 0, z = 0) {
228921
+ this.x = x;
228922
+ this.y = y;
228923
+ this.z = z;
228924
+ }
228576
228925
  /** Set the x,y,z parts to zero. */
228577
- setZero() { this.x = 0; this.y = 0; this.z = 0; }
228926
+ setZero() {
228927
+ this.x = 0;
228928
+ this.y = 0;
228929
+ this.z = 0;
228930
+ }
228578
228931
  /** Type guard for XAndY.
228579
228932
  * @note this will return true for an XYAndZ. If you wish to distinguish between the two, call isXYAndZ first.
228580
228933
  */
228581
- static isXAndY(arg) { return arg.x !== undefined && arg.y !== undefined; }
228934
+ static isXAndY(arg) {
228935
+ return arg.x !== undefined && arg.y !== undefined;
228936
+ }
228582
228937
  /** Type guard to determine whether an object has a member called "z" */
228583
- static hasZ(arg) { return arg.z !== undefined; }
228938
+ static hasZ(arg) {
228939
+ return arg.z !== undefined;
228940
+ }
228584
228941
  /** Type guard for XYAndZ. */
228585
- static isXYAndZ(arg) { return this.isXAndY(arg) && this.hasZ(arg); }
228942
+ static isXYAndZ(arg) {
228943
+ return this.isXAndY(arg) && this.hasZ(arg);
228944
+ }
228586
228945
  /** Test if arg is any of:
228587
228946
  * * XAndY
228588
228947
  * * XYAndZ
@@ -228665,6 +229024,7 @@ class XYZ {
228665
229024
  /**
228666
229025
  * Set the x,y,z parts from a Vector3d
228667
229026
  * This is the same effect as `setFrom(other)` with no pretesting of variant input type
229027
+ * * Set to zeros if `other` is undefined.
228668
229028
  */
228669
229029
  setFromVector3d(other) {
228670
229030
  if (other) {
@@ -228695,13 +229055,21 @@ class XYZ {
228695
229055
  && _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSameCoordinate(this.y, other.y, tol);
228696
229056
  }
228697
229057
  /** Return a JSON object as array `[x,y,z]` */
228698
- toJSON() { return this.toArray(); }
229058
+ toJSON() {
229059
+ return this.toArray();
229060
+ }
228699
229061
  /** Return as an array `[x,y,z]` */
228700
- toArray() { return [this.x, this.y, this.z]; }
229062
+ toArray() {
229063
+ return [this.x, this.y, this.z];
229064
+ }
228701
229065
  /** Return a JSON object as key value pairs `{x: value, y: value, z: value}` */
228702
- toJSONXYZ() { return { x: this.x, y: this.y, z: this.z }; }
229066
+ toJSONXYZ() {
229067
+ return { x: this.x, y: this.y, z: this.z };
229068
+ }
228703
229069
  /** Pack the x,y,z values in a Float64Array. */
228704
- toFloat64Array() { return Float64Array.of(this.x, this.y, this.z); }
229070
+ toFloat64Array() {
229071
+ return Float64Array.of(this.x, this.y, this.z);
229072
+ }
228705
229073
  /**
228706
229074
  * Set the x,y,z properties from one of several json forms:
228707
229075
  *
@@ -228787,28 +229155,54 @@ class XYZ {
228787
229155
  }
228788
229156
  /** Return true if the x,y,z components are all nearly zero to tolerance Geometry.smallMetricDistance */
228789
229157
  get isAlmostZero() {
228790
- return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(this.x) && _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(this.y) && _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(this.z);
229158
+ return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(this.x) &&
229159
+ _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(this.y) &&
229160
+ _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(this.z);
228791
229161
  }
228792
229162
  /** Return true if the x,y,z components are all exactly zero */
228793
- get isZero() { return this.x === 0.0 && this.y === 0.0 && this.z === 0.0; }
229163
+ get isZero() {
229164
+ return this.x === 0.0 && this.y === 0.0 && this.z === 0.0;
229165
+ }
228794
229166
  /** Return the largest absolute value of any component */
228795
- maxAbs() { return Math.max(Math.abs(this.x), Math.abs(this.y), Math.abs(this.z)); }
229167
+ maxAbs() {
229168
+ return Math.max(Math.abs(this.x), Math.abs(this.y), Math.abs(this.z));
229169
+ }
228796
229170
  /** Return the sqrt of the sum of squared x,y,z parts */
228797
- magnitude() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); }
229171
+ magnitude() {
229172
+ return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
229173
+ }
228798
229174
  /** Return the sum of squared x,y,z parts */
228799
- magnitudeSquared() { return this.x * this.x + this.y * this.y + this.z * this.z; }
229175
+ magnitudeSquared() {
229176
+ return this.x * this.x + this.y * this.y + this.z * this.z;
229177
+ }
228800
229178
  /** Return sqrt of the sum of squared x,y parts */
228801
- magnitudeXY() { return Math.sqrt(this.x * this.x + this.y * this.y); }
229179
+ magnitudeXY() {
229180
+ return Math.sqrt(this.x * this.x + this.y * this.y);
229181
+ }
228802
229182
  /** Return the sum of squared x,y parts */
228803
- magnitudeSquaredXY() { return this.x * this.x + this.y * this.y; }
229183
+ magnitudeSquaredXY() {
229184
+ return this.x * this.x + this.y * this.y;
229185
+ }
228804
229186
  /** exact equality test. */
228805
- isExactEqual(other) { return this.x === other.x && this.y === other.y && this.z === other.z; }
229187
+ isExactEqual(other) {
229188
+ return this.x === other.x && this.y === other.y && this.z === other.z;
229189
+ }
228806
229190
  /** equality test with Geometry.smallMetricDistance tolerance */
228807
- isAlmostEqualMetric(other) { return this.maxDiff(other) <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistance; }
229191
+ isAlmostEqualMetric(other) {
229192
+ return this.maxDiff(other) <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistance;
229193
+ }
228808
229194
  /** add x,y,z from other in place. */
228809
- addInPlace(other) { this.x += other.x; this.y += other.y; this.z += other.z; }
229195
+ addInPlace(other) {
229196
+ this.x += other.x;
229197
+ this.y += other.y;
229198
+ this.z += other.z;
229199
+ }
228810
229200
  /** add x,y,z from other in place. */
228811
- subtractInPlace(other) { this.x -= other.x; this.y -= other.y; this.z -= other.z; }
229201
+ subtractInPlace(other) {
229202
+ this.x -= other.x;
229203
+ this.y -= other.y;
229204
+ this.z -= other.z;
229205
+ }
228812
229206
  /** add (in place) the scaled x,y,z of other */
228813
229207
  addScaledInPlace(other, scale) {
228814
229208
  this.x += scale * other.x;
@@ -228816,11 +229210,21 @@ class XYZ {
228816
229210
  this.z += scale * other.z;
228817
229211
  }
228818
229212
  /** Multiply the x, y, z parts by scale. */
228819
- scaleInPlace(scale) { this.x *= scale; this.y *= scale; this.z *= scale; }
229213
+ scaleInPlace(scale) {
229214
+ this.x *= scale;
229215
+ this.y *= scale;
229216
+ this.z *= scale;
229217
+ }
228820
229218
  /** add to x, y, z parts */
228821
- addXYZInPlace(dx = 0.0, dy = 0.0, dz = 0.0) { this.x += dx; this.y += dy; this.z += dz; }
229219
+ addXYZInPlace(dx = 0.0, dy = 0.0, dz = 0.0) {
229220
+ this.x += dx;
229221
+ this.y += dy;
229222
+ this.z += dz;
229223
+ }
228822
229224
  /** Clone strongly typed as Point3d */
228823
- cloneAsPoint3d() { return Point3d.create(this.x, this.y, this.z); }
229225
+ cloneAsPoint3d() {
229226
+ return Point3d.create(this.x, this.y, this.z);
229227
+ }
228824
229228
  /** Return a (full length) vector from this point to other */
228825
229229
  vectorTo(other, result) {
228826
229230
  return Vector3d.create(other.x - this.x, other.y - this.y, other.z - this.z, result);
@@ -228833,9 +229237,13 @@ class XYZ {
228833
229237
  * @param other target of created vector.
228834
229238
  * @param result optional result vector.
228835
229239
  */
228836
- unitVectorTo(target, result) { return this.vectorTo(target, result).normalize(result); }
229240
+ unitVectorTo(target, result) {
229241
+ return this.vectorTo(target, result).normalize(result);
229242
+ }
228837
229243
  /** Freeze this XYZ */
228838
- freeze() { return Object.freeze(this); }
229244
+ freeze() {
229245
+ return Object.freeze(this);
229246
+ }
228839
229247
  /** access x part of XYZProps (which may be .x or [0]) */
228840
229248
  static x(xyz, defaultValue = 0) {
228841
229249
  if (xyz === undefined)
@@ -228872,7 +229280,9 @@ class XYZ {
228872
229280
  */
228873
229281
  class Point3d extends XYZ {
228874
229282
  /** Constructor for Point3d */
228875
- constructor(x = 0, y = 0, z = 0) { super(x, y, z); }
229283
+ constructor(x = 0, y = 0, z = 0) {
229284
+ super(x, y, z);
229285
+ }
228876
229286
  /**
228877
229287
  * Convert json to Point3d. Accepted forms are:
228878
229288
  * * `[1,2,3]` --- array of numbers
@@ -228880,9 +229290,15 @@ class Point3d extends XYZ {
228880
229290
  * * object with x,y, and (optional) z as numeric properties {x: xValue, y: yValue, z: zValue}
228881
229291
  * @param json json value.
228882
229292
  */
228883
- static fromJSON(json) { const val = new Point3d(); val.setFromJSON(json); return val; }
229293
+ static fromJSON(json) {
229294
+ const val = new Point3d();
229295
+ val.setFromJSON(json);
229296
+ return val;
229297
+ }
228884
229298
  /** Return a new Point3d with the same coordinates */
228885
- clone(result) { return Point3d.create(this.x, this.y, this.z, result); }
229299
+ clone(result) {
229300
+ return Point3d.create(this.x, this.y, this.z, result);
229301
+ }
228886
229302
  /** Create a new Point3d with given coordinates
228887
229303
  * @param x x part
228888
229304
  * @param y y part
@@ -228928,7 +229344,7 @@ class Point3d extends XYZ {
228928
229344
  /**
228929
229345
  * Copy and unweight xyzw.
228930
229346
  * @param xyzData flat array of x,y,z,w,x,y,z,w for multiple points
228931
- * @param pointIndex index of point to extract. This index is multiplied by 4 to obtain starting index in the array.
229347
+ * @param pointIndex index of point to extract. This index is multiplied by 4 to obtain starting index in the array.
228932
229348
  * @param result optional result point.
228933
229349
  */
228934
229350
  static createFromPackedXYZW(xyzData, pointIndex, result) {
@@ -228953,7 +229369,9 @@ class Point3d extends XYZ {
228953
229369
  return result;
228954
229370
  }
228955
229371
  /** Create a new point with 000 xyz */
228956
- static createZero(result) { return Point3d.create(0, 0, 0, result); }
229372
+ static createZero(result) {
229373
+ return Point3d.create(0, 0, 0, result);
229374
+ }
228957
229375
  /** Return the cross product of the vectors from this to pointA and pointB
228958
229376
  *
228959
229377
  * * the result is a vector
@@ -228971,7 +229389,7 @@ class Point3d extends XYZ {
228971
229389
  /** Return the triple product of the vectors from this to pointA, pointB, pointC
228972
229390
  *
228973
229391
  * * This is a scalar (number)
228974
- * * This is 6 times the (signed) volume of the tetrahedron on the 4 points.
229392
+ * * This is 6 times the (signed) volume of the tetrahedron on the 4 points.
228975
229393
  */
228976
229394
  tripleProductToPoints(pointA, pointB, pointC) {
228977
229395
  return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.tripleProduct(pointA.x - this.x, pointA.y - this.y, pointA.z - this.z, pointB.x - this.x, pointB.y - this.y, pointB.z - this.z, pointC.x - this.x, pointC.y - this.y, pointC.z - this.z);
@@ -229068,9 +229486,7 @@ class Point3d extends XYZ {
229068
229486
  (targetA.y - this.y) * (targetB.y - this.y) +
229069
229487
  (targetA.z - this.z) * (targetB.z - this.z);
229070
229488
  }
229071
- /** Return the fractional projection of this onto a line between points.
229072
- *
229073
- */
229489
+ /** Return the fractional projection of this onto a line between points. */
229074
229490
  fractionOfProjectionToLine(startPoint, endPoint, defaultFraction = 0) {
229075
229491
  const denominator = startPoint.distanceSquared(endPoint);
229076
229492
  if (denominator < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared)
@@ -229082,7 +229498,9 @@ class Point3d extends XYZ {
229082
229498
  * @public
229083
229499
  */
229084
229500
  class Vector3d extends XYZ {
229085
- constructor(x = 0, y = 0, z = 0) { super(x, y, z); }
229501
+ constructor(x = 0, y = 0, z = 0) {
229502
+ super(x, y, z);
229503
+ }
229086
229504
  /**
229087
229505
  * Return an array of vectors constructed from groups of 3 entries in a Float64Array.
229088
229506
  * Any incomplete group at the tail of the array is ignored.
@@ -229097,7 +229515,9 @@ class Vector3d extends XYZ {
229097
229515
  * Copy xyz from this instance to a new (or optionally reused) Vector3d
229098
229516
  * @param result optional instance to reuse.
229099
229517
  */
229100
- clone(result) { return Vector3d.create(this.x, this.y, this.z, result); }
229518
+ clone(result) {
229519
+ return Vector3d.create(this.x, this.y, this.z, result);
229520
+ }
229101
229521
  /**
229102
229522
  * return a Vector3d (new or reused from optional result)
229103
229523
  * @param x x component
@@ -229186,7 +229606,11 @@ class Vector3d extends XYZ {
229186
229606
  * * object with x,y, and (optional) z as numeric properties {x: xValue, y: yValue, z: zValue}
229187
229607
  * @param json json value.
229188
229608
  */
229189
- static fromJSON(json) { const val = new Vector3d(); val.setFromJSON(json); return val; }
229609
+ static fromJSON(json) {
229610
+ const val = new Vector3d();
229611
+ val.setFromJSON(json);
229612
+ return val;
229613
+ }
229190
229614
  /** Copy contents from another Point3d, Point2d, Vector2d, or Vector3d */
229191
229615
  static createFrom(data, result) {
229192
229616
  if (data instanceof Float64Array) {
@@ -229262,7 +229686,7 @@ class Vector3d extends XYZ {
229262
229686
  return undefined;
229263
229687
  }
229264
229688
  /**
229265
- * Set (replace) xzz components so they are a vector from point0 to point1
229689
+ * Set (replace) xyz components so they are a vector from point0 to point1
229266
229690
  * @param point0 start point of computed vector
229267
229691
  * @param point1 end point of computed vector.
229268
229692
  */
@@ -229272,13 +229696,21 @@ class Vector3d extends XYZ {
229272
229696
  this.z = point1.z - point0.z;
229273
229697
  }
229274
229698
  /** Return a vector with 000 xyz parts. */
229275
- static createZero(result) { return Vector3d.create(0, 0, 0, result); }
229699
+ static createZero(result) {
229700
+ return Vector3d.create(0, 0, 0, result);
229701
+ }
229276
229702
  /** Return a unit X vector optionally multiplied by a scale */
229277
- static unitX(scale = 1) { return new Vector3d(scale, 0, 0); }
229278
- /** Return a unit Y vector */
229279
- static unitY(scale = 1) { return new Vector3d(0, scale, 0); }
229280
- /** Return a unit Z vector */
229281
- static unitZ(scale = 1) { return new Vector3d(0, 0, scale); }
229703
+ static unitX(scale = 1) {
229704
+ return new Vector3d(scale, 0, 0);
229705
+ }
229706
+ /** Return a unit Y vector optionally multiplied by a scale */
229707
+ static unitY(scale = 1) {
229708
+ return new Vector3d(0, scale, 0);
229709
+ }
229710
+ /** Return a unit Z vector optionally multiplied by a scale */
229711
+ static unitZ(scale = 1) {
229712
+ return new Vector3d(0, 0, scale);
229713
+ }
229282
229714
  /** Divide by denominator, but return undefined if denominator is zero. */
229283
229715
  safeDivideOrNull(denominator, result) {
229284
229716
  if (denominator !== 0.0) {
@@ -229287,8 +229719,8 @@ class Vector3d extends XYZ {
229287
229719
  return undefined;
229288
229720
  }
229289
229721
  /**
229290
- * Return a pair object containing (a) property `v` which is a unit vector in the direction
229291
- * of the input and (b) property mag which is the magnitude (length) of the input (instance) prior to normalization.
229722
+ * Return a pair object containing (a) property `v` which is a unit vector in the direction of the input
229723
+ * and (b) property mag which is the magnitude (length) of the input (instance) prior to normalization.
229292
229724
  * If the instance (input) is a near zero length the `v` property of the output is undefined.
229293
229725
  * @param result optional result.
229294
229726
  */
@@ -229301,7 +229733,9 @@ class Vector3d extends XYZ {
229301
229733
  * Return a unit vector parallel with this. Return undefined if this.magnitude is near zero.
229302
229734
  * @param result optional result.
229303
229735
  */
229304
- normalize(result) { return this.normalizeWithLength(result).v; }
229736
+ normalize(result) {
229737
+ return this.normalizeWithLength(result).v;
229738
+ }
229305
229739
  /**
229306
229740
  * If this vector has nonzero length, divide by the length to change to a unit vector.
229307
229741
  * @returns true if normalization completed.
@@ -229336,7 +229770,7 @@ class Vector3d extends XYZ {
229336
229770
  /** Return a vector same length as this but rotate 90 degrees CCW */
229337
229771
  rotate90CCWXY(result) {
229338
229772
  result = result ? result : new Vector3d();
229339
- // save x,y to allow aliasing ..
229773
+ // save x,y to allow aliasing ("this" can be passed to the function as "result")
229340
229774
  const xx = this.x;
229341
229775
  const yy = this.y;
229342
229776
  result.x = -yy;
@@ -229382,17 +229816,23 @@ class Vector3d extends XYZ {
229382
229816
  return result;
229383
229817
  }
229384
229818
  /**
229385
- * Return a (new or optionally preallocated) vector that is rotated 90 degrees in the plane of this vector and the target vector.
229819
+ * Return a (new or optionally preallocated) vector that is rotated 90 degrees in
229820
+ * the plane of this vector and the target vector.
229386
229821
  * @param target Second vector which defines the plane of rotation.
229387
229822
  * @param result optional preallocated vector for result.
229388
- * @returns rotated vector, or undefined if the cross product of this and the the target cannot be normalized (i.e. if the target and this are colinear)
229823
+ * @returns rotated vector, or undefined if the cross product of this and
229824
+ * the the target cannot be normalized (i.e. if the target and this are colinear)
229389
229825
  */
229390
229826
  rotate90Towards(target, result) {
229391
229827
  const normal = this.crossProduct(target).normalize();
229392
229828
  return normal ? normal.crossProduct(this, result) : undefined;
229393
229829
  }
229394
229830
  /** Rotate this vector 90 degrees around an axis vector.
229395
- * @returns the (new or optionally reused result) rotated vector, or undefined if the axis vector cannot be normalized.
229831
+ * * Note that simple cross is in the plane perpendicular to axis -- it loses the part
229832
+ * of "this" that is along the axis. The unit and scale is supposed to fix that.
229833
+ * This matches with Rodrigues' rotation formula because cos(theta) = 0 and sin(theta) = 1
229834
+ * @returns the (new or optionally reused result) rotated vector, or undefined if the axis
229835
+ * vector cannot be normalized.
229396
229836
  */
229397
229837
  rotate90Around(axis, result) {
229398
229838
  const unitNormal = axis.normalize();
@@ -229400,7 +229840,8 @@ class Vector3d extends XYZ {
229400
229840
  }
229401
229841
  /**
229402
229842
  * Return a vector computed at fractional position between this vector and vectorB
229403
- * @param fraction fractional position. 0 is at `this`. 1 is at `vectorB`. True fractions are "between", negatives are "before this", beyond 1 is "beyond vectorB".
229843
+ * @param fraction fractional position. 0 is at `this`. 1 is at `vectorB`.
229844
+ * True fractions are "between", negatives are "before this", beyond 1 is "beyond vectorB".
229404
229845
  * @param vectorB second vector
229405
229846
  * @param result optional preallocated result.
229406
229847
  */
@@ -229471,7 +229912,8 @@ class Vector3d extends XYZ {
229471
229912
  static createAdd2Scaled(vectorA, scaleA, vectorB, scaleB, result) {
229472
229913
  return Vector3d.create(vectorA.x * scaleA + vectorB.x * scaleB, vectorA.y * scaleA + vectorB.y * scaleB, vectorA.z * scaleA + vectorB.z * scaleB, result);
229473
229914
  }
229474
- /** Return the (strongly typed Vector3d) `thisVector3d + vectorA * scalarA + vectorB * scalarB` with all components presented as numbers */
229915
+ /** Return the (strongly typed Vector3d) `thisVector3d + vectorA * scalarA + vectorB * scalarB`
229916
+ * with all components presented as numbers */
229475
229917
  static createAdd2ScaledXYZ(ax, ay, az, scaleA, bx, by, bz, scaleB, result) {
229476
229918
  return Vector3d.create(ax * scaleA + bx * scaleB, ay * scaleA + by * scaleB, az * scaleA + bz * scaleB, result);
229477
229919
  }
@@ -229506,7 +229948,8 @@ class Vector3d extends XYZ {
229506
229948
  return this.crossProduct(vectorB, result).normalize(result);
229507
229949
  }
229508
229950
  /**
229509
- * Compute the cross product of this vector with `vectorB`. Normalize it, using given xyz as default if length is zero.
229951
+ * Compute the cross product of this vector with `vectorB`. Normalize it, using given xyz as
229952
+ * default if length is zero.
229510
229953
  * @param vectorB second vector of cross product
229511
229954
  * @param x x value for default result
229512
229955
  * @param y y value for default result
@@ -229639,17 +230082,18 @@ class Vector3d extends XYZ {
229639
230082
  return this.x * (pointB.x - pointA.x)
229640
230083
  + this.y * (pointB.y - pointA.y);
229641
230084
  }
229642
- /** Dot product with vector from pointA to pointB, with pointB given as (weighted) x,y,z,w
229643
- * * pointB is a homogeneous point that has to be unweighted
230085
+ /** Dot product with vector from pointA to pointB, with pointB given as (weighted) wx,wy,wz,w
230086
+ * * We need to unweight pointB (which is a homogeneous point) to be able to participate in the
230087
+ * vector dot product
229644
230088
  * * if the weight is near zero metric, the return is zero.
229645
230089
  */
229646
- dotProductStartEndXYZW(pointA, x, y, z, w) {
230090
+ dotProductStartEndXYZW(pointA, wx, wy, wz, w) {
229647
230091
  if (_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(w))
229648
230092
  return 0.0;
229649
230093
  const dw = 1.0 / w;
229650
- return this.x * (dw * x - pointA.x)
229651
- + this.y * (dw * y - pointA.y)
229652
- + this.z * (dw * z - pointA.z);
230094
+ return this.x * (dw * wx - pointA.x)
230095
+ + this.y * (dw * wy - pointA.y)
230096
+ + this.z * (dw * wz - pointA.z);
229653
230097
  }
229654
230098
  /** Return the dot product of the instance and vectorB, using only the x and y parts. */
229655
230099
  dotProductXY(vectorB) {
@@ -229691,46 +230135,93 @@ class Vector3d extends XYZ {
229691
230135
  return Vector3d.createCrossProduct(this.x, this.y, this.z, x, y, z, result);
229692
230136
  }
229693
230137
  /**
229694
- * Return the (Strongly typed) angle from this vector to vectorB.
230138
+ * Return the (radians as a simple number, not strongly typed Angle) angle from this vector to vectorB.
230139
+ * * The returned angle is always positive and no larger than 180 degrees (PI radians)
230140
+ * * The returned angle is "in the plane containing the two vectors"
230141
+ * * Use `planarRadiansTo` and `signedRadiansTo` to take have angle measured in specific plane.
230142
+ * @param vectorB target vector of rotation.
230143
+ */
230144
+ radiansTo(vectorB) {
230145
+ // ||axb|| = ||a|| ||b|| |sin(t)| and a.b = ||a|| ||b|| cos(t) ==>
230146
+ // ||axb|| / a.b = sin(t)/cos(t) = tan(t) ==> t = arctan(||axb|| / a.b).
230147
+ return Math.atan2(this.crossProductMagnitude(vectorB), this.dotProduct(vectorB));
230148
+ }
230149
+ /**
230150
+ * Return the (strongly typed) angle from this vector to vectorB.
229695
230151
  * * The returned angle is always positive and no larger than 180 degrees (PI radians)
229696
230152
  * * The returned angle is "in the plane containing the two vectors"
229697
- * * Use `planarAngleTo`, `signedAngleTo`, `angleToXY` to take have angle measured in specific plane.
230153
+ * * Use `planarAngleTo` and `signedAngleTo` to take have angle measured in specific plane.
229698
230154
  * @param vectorB target vector of rotation.
229699
230155
  */
229700
230156
  angleTo(vectorB) {
229701
- return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createAtan2(this.crossProductMagnitude(vectorB), this.dotProduct(vectorB));
230157
+ return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.radiansTo(vectorB));
229702
230158
  }
229703
230159
  /**
229704
- * Return the (Strongly typed) angle from this vector to the plane perpendicular to planeNormal.
230160
+ * Return the (strongly typed) angle from this vector to the plane perpendicular to planeNormal.
229705
230161
  * * The returned vector is signed
229706
- * * The returned vector is (as degrees) always less than or equal to 90 degrees.
229707
- * @param planeNormal a normal vector to the plane
230162
+ * * The returned vector is (as degrees) always between -90 and 90 degrees.
230163
+ * * The function returns "PI/2 - angleTo(planeNormal)"
230164
+ * @param planeNormal a normal vector to the plane.
229708
230165
  */
229709
- angleFromPerpendicular(vectorB) {
229710
- return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createAtan2(this.dotProduct(vectorB), this.crossProductMagnitude(vectorB));
230166
+ angleFromPerpendicular(planeNormal) {
230167
+ return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createAtan2(this.dotProduct(planeNormal), this.crossProductMagnitude(planeNormal));
229711
230168
  }
229712
230169
  /**
229713
- * Return the (Strongly typed) angle from this vector to vectorB,using only the xy parts.
229714
- * * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180 degrees (positive PI radians), not closed on the negative side.
229715
- * * Use `planarAngleTo`, `signedAngleTo`, `angleToXY` to take have angle measured in other planes.
230170
+ * Return the (Strongly typed) angle from this vector to vectorB, using only the xy parts.
230171
+ * * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180
230172
+ * * degrees (positive PI radians), not closed on the negative side.
230173
+ * * Use `planarAngleTo` and `signedAngleTo` to take have angle measured in other planes.
229716
230174
  * @param vectorB target vector of rotation.
229717
230175
  */
229718
230176
  angleToXY(vectorB) {
229719
230177
  return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createAtan2(this.crossProductXY(vectorB), this.dotProductXY(vectorB));
229720
230178
  }
230179
+ /**
230180
+ * Return the (simple number of radians, not Strongly typed Angle) angle from this vector to vectorB, measured
230181
+ * in the plane containing both, with vectorW indicating which side to view to control sign of the angle.
230182
+ * * The returned angle can range from negative PI to positive PI (not closed on negative side)
230183
+ * * The returned angle is "in the plane containing the two vectors"
230184
+ * * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
230185
+ * * vectorW does not have to be perpendicular to the plane.
230186
+ * @param vectorB target vector of rotation.
230187
+ * @param vectorW distinguishes between the sides of the plane.
230188
+ */
230189
+ signedRadiansTo(vectorB, vectorW) {
230190
+ const p = this.crossProduct(vectorB);
230191
+ const theta = Math.atan2(p.magnitude(), this.dotProduct(vectorB));
230192
+ if (vectorW.dotProduct(p) < 0.0)
230193
+ return -theta;
230194
+ else
230195
+ return theta;
230196
+ }
230197
+ /**
230198
+ * Return the (strongly typed Angle) angle from this vector to vectorB, measured in the plane containing both,
230199
+ * with vectorW indicating which side to view to control sign of the angle.
230200
+ * * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180 degrees
230201
+ * * (positive PI radians), not closed on the negative side.
230202
+ * * The returned angle is "in the plane containing the two vectors"
230203
+ * * `vectorW` distinguishes between the sides of the plane, but does not have to be perpendicular.
230204
+ * * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
230205
+ * @param vectorB target vector of rotation.
230206
+ * @param vectorW distinguishes between the sides of the plane.
230207
+ */
230208
+ signedAngleTo(vectorB, vectorW) {
230209
+ return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.signedRadiansTo(vectorB, vectorW));
230210
+ }
229721
230211
  /**
229722
230212
  * Return the (radians as a simple number, not strongly typed Angle) radians from this vector to vectorB.
229723
230213
  * * The returned angle can be positive or negative, with magnitude no larger than PI radians
229724
230214
  * * Use signedRadiansTo` to take have angle measured in other planes.
229725
230215
  * @param vectorB target vector of rotation.
230216
+ * @param planeNormal a normal vector to the plane.
229726
230217
  */
229727
- planarRadiansTo(vector, planeNormal) {
230218
+ planarRadiansTo(vectorB, planeNormal) {
229728
230219
  const square = planeNormal.dotProduct(planeNormal);
229729
230220
  if (square === 0.0)
229730
230221
  return 0.0;
229731
230222
  const factor = 1.0 / square;
229732
230223
  const projection0 = this.plusScaled(planeNormal, -this.dotProduct(planeNormal) * factor);
229733
- const projection1 = vector.plusScaled(planeNormal, -vector.dotProduct(planeNormal) * factor);
230224
+ const projection1 = vectorB.plusScaled(planeNormal, -vectorB.dotProduct(planeNormal) * factor);
229734
230225
  return projection0.signedRadiansTo(projection1, planeNormal);
229735
230226
  }
229736
230227
  /**
@@ -229738,86 +230229,67 @@ class Vector3d extends XYZ {
229738
230229
  * * The returned angle can range from negative PI to positive PI (not closed on negative side)
229739
230230
  * * Use signedRadiansTo` to take have angle measured in other planes.
229740
230231
  * @param vectorB target vector of rotation.
230232
+ * @param planeNormal a normal vector to the plane.
229741
230233
  */
229742
- planarAngleTo(vector, planeNormal) {
229743
- return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.planarRadiansTo(vector, planeNormal));
229744
- }
229745
- /**
229746
- * Return the (simple number of radians, not Strongly typed Angle) angle from this vector to vectorB, measured in the plane containing both, with vectorW indicating which side to view to control sign of the angle.
229747
- * * The returned angle can range from negative PI to positive PI (not closed on negative side)
229748
- * * The returned angle is "in the plane containing the two vectors"
229749
- * * `vectorW` distinguishes between the sides of the plane, but does not have to be perpendicular.
229750
- * * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
229751
- * @param vectorB target vector of rotation.
229752
- */
229753
- signedRadiansTo(vector1, vectorW) {
229754
- const p = this.crossProduct(vector1);
229755
- const theta = Math.atan2(p.magnitude(), this.dotProduct(vector1));
229756
- if (vectorW.dotProduct(p) < 0.0)
229757
- return -theta;
229758
- else
229759
- return theta;
229760
- }
229761
- /**
229762
- * Return the (strongly typed Angle) angle from this vector to vectorB, measured in the plane containing both, with vectorW indicating which side to view to control sign of the angle.
229763
- * * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180 degrees (positive PI radians), not closed on the negative side.
229764
- * * The returned angle is "in the plane containing the two vectors"
229765
- * * `vectorW` distinguishes between the sides of the plane, but does not have to be perpendicular.
229766
- * * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
229767
- * @param vectorB target vector of rotation.
229768
- */
229769
- signedAngleTo(vector1, vectorW) { return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.signedRadiansTo(vector1, vectorW)); }
229770
- /** Return the smallest (strongly typed) angle from the (bidirectional) line containing `this` to the (bidirectional) line containing `vectorB` */
229771
- smallerUnorientedAngleTo(vectorB) {
229772
- return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.smallerUnorientedRadiansTo(vectorB));
230234
+ planarAngleTo(vectorB, planeNormal) {
230235
+ return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.planarRadiansTo(vectorB, planeNormal));
229773
230236
  }
229774
- /** Return the smallest angle (in radians) from the (bidirectional) line containing `this` to the (bidirectional) line containing `vectorB` */
230237
+ /** Return the smallest angle (in radians) from the (bidirectional) line containing `this`
230238
+ * to the (bidirectional) line containing `vectorB` */
229775
230239
  smallerUnorientedRadiansTo(vectorB) {
229776
230240
  const c = this.dotProduct(vectorB);
229777
230241
  const s = this.crossProductMagnitude(vectorB);
229778
230242
  return Math.atan2(Math.abs(s), Math.abs(c));
229779
230243
  }
229780
- /*
229781
- signedAngleTo(vectorB: Vector3d, upVector: Vector3d): Angle { }
229782
- // sectors
229783
- isInSmallerSector(vectorA: Vector3d, vectorB: Vector3d): boolean { }
229784
- isInCCWSector(vectorA: Vector3d, vectorB: Vector3d, upVector: Vector3d): boolean { }
229785
- */
230244
+ /** Return the smallest (strongly typed) angle from the (bidirectional) line containing `this`
230245
+ * to the (bidirectional) line containing `vectorB` */
230246
+ smallerUnorientedAngleTo(vectorB) {
230247
+ return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.smallerUnorientedRadiansTo(vectorB));
230248
+ }
229786
230249
  /**
229787
230250
  * Test if this vector is parallel to other.
230251
+ * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
230252
+ * so if you have a distance or angle tolerance t, you should pass in t * t.
229788
230253
  * @param other second vector in comparison
229789
- * @param oppositeIsParallel if the vectors are on the same line but in opposite directions, return this value.
230254
+ * @param oppositeIsParallel whether to consider diametrically opposed vectors as parallel
229790
230255
  * @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.
230256
+ * @param options optional radian and distance tolerances.
229791
230257
  */
229792
- isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false) {
230258
+ isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false, options) {
230259
+ var _a, _b;
230260
+ const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared;
230261
+ const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared;
229793
230262
  const a2 = this.magnitudeSquared();
229794
230263
  const b2 = other.magnitudeSquared();
229795
- // we know both are 0 or positive -- no need for
229796
- if (a2 < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared || b2 < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared)
230264
+ if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)
229797
230265
  return returnValueIfAnInputIsZeroLength;
229798
230266
  const dot = this.dotProduct(other);
229799
230267
  if (dot < 0.0 && !oppositeIsParallel)
229800
- return returnValueIfAnInputIsZeroLength;
230268
+ return false;
229801
230269
  const cross2 = this.crossProductMagnitudeSquared(other);
229802
230270
  /* a2,b2,cross2 are squared lengths of respective vectors */
229803
230271
  /* cross2 = sin^2(theta) * a2 * b2 */
229804
230272
  /* For small theta, sin^2(theta)~~theta^2 */
229805
- return cross2 <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared * a2 * b2;
230273
+ return cross2 <= radianSquaredTol * a2 * b2;
229806
230274
  }
229807
230275
  /**
229808
230276
  * Test if this vector is perpendicular to other.
230277
+ * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
230278
+ * so if you have a distance or angle tolerance t, you should pass in t * t.
229809
230279
  * @param other second vector in comparison
229810
230280
  * @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.
230281
+ * @param options optional radian and distance tolerances.
229811
230282
  */
229812
- isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false) {
230283
+ isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false, options) {
230284
+ var _a, _b;
230285
+ const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared;
230286
+ const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared;
229813
230287
  const aa = this.magnitudeSquared();
229814
- if (aa < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared)
229815
- return returnValueIfAnInputIsZeroLength;
229816
230288
  const bb = other.magnitudeSquared();
229817
- if (bb < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared)
230289
+ if (aa < distanceSquaredTol || bb < distanceSquaredTol)
229818
230290
  return returnValueIfAnInputIsZeroLength;
229819
230291
  const ab = this.dotProduct(other);
229820
- return ab * ab <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared * aa * bb;
230292
+ return ab * ab <= radianSquaredTol * aa * bb;
229821
230293
  }
229822
230294
  }
229823
230295
 
@@ -233678,7 +234150,6 @@ class Range1d extends RangeBase {
233678
234150
  return Range1d.createXXOrCorrectToNull(Math.max(this.low, other.low), Math.min(this.high, other.high), result);
233679
234151
  }
233680
234152
  /** Return the union of ranges. */
233681
- /** Return the intersection of ranges. */
233682
234153
  union(other, result) {
233683
234154
  // we trust null ranges have EXTREME values, so a null in either input leads to expected results.
233684
234155
  return Range1d.createXX(Math.min(this.low, other.low), Math.max(this.high, other.high), result);
@@ -261398,8 +261869,8 @@ var IModelJson;
261398
261869
  // optional specific X
261399
261870
  const radiusX = Reader.parseNumberProperty(json, "radiusX", radius);
261400
261871
  // missing Y and Z both pick up radiusX (which may have already been defaulted from unqualified radius)
261401
- const radiusY = Reader.parseNumberProperty(json, "radiusX", radiusX);
261402
- const radiusZ = Reader.parseNumberProperty(json, "radiusX", radiusX);
261872
+ const radiusY = Reader.parseNumberProperty(json, "radiusY", radiusX);
261873
+ const radiusZ = Reader.parseNumberProperty(json, "radiusZ", radiusX);
261403
261874
  const latitudeStartEnd = Reader.parseAngleSweepProps(json, "latitudeStartEnd"); // this may be undefined!!
261404
261875
  const axes = Reader.parseOrientation(json, true);
261405
261876
  const capped = Reader.parseBooleanProperty(json, "capped", false);
@@ -261424,7 +261895,7 @@ var IModelJson;
261424
261895
  }
261425
261896
  /** Parse TorusPipe props to TorusPipe instance. */
261426
261897
  static parseTorusPipe(json) {
261427
- const axes = Reader.parseOrientation(json, true);
261898
+ const axes = Reader.parseOrientation(json, true); // force frame to be pure rotation (no scale or mirror)!
261428
261899
  const center = Reader.parsePoint3dProperty(json, "center");
261429
261900
  const radiusA = Reader.parseNumberProperty(json, "majorRadius");
261430
261901
  const radiusB = Reader.parseNumberProperty(json, "minorRadius");
@@ -261756,6 +262227,7 @@ var IModelJson;
261756
262227
  const radiusB = data.getMinorRadius();
261757
262228
  const sweep = data.getSweepAngle();
261758
262229
  if (data.getIsReversed()) {
262230
+ // the TorusPipe was created with negative sweep that was forced positive; restore original values
261759
262231
  vectorY.scaleInPlace(-1.0);
261760
262232
  sweep.setRadians(-sweep.radians);
261761
262233
  }
@@ -263519,16 +263991,16 @@ class Sphere extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimitive
263519
263991
  const factors = this._localToWorld.matrix.factorRigidWithSignedScale();
263520
263992
  if (!factors)
263521
263993
  return undefined;
263522
- if (factors && factors.scale > 0)
263994
+ if (factors && factors.scale > 0) // why do we rule out mirror?
263523
263995
  return factors.scale;
263524
263996
  return undefined;
263525
263997
  }
263526
263998
  /**
263527
- * Return the larger of the primary xyz axis radii
263999
+ * Return the largest of the primary xyz axis radii
263528
264000
  */
263529
264001
  maxAxisRadius() {
263530
264002
  const matrix = this._localToWorld.matrix;
263531
- return _Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.maxXYZ(matrix.columnXMagnitude(), matrix.columnYMagnitude(), matrix.columnYMagnitude());
264003
+ return _Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.maxXYZ(matrix.columnXMagnitude(), matrix.columnYMagnitude(), matrix.columnZMagnitude());
263532
264004
  }
263533
264005
  /**
263534
264006
  * Return a (clone of) the sphere's local to world transformation.
@@ -264017,13 +264489,13 @@ __webpack_require__.r(__webpack_exports__);
264017
264489
  * A torus pipe is a partial torus (donut). In a local coordinate system
264018
264490
  * * The z axis passes through the hole.
264019
264491
  * * The "major hoop" arc has
264020
- * * vectorTheta0 = (radiusA,0,0)
264021
- * * vectorTheta90 = (0, radiusA,0)
264492
+ * * vectorTheta0 = (radiusA, 0, 0)
264493
+ * * vectorTheta90 = (0, radiusA, 0)
264022
264494
  * * The major arc point at angle theta is `C(theta) = vectorTheta0 * cos(theta) + vectorTheta90 * sin(theta)
264023
264495
  * * The minor hoop at theta various with phi "around the minor hoop"
264024
- * * (x,y,z) = C(theta) + (radiusB *cos(theta), radiusB * sin(theta)) * cos(phi) + (0,radiusB,0) * sin(phi)
264496
+ * * (x,y,z) = C(theta) + (radiusB * cos(theta), radiusB * sin(theta), 0) * cos(phi) + (0, 0, radiusB) * sin(phi)
264025
264497
  * * The stored form of the torus pipe is oriented for positive volume:
264026
- * * Both radii are positive, with r0 >= r1 > 0
264498
+ * * Both radii are positive, with radiusA >= radiusB > 0
264027
264499
  * * The sweep is positive
264028
264500
  * * The coordinate system has positive determinant.
264029
264501
  * * For uv parameterization,
@@ -264034,6 +264506,7 @@ __webpack_require__.r(__webpack_exports__);
264034
264506
  * @public
264035
264507
  */
264036
264508
  class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimitive {
264509
+ // constructor captures the pointers!
264037
264510
  constructor(map, radiusA, radiusB, sweep, capped) {
264038
264511
  super(capped);
264039
264512
  /** String name for schema properties */
@@ -264060,11 +264533,12 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
264060
264533
  /** Clone this TorusPipe and transform the clone */
264061
264534
  cloneTransformed(transform) {
264062
264535
  const result = this.clone();
264063
- transform.multiplyTransformTransform(result._localToWorld, result._localToWorld);
264536
+ if (!result.tryTransformInPlace(transform))
264537
+ return undefined;
264064
264538
  return result;
264065
264539
  }
264066
264540
  /** Create a new `TorusPipe`
264067
- * @param frame local to world transformation
264541
+ * @param frame local to world transformation. For best results, the matrix part should be a pure rotation.
264068
264542
  * @param majorRadius major hoop radius
264069
264543
  * @param minorRadius minor hoop radius
264070
264544
  * @param sweep sweep angle for major circle, with positive sweep from x axis towards y axis.
@@ -264082,12 +264556,12 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
264082
264556
  return undefined;
264083
264557
  if (sweep.isAlmostZero)
264084
264558
  return undefined;
264085
- const xScale = 1.0;
264559
+ // remove mirror and negative sweep
264086
264560
  let yScale = 1.0;
264087
264561
  let zScale = 1.0;
264562
+ let isReversed = false;
264088
264563
  if (frame.matrix.determinant() < 0.0)
264089
264564
  zScale *= -1.0;
264090
- let isReversed = false;
264091
264565
  const sweep1 = sweep.clone();
264092
264566
  if (sweep.radians < 0.0) {
264093
264567
  sweep1.setRadians(-sweep.radians);
@@ -264096,15 +264570,14 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
264096
264570
  isReversed = true;
264097
264571
  }
264098
264572
  const frame1 = frame.clone();
264099
- frame1.matrix.scaleColumns(xScale, yScale, zScale, frame1.matrix);
264573
+ frame1.matrix.scaleColumnsInPlace(1, yScale, zScale);
264100
264574
  const result = new TorusPipe(frame1, majorRadius, minorRadius, sweep1, capped);
264101
264575
  result._isReversed = isReversed;
264102
264576
  return result;
264103
264577
  }
264104
264578
  /** Create a TorusPipe from the typical parameters of the Dgn file */
264105
264579
  static createDgnTorusPipe(center, vectorX, vectorY, majorRadius, minorRadius, sweep, capped) {
264106
- const vectorZ = vectorX.crossProduct(vectorY);
264107
- vectorZ.scaleToLength(vectorX.magnitude(), vectorZ);
264580
+ const vectorZ = vectorX.unitCrossProductWithDefault(vectorY, 0, 0, 1);
264108
264581
  const frame = _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_2__.Transform.createOriginAndMatrixColumns(center, vectorX, vectorY, vectorZ);
264109
264582
  return TorusPipe.createInFrame(frame, majorRadius, minorRadius, sweep, capped);
264110
264583
  }
@@ -264119,28 +264592,41 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
264119
264592
  }
264120
264593
  /** Return a coordinate frame (right handed, unit axes)
264121
264594
  * * origin at center of major circle
264122
- * * major circle in xy plane
264123
- * * z axis perpendicular
264595
+ * * major circle in plane of first two columns
264596
+ * * last column perpendicular to first two
264124
264597
  */
264125
264598
  getConstructiveFrame() {
264126
264599
  return this._localToWorld.cloneRigid();
264127
264600
  }
264128
264601
  /** Return the center of the torus pipe (inside the donut hole) */
264129
264602
  cloneCenter() { return this._localToWorld.getOrigin(); }
264130
- /** return the vector along the x axis (in the major hoops plane) */
264131
- cloneVectorX() { return this._localToWorld.matrix.columnX(); }
264132
- /** return the vector along the y axis (in the major hoop plane) */
264133
- cloneVectorY() { return this._localToWorld.matrix.columnY(); }
264134
- /** get the minor hoop radius (`radiusA`) */
264135
- getMinorRadius() { return this._radiusB; }
264136
- /** get the major hoop radius (`radiusB`) */
264137
- getMajorRadius() { return this._radiusA; }
264603
+ /** return unit vector along the x axis (in the major hoop plane) */
264604
+ cloneVectorX() {
264605
+ const xAxis = this._localToWorld.matrix.columnX();
264606
+ return xAxis.normalizeWithDefault(1, 0, 0, xAxis);
264607
+ }
264608
+ /** return unit vector along the y axis (in the major hoop plane) */
264609
+ cloneVectorY() {
264610
+ const yAxis = this._localToWorld.matrix.columnY();
264611
+ return yAxis.normalizeWithDefault(0, 1, 0, yAxis);
264612
+ }
264613
+ /** return unit vector along the z axis */
264614
+ cloneVectorZ() {
264615
+ const zAxis = this._localToWorld.matrix.columnZ();
264616
+ return zAxis.normalizeWithDefault(0, 0, 1, zAxis);
264617
+ }
264618
+ /** get the major hoop radius (`radiusA`) in world coordinates */
264619
+ getMajorRadius() { return this._radiusA * this._localToWorld.matrix.columnXMagnitude(); }
264620
+ /** get the minor hoop radius (`radiusB`) in world coordinates */
264621
+ getMinorRadius() { return this._radiusB * this._localToWorld.matrix.columnZMagnitude(); }
264138
264622
  /** get the sweep angle along the major circle. */
264139
264623
  getSweepAngle() { return this._sweep.clone(); }
264140
264624
  /** Ask if this TorusPipe is labeled as reversed */
264141
264625
  getIsReversed() { return this._isReversed; }
264142
264626
  /** Return the sweep angle as a fraction of full 360 degrees (2PI radians) */
264143
264627
  getThetaFraction() { return this._sweep.radians / (Math.PI * 2.0); }
264628
+ /** Return a (clone of) the TorusPipe's local to world transformation. */
264629
+ cloneLocalToWorld() { return this._localToWorld.clone(); }
264144
264630
  /** ask if `other` is an instance of `TorusPipe` */
264145
264631
  isSameGeometryClass(other) { return other instanceof TorusPipe; }
264146
264632
  /** test if `this` and `other` have nearly equal geometry */
@@ -264148,11 +264634,24 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
264148
264634
  if (other instanceof TorusPipe) {
264149
264635
  if ((!this._sweep.isFullCircle) && this.capped !== other.capped)
264150
264636
  return false;
264151
- if (!this._localToWorld.isAlmostEqual(other._localToWorld))
264637
+ // Compare getter output so that we can equate TorusPipes created/transformed in equivalent ways.
264638
+ // In particular, the column vectors contribute their scale to the radii, so we ignore their length.
264639
+ if (!this.cloneCenter().isAlmostEqual(other.cloneCenter()))
264152
264640
  return false;
264153
- return _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isSameCoordinate(this._radiusA, other._radiusA)
264154
- && _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isSameCoordinate(this._radiusB, other._radiusB)
264155
- && this._sweep.isAlmostEqualNoPeriodShift(other._sweep);
264641
+ if (!this.cloneVectorX().isAlmostEqual(other.cloneVectorX()))
264642
+ return false;
264643
+ if (!this.cloneVectorY().isAlmostEqual(other.cloneVectorY()))
264644
+ return false;
264645
+ if (!this.cloneVectorZ().isAlmostEqual(other.cloneVectorZ()))
264646
+ return false;
264647
+ if (!_Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isSameCoordinate(this.getMinorRadius(), other.getMinorRadius()))
264648
+ return false;
264649
+ if (!_Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isSameCoordinate(this.getMajorRadius(), other.getMajorRadius()))
264650
+ return false;
264651
+ if (!this.getSweepAngle().isAlmostEqualNoPeriodShift(other.getSweepAngle()))
264652
+ return false;
264653
+ // ignore _isReversed; it doesn't affect geometry
264654
+ return true;
264156
264655
  }
264157
264656
  return false;
264158
264657
  }
@@ -264171,19 +264670,19 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
264171
264670
  const thetaRadians = this.vFractionToRadians(v);
264172
264671
  const c0 = Math.cos(thetaRadians);
264173
264672
  const s0 = Math.sin(thetaRadians);
264174
- const majorRadius = this.getMajorRadius();
264175
- const minorRadius = this.getMinorRadius();
264673
+ const majorRadius = this._radiusA;
264674
+ const minorRadius = this._radiusB;
264176
264675
  const center = this._localToWorld.multiplyXYZ(majorRadius * c0, majorRadius * s0, 0);
264177
264676
  const vector0 = this._localToWorld.multiplyVectorXYZ(minorRadius * c0, minorRadius * s0, 0);
264178
264677
  const vector90 = this._localToWorld.multiplyVectorXYZ(0, 0, minorRadius);
264179
264678
  return _curve_Loop__WEBPACK_IMPORTED_MODULE_4__.Loop.create(_curve_Arc3d__WEBPACK_IMPORTED_MODULE_5__.Arc3d.create(center, vector0, vector90));
264180
264679
  }
264181
- /** Return an arc at constant u, and arc sweep matching this TorusPipe sweep. */
264680
+ /** Return an arc at constant u, and arc sweep matching this TorusPipe sweep. */
264182
264681
  constantUSection(uFraction) {
264183
264682
  const theta1Radians = this._sweep.radians;
264184
- const phiRadians = uFraction * Math.PI;
264185
- const majorRadius = this.getMajorRadius();
264186
- const minorRadius = this.getMinorRadius();
264683
+ const phiRadians = uFraction * 2 * Math.PI;
264684
+ const majorRadius = this._radiusA;
264685
+ const minorRadius = this._radiusB;
264187
264686
  const transform = this._localToWorld;
264188
264687
  const axes = transform.matrix;
264189
264688
  const center = this._localToWorld.multiplyXYZ(0, 0, minorRadius * Math.sin(phiRadians));
@@ -264195,8 +264694,8 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
264195
264694
  /** extend `rangeToExtend` to include this `TorusPipe` */
264196
264695
  extendRange(rangeToExtend, transform) {
264197
264696
  const theta1Radians = this._sweep.radians;
264198
- const majorRadius = this.getMajorRadius();
264199
- const minorRadius = this.getMinorRadius();
264697
+ const majorRadius = this._radiusA;
264698
+ const minorRadius = this._radiusB;
264200
264699
  const transform0 = this._localToWorld;
264201
264700
  const numThetaSample = Math.ceil(theta1Radians / (Math.PI / 16.0));
264202
264701
  const numHalfPhiSample = 16;
@@ -264236,7 +264735,7 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
264236
264735
  else {
264237
264736
  for (j = 0; j <= numPhiSample; j++) {
264238
264737
  phi = phi0 + j * dPhi;
264239
- rxy = majorRadius + minorRadius * Math.sin(phi);
264738
+ rxy = majorRadius + minorRadius * Math.cos(phi);
264240
264739
  rangeToExtend.extendTransformedXYZ(transform0, cosTheta * rxy, sinTheta * rxy, Math.sin(phi) * minorRadius);
264241
264740
  }
264242
264741
  }
@@ -264251,8 +264750,9 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
264251
264750
  const phiRadians = u * Math.PI * 2.0;
264252
264751
  const cosTheta = Math.cos(thetaRadians);
264253
264752
  const sinTheta = Math.sin(thetaRadians);
264254
- const minorRadius = this.getMinorRadius();
264255
- const rxy = this.getMajorRadius() + Math.cos(phiRadians) * minorRadius;
264753
+ const majorRadius = this._radiusA;
264754
+ const minorRadius = this._radiusB;
264755
+ const rxy = majorRadius + Math.cos(phiRadians) * minorRadius;
264256
264756
  return this._localToWorld.multiplyXYZ(rxy * cosTheta, rxy * sinTheta, minorRadius * Math.sin(phiRadians), result);
264257
264757
  }
264258
264758
  /** Evaluate as a uv surface, returning point and two vectors.
@@ -264268,8 +264768,9 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
264268
264768
  const sinTheta = Math.sin(thetaRadians);
264269
264769
  const sinPhi = Math.sin(phiRadians);
264270
264770
  const cosPhi = Math.cos(phiRadians);
264271
- const minorRadius = this.getMinorRadius();
264272
- const rxy = this.getMajorRadius() + Math.cos(phiRadians) * minorRadius;
264771
+ const majorRadius = this._radiusA;
264772
+ const minorRadius = this._radiusB;
264773
+ const rxy = majorRadius + Math.cos(phiRadians) * minorRadius;
264273
264774
  const rSinPhi = minorRadius * sinPhi;
264274
264775
  const rCosPhi = minorRadius * cosPhi; // appears only as derivative of rSinPhi.
264275
264776
  return _geometry3d_Plane3dByOriginAndVectors__WEBPACK_IMPORTED_MODULE_8__.Plane3dByOriginAndVectors.createOriginAndVectors(this._localToWorld.multiplyXYZ(cosTheta * rxy, sinTheta * rxy, rSinPhi), this._localToWorld.multiplyVectorXYZ(-cosTheta * rSinPhi * fPhi, -sinTheta * rSinPhi * fPhi, rCosPhi * fPhi), this._localToWorld.multiplyVectorXYZ(-rxy * sinTheta * fTheta, rxy * cosTheta * fTheta, 0), result);
@@ -265118,7 +265619,7 @@ class HalfEdge {
265118
265619
  }
265119
265620
  /**
265120
265621
  * Pinch this half edge out of its base vertex loop.
265121
- * * if this the half edge (possibly undefined)
265622
+ * @return the surviving HalfEdge in the vertex loop, or undefined if the instance HalfEdge is already dangling
265122
265623
  */
265123
265624
  yankFromVertexLoop() {
265124
265625
  const other = this.edgeMate.faceSuccessor;
@@ -268831,7 +269332,7 @@ __webpack_require__.r(__webpack_exports__);
268831
269332
  */
268832
269333
  class Triangulator {
268833
269334
  /** Given the six nodes that make up two bordering triangles, "pinch" and relocate the nodes to flip them
268834
- * * The shared edge mates are a and d.
269335
+ * * The shared edge mates are c and e.
268835
269336
  * * (abc) are a triangle in CCW order
268836
269337
  * * (dfe) are a triangle in CCW order. (!! node dfe instead of def.)
268837
269338
  */
@@ -291342,7 +291843,7 @@ class TestContext {
291342
291843
  this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
291343
291844
  const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${(_a = process.env.IMJS_URL_PREFIX) !== null && _a !== void 0 ? _a : ""}api.bentley.com/imodels` } });
291344
291845
  await core_frontend_1.NoRenderApp.startup({
291345
- applicationVersion: "3.5.0-dev.35",
291846
+ applicationVersion: "3.5.0-dev.41",
291346
291847
  applicationId: this.settings.gprid,
291347
291848
  authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
291348
291849
  hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
@@ -310411,7 +310912,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
310411
310912
  /***/ ((module) => {
310412
310913
 
310413
310914
  "use strict";
310414
- module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"3.5.0-dev.35","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs","build:ci":"npm run -s build && npm run -s build:esm","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2020 --outDir lib/esm","clean":"rimraf lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","docs":"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/primitives,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-eslintrc -c \\"../../tools/eslint-plugin/dist/configs/extension-exports-config.js\\" \\"./src/**/*.ts\\" 1>&2","lint":"eslint -f visualstudio \\"./src/**/*.ts\\" 1>&2","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run -s webpackTests && certa -r chrome","cover":"npm -s test","test:debug":"certa -r chrome --debug","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core/tree/master/core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^3.5.0-dev.35","@itwin/core-bentley":"workspace:^3.5.0-dev.35","@itwin/core-common":"workspace:^3.5.0-dev.35","@itwin/core-geometry":"workspace:^3.5.0-dev.35","@itwin/core-orbitgt":"workspace:^3.5.0-dev.35","@itwin/core-quantity":"workspace:^3.5.0-dev.35","@itwin/webgl-compatibility":"workspace:^3.5.0-dev.35"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/certa":"workspace:*","@itwin/eslint-plugin":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/deep-assign":"^0.1.0","@types/lodash":"^4.14.0","@types/mocha":"^8.2.2","@types/node":"16.11.59","@types/qs":"^6.5.0","@types/semver":"7.3.10","@types/superagent":"^4.1.14","@types/sinon":"^9.0.0","chai":"^4.1.2","chai-as-promised":"^7","cpx2":"^3.0.0","eslint":"^7.11.0","glob":"^7.1.2","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^9.0.2","source-map-loader":"^4.0.0","typescript":"~4.4.0","webpack":"^5.64.4"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/object-storage-azure":"~1.4.0","@itwin/cloud-agnostic-core":"~1.4.0","@itwin/object-storage-core":"~1.4.0","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","deep-assign":"^2.0.0","fuse.js":"^3.3.0","lodash":"^4.17.10","qs":"^6.5.1","semver":"^7.3.5","superagent":"7.1.3","wms-capabilities":"0.4.0","xml-js":"~1.6.11","reflect-metadata":"0.1.13"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"},"eslintConfig":{"plugins":["@itwin"],"extends":"plugin:@itwin/itwinjs-recommended","rules":{"@itwin/no-internal-barrel-imports":["error",{"required-barrel-modules":["./src/tile/internal.ts"]}],"@itwin/public-extension-exports":["error",{"releaseTags":["public","preview"],"outputApiFile":false}]},"overrides":[{"files":["*.test.ts","*.test.tsx","**/test/**/*.ts"],"rules":{"@itwin/no-internal-barrel-imports":"off"}}]}}');
310915
+ module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"3.5.0-dev.41","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs","build:ci":"npm run -s build && npm run -s build:esm","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2020 --outDir lib/esm","clean":"rimraf lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","docs":"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/primitives,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-eslintrc -c \\"../../tools/eslint-plugin/dist/configs/extension-exports-config.js\\" \\"./src/**/*.ts\\" 1>&2","lint":"eslint -f visualstudio \\"./src/**/*.ts\\" 1>&2","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run -s webpackTests && certa -r chrome","cover":"npm -s test","test:debug":"certa -r chrome --debug","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core/tree/master/core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^3.5.0-dev.41","@itwin/core-bentley":"workspace:^3.5.0-dev.41","@itwin/core-common":"workspace:^3.5.0-dev.41","@itwin/core-geometry":"workspace:^3.5.0-dev.41","@itwin/core-orbitgt":"workspace:^3.5.0-dev.41","@itwin/core-quantity":"workspace:^3.5.0-dev.41","@itwin/webgl-compatibility":"workspace:^3.5.0-dev.41"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/certa":"workspace:*","@itwin/eslint-plugin":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/deep-assign":"^0.1.0","@types/lodash":"^4.14.0","@types/mocha":"^8.2.2","@types/node":"16.11.59","@types/qs":"^6.5.0","@types/semver":"7.3.10","@types/superagent":"^4.1.14","@types/sinon":"^9.0.0","babel-loader":"~8.2.5","babel-plugin-istanbul":"~6.1.1","chai":"^4.1.2","chai-as-promised":"^7","cpx2":"^3.0.0","eslint":"^7.11.0","glob":"^7.1.2","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^9.0.2","source-map-loader":"^4.0.0","typescript":"~4.4.0","webpack":"^5.64.4"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/object-storage-azure":"~1.4.0","@itwin/cloud-agnostic-core":"~1.4.0","@itwin/object-storage-core":"~1.4.0","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","deep-assign":"^2.0.0","fuse.js":"^3.3.0","lodash":"^4.17.10","qs":"^6.5.1","semver":"^7.3.5","superagent":"7.1.3","wms-capabilities":"0.4.0","xml-js":"~1.6.11","reflect-metadata":"0.1.13"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"},"eslintConfig":{"plugins":["@itwin"],"extends":"plugin:@itwin/itwinjs-recommended","rules":{"@itwin/no-internal-barrel-imports":["error",{"required-barrel-modules":["./src/tile/internal.ts"]}],"@itwin/public-extension-exports":["error",{"releaseTags":["public","preview"],"outputApiFile":false}]},"overrides":[{"files":["*.test.ts","*.test.tsx","**/test/**/*.ts"],"rules":{"@itwin/no-internal-barrel-imports":"off"}}]}}');
310415
310916
 
310416
310917
  /***/ }),
310417
310918