@itwin/ecschema-rpcinterface-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.
@@ -106973,6 +106973,20 @@ class AccuSnap {
106973
106973
  const currSnap = this.getCurrSnapDetail();
106974
106974
  return !currSnap ? false : currSnap.isHot;
106975
106975
  }
106976
+ /** Optional ids to never flash. Useful for tools like "trim curve" that won't want a flashed segment to obscure a result preview.
106977
+ * @note Cleared when a primitive or view tool is started and saved/restored when a primitive tool is suspended/unsuspended.
106978
+ * @public
106979
+ */
106980
+ neverFlash(ids) {
106981
+ if (undefined === ids) {
106982
+ this.toolState.neverFlash = undefined;
106983
+ return;
106984
+ }
106985
+ const newIds = new Set();
106986
+ for (const id of _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.Id64.iterable(ids))
106987
+ newIds.add(id);
106988
+ this.toolState.neverFlash = (0 !== newIds.size ? newIds : undefined);
106989
+ }
106976
106990
  /** @internal */
106977
106991
  destroy() {
106978
106992
  this.currHit = undefined;
@@ -107202,6 +107216,8 @@ class AccuSnap {
107202
107216
  return false;
107203
107217
  if (hit.isModelHit || hit.isMapHit)
107204
107218
  return false; // Avoid annoying flashing of reality models.
107219
+ if (this.toolState.neverFlash && this.toolState.neverFlash.has(hit.sourceId))
107220
+ return false;
107205
107221
  const snap = AccuSnap.toSnapDetail(hit);
107206
107222
  return !snap || snap.isHot || this._settings.hiliteColdHits;
107207
107223
  }
@@ -107231,7 +107247,10 @@ class AccuSnap {
107231
107247
  }
107232
107248
  return hit;
107233
107249
  }
107234
- initCmdState() { this.toolState.suspended = 0; }
107250
+ initCmdState() {
107251
+ this.toolState.suspended = 0;
107252
+ this.toolState.neverFlash = undefined;
107253
+ }
107235
107254
  /** @internal */
107236
107255
  suspend(doSuspend) {
107237
107256
  const previousDoSnapping = this._doSnapping;
@@ -107635,8 +107654,11 @@ class AccuSnap {
107635
107654
  return;
107636
107655
  }
107637
107656
  const hit = _IModelApp__WEBPACK_IMPORTED_MODULE_4__.IModelApp.tentativePoint.getCurrSnap();
107638
- if (hit && !(hit.isModelHit || hit.isMapHit)) // Don't hilite reality models.
107639
- hit.draw(context);
107657
+ if (!hit || hit.isModelHit || hit.isMapHit)
107658
+ return; // Don't hilite reality models.
107659
+ if (this.toolState.neverFlash && this.toolState.neverFlash.has(hit.sourceId))
107660
+ return;
107661
+ hit.draw(context);
107640
107662
  }
107641
107663
  /** @internal */
107642
107664
  decorate(context) {
@@ -107730,6 +107752,7 @@ class TentativeOrAccuSnap {
107730
107752
  this.enabled = other.enabled;
107731
107753
  this.locate = other.locate;
107732
107754
  this.suspended = other.suspended;
107755
+ this.neverFlash = other.neverFlash;
107733
107756
  }
107734
107757
  clone() {
107735
107758
  const val = new ToolState();
@@ -188996,7 +189019,8 @@ var EditManipulator;
188996
189019
  init() {
188997
189020
  // Set this.receivedDownEvent to still get up events sent to this tool instance when installed from another tool's down event (ex. onModelStartDrag).
188998
189021
  this.receivedDownEvent = true;
188999
- // Override inherited tool state from suspended primitive tool...
189022
+ // Override inherited tool state from suspended primitive tool.
189023
+ _IModelApp__WEBPACK_IMPORTED_MODULE_2__.IModelApp.accuSnap.onStartTool();
189000
189024
  if (this.wantAccuSnap)
189001
189025
  this.initLocateElements(false, true, undefined, _Tool__WEBPACK_IMPORTED_MODULE_3__.CoordinateLockOverrides.None);
189002
189026
  else
@@ -194705,6 +194729,7 @@ class ToolAdmin {
194705
194729
  }
194706
194730
  if (_IModelApp__WEBPACK_IMPORTED_MODULE_5__.IModelApp.accuDraw.onPreButtonEvent(ev))
194707
194731
  return;
194732
+ let updateDynamics = false;
194708
194733
  switch (ev.button) {
194709
194734
  case _Tool__WEBPACK_IMPORTED_MODULE_13__.BeButton.Data: {
194710
194735
  if (undefined === tool) {
@@ -194722,10 +194747,7 @@ class ToolAdmin {
194722
194747
  // Lock tool to target model of this view on first data button
194723
194748
  if (tool instanceof _PrimitiveTool__WEBPACK_IMPORTED_MODULE_12__.PrimitiveTool)
194724
194749
  tool.autoLockTarget();
194725
- // Process the active tool's pending hints from onDataButtonDown before calling updateDynamics...
194726
- _IModelApp__WEBPACK_IMPORTED_MODULE_5__.IModelApp.accuDraw.processHints();
194727
- // Update tool dynamics. Use last data button location which was potentially adjusted by onDataButtonDown and not current event
194728
- this.updateDynamics(undefined, true, true);
194750
+ updateDynamics = true; // AccuDraw.onPostButtonEvent needs to process the active tool's pending hints from onDataButtonDown before calling updateDynamics...
194729
194751
  break;
194730
194752
  }
194731
194753
  case _Tool__WEBPACK_IMPORTED_MODULE_13__.BeButton.Reset: {
@@ -194755,6 +194777,10 @@ class ToolAdmin {
194755
194777
  }
194756
194778
  _IModelApp__WEBPACK_IMPORTED_MODULE_5__.IModelApp.tentativePoint.onButtonEvent(ev);
194757
194779
  _IModelApp__WEBPACK_IMPORTED_MODULE_5__.IModelApp.accuDraw.onPostButtonEvent(ev);
194780
+ if (!updateDynamics)
194781
+ return;
194782
+ // Update tool dynamics. Use last data button location which was potentially adjusted by onDataButtonDown and not current event
194783
+ this.updateDynamics(undefined, true, true);
194758
194784
  }
194759
194785
  async onButtonDown(vp, pt2d, button, inputSource) {
194760
194786
  const filtered = this.filterViewport(vp);
@@ -201072,7 +201098,7 @@ class BSplineCurve3dBase extends _curve_CurvePrimitive__WEBPACK_IMPORTED_MODULE_
201072
201098
  * * If the space point is exactly on the curve, this is the reverse of fractionToPoint.
201073
201099
  * * Since CurvePrimitive should always have start and end available as candidate points, this method should always succeed
201074
201100
  * @param spacePoint point in space
201075
- * @param extend true to extend the curve (if possible)
201101
+ * @param _extend ignored. A BSplineCurve3dBase cannot be extended.
201076
201102
  * @returns Returns a CurveLocationDetail structure that holds the details of the close point.
201077
201103
  */
201078
201104
  closestPoint(spacePoint, _extend) {
@@ -205515,11 +205541,13 @@ class KnotVector {
205515
205541
  /** Convert localFraction within the interval following an indexed knot to a knot value. */
205516
205542
  baseKnotFractionToKnot(knotIndex0, localFraction) {
205517
205543
  const knot0 = this.knots[knotIndex0];
205544
+ localFraction = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.clamp(localFraction, 0, 1);
205518
205545
  return knot0 + localFraction * (this.knots[knotIndex0 + 1] - knot0);
205519
205546
  }
205520
205547
  /** Convert localFraction within an indexed bezier span to a knot value. */
205521
205548
  spanFractionToKnot(spanIndex, localFraction) {
205522
205549
  const k = this.spanIndexToLeftKnotIndex(spanIndex);
205550
+ localFraction = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.clamp(localFraction, 0, 1);
205523
205551
  return this.knots[k] + localFraction * (this.knots[k + 1] - this.knots[k]);
205524
205552
  }
205525
205553
  /** Convert localFraction within an indexed bezier span to fraction of active knot range. */
@@ -205529,6 +205557,7 @@ class KnotVector {
205529
205557
  }
205530
205558
  /** Return fraction of active knot range to knot value. */
205531
205559
  fractionToKnot(fraction) {
205560
+ fraction = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.clamp(fraction, 0, 1); // B-splines are not extendable
205532
205561
  return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.interpolate(this.knots[this.degree - 1], fraction, this.knots[this.knots.length - this.degree]);
205533
205562
  }
205534
205563
  /**
@@ -212772,9 +212801,9 @@ class PathFragment {
212772
212801
  }
212773
212802
  /** Convert chainDistance to true chidFraction, using detailed moveSignedDistanceFromFraction
212774
212803
  */
212775
- chainDistanceToAccurateChildFraction(chainDistance) {
212804
+ chainDistanceToAccurateChildFraction(chainDistance, allowExtrapolation) {
212776
212805
  // The fragments are really expected to do good mappings in their distance range ...
212777
- const childDetail = this.childCurve.moveSignedDistanceFromFraction(this.childFraction0, chainDistance - this.chainDistance0, false);
212806
+ const childDetail = this.childCurve.moveSignedDistanceFromFraction(this.childFraction0, chainDistance - this.chainDistance0, allowExtrapolation !== null && allowExtrapolation !== void 0 ? allowExtrapolation : false);
212778
212807
  return childDetail.fraction;
212779
212808
  }
212780
212809
  /** Return the scale factor to map childCurve fraction derivatives to chain fraction derivatives
@@ -212797,12 +212826,16 @@ class PathFragment {
212797
212826
  this.chainDistance0 = totalDistance - d1;
212798
212827
  this.chainDistance1 = totalDistance - d0;
212799
212828
  }
212829
+ /** @deprecated Use childFractionToChainDistance */
212830
+ childFractionTChainDistance(fraction) {
212831
+ return this.childFractionToChainDistance(fraction);
212832
+ }
212800
212833
  /**
212801
212834
  * convert a fractional position on the childCurve to distance in the chain space.
212802
212835
  * * Return value is SIGNED -- will be negative when fraction < this.childFraction0.
212803
212836
  * @param fraction fraction along the curve within this fragment
212804
212837
  */
212805
- childFractionTChainDistance(fraction) {
212838
+ childFractionToChainDistance(fraction) {
212806
212839
  let d = this.childCurve.curveLengthBetweenFractions(this.childFraction0, fraction);
212807
212840
  if (fraction < this.childFraction0)
212808
212841
  d = -d;
@@ -212835,7 +212868,7 @@ class DistanceIndexConstructionContext {
212835
212868
  let f1;
212836
212869
  for (let i = 1, f0 = fraction0; i <= numStrokes; i++, f0 = f1) {
212837
212870
  f1 = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.interpolate(fraction0, i / numStrokes, fraction1);
212838
- point0.interpolate(fraction1, point1, fragmentPoint1);
212871
+ point0.interpolate(f1, point1, fragmentPoint1);
212839
212872
  d0 = this._accumulatedDistance;
212840
212873
  this._accumulatedDistance += (Math.abs(f1 - f0) * point0.distance(point1));
212841
212874
  this._fragments.push(new PathFragment(f0, f1, d0, this._accumulatedDistance, cp, _geometry3d_Range__WEBPACK_IMPORTED_MODULE_1__.Range3d.create(fragmentPoint0, fragmentPoint1)));
@@ -212903,37 +212936,41 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
212903
212936
  return CurveChainWithDistanceIndex.createCapture(c);
212904
212937
  }
212905
212938
  /** Return a deep clone */
212906
- clonePartialCurve(_fractionA, _fractionB) {
212907
- if (_fractionA === _fractionB)
212939
+ clonePartialCurve(fractionA, fractionB) {
212940
+ if (fractionA === fractionB)
212908
212941
  return undefined;
212909
- let fractionA = _fractionA;
212910
- let fractionB = _fractionB;
212911
- const reversed = _fractionA > _fractionB;
212942
+ let fracA = fractionA;
212943
+ let fracB = fractionB;
212944
+ const reversed = fractionA > fractionB;
212912
212945
  if (reversed) {
212913
- fractionA = _fractionB;
212914
- fractionB = _fractionA;
212946
+ fracA = fractionB;
212947
+ fracB = fractionA;
212915
212948
  }
212916
- const chainDistanceA = fractionA * this._totalLength;
212917
- const chainDistanceB = fractionB * this._totalLength;
212918
- const newPath = _Path__WEBPACK_IMPORTED_MODULE_4__.Path.create();
212949
+ const chainDistanceA = fracA * this._totalLength;
212950
+ const chainDistanceB = fracB * this._totalLength;
212919
212951
  const fragmentA = this.chainDistanceToFragment(chainDistanceA, true);
212952
+ if (undefined === fragmentA)
212953
+ return undefined;
212920
212954
  const fragmentB = this.chainDistanceToFragment(chainDistanceB, true);
212921
- if (!fragmentA || !fragmentB)
212955
+ if (undefined === fragmentB)
212922
212956
  return undefined;
212923
- const childCurveIndexA = this._path.childIndex(fragmentA.childCurve);
212924
- const childCurveIndexB = this._path.childIndex(fragmentB.childCurve);
212925
- const childFractionA = fragmentA.chainDistanceToAccurateChildFraction(chainDistanceA);
212926
- const childFractionB = fragmentB.chainDistanceToAccurateChildFraction(chainDistanceB);
212927
- if (childCurveIndexA === undefined || childCurveIndexB === undefined)
212957
+ const childCurveIndexA = this._path.childIndex(fragmentA.childCurve, true);
212958
+ if (undefined === childCurveIndexA)
212928
212959
  return undefined;
212960
+ const childCurveIndexB = this._path.childIndex(fragmentB.childCurve, true);
212961
+ if (undefined === childCurveIndexB)
212962
+ return undefined;
212963
+ const childFractionA = fragmentA.chainDistanceToAccurateChildFraction(chainDistanceA, true);
212964
+ const childFractionB = fragmentB.chainDistanceToAccurateChildFraction(chainDistanceB, true);
212929
212965
  // add a (possibly reversed) partial clone to newPath
212966
+ const newPath = _Path__WEBPACK_IMPORTED_MODULE_4__.Path.create();
212930
212967
  const addPartialChild = (childCurve, childFraction0, childFraction1, reversedClone) => {
212931
- if (fractionA === fractionB)
212968
+ if (childFraction0 === childFraction1)
212932
212969
  return false;
212933
212970
  let newCurve;
212934
- if (fractionA === 0.0 && fractionB === 1.0) {
212971
+ if (childFraction0 === 0.0 && childFraction1 === 1.0) {
212935
212972
  newCurve = childCurve.clone();
212936
- if (reversed)
212973
+ if (reversedClone)
212937
212974
  newCurve.reverseInPlace();
212938
212975
  }
212939
212976
  else {
@@ -213064,7 +213101,7 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
213064
213101
  }
213065
213102
  /**
213066
213103
  * Capture (not clone) a path into a new `CurveChainWithDistanceIndex`
213067
- * @param primitives primitive array to be CAPTURED (not cloned)
213104
+ * @param path primitive array to be CAPTURED (not cloned)
213068
213105
  */
213069
213106
  static createCapture(path, options) {
213070
213107
  const fragments = DistanceIndexConstructionContext.createPathFragmentIndex(path, options);
@@ -213161,7 +213198,7 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
213161
213198
  const chainDistance = fraction * this._totalLength;
213162
213199
  const fragment = this.chainDistanceToFragment(chainDistance, true);
213163
213200
  if (fragment) {
213164
- const childFraction = fragment.chainDistanceToAccurateChildFraction(chainDistance);
213201
+ const childFraction = fragment.chainDistanceToAccurateChildFraction(chainDistance, true);
213165
213202
  return fragment.childCurve.fractionToPoint(childFraction, result);
213166
213203
  }
213167
213204
  // no fragment found. Use _fragments[0]
@@ -213179,7 +213216,7 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
213179
213216
  fractionToPointAndDerivative(fraction, result) {
213180
213217
  const distanceAlongPath = fraction * this._totalLength;
213181
213218
  const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
213182
- const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath);
213219
+ const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
213183
213220
  result = fragment.childCurve.fractionToPointAndDerivative(curveFraction, result);
213184
213221
  const a = this._totalLength / result.direction.magnitude();
213185
213222
  result.direction.scaleInPlace(a);
@@ -213194,7 +213231,7 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
213194
213231
  fractionToPointAndUnitTangent(fraction, result) {
213195
213232
  const distanceAlongPath = fraction * this._totalLength;
213196
213233
  const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
213197
- const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath);
213234
+ const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
213198
213235
  result = fragment.childCurve.fractionToPointAndDerivative(curveFraction, result);
213199
213236
  result.direction.normalizeInPlace();
213200
213237
  return result;
@@ -213209,7 +213246,7 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
213209
213246
  const totalLength = this._totalLength;
213210
213247
  const distanceAlongPath = fraction * totalLength;
213211
213248
  const fragment = this.chainDistanceToFragment(distanceAlongPath, true);
213212
- const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath);
213249
+ const curveFraction = fragment.chainDistanceToAccurateChildFraction(distanceAlongPath, true);
213213
213250
  result = fragment.childCurve.fractionToPointAnd2Derivatives(curveFraction, result);
213214
213251
  if (!result)
213215
213252
  return undefined;
@@ -213338,7 +213375,7 @@ class CurveChainWithDistanceIndex extends _curve_CurvePrimitive__WEBPACK_IMPORTE
213338
213375
  return undefined;
213339
213376
  const fragment = this.curveAndChildFractionToFragment(childDetail.curve, childDetail.fraction);
213340
213377
  if (fragment) {
213341
- const chainDistance = fragment.childFractionTChainDistance(childDetail.fraction);
213378
+ const chainDistance = fragment.childFractionToChainDistance(childDetail.fraction);
213342
213379
  const chainFraction = this.chainDistanceToChainFraction(chainDistance);
213343
213380
  const chainDetail = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_7__.CurveLocationDetail.createCurveFractionPoint(this, chainFraction, childDetail.point);
213344
213381
  chainDetail.childDetail = childDetail;
@@ -213400,6 +213437,7 @@ __webpack_require__.r(__webpack_exports__);
213400
213437
  /* harmony import */ var _internalContexts_SumLengthsContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./internalContexts/SumLengthsContext */ "../../core/geometry/lib/esm/curve/internalContexts/SumLengthsContext.js");
213401
213438
  /* harmony import */ var _internalContexts_TransformInPlaceContext__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./internalContexts/TransformInPlaceContext */ "../../core/geometry/lib/esm/curve/internalContexts/TransformInPlaceContext.js");
213402
213439
  /* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
213440
+ /* harmony import */ var _ProxyCurve__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./ProxyCurve */ "../../core/geometry/lib/esm/curve/ProxyCurve.js");
213403
213441
  /*---------------------------------------------------------------------------------------------
213404
213442
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
213405
213443
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -213418,6 +213456,7 @@ __webpack_require__.r(__webpack_exports__);
213418
213456
 
213419
213457
 
213420
213458
 
213459
+
213421
213460
  /**
213422
213461
  * A `CurveCollection` is an abstract (non-instantiable) class for various sets of curves with particular structures:
213423
213462
  * - `CurveChain` is a (non-instantiable) intermediate class for a sequence of `CurvePrimitive ` joining head-to-tail. The two instantiable forms of `CurveChain` are
@@ -213642,12 +213681,23 @@ class CurveChain extends CurveCollection {
213642
213681
  curve.reverseInPlace();
213643
213682
  this._curves.reverse();
213644
213683
  }
213645
- /** Return the index where target is found in the array of children */
213646
- childIndex(target) {
213684
+ /** Return the index where target is found in the array of children
213685
+ * @param alsoSearchProxies whether to also check proxy curves of the children
213686
+ */
213687
+ childIndex(target, alsoSearchProxies) {
213647
213688
  for (let i = 0; i < this._curves.length; i++) {
213648
213689
  if (this._curves[i] === target)
213649
213690
  return i;
213650
213691
  }
213692
+ if (alsoSearchProxies !== null && alsoSearchProxies !== void 0 ? alsoSearchProxies : false) {
213693
+ for (let i = 0; i < this._curves.length; i++) {
213694
+ const childCurve = this._curves[i];
213695
+ if (childCurve instanceof _ProxyCurve__WEBPACK_IMPORTED_MODULE_11__.ProxyCurve) {
213696
+ if (childCurve.proxyCurve === target)
213697
+ return i;
213698
+ }
213699
+ }
213700
+ }
213651
213701
  return undefined;
213652
213702
  }
213653
213703
  /** Evaluate an indexed curve at a fraction. Return as a CurveLocationDetail that indicates the primitive.
@@ -217258,19 +217308,26 @@ __webpack_require__.r(__webpack_exports__);
217258
217308
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
217259
217309
  /* harmony export */ "CurvePrimitive": () => (/* binding */ CurvePrimitive)
217260
217310
  /* harmony export */ });
217261
- /* harmony import */ var _curve_Query_StrokeCountMap__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../curve/Query/StrokeCountMap */ "../../core/geometry/lib/esm/curve/Query/StrokeCountMap.js");
217262
- /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
217263
- /* harmony import */ var _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../geometry3d/Matrix3d */ "../../core/geometry/lib/esm/geometry3d/Matrix3d.js");
217264
- /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
217265
- /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
217266
- /* harmony import */ var _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geometry3d/Transform */ "../../core/geometry/lib/esm/geometry3d/Transform.js");
217267
- /* harmony import */ var _numerics_BezierPolynomials__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../numerics/BezierPolynomials */ "../../core/geometry/lib/esm/numerics/BezierPolynomials.js");
217268
- /* harmony import */ var _numerics_Newton__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../numerics/Newton */ "../../core/geometry/lib/esm/numerics/Newton.js");
217269
- /* harmony import */ var _numerics_Quadrature__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../numerics/Quadrature */ "../../core/geometry/lib/esm/numerics/Quadrature.js");
217270
- /* harmony import */ var _CurveExtendMode__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./CurveExtendMode */ "../../core/geometry/lib/esm/curve/CurveExtendMode.js");
217271
- /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
217272
- /* harmony import */ var _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./GeometryQuery */ "../../core/geometry/lib/esm/curve/GeometryQuery.js");
217273
- /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
217311
+ /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
217312
+ /* harmony import */ var _curve_Query_StrokeCountMap__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../curve/Query/StrokeCountMap */ "../../core/geometry/lib/esm/curve/Query/StrokeCountMap.js");
217313
+ /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
217314
+ /* harmony import */ var _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geometry3d/Matrix3d */ "../../core/geometry/lib/esm/geometry3d/Matrix3d.js");
217315
+ /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
217316
+ /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
217317
+ /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
217318
+ /* harmony import */ var _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geometry3d/Transform */ "../../core/geometry/lib/esm/geometry3d/Transform.js");
217319
+ /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
217320
+ /* harmony import */ var _GeometryQuery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GeometryQuery */ "../../core/geometry/lib/esm/curve/GeometryQuery.js");
217321
+ /* harmony import */ var _internalContexts_AppendPlaneIntersectionStrokeHandler__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./internalContexts/AppendPlaneIntersectionStrokeHandler */ "../../core/geometry/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js");
217322
+ /* harmony import */ var _internalContexts_ClosestPointStrokeHandler__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./internalContexts/ClosestPointStrokeHandler */ "../../core/geometry/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js");
217323
+ /* harmony import */ var _internalContexts_CurveLengthContext__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./internalContexts/CurveLengthContext */ "../../core/geometry/lib/esm/curve/internalContexts/CurveLengthContext.js");
217324
+ /*---------------------------------------------------------------------------------------------
217325
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
217326
+ * See LICENSE.md in the project root for license terms and full copyright notice.
217327
+ *--------------------------------------------------------------------------------------------*/
217328
+ /** @packageDocumentation
217329
+ * @module Curve
217330
+ */
217274
217331
 
217275
217332
 
217276
217333
 
@@ -217298,7 +217355,7 @@ __webpack_require__.r(__webpack_exports__);
217298
217355
  * For fractions outside 0..1, the curve primitive class may either (a) return the near endpoint or (b) evaluate an extended curve.
217299
217356
  * @public
217300
217357
  */
217301
- class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.GeometryQuery {
217358
+ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_1__.GeometryQuery {
217302
217359
  constructor() {
217303
217360
  super();
217304
217361
  /** String name for schema properties */
@@ -217324,7 +217381,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217324
217381
  const cross = data.vectorU.crossProduct(data.vectorV);
217325
217382
  const a = cross.magnitude();
217326
217383
  const b = data.vectorU.magnitude();
217327
- return _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.conditionalDivideFraction(a, b * b * b);
217384
+ return _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.conditionalDivideFraction(a, b * b * b);
217328
217385
  }
217329
217386
  /** Construct a frenet frame:
217330
217387
  * * origin at the point on the curve
@@ -217336,14 +217393,14 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217336
217393
  const plane = this.fractionToPointAnd2Derivatives(fraction);
217337
217394
  if (!plane)
217338
217395
  return undefined;
217339
- let axes = _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createRigidFromColumns(plane.vectorU, plane.vectorV, _Geometry__WEBPACK_IMPORTED_MODULE_1__.AxisOrder.XYZ);
217396
+ let axes = _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_3__.Matrix3d.createRigidFromColumns(plane.vectorU, plane.vectorV, _Geometry__WEBPACK_IMPORTED_MODULE_2__.AxisOrder.XYZ);
217340
217397
  if (axes)
217341
- return _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_3__.Transform.createRefs(plane.origin, axes, result);
217398
+ return _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_4__.Transform.createRefs(plane.origin, axes, result);
217342
217399
  // 2nd derivative not distinct -- do arbitrary headsUP ...
217343
- const perpVector = _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createPerpendicularVectorFavorXYPlane(plane.vectorU, plane.vectorV);
217344
- axes = _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_2__.Matrix3d.createRigidFromColumns(plane.vectorU, perpVector, _Geometry__WEBPACK_IMPORTED_MODULE_1__.AxisOrder.XYZ);
217400
+ const perpVector = _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_3__.Matrix3d.createPerpendicularVectorFavorXYPlane(plane.vectorU, plane.vectorV);
217401
+ axes = _geometry3d_Matrix3d__WEBPACK_IMPORTED_MODULE_3__.Matrix3d.createRigidFromColumns(plane.vectorU, perpVector, _Geometry__WEBPACK_IMPORTED_MODULE_2__.AxisOrder.XYZ);
217345
217402
  if (axes)
217346
- return _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_3__.Transform.createRefs(plane.origin, axes, result);
217403
+ return _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_4__.Transform.createRefs(plane.origin, axes, result);
217347
217404
  return undefined;
217348
217405
  }
217349
217406
  /** Construct signed distance from a point on the curve to its center of curvature (in xy only).
@@ -217359,7 +217416,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217359
217416
  const b = plane.vectorU.magnitude();
217360
217417
  if (b === 0.0)
217361
217418
  return 0.0;
217362
- const r = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.conditionalDivideCoordinate(b * b * b, cross);
217419
+ const r = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.conditionalDivideCoordinate(b * b * b, cross);
217363
217420
  if (r !== undefined)
217364
217421
  return r;
217365
217422
  return 0.0;
@@ -217378,7 +217435,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217378
217435
  * * Curve length is always positive.
217379
217436
  */
217380
217437
  curveLength() {
217381
- const context = new CurveLengthContext();
217438
+ const context = new _internalContexts_CurveLengthContext__WEBPACK_IMPORTED_MODULE_5__.CurveLengthContext();
217382
217439
  this.emitStrokableParts(context);
217383
217440
  return context.getSum();
217384
217441
  }
@@ -217398,7 +217455,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217398
217455
  const totalLength = this.curveLength();
217399
217456
  return Math.abs((fraction1 - fraction0) * totalLength);
217400
217457
  }
217401
- const context = new CurveLengthContext(fraction0, fraction1);
217458
+ const context = new _internalContexts_CurveLengthContext__WEBPACK_IMPORTED_MODULE_5__.CurveLengthContext(fraction0, fraction1);
217402
217459
  this.emitStrokableParts(context);
217403
217460
  return Math.abs(context.getSum());
217404
217461
  }
@@ -217415,11 +217472,11 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217415
217472
  */
217416
217473
  rangeBetweenFractionsByClone(fraction0, fraction1, transform) {
217417
217474
  if (fraction0 === fraction1)
217418
- return _geometry3d_Range__WEBPACK_IMPORTED_MODULE_4__.Range3d.create(this.fractionToPoint(fraction0));
217475
+ return _geometry3d_Range__WEBPACK_IMPORTED_MODULE_6__.Range3d.create(this.fractionToPoint(fraction0));
217419
217476
  const fragment = this.clonePartialCurve(fraction0, fraction1);
217420
217477
  if (fragment)
217421
217478
  return fragment.range(transform);
217422
- return _geometry3d_Range__WEBPACK_IMPORTED_MODULE_4__.Range3d.createNull();
217479
+ return _geometry3d_Range__WEBPACK_IMPORTED_MODULE_6__.Range3d.createNull();
217423
217480
  }
217424
217481
  /**
217425
217482
  * Returns an approximate range based on a fixed number of evaluations
@@ -217433,8 +217490,8 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217433
217490
  * @param extrapolationFactor if positive, evaluate again at interval midpoints and apply this fraction multiplier to any increase in size.
217434
217491
  */
217435
217492
  rangeBetweenFractionsByCount(fraction0, fraction1, count, transform, extrapolationFactor = 0.0) {
217436
- const range = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_4__.Range3d.createNull();
217437
- const workPoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d.create();
217493
+ const range = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_6__.Range3d.createNull();
217494
+ const workPoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__.Point3d.create();
217438
217495
  range.extendPoint(this.startPoint(workPoint));
217439
217496
  range.extendPoint(this.endPoint(workPoint));
217440
217497
  // Evaluate at count fractions (fraction0 + i * fractionStep)
@@ -217484,7 +217541,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217484
217541
  fraction0 = fraction1;
217485
217542
  fraction1 = fSave;
217486
217543
  }
217487
- const context = new CurveLengthContext(fraction0, fraction1, numGauss);
217544
+ const context = new _internalContexts_CurveLengthContext__WEBPACK_IMPORTED_MODULE_5__.CurveLengthContext(fraction0, fraction1, numGauss);
217488
217545
  context.announceIntervalForUniformStepStrokes(this, numInterval, fraction0, fraction1);
217489
217546
  return Math.abs(context.getSum());
217490
217547
  }
@@ -217493,9 +217550,8 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217493
217550
  * * (Attempt to) find a position on the curve at a signed distance from start fraction.
217494
217551
  * * Return the position as a CurveLocationDetail.
217495
217552
  * * In the `CurveLocationDetail`, record:
217496
- * * `fractional` position
217497
- * * `fraction` = coordinates of the point
217498
- * * `search
217553
+ * * `fraction` = fractional position
217554
+ * * `point` = coordinates of the point
217499
217555
  * * `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.
217500
217556
  * * `curveSearchStatus` indicates one of:
217501
217557
  * * `error` (unusual) computation failed not supported for this curve.
@@ -217524,11 +217580,11 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217524
217580
  // We are in luck! simple proportions determine it all !!!
217525
217581
  // (for example, a LineSegment3d or a circular arc)
217526
217582
  const totalLength = this.curveLength();
217527
- const signedFractionMove = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.conditionalDivideFraction(signedDistance, totalLength);
217583
+ const signedFractionMove = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.conditionalDivideFraction(signedDistance, totalLength);
217528
217584
  if (signedFractionMove === undefined) {
217529
- return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createCurveFractionPointDistanceCurveSearchStatus(this, startFraction, this.fractionToPoint(startFraction), 0.0, _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveSearchStatus.error);
217585
+ return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createCurveFractionPointDistanceCurveSearchStatus(this, startFraction, this.fractionToPoint(startFraction), 0.0, _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveSearchStatus.error);
217530
217586
  }
217531
- return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, startFraction + signedFractionMove, signedDistance, result);
217587
+ return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, startFraction + signedFractionMove, signedDistance, result);
217532
217588
  }
217533
217589
  return this.moveSignedDistanceFromFractionGeneric(startFraction, signedDistance, allowExtension, result);
217534
217590
  }
@@ -217550,19 +217606,45 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217550
217606
  * @param result
217551
217607
  */
217552
217608
  moveSignedDistanceFromFractionGeneric(startFraction, signedDistance, allowExtension, result) {
217553
- const limitFraction = signedDistance > 0.0 ? 1.0 : 0.0;
217609
+ let limitFraction;
217610
+ const slackFraction = 0.1; // slack to use when integration would otherwise have no room to work
217611
+ if (signedDistance === 0.0)
217612
+ return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result); // no movement, just evaluate at startFraction
217613
+ if (signedDistance > 0.0) {
217614
+ limitFraction = 1.0;
217615
+ if (startFraction >= 1.0) {
217616
+ const newStartFraction = 1.0 - slackFraction;
217617
+ signedDistance += this.curveLengthBetweenFractions(newStartFraction, startFraction);
217618
+ startFraction = newStartFraction;
217619
+ }
217620
+ }
217621
+ else { // signedDistance < 0.0
217622
+ limitFraction = 0.0;
217623
+ if (startFraction <= 0.0) {
217624
+ const newStartFraction = 0.0 + slackFraction;
217625
+ signedDistance -= this.curveLengthBetweenFractions(startFraction, newStartFraction);
217626
+ startFraction = newStartFraction;
217627
+ }
217628
+ }
217629
+ const availableLength = this.curveLengthBetweenFractions(startFraction, limitFraction);
217630
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(availableLength > 0.0);
217554
217631
  const absDistance = Math.abs(signedDistance);
217555
- const directionFactor = signedDistance < 0.0 ? -1.0 : 1.0;
217556
- const availableLength = this.curveLengthBetweenFractions(startFraction, limitFraction); // that is always positive
217557
217632
  if (availableLength < absDistance && !allowExtension)
217558
- return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, limitFraction, signedDistance, result);
217559
- const fractionStep = absDistance / availableLength;
217560
- let fractionB = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(startFraction, fractionStep, limitFraction);
217633
+ return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, limitFraction, signedDistance, result);
217634
+ const fractionStep = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.conditionalDivideCoordinate(absDistance, availableLength);
217635
+ if (undefined === fractionStep) {
217636
+ // no available length!
217637
+ result = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);
217638
+ result.curveSearchStatus = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveSearchStatus.error;
217639
+ return result;
217640
+ }
217641
+ const directionFactor = signedDistance < 0.0 ? -1.0 : 1.0;
217642
+ let fractionB = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.interpolate(startFraction, fractionStep, limitFraction);
217561
217643
  let fractionA = startFraction;
217562
217644
  let distanceA = 0.0;
217563
217645
  const tol = 1.0e-12 * availableLength;
217564
217646
  let numConverged = 0;
217565
- const tangent = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_7__.Ray3d.createXAxis();
217647
+ const tangent = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_9__.Ray3d.createXAxis();
217566
217648
  // on each loop entry:
217567
217649
  // fractionA is the most recent endOfInterval. (It may have been reached by a mixture of forward and backward step.)
217568
217650
  // distanceA is the distance to (the point at) fractionA
@@ -217591,10 +217673,9 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217591
217673
  distanceA = distance0B;
217592
217674
  }
217593
217675
  if (numConverged > 1)
217594
- return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createConditionalMoveSignedDistance(false, this, startFraction, fractionB, signedDistance, result);
217595
- result = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);
217596
- result.a = 0.0;
217597
- result.curveSearchStatus = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveSearchStatus.error;
217676
+ return _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, fractionB, signedDistance, result);
217677
+ result = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);
217678
+ result.curveSearchStatus = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveSearchStatus.error;
217598
217679
  return result;
217599
217680
  }
217600
217681
  /**
@@ -217615,7 +217696,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217615
217696
  * @returns Returns a CurveLocationDetail structure that holds the details of the close point.
217616
217697
  */
217617
217698
  closestPoint(spacePoint, extend) {
217618
- const strokeHandler = new ClosestPointStrokeHandler(spacePoint, extend);
217699
+ const strokeHandler = new _internalContexts_ClosestPointStrokeHandler__WEBPACK_IMPORTED_MODULE_10__.ClosestPointStrokeHandler(spacePoint, extend);
217619
217700
  this.emitStrokableParts(strokeHandler);
217620
217701
  return strokeHandler.claimResult();
217621
217702
  }
@@ -217637,7 +217718,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217637
217718
  return undefined;
217638
217719
  }
217639
217720
  /**
217640
- * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return true
217721
+ * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return the scale factor.
217641
217722
  * * If distance-along-the-curve is not proportional, return undefined.
217642
217723
  * * When defined, the scale factor is always the length of the curve.
217643
217724
  * * This scale factor is typically available for these curve types:
@@ -217662,7 +217743,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217662
217743
  * @returns Return the number of CurveLocationDetail's added to the result array.
217663
217744
  */
217664
217745
  appendPlaneIntersectionPoints(plane, result) {
217665
- const strokeHandler = new AppendPlaneIntersectionStrokeHandler(plane, result);
217746
+ const strokeHandler = new _internalContexts_AppendPlaneIntersectionStrokeHandler__WEBPACK_IMPORTED_MODULE_11__.AppendPlaneIntersectionStrokeHandler(plane, result);
217666
217747
  const n0 = result.length;
217667
217748
  this.emitStrokableParts(strokeHandler);
217668
217749
  return result.length - n0;
@@ -217677,17 +217758,17 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217677
217758
  * @param startEndXYZTolerance if nonzero, adjust to endpoint with this tolerance.
217678
217759
  * @internal
217679
217760
  */
217680
- static snapAndRestrictDetails(details, allowExtend = true, applySnappedCoordinates = false, startEndFractionTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.smallAngleRadians, startEndXYZTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.smallMetricDistance) {
217761
+ static snapAndRestrictDetails(details, allowExtend = true, applySnappedCoordinates = false, startEndFractionTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallAngleRadians, startEndXYZTolerance = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallMetricDistance) {
217681
217762
  const n0 = details.length;
217682
217763
  let acceptIndex = 0;
217683
- const point0 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d.create();
217684
- const point1 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d.create();
217764
+ const point0 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__.Point3d.create();
217765
+ const point1 = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_7__.Point3d.create();
217685
217766
  let snappedCoordinates;
217686
217767
  for (let candidateIndex = 0; candidateIndex < n0; candidateIndex++) {
217687
217768
  snappedCoordinates = undefined;
217688
217769
  const detail = details[candidateIndex];
217689
217770
  let fraction = detail.fraction;
217690
- let accept = allowExtend || _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isIn01(fraction);
217771
+ let accept = allowExtend || _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isIn01(fraction);
217691
217772
  if (detail.curve) {
217692
217773
  detail.curve.startPoint(point0);
217693
217774
  detail.curve.endPoint(point1);
@@ -217696,13 +217777,13 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217696
217777
  if (Math.abs(fraction) < startEndFractionTolerance) {
217697
217778
  fraction = 0.0;
217698
217779
  accept = true;
217699
- detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveIntervalRole.isolatedAtVertex;
217780
+ detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveIntervalRole.isolatedAtVertex;
217700
217781
  snappedCoordinates = point0;
217701
217782
  }
217702
217783
  if (Math.abs(fraction - 1.0) < startEndFractionTolerance) {
217703
217784
  fraction = 1.0;
217704
217785
  accept = true;
217705
- detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveIntervalRole.isolatedAtVertex;
217786
+ detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveIntervalRole.isolatedAtVertex;
217706
217787
  snappedCoordinates = point1;
217707
217788
  if (detail.curve)
217708
217789
  snappedCoordinates = detail.curve.startPoint(point1);
@@ -217712,12 +217793,12 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217712
217793
  // 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.
217713
217794
  if (detail.point.distance(point0) <= startEndXYZTolerance) {
217714
217795
  fraction = 0.0;
217715
- detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveIntervalRole.isolatedAtVertex;
217796
+ detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveIntervalRole.isolatedAtVertex;
217716
217797
  snappedCoordinates = point0;
217717
217798
  }
217718
217799
  else if (detail.point.distance(point1) <= startEndXYZTolerance) {
217719
217800
  fraction = 1.0;
217720
- detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveIntervalRole.isolatedAtVertex;
217801
+ detail.intervalRole = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_8__.CurveIntervalRole.isolatedAtVertex;
217721
217802
  snappedCoordinates = point1;
217722
217803
  }
217723
217804
  }
@@ -217754,7 +217835,7 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217754
217835
  computeAndAttachRecursiveStrokeCounts(options, parentMap) {
217755
217836
  const n = this.computeStrokeCountForOptions(options);
217756
217837
  const a = this.curveLength();
217757
- CurvePrimitive.installStrokeCountMap(this, _curve_Query_StrokeCountMap__WEBPACK_IMPORTED_MODULE_8__.StrokeCountMap.createWithCurvePrimitive(this, n, a, 0, a), parentMap);
217838
+ CurvePrimitive.installStrokeCountMap(this, _curve_Query_StrokeCountMap__WEBPACK_IMPORTED_MODULE_12__.StrokeCountMap.createWithCurvePrimitive(this, n, a, 0, a), parentMap);
217758
217839
  }
217759
217840
  /**
217760
217841
  * * evaluate strokes at fractions indicated in a StrokeCountMap.
@@ -217810,326 +217891,6 @@ class CurvePrimitive extends _GeometryQuery__WEBPACK_IMPORTED_MODULE_0__.Geometr
217810
217891
  return results;
217811
217892
  }
217812
217893
  }
217813
- /** Intermediate class for managing the parentCurve announcements from an IStrokeHandler */
217814
- class NewtonRotRStrokeHandler extends _numerics_Newton__WEBPACK_IMPORTED_MODULE_9__.NewtonEvaluatorRtoR {
217815
- constructor() {
217816
- super();
217817
- this._parentCurvePrimitive = undefined;
217818
- }
217819
- /** retain the parentCurvePrimitive.
217820
- * * Calling this method tells the handler that the parent curve is to be used for detail searches.
217821
- * * Example: Transition spiral search is based on linestring first, then the exact spiral.
217822
- * * Example: CurveChainWithDistanceIndex does NOT do this announcement -- the constituents act independently.
217823
- */
217824
- startParentCurvePrimitive(curve) { this._parentCurvePrimitive = curve; }
217825
- /** Forget the parentCurvePrimitive */
217826
- endParentCurvePrimitive(_curve) { this._parentCurvePrimitive = undefined; }
217827
- }
217828
- class AppendPlaneIntersectionStrokeHandler extends NewtonRotRStrokeHandler {
217829
- constructor(plane, intersections) {
217830
- super();
217831
- this._fractionA = 0;
217832
- this._functionA = 0;
217833
- // private derivativeA: number; <---- Not currently used
217834
- this._functionB = 0;
217835
- this._fractionB = 0;
217836
- this._derivativeB = 0;
217837
- this._numThisCurve = 0;
217838
- this._plane = plane;
217839
- this._intersections = intersections;
217840
- this.startCurvePrimitive(undefined);
217841
- this._ray = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_7__.Ray3d.createZero();
217842
- this._newtonSolver = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_9__.Newton1dUnboundedApproximateDerivative(this);
217843
- }
217844
- // Return the first defined curve among: this.parentCurvePrimitive, this.curve;
217845
- effectiveCurve() {
217846
- if (this._parentCurvePrimitive)
217847
- return this._parentCurvePrimitive;
217848
- return this._curve;
217849
- }
217850
- get getDerivativeB() { return this._derivativeB; } // <--- DerivativeB is not currently used anywhere. Provided getter to suppress lint error
217851
- startCurvePrimitive(curve) {
217852
- this._curve = curve;
217853
- this._fractionA = 0.0;
217854
- this._numThisCurve = 0;
217855
- this._functionA = 0.0;
217856
- // this.derivativeA = 0.0;
217857
- }
217858
- endCurvePrimitive() { }
217859
- announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
217860
- this.startCurvePrimitive(cp);
217861
- if (numStrokes < 1)
217862
- numStrokes = 1;
217863
- const df = 1.0 / numStrokes;
217864
- for (let i = 0; i <= numStrokes; i++) {
217865
- const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(fraction0, i * df, fraction1);
217866
- cp.fractionToPointAndDerivative(fraction, this._ray);
217867
- this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);
217868
- }
217869
- }
217870
- announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
217871
- const h0 = this._plane.altitude(point0);
217872
- const h1 = this._plane.altitude(point1);
217873
- if (h0 * h1 > 0.0)
217874
- return;
217875
- const fraction01 = _numerics_BezierPolynomials__WEBPACK_IMPORTED_MODULE_10__.Order2Bezier.solveCoffs(h0, h1);
217876
- // let numIntersection = 0;
217877
- if (fraction01 !== undefined) {
217878
- // numIntersection++;
217879
- const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(fraction0, fraction01, fraction1);
217880
- this._newtonSolver.setX(fraction);
217881
- if (this._newtonSolver.runIterations()) {
217882
- this.announceSolutionFraction(this._newtonSolver.getX());
217883
- }
217884
- // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));
217885
- }
217886
- }
217887
- announceSolutionFraction(fraction) {
217888
- const curve = this.effectiveCurve();
217889
- if (curve) {
217890
- this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);
217891
- this._intersections.push(_CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));
217892
- }
217893
- }
217894
- evaluate(fraction) {
217895
- const curve = this.effectiveCurve();
217896
- if (!curve)
217897
- return false;
217898
- this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));
217899
- return true;
217900
- }
217901
- /**
217902
- * * ASSUME both the "A" and "B" evaluations (fraction, function, and derivative) are known.
217903
- * * If function value changed sign between, interpolate an approximate root and improve it with
217904
- * the newton solver.
217905
- */
217906
- searchInterval() {
217907
- if (this._functionA * this._functionB > 0)
217908
- return;
217909
- if (this._functionA === 0)
217910
- this.announceSolutionFraction(this._fractionA);
217911
- if (this._functionB === 0)
217912
- this.announceSolutionFraction(this._fractionB);
217913
- if (this._functionA * this._functionB < 0) {
217914
- const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
217915
- if (fraction) {
217916
- this._newtonSolver.setX(fraction);
217917
- if (this._newtonSolver.runIterations())
217918
- this.announceSolutionFraction(this._newtonSolver.getX());
217919
- }
217920
- }
217921
- }
217922
- /** Evaluate and save _functionB, _derivativeB, and _fractionB. */
217923
- evaluateB(xyz, fraction, tangent) {
217924
- this._functionB = this._plane.altitude(xyz);
217925
- this._derivativeB = this._plane.velocity(tangent);
217926
- this._fractionB = fraction;
217927
- }
217928
- /**
217929
- * Announce point and tangent for evaluations.
217930
- * * The function evaluation is saved as the "B" function point.
217931
- * * The function point count is incremented
217932
- * * If function point count is greater than 1, the current interval is searched.
217933
- * * The just-evaluated point ("B") is saved as the "old" ("A") evaluation point.
217934
- * @param xyz
217935
- * @param fraction
217936
- * @param tangent
217937
- */
217938
- announcePointTangent(xyz, fraction, tangent) {
217939
- this.evaluateB(xyz, fraction, tangent);
217940
- if (this._numThisCurve++ > 0)
217941
- this.searchInterval();
217942
- this._functionA = this._functionB;
217943
- this._fractionA = this._fractionB;
217944
- }
217945
- }
217946
- class CurveLengthContext {
217947
- constructor(fraction0 = 0.0, fraction1 = 1.0, numGaussPoints = 5) {
217948
- this.startCurvePrimitive(undefined);
217949
- this._summedLength = 0.0;
217950
- this._ray = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_7__.Ray3d.createZero();
217951
- if (fraction0 < fraction1) {
217952
- this._fraction0 = fraction0;
217953
- this._fraction1 = fraction1;
217954
- }
217955
- else {
217956
- this._fraction0 = fraction1;
217957
- this._fraction1 = fraction0;
217958
- }
217959
- this._gaussMapper = new _numerics_Quadrature__WEBPACK_IMPORTED_MODULE_11__.GaussMapper(numGaussPoints);
217960
- }
217961
- tangentMagnitude(fraction) {
217962
- this._ray = this._curve.fractionToPointAndDerivative(fraction, this._ray);
217963
- return this._ray.direction.magnitude();
217964
- }
217965
- getSum() { return this._summedLength; }
217966
- startCurvePrimitive(curve) {
217967
- this._curve = curve;
217968
- }
217969
- startParentCurvePrimitive(_curve) { }
217970
- endParentCurvePrimitive(_curve) { }
217971
- endCurvePrimitive() { }
217972
- announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
217973
- if (fraction0 < this._fraction0)
217974
- fraction0 = this._fraction0;
217975
- if (fraction1 > this._fraction1)
217976
- fraction1 = this._fraction1;
217977
- if (fraction1 > fraction0) {
217978
- this.startCurvePrimitive(cp);
217979
- if (numStrokes < 1)
217980
- numStrokes = 1;
217981
- const df = 1.0 / numStrokes;
217982
- for (let i = 1; i <= numStrokes; i++) {
217983
- const fractionA = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(fraction0, (i - 1) * df, fraction1);
217984
- const fractionB = i === numStrokes ? fraction1 : _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(fraction0, (i) * df, fraction1);
217985
- const numGauss = this._gaussMapper.mapXAndW(fractionA, fractionB);
217986
- for (let k = 0; k < numGauss; k++) {
217987
- this._summedLength += this._gaussMapper.gaussW[k] * this.tangentMagnitude(this._gaussMapper.gaussX[k]);
217988
- }
217989
- }
217990
- }
217991
- }
217992
- announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
217993
- const segmentLength = point0.distance(point1);
217994
- if (this._fraction0 <= fraction0 && fraction1 <= this._fraction1)
217995
- this._summedLength += segmentLength;
217996
- else {
217997
- let g0 = fraction0;
217998
- let g1 = fraction1;
217999
- if (g0 < this._fraction0)
218000
- g0 = this._fraction0;
218001
- if (g1 > this._fraction1)
218002
- g1 = this._fraction1;
218003
- if (g1 > g0) {
218004
- this._summedLength += segmentLength * (g1 - g0) / (fraction1 - fraction0);
218005
- }
218006
- }
218007
- }
218008
- announcePointTangent(_xyz, _fraction, _tangent) {
218009
- // uh oh -- need to retain point for next interval
218010
- }
218011
- }
218012
- // context for searching for closest point .. .
218013
- class ClosestPointStrokeHandler extends NewtonRotRStrokeHandler {
218014
- constructor(spacePoint, extend) {
218015
- super();
218016
- this._fractionA = 0;
218017
- this._functionA = 0;
218018
- this._functionB = 0;
218019
- this._fractionB = 0;
218020
- this._numThisCurve = 0;
218021
- this._spacePoint = spacePoint;
218022
- this._workPoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_5__.Point3d.create();
218023
- this._workRay = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_7__.Ray3d.createZero();
218024
- this._closestPoint = undefined;
218025
- this._extend = extend;
218026
- this.startCurvePrimitive(undefined);
218027
- this._newtonSolver = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_9__.Newton1dUnboundedApproximateDerivative(this);
218028
- }
218029
- claimResult() {
218030
- if (this._closestPoint) {
218031
- this._newtonSolver.setX(this._closestPoint.fraction);
218032
- this._curve = this._closestPoint.curve;
218033
- if (this._newtonSolver.runIterations()) {
218034
- let fraction = this._newtonSolver.getX();
218035
- fraction = _CurveExtendMode__WEBPACK_IMPORTED_MODULE_12__.CurveExtendOptions.correctFraction(this._extend, fraction);
218036
- this.announceSolutionFraction(fraction);
218037
- }
218038
- }
218039
- return this._closestPoint;
218040
- }
218041
- needPrimaryGeometryForStrokes() { return true; }
218042
- startCurvePrimitive(curve) {
218043
- this._curve = curve;
218044
- this._fractionA = 0.0;
218045
- this._numThisCurve = 0;
218046
- this._functionA = 0.0;
218047
- }
218048
- endCurvePrimitive() { }
218049
- announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
218050
- this.startCurvePrimitive(cp);
218051
- this.announceSolutionFraction(0.0); // test start point as closest
218052
- this.announceSolutionFraction(1.0); // test end point as closest
218053
- if (numStrokes < 1)
218054
- numStrokes = 1;
218055
- const df = 1.0 / numStrokes;
218056
- for (let i = 0; i <= numStrokes; i++) {
218057
- const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(fraction0, i * df, fraction1);
218058
- cp.fractionToPointAndDerivative(fraction, this._workRay);
218059
- this.announceRay(fraction, this._workRay);
218060
- }
218061
- }
218062
- announceCandidate(cp, fraction, point) {
218063
- const distance = this._spacePoint.distance(point);
218064
- if (this._closestPoint && distance > this._closestPoint.a)
218065
- return;
218066
- this._closestPoint = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);
218067
- this._closestPoint.a = distance;
218068
- if (this._parentCurvePrimitive !== undefined)
218069
- this._closestPoint.curve = this._parentCurvePrimitive;
218070
- }
218071
- announceSegmentInterval(cp, point0, point1, _numStrokes, fraction0, fraction1) {
218072
- let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);
218073
- // only consider extending the segment if the immediate caller says we are at endpoints ...
218074
- if (!this._extend)
218075
- localFraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.clampToStartEnd(localFraction, 0.0, 1.0);
218076
- else {
218077
- if (fraction0 !== 0.0)
218078
- localFraction = Math.max(localFraction, 0.0);
218079
- if (fraction1 !== 1.0)
218080
- localFraction = Math.min(localFraction, 1.0);
218081
- }
218082
- this._workPoint = point0.interpolate(localFraction, point1);
218083
- const globalFraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.interpolate(fraction0, localFraction, fraction1);
218084
- this.announceCandidate(cp, globalFraction, this._workPoint);
218085
- }
218086
- searchInterval() {
218087
- if (this._functionA * this._functionB > 0)
218088
- return;
218089
- if (this._functionA === 0)
218090
- this.announceSolutionFraction(this._fractionA);
218091
- if (this._functionB === 0)
218092
- this.announceSolutionFraction(this._fractionB);
218093
- if (this._functionA * this._functionB < 0) {
218094
- const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
218095
- if (fraction) {
218096
- this._newtonSolver.setX(fraction);
218097
- if (this._newtonSolver.runIterations())
218098
- this.announceSolutionFraction(this._newtonSolver.getX());
218099
- }
218100
- }
218101
- }
218102
- evaluateB(fractionB, dataB) {
218103
- this._functionB = dataB.dotProductToPoint(this._spacePoint);
218104
- this._fractionB = fractionB;
218105
- }
218106
- announceSolutionFraction(fraction) {
218107
- if (this._curve)
218108
- this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));
218109
- }
218110
- evaluate(fraction) {
218111
- let curve = this._curve;
218112
- if (this._parentCurvePrimitive)
218113
- curve = this._parentCurvePrimitive;
218114
- if (curve) {
218115
- this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);
218116
- this.currentF = this._workRay.dotProductToPoint(this._spacePoint);
218117
- return true;
218118
- }
218119
- return false;
218120
- }
218121
- announceRay(fraction, data) {
218122
- this.evaluateB(fraction, data);
218123
- if (this._numThisCurve++ > 0)
218124
- this.searchInterval();
218125
- this._functionA = this._functionB;
218126
- this._fractionA = this._fractionB;
218127
- }
218128
- announcePointTangent(point, fraction, tangent) {
218129
- this._workRay.set(point, tangent);
218130
- this.announceRay(fraction, this._workRay);
218131
- }
218132
- }
218133
217894
 
218134
217895
 
218135
217896
  /***/ }),
@@ -219365,7 +219126,8 @@ class LineString3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePri
219365
219126
  /**
219366
219127
  * Convert a segment index and local fraction to a global fraction.
219367
219128
  * @param index index of segment being evaluated
219368
- * @param localFraction local fraction within that segment
219129
+ * @param localFraction local fraction in [0,1] within the segment
219130
+ * @return global fraction f in [0,1] such that the segment is parameterized by index/N <= f <= (index+1)/N.
219369
219131
  */
219370
219132
  segmentIndexAndLocalFractionToGlobalFraction(index, localFraction) {
219371
219133
  const numSegment = this._points.length - 1;
@@ -219373,6 +219135,25 @@ class LineString3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePri
219373
219135
  return 0.0;
219374
219136
  return (index + localFraction) / numSegment;
219375
219137
  }
219138
+ /**
219139
+ * Convert a global fraction to a segment index and local fraction.
219140
+ * @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.
219141
+ */
219142
+ globalFractionToSegmentIndexAndLocalFraction(globalFraction) {
219143
+ const numSegment = this._points.length - 1;
219144
+ if (numSegment < 1)
219145
+ return { index: 0, fraction: 0.0 };
219146
+ const scaledGlobalFraction = globalFraction * numSegment;
219147
+ let segmentIndex;
219148
+ if (globalFraction < 0)
219149
+ segmentIndex = 0;
219150
+ else if (globalFraction > 1)
219151
+ segmentIndex = numSegment - 1;
219152
+ else // globalFraction in [0,1]
219153
+ segmentIndex = Math.floor(scaledGlobalFraction);
219154
+ const localFraction = scaledGlobalFraction - segmentIndex;
219155
+ return { index: segmentIndex, fraction: localFraction };
219156
+ }
219376
219157
  /** Return a frenet frame, using nearby points to estimate a plane. */
219377
219158
  fractionToFrenetFrame(fraction, result) {
219378
219159
  const n = this._points.length;
@@ -219606,7 +219387,6 @@ class LineString3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePri
219606
219387
  if (numPoints > 1) {
219607
219388
  let segmentFraction = 0;
219608
219389
  let d = 0;
219609
- const df = 1.0 / lastIndex;
219610
219390
  for (let i = 1; i < numPoints; i++) {
219611
219391
  segmentFraction = spacePoint.fractionOfProjectionToLine(this._points.getPoint3dAtUncheckedPointIndex(i - 1), this._points.getPoint3dAtUncheckedPointIndex(i));
219612
219392
  if (segmentFraction < 0) {
@@ -219620,7 +219400,7 @@ class LineString3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePri
219620
219400
  this._points.getPoint3dAtUncheckedPointIndex(i - 1).interpolate(segmentFraction, this._points.getPoint3dAtUncheckedPointIndex(i), result.pointQ);
219621
219401
  d = result.pointQ.distance(spacePoint);
219622
219402
  if (d < result.a) {
219623
- result.setFP((i - 1 + segmentFraction) * df, result.pointQ, undefined, d);
219403
+ result.setFP(this.segmentIndexAndLocalFractionToGlobalFraction(i - 1, segmentFraction), result.pointQ, undefined, d);
219624
219404
  }
219625
219405
  }
219626
219406
  }
@@ -219953,6 +219733,7 @@ class LineString3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePri
219953
219733
  }
219954
219734
  return status;
219955
219735
  }
219736
+ /** @param fraction used to interpolate between points at index and index + 1 */
219956
219737
  addResolvedPoint(index, fraction, dest) {
219957
219738
  const n = this._points.length;
219958
219739
  if (n === 0)
@@ -219993,49 +219774,36 @@ class LineString3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePri
219993
219774
  if (fractionB > 1)
219994
219775
  fractionB = 1;
219995
219776
  }
219996
- const numEdge = n - 1;
219997
- let indexA; // left index of first extended/partial segment of clone
219998
- let indexB; // left index of last extended/partial segment of clone
219999
219777
  let index0, index1; // range of original vertices to copy into clone
220000
- let localFractionA = fractionA;
220001
- let localFractionB = fractionB;
219778
+ const localA = this.globalFractionToSegmentIndexAndLocalFraction(fractionA);
219779
+ const localB = this.globalFractionToSegmentIndexAndLocalFraction(fractionB);
220002
219780
  if (fractionA < 0) {
220003
- indexA = 0;
220004
219781
  index0 = 1; // first original vertex is not in clone
220005
219782
  }
220006
219783
  else if (0 <= fractionA && fractionA <= 1) {
220007
- const gA = fractionA * numEdge;
220008
- indexA = Math.floor(gA);
220009
- localFractionA = gA - indexA;
220010
- index0 = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isSmallRelative(1 - localFractionA) ? indexA + 2 : indexA + 1;
219784
+ index0 = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isSmallRelative(1 - localA.fraction) ? localA.index + 2 : localA.index + 1;
220011
219785
  }
220012
219786
  else { // 1 < fractionA
220013
- indexA = n - 2;
220014
219787
  index0 = n; // no original vertices in clone
220015
219788
  }
220016
219789
  if (fractionB < 0) {
220017
- indexB = 0;
220018
219790
  index1 = -1; // no original vertices in clone
220019
219791
  }
220020
219792
  else if (0 <= fractionB && fractionB <= 1) {
220021
- const gB = fractionB * numEdge;
220022
- indexB = Math.floor(gB);
220023
- localFractionB = gB - indexB;
220024
- index1 = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isSmallRelative(localFractionB) ? indexB - 1 : indexB;
219793
+ index1 = _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.isSmallRelative(localB.fraction) ? localB.index - 1 : localB.index;
220025
219794
  }
220026
219795
  else { // 1 < fractionB
220027
- indexB = n - 2;
220028
219796
  index1 = n - 2; // last original vertex is not in clone
220029
219797
  }
220030
219798
  const result = LineString3d.create();
220031
- this.addResolvedPoint(indexA, localFractionA, result._points);
219799
+ this.addResolvedPoint(localA.index, localA.fraction, result._points);
220032
219800
  for (let index = index0; index <= index1; index++) {
220033
219801
  if (this._points.isIndexValid(index)) {
220034
219802
  this._points.getPoint3dAtUncheckedPointIndex(index, LineString3d._workPointA);
220035
219803
  result._points.push(LineString3d._workPointA);
220036
219804
  }
220037
219805
  }
220038
- this.addResolvedPoint(indexB, localFractionB, result._points);
219806
+ this.addResolvedPoint(localB.index, localB.fraction, result._points);
220039
219807
  return result;
220040
219808
  }
220041
219809
  /** Return (if possible) a specific segment of the linestring */
@@ -220146,7 +219914,7 @@ LineString3d._workPointA = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_
220146
219914
  LineString3d._workPointB = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__.Point3d.create();
220147
219915
  LineString3d._workPointC = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__.Point3d.create();
220148
219916
  LineString3d._workRay = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_7__.Ray3d.createXAxis();
220149
- LineString3d._indexPoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__.Point3d.create(); // private point for indexAndFractionToPoint.
219917
+ LineString3d._indexPoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__.Point3d.create(); // private point for addResolvedPoint
220150
219918
  /** An AnnotatedLineString3d is a linestring with additional surface-related data attached to each point
220151
219919
  * * This is useful in facet construction.
220152
219920
  * @internal
@@ -224133,6 +223901,165 @@ class UnionRegion extends _CurveCollection__WEBPACK_IMPORTED_MODULE_0__.CurveCol
224133
223901
  }
224134
223902
 
224135
223903
 
223904
+ /***/ }),
223905
+
223906
+ /***/ "../../core/geometry/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js":
223907
+ /*!**************************************************************************************************!*\
223908
+ !*** ../../core/geometry/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js ***!
223909
+ \**************************************************************************************************/
223910
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
223911
+
223912
+ "use strict";
223913
+ __webpack_require__.r(__webpack_exports__);
223914
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
223915
+ /* harmony export */ "AppendPlaneIntersectionStrokeHandler": () => (/* binding */ AppendPlaneIntersectionStrokeHandler)
223916
+ /* harmony export */ });
223917
+ /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
223918
+ /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
223919
+ /* harmony import */ var _numerics_BezierPolynomials__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../numerics/BezierPolynomials */ "../../core/geometry/lib/esm/numerics/BezierPolynomials.js");
223920
+ /* harmony import */ var _numerics_Newton__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../numerics/Newton */ "../../core/geometry/lib/esm/numerics/Newton.js");
223921
+ /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
223922
+ /* harmony import */ var _NewtonRtoRStrokeHandler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NewtonRtoRStrokeHandler */ "../../core/geometry/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js");
223923
+ /*---------------------------------------------------------------------------------------------
223924
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
223925
+ * See LICENSE.md in the project root for license terms and full copyright notice.
223926
+ *--------------------------------------------------------------------------------------------*/
223927
+ /** @packageDocumentation
223928
+ * @module Curve
223929
+ */
223930
+
223931
+
223932
+
223933
+
223934
+
223935
+
223936
+ /**
223937
+ * Context for computing intersections of a CurvePrimitive with a plane.
223938
+ * @internal
223939
+ */
223940
+ class AppendPlaneIntersectionStrokeHandler extends _NewtonRtoRStrokeHandler__WEBPACK_IMPORTED_MODULE_0__.NewtonRtoRStrokeHandler {
223941
+ constructor(plane, intersections) {
223942
+ super();
223943
+ this._fractionA = 0;
223944
+ this._functionA = 0;
223945
+ // private derivativeA: number; <---- Not currently used
223946
+ this._functionB = 0;
223947
+ this._fractionB = 0;
223948
+ this._derivativeB = 0;
223949
+ this._numThisCurve = 0;
223950
+ this._plane = plane;
223951
+ this._intersections = intersections;
223952
+ this.startCurvePrimitive(undefined);
223953
+ this._ray = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_1__.Ray3d.createZero();
223954
+ this._newtonSolver = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_2__.Newton1dUnboundedApproximateDerivative(this);
223955
+ }
223956
+ // Return the first defined curve among: this.parentCurvePrimitive, this.curve;
223957
+ effectiveCurve() {
223958
+ if (this._parentCurvePrimitive)
223959
+ return this._parentCurvePrimitive;
223960
+ return this._curve;
223961
+ }
223962
+ get getDerivativeB() {
223963
+ return this._derivativeB; // <--- _derivativeB is not currently used anywhere. Provided getter to suppress lint error
223964
+ }
223965
+ startCurvePrimitive(curve) {
223966
+ this._curve = curve;
223967
+ this._fractionA = 0.0;
223968
+ this._numThisCurve = 0;
223969
+ this._functionA = 0.0;
223970
+ // this.derivativeA = 0.0;
223971
+ }
223972
+ endCurvePrimitive() {
223973
+ }
223974
+ announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
223975
+ this.startCurvePrimitive(cp);
223976
+ if (numStrokes < 1)
223977
+ numStrokes = 1;
223978
+ const df = 1.0 / numStrokes;
223979
+ for (let i = 0; i <= numStrokes; i++) {
223980
+ const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.interpolate(fraction0, i * df, fraction1);
223981
+ cp.fractionToPointAndDerivative(fraction, this._ray);
223982
+ this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);
223983
+ }
223984
+ }
223985
+ announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
223986
+ const h0 = this._plane.altitude(point0);
223987
+ const h1 = this._plane.altitude(point1);
223988
+ if (h0 * h1 > 0.0)
223989
+ return;
223990
+ const fraction01 = _numerics_BezierPolynomials__WEBPACK_IMPORTED_MODULE_4__.Order2Bezier.solveCoffs(h0, h1);
223991
+ // let numIntersection = 0;
223992
+ if (fraction01 !== undefined) {
223993
+ // numIntersection++;
223994
+ const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.interpolate(fraction0, fraction01, fraction1);
223995
+ this._newtonSolver.setX(fraction);
223996
+ if (this._newtonSolver.runIterations()) {
223997
+ this.announceSolutionFraction(this._newtonSolver.getX());
223998
+ }
223999
+ // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));
224000
+ }
224001
+ }
224002
+ announceSolutionFraction(fraction) {
224003
+ const curve = this.effectiveCurve();
224004
+ if (curve) {
224005
+ this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);
224006
+ this._intersections.push(_CurveLocationDetail__WEBPACK_IMPORTED_MODULE_5__.CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));
224007
+ }
224008
+ }
224009
+ evaluate(fraction) {
224010
+ const curve = this.effectiveCurve();
224011
+ if (!curve)
224012
+ return false;
224013
+ this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));
224014
+ return true;
224015
+ }
224016
+ /**
224017
+ * * ASSUME both the "A" and "B" evaluations (fraction, function, and derivative) are known.
224018
+ * * If function value changed sign between, interpolate an approximate root and improve it with
224019
+ * the newton solver.
224020
+ */
224021
+ searchInterval() {
224022
+ if (this._functionA * this._functionB > 0)
224023
+ return;
224024
+ if (this._functionA === 0)
224025
+ this.announceSolutionFraction(this._fractionA);
224026
+ if (this._functionB === 0)
224027
+ this.announceSolutionFraction(this._fractionB);
224028
+ if (this._functionA * this._functionB < 0) {
224029
+ const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_3__.Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
224030
+ if (fraction) {
224031
+ this._newtonSolver.setX(fraction);
224032
+ if (this._newtonSolver.runIterations())
224033
+ this.announceSolutionFraction(this._newtonSolver.getX());
224034
+ }
224035
+ }
224036
+ }
224037
+ /** Evaluate and save _functionB, _derivativeB, and _fractionB. */
224038
+ evaluateB(xyz, fraction, tangent) {
224039
+ this._functionB = this._plane.altitude(xyz);
224040
+ this._derivativeB = this._plane.velocity(tangent);
224041
+ this._fractionB = fraction;
224042
+ }
224043
+ /**
224044
+ * Announce point and tangent for evaluations.
224045
+ * * The function evaluation is saved as the "B" function point.
224046
+ * * The function point count is incremented
224047
+ * * If function point count is greater than 1, the current interval is searched.
224048
+ * * The just-evaluated point ("B") is saved as the "old" ("A") evaluation point.
224049
+ * @param xyz
224050
+ * @param fraction
224051
+ * @param tangent
224052
+ */
224053
+ announcePointTangent(xyz, fraction, tangent) {
224054
+ this.evaluateB(xyz, fraction, tangent);
224055
+ if (this._numThisCurve++ > 0)
224056
+ this.searchInterval();
224057
+ this._functionA = this._functionB;
224058
+ this._fractionA = this._fractionB;
224059
+ }
224060
+ }
224061
+
224062
+
224136
224063
  /***/ }),
224137
224064
 
224138
224065
  /***/ "../../core/geometry/lib/esm/curve/internalContexts/CloneCurvesContext.js":
@@ -224264,6 +224191,169 @@ class CloneWithExpandedLineStrings extends _CloneCurvesContext__WEBPACK_IMPORTED
224264
224191
  }
224265
224192
 
224266
224193
 
224194
+ /***/ }),
224195
+
224196
+ /***/ "../../core/geometry/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js":
224197
+ /*!***************************************************************************************!*\
224198
+ !*** ../../core/geometry/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js ***!
224199
+ \***************************************************************************************/
224200
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
224201
+
224202
+ "use strict";
224203
+ __webpack_require__.r(__webpack_exports__);
224204
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
224205
+ /* harmony export */ "ClosestPointStrokeHandler": () => (/* binding */ ClosestPointStrokeHandler)
224206
+ /* harmony export */ });
224207
+ /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
224208
+ /* harmony import */ var _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../geometry3d/Point3dVector3d */ "../../core/geometry/lib/esm/geometry3d/Point3dVector3d.js");
224209
+ /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
224210
+ /* harmony import */ var _numerics_Newton__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../numerics/Newton */ "../../core/geometry/lib/esm/numerics/Newton.js");
224211
+ /* harmony import */ var _CurveExtendMode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../CurveExtendMode */ "../../core/geometry/lib/esm/curve/CurveExtendMode.js");
224212
+ /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
224213
+ /* harmony import */ var _NewtonRtoRStrokeHandler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NewtonRtoRStrokeHandler */ "../../core/geometry/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js");
224214
+ /*---------------------------------------------------------------------------------------------
224215
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
224216
+ * See LICENSE.md in the project root for license terms and full copyright notice.
224217
+ *--------------------------------------------------------------------------------------------*/
224218
+ /** @packageDocumentation
224219
+ * @module Curve
224220
+ */
224221
+
224222
+
224223
+
224224
+
224225
+
224226
+
224227
+
224228
+ /**
224229
+ * Context for searching for the closest point to a CurvePrimitive.
224230
+ * @internal
224231
+ */
224232
+ class ClosestPointStrokeHandler extends _NewtonRtoRStrokeHandler__WEBPACK_IMPORTED_MODULE_0__.NewtonRtoRStrokeHandler {
224233
+ constructor(spacePoint, extend) {
224234
+ super();
224235
+ this._fractionA = 0;
224236
+ this._functionA = 0;
224237
+ this._functionB = 0;
224238
+ this._fractionB = 0;
224239
+ this._numThisCurve = 0;
224240
+ this._spacePoint = spacePoint;
224241
+ this._workPoint = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_1__.Point3d.create();
224242
+ this._workRay = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_2__.Ray3d.createZero();
224243
+ this._closestPoint = undefined;
224244
+ this._extend = extend;
224245
+ this.startCurvePrimitive(undefined);
224246
+ this._newtonSolver = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_3__.Newton1dUnboundedApproximateDerivative(this);
224247
+ }
224248
+ claimResult() {
224249
+ if (this._closestPoint) {
224250
+ this._newtonSolver.setX(this._closestPoint.fraction);
224251
+ this._curve = this._closestPoint.curve;
224252
+ if (this._newtonSolver.runIterations()) {
224253
+ let fraction = this._newtonSolver.getX();
224254
+ fraction = _CurveExtendMode__WEBPACK_IMPORTED_MODULE_4__.CurveExtendOptions.correctFraction(this._extend, fraction);
224255
+ this.announceSolutionFraction(fraction);
224256
+ }
224257
+ }
224258
+ return this._closestPoint;
224259
+ }
224260
+ needPrimaryGeometryForStrokes() {
224261
+ return true;
224262
+ }
224263
+ startCurvePrimitive(curve) {
224264
+ this._curve = curve;
224265
+ this._fractionA = 0.0;
224266
+ this._numThisCurve = 0;
224267
+ this._functionA = 0.0;
224268
+ }
224269
+ endCurvePrimitive() {
224270
+ }
224271
+ announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
224272
+ this.startCurvePrimitive(cp);
224273
+ this.announceSolutionFraction(0.0); // test start point as closest
224274
+ this.announceSolutionFraction(1.0); // test end point as closest
224275
+ if (numStrokes < 1)
224276
+ numStrokes = 1;
224277
+ const df = 1.0 / numStrokes;
224278
+ for (let i = 0; i <= numStrokes; i++) {
224279
+ const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.interpolate(fraction0, i * df, fraction1);
224280
+ cp.fractionToPointAndDerivative(fraction, this._workRay);
224281
+ this.announceRay(fraction, this._workRay);
224282
+ }
224283
+ }
224284
+ announceCandidate(cp, fraction, point) {
224285
+ const distance = this._spacePoint.distance(point);
224286
+ if (this._closestPoint && distance > this._closestPoint.a)
224287
+ return;
224288
+ this._closestPoint = _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_6__.CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);
224289
+ this._closestPoint.a = distance;
224290
+ if (this._parentCurvePrimitive !== undefined)
224291
+ this._closestPoint.curve = this._parentCurvePrimitive;
224292
+ }
224293
+ announceSegmentInterval(cp, point0, point1, _numStrokes, fraction0, fraction1) {
224294
+ let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);
224295
+ // only consider extending the segment if the immediate caller says we are at endpoints ...
224296
+ if (!this._extend)
224297
+ localFraction = _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.clampToStartEnd(localFraction, 0.0, 1.0);
224298
+ else {
224299
+ if (fraction0 !== 0.0)
224300
+ localFraction = Math.max(localFraction, 0.0);
224301
+ if (fraction1 !== 1.0)
224302
+ localFraction = Math.min(localFraction, 1.0);
224303
+ }
224304
+ this._workPoint = point0.interpolate(localFraction, point1);
224305
+ const globalFraction = _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.interpolate(fraction0, localFraction, fraction1);
224306
+ this.announceCandidate(cp, globalFraction, this._workPoint);
224307
+ }
224308
+ searchInterval() {
224309
+ if (this._functionA * this._functionB > 0)
224310
+ return;
224311
+ if (this._functionA === 0)
224312
+ this.announceSolutionFraction(this._fractionA);
224313
+ if (this._functionB === 0)
224314
+ this.announceSolutionFraction(this._fractionB);
224315
+ if (this._functionA * this._functionB < 0) {
224316
+ const fraction = _Geometry__WEBPACK_IMPORTED_MODULE_5__.Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);
224317
+ if (fraction) {
224318
+ this._newtonSolver.setX(fraction);
224319
+ if (this._newtonSolver.runIterations())
224320
+ this.announceSolutionFraction(this._newtonSolver.getX());
224321
+ }
224322
+ }
224323
+ }
224324
+ evaluateB(fractionB, dataB) {
224325
+ this._functionB = dataB.dotProductToPoint(this._spacePoint);
224326
+ this._fractionB = fractionB;
224327
+ }
224328
+ announceSolutionFraction(fraction) {
224329
+ if (this._curve)
224330
+ this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));
224331
+ }
224332
+ evaluate(fraction) {
224333
+ let curve = this._curve;
224334
+ if (this._parentCurvePrimitive)
224335
+ curve = this._parentCurvePrimitive;
224336
+ if (curve) {
224337
+ this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);
224338
+ this.currentF = this._workRay.dotProductToPoint(this._spacePoint);
224339
+ return true;
224340
+ }
224341
+ return false;
224342
+ }
224343
+ announceRay(fraction, data) {
224344
+ this.evaluateB(fraction, data);
224345
+ if (this._numThisCurve++ > 0)
224346
+ this.searchInterval();
224347
+ this._functionA = this._functionB;
224348
+ this._fractionA = this._fractionB;
224349
+ }
224350
+ announcePointTangent(point, fraction, tangent) {
224351
+ this._workRay.set(point, tangent);
224352
+ this.announceRay(fraction, this._workRay);
224353
+ }
224354
+ }
224355
+
224356
+
224267
224357
  /***/ }),
224268
224358
 
224269
224359
  /***/ "../../core/geometry/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js":
@@ -224313,6 +224403,110 @@ class CountLinearPartsSearchContext extends _CurveProcessor__WEBPACK_IMPORTED_MO
224313
224403
  }
224314
224404
 
224315
224405
 
224406
+ /***/ }),
224407
+
224408
+ /***/ "../../core/geometry/lib/esm/curve/internalContexts/CurveLengthContext.js":
224409
+ /*!********************************************************************************!*\
224410
+ !*** ../../core/geometry/lib/esm/curve/internalContexts/CurveLengthContext.js ***!
224411
+ \********************************************************************************/
224412
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
224413
+
224414
+ "use strict";
224415
+ __webpack_require__.r(__webpack_exports__);
224416
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
224417
+ /* harmony export */ "CurveLengthContext": () => (/* binding */ CurveLengthContext)
224418
+ /* harmony export */ });
224419
+ /* harmony import */ var _geometry3d_Range__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../geometry3d/Range */ "../../core/geometry/lib/esm/geometry3d/Range.js");
224420
+ /* harmony import */ var _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../geometry3d/Ray3d */ "../../core/geometry/lib/esm/geometry3d/Ray3d.js");
224421
+ /* harmony import */ var _numerics_Quadrature__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../numerics/Quadrature */ "../../core/geometry/lib/esm/numerics/Quadrature.js");
224422
+ /*---------------------------------------------------------------------------------------------
224423
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
224424
+ * See LICENSE.md in the project root for license terms and full copyright notice.
224425
+ *--------------------------------------------------------------------------------------------*/
224426
+ /** @packageDocumentation
224427
+ * @module Curve
224428
+ */
224429
+
224430
+
224431
+
224432
+ /**
224433
+ * Context for computing the length of a CurvePrimitive.
224434
+ * @internal
224435
+ */
224436
+ class CurveLengthContext {
224437
+ constructor(fraction0 = 0.0, fraction1 = 1.0, numGaussPoints = 5) {
224438
+ this.startCurvePrimitive(undefined);
224439
+ this._summedLength = 0.0;
224440
+ this._ray = _geometry3d_Ray3d__WEBPACK_IMPORTED_MODULE_0__.Ray3d.createZero();
224441
+ if (fraction0 < fraction1) {
224442
+ this._fraction0 = fraction0;
224443
+ this._fraction1 = fraction1;
224444
+ }
224445
+ else {
224446
+ this._fraction0 = fraction1;
224447
+ this._fraction1 = fraction0;
224448
+ }
224449
+ this._gaussMapper = new _numerics_Quadrature__WEBPACK_IMPORTED_MODULE_1__.GaussMapper(numGaussPoints);
224450
+ }
224451
+ tangentMagnitude(fraction) {
224452
+ this._ray = this._curve.fractionToPointAndDerivative(fraction, this._ray);
224453
+ return this._ray.direction.magnitude();
224454
+ }
224455
+ /** Return the fraction0 installed at construction time. */
224456
+ get getFraction0() {
224457
+ return this._fraction0;
224458
+ }
224459
+ /** Return the fraction1 installed at construction time. */
224460
+ get getFraction1() {
224461
+ return this._fraction1;
224462
+ }
224463
+ getSum() {
224464
+ return this._summedLength;
224465
+ }
224466
+ startCurvePrimitive(curve) {
224467
+ this._curve = curve;
224468
+ }
224469
+ startParentCurvePrimitive(_curve) {
224470
+ }
224471
+ endParentCurvePrimitive(_curve) {
224472
+ }
224473
+ endCurvePrimitive() {
224474
+ }
224475
+ announceIntervalForUniformStepStrokes(cp, numStrokes, fraction0, fraction1) {
224476
+ const range = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_2__.Range1d.createXX(fraction0, fraction1);
224477
+ range.intersectRangeXXInPlace(this._fraction0, this._fraction1);
224478
+ if (!range.isNull) {
224479
+ this.startCurvePrimitive(cp);
224480
+ if (numStrokes < 1)
224481
+ numStrokes = 1;
224482
+ const df = 1.0 / numStrokes;
224483
+ for (let i = 1; i <= numStrokes; i++) {
224484
+ const fractionA = range.fractionToPoint((i - 1) * df);
224485
+ const fractionB = i === numStrokes ? range.high : range.fractionToPoint(i * df);
224486
+ const numGauss = this._gaussMapper.mapXAndW(fractionA, fractionB);
224487
+ for (let k = 0; k < numGauss; k++) {
224488
+ this._summedLength += this._gaussMapper.gaussW[k] * this.tangentMagnitude(this._gaussMapper.gaussX[k]);
224489
+ }
224490
+ }
224491
+ }
224492
+ }
224493
+ announceSegmentInterval(_cp, point0, point1, _numStrokes, fraction0, fraction1) {
224494
+ const segmentLength = point0.distance(point1);
224495
+ if (this._fraction0 <= fraction0 && fraction1 <= this._fraction1)
224496
+ this._summedLength += segmentLength;
224497
+ else {
224498
+ const range = _geometry3d_Range__WEBPACK_IMPORTED_MODULE_2__.Range1d.createXX(fraction0, fraction1);
224499
+ range.intersectRangeXXInPlace(this._fraction0, this._fraction1);
224500
+ if (!range.isNull)
224501
+ this._summedLength += segmentLength * range.length() / (fraction1 - fraction0);
224502
+ }
224503
+ }
224504
+ announcePointTangent(_xyz, _fraction, _tangent) {
224505
+ // uh oh -- need to retain point for next interval
224506
+ }
224507
+ }
224508
+
224509
+
224316
224510
  /***/ }),
224317
224511
 
224318
224512
  /***/ "../../core/geometry/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js":
@@ -224905,6 +225099,51 @@ class OffsetHelpers {
224905
225099
  }
224906
225100
 
224907
225101
 
225102
+ /***/ }),
225103
+
225104
+ /***/ "../../core/geometry/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js":
225105
+ /*!*************************************************************************************!*\
225106
+ !*** ../../core/geometry/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js ***!
225107
+ \*************************************************************************************/
225108
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
225109
+
225110
+ "use strict";
225111
+ __webpack_require__.r(__webpack_exports__);
225112
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
225113
+ /* harmony export */ "NewtonRtoRStrokeHandler": () => (/* binding */ NewtonRtoRStrokeHandler)
225114
+ /* harmony export */ });
225115
+ /* harmony import */ var _numerics_Newton__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../numerics/Newton */ "../../core/geometry/lib/esm/numerics/Newton.js");
225116
+ /*---------------------------------------------------------------------------------------------
225117
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
225118
+ * See LICENSE.md in the project root for license terms and full copyright notice.
225119
+ *--------------------------------------------------------------------------------------------*/
225120
+ /** @packageDocumentation
225121
+ * @module Curve
225122
+ */
225123
+
225124
+ /** Intermediate class for managing the parentCurve announcements from an IStrokeHandler.
225125
+ * @internal
225126
+ */
225127
+ class NewtonRtoRStrokeHandler extends _numerics_Newton__WEBPACK_IMPORTED_MODULE_0__.NewtonEvaluatorRtoR {
225128
+ constructor() {
225129
+ super();
225130
+ this._parentCurvePrimitive = undefined;
225131
+ }
225132
+ /** retain the parentCurvePrimitive.
225133
+ * * Calling this method tells the handler that the parent curve is to be used for detail searches.
225134
+ * * Example: Transition spiral search is based on linestring first, then the exact spiral.
225135
+ * * Example: CurveChainWithDistanceIndex does NOT do this announcement -- the constituents act independently.
225136
+ */
225137
+ startParentCurvePrimitive(curve) {
225138
+ this._parentCurvePrimitive = curve;
225139
+ }
225140
+ /** Forget the parentCurvePrimitive */
225141
+ endParentCurvePrimitive(_curve) {
225142
+ this._parentCurvePrimitive = undefined;
225143
+ }
225144
+ }
225145
+
225146
+
224908
225147
  /***/ }),
224909
225148
 
224910
225149
  /***/ "../../core/geometry/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js":
@@ -226595,15 +226834,16 @@ __webpack_require__.r(__webpack_exports__);
226595
226834
  /* harmony export */ });
226596
226835
  /* harmony import */ var _Geometry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Geometry */ "../../core/geometry/lib/esm/Geometry.js");
226597
226836
  /* harmony import */ var _geometry3d_Segment1d__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../geometry3d/Segment1d */ "../../core/geometry/lib/esm/geometry3d/Segment1d.js");
226837
+ /* harmony import */ var _internalContexts_CurveLengthContext__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../internalContexts/CurveLengthContext */ "../../core/geometry/lib/esm/curve/internalContexts/CurveLengthContext.js");
226598
226838
  /* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
226599
226839
  /* harmony import */ var _StrokeOptions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../StrokeOptions */ "../../core/geometry/lib/esm/curve/StrokeOptions.js");
226840
+ /* harmony import */ var _AustralianRailCorpXYEvaluator__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./AustralianRailCorpXYEvaluator */ "../../core/geometry/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js");
226600
226841
  /* harmony import */ var _ClothoidSeries__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ClothoidSeries */ "../../core/geometry/lib/esm/curve/spiral/ClothoidSeries.js");
226601
226842
  /* harmony import */ var _CzechSpiralEvaluator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./CzechSpiralEvaluator */ "../../core/geometry/lib/esm/curve/spiral/CzechSpiralEvaluator.js");
226602
226843
  /* harmony import */ var _DirectHalfCosineSpiralEvaluator__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./DirectHalfCosineSpiralEvaluator */ "../../core/geometry/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js");
226603
- /* harmony import */ var _AustralianRailCorpXYEvaluator__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./AustralianRailCorpXYEvaluator */ "../../core/geometry/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js");
226604
- /* harmony import */ var _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TransitionSpiral3d */ "../../core/geometry/lib/esm/curve/spiral/TransitionSpiral3d.js");
226605
226844
  /* harmony import */ var _MXCubicAlongArcSpiralEvaluator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./MXCubicAlongArcSpiralEvaluator */ "../../core/geometry/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js");
226606
226845
  /* harmony import */ var _PolishCubicSpiralEvaluator__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./PolishCubicSpiralEvaluator */ "../../core/geometry/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js");
226846
+ /* harmony import */ var _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TransitionSpiral3d */ "../../core/geometry/lib/esm/curve/spiral/TransitionSpiral3d.js");
226607
226847
  /*---------------------------------------------------------------------------------------------
226608
226848
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
226609
226849
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -226622,6 +226862,7 @@ __webpack_require__.r(__webpack_exports__);
226622
226862
 
226623
226863
 
226624
226864
 
226865
+
226625
226866
  /**
226626
226867
  * DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have "direct" xy calculations without the integrations required
226627
226868
  * for IntegratedSpiral3d.
@@ -226972,13 +227213,19 @@ class DirectSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.Tr
226972
227213
  const n = this.computeStrokeCountForOptions(options);
226973
227214
  const activeStrokes = this.activeStrokes;
226974
227215
  dest.startParentCurvePrimitive(this);
226975
- if (n <= activeStrokes.numPoints()) {
226976
- // this.activeStrokes.emitStrokableParts(dest, options);
226977
- dest.announceIntervalForUniformStepStrokes(this, 2 * activeStrokes.numPoints(), 0.0, 1.0);
226978
- }
226979
- else {
226980
- dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);
226981
- }
227216
+ // hack: specify the extended range so we can compute length of an extended spiral
227217
+ let globalFraction0 = 0.0;
227218
+ let globalFraction1 = 1.0;
227219
+ if (dest instanceof _internalContexts_CurveLengthContext__WEBPACK_IMPORTED_MODULE_11__.CurveLengthContext) {
227220
+ if (dest.getFraction0 < 0.0)
227221
+ globalFraction0 = dest.getFraction0;
227222
+ if (dest.getFraction1 > 1.0)
227223
+ globalFraction1 = dest.getFraction1;
227224
+ }
227225
+ if (n <= activeStrokes.numPoints())
227226
+ dest.announceIntervalForUniformStepStrokes(this, 2 * activeStrokes.numPoints(), globalFraction0, globalFraction1);
227227
+ else
227228
+ dest.announceIntervalForUniformStepStrokes(this, n, globalFraction0, globalFraction1);
226982
227229
  dest.endParentCurvePrimitive(this);
226983
227230
  }
226984
227231
  /**
@@ -228581,38 +228828,53 @@ class Angle {
228581
228828
  * Test if two radians values are equivalent, allowing shift by full circle (i.e. by a multiple of `2*PI`)
228582
228829
  * @param radiansA first radians value
228583
228830
  * @param radiansB second radians value
228831
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
228584
228832
  */
228585
- static isAlmostEqualRadiansAllowPeriodShift(radiansA, radiansB) {
228586
- // try to get simple conclusions with un-shifted radians ...
228833
+ static isAlmostEqualRadiansAllowPeriodShift(radiansA, radiansB, radianTol = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians) {
228587
228834
  const delta = Math.abs(radiansA - radiansB);
228588
- if (delta <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians)
228835
+ if (delta <= radianTol)
228589
228836
  return true;
228590
228837
  const period = Math.PI * 2.0;
228591
- if (Math.abs(delta - period) <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians)
228838
+ if (Math.abs(delta - period) <= radianTol)
228592
228839
  return true;
228593
228840
  const numPeriod = Math.round(delta / period);
228594
228841
  const delta1 = delta - numPeriod * period;
228595
- return Math.abs(delta1) <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians;
228842
+ return Math.abs(delta1) <= radianTol;
228596
228843
  }
228597
228844
  /**
228598
- * Test if this angle and other are equivalent, allowing shift by full circle (i.e. by a multiple of 360 degrees)
228845
+ * Test if this angle and other are equivalent, allowing shift by full circle (i.e., multiples of `2 * PI`).
228846
+ * @param other the other angle
228847
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
228599
228848
  */
228600
- isAlmostEqualAllowPeriodShift(other) {
228601
- return Angle.isAlmostEqualRadiansAllowPeriodShift(this._radians, other._radians);
228849
+ isAlmostEqualAllowPeriodShift(other, radianTol = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians) {
228850
+ return Angle.isAlmostEqualRadiansAllowPeriodShift(this._radians, other._radians, radianTol);
228602
228851
  }
228603
228852
  /**
228604
- * Test if two this angle and other are almost equal, NOT allowing shift by full circle multiples of 360 degrees.
228853
+ * Test if two angle (in radians) almost equal, NOT allowing shift by full circle (i.e., multiples of `2 * PI`).
228854
+ * @param radiansA first radians value
228855
+ * @param radiansB second radians value
228856
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
228605
228857
  */
228606
- isAlmostEqualNoPeriodShift(other) { return Math.abs(this._radians - other._radians) < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians; }
228858
+ static isAlmostEqualRadiansNoPeriodShift(radiansA, radiansB, radianTol = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians) {
228859
+ return Math.abs(radiansA - radiansB) < radianTol;
228860
+ }
228607
228861
  /**
228608
- * Test if two angle (in radians) almost equal, NOT allowing shift by full circle multiples of `2 * PI`.
228609
- * * (Same test as isAlmostEqualRadiansNoPeriodShift)
228862
+ * Test if two this angle and other are almost equal, NOT allowing shift by full circle (i.e., multiples of `2 * PI`).
228863
+ * @param other the other angle
228864
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
228610
228865
  */
228611
- isAlmostEqual(other) { return this.isAlmostEqualNoPeriodShift(other); }
228866
+ isAlmostEqualNoPeriodShift(other, radianTol = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians) {
228867
+ return Angle.isAlmostEqualRadiansNoPeriodShift(this._radians, other._radians, radianTol);
228868
+ }
228612
228869
  /**
228613
- * Test if two angle (in radians) almost equal, NOT allowing shift by full circle multiples of `2 * PI`.
228870
+ * Test if two this angle and other are almost equal, NOT allowing shift by full circle (i.e., multiples of `2 * PI`).
228871
+ * * This function is same as isAlmostEqualRadiansNoPeriodShift. Please use isAlmostEqualRadiansNoPeriodShift.
228872
+ * @param other the other angle
228873
+ * @param radianTol radian tolerance with default value of Geometry.smallAngleRadians
228614
228874
  */
228615
- static isAlmostEqualRadiansNoPeriodShift(radiansA, radiansB) { return Math.abs(radiansA - radiansB) < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians; }
228875
+ isAlmostEqual(other, radianTol = _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadians) {
228876
+ return this.isAlmostEqualNoPeriodShift(other, radianTol);
228877
+ }
228616
228878
  /**
228617
228879
  * Test if dot product values indicate non-zero length perpendicular vectors.
228618
228880
  * @param dotUU dot product of vectorU with itself
@@ -234974,7 +235236,7 @@ class Matrix3d {
234974
235236
  * Factor this as a product C * U where C has mutually perpendicular columns and
234975
235237
  * U is orthogonal.
234976
235238
  * @param matrixC (allocate by caller, computed here)
234977
- * @param factor (allocate by caller, computed here)
235239
+ * @param matrixU (allocate by caller, computed here)
234978
235240
  */
234979
235241
  factorPerpendicularColumns(matrixC, matrixU) {
234980
235242
  matrixC.setFrom(this);
@@ -234993,6 +235255,46 @@ class Matrix3d {
234993
235255
  }
234994
235256
  return false;
234995
235257
  }
235258
+ /**
235259
+ * Factor this matrix M as a product M = V * D * U where V and U are orthogonal, and D is diagonal (scale matrix).
235260
+ * @param matrixV left orthogonal factor (allocate by caller, computed here)
235261
+ * @param scale diagonal entries of D (allocate by caller, computed here)
235262
+ * @param matrixU right orthogonal factor (allocate by caller, computed here)
235263
+ */
235264
+ factorOrthogonalScaleOrthogonal(matrixV, scale, matrixU) {
235265
+ const matrixVD = Matrix3d.createZero();
235266
+ if (!this.factorPerpendicularColumns(matrixVD, matrixU))
235267
+ return false;
235268
+ const column = [];
235269
+ column.push(matrixVD.getColumn(0));
235270
+ column.push(matrixVD.getColumn(1));
235271
+ column.push(matrixVD.getColumn(2));
235272
+ scale.set(column[0].magnitude(), column[1].magnitude(), column[2].magnitude());
235273
+ const det = matrixVD.determinant();
235274
+ if (det < 0)
235275
+ scale.z = -scale.z;
235276
+ const almostZero = 1.0e-15;
235277
+ const scaleXIsZero = Math.abs(scale.x) < almostZero;
235278
+ const scaleYIsZero = Math.abs(scale.y) < almostZero;
235279
+ const scaleZIsZero = Math.abs(scale.z) < almostZero;
235280
+ // ASSUME: any zero-magnitude column(s) of matrixVD are last
235281
+ if (!scaleXIsZero && !scaleYIsZero && !scaleZIsZero) { // full rank
235282
+ matrixV = matrixVD.scaleColumns(1 / scale.x, 1 / scale.y, 1 / scale.z, matrixV);
235283
+ }
235284
+ else if (!scaleXIsZero && !scaleYIsZero) { // rank 2
235285
+ column[0].scaleInPlace(1 / scale.x);
235286
+ column[1].scaleInPlace(1 / scale.y);
235287
+ column[2] = column[0].unitCrossProduct(column[1], column[2]);
235288
+ matrixV.setColumns(column[0], column[1], column[2]);
235289
+ }
235290
+ else if (!scaleXIsZero) { // rank 1
235291
+ matrixV = Matrix3d.createRigidHeadsUp(column[0], _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.XYZ, matrixV); // preserve column0
235292
+ }
235293
+ else { // rank 0
235294
+ matrixV.setIdentity();
235295
+ }
235296
+ return true;
235297
+ }
234996
235298
  /** Apply a jacobi step to lambda which evolves towards diagonal. */
234997
235299
  applySymmetricJacobi(i, j, lambda) {
234998
235300
  const uDotU = lambda.at(i, i);
@@ -235883,7 +236185,7 @@ class Matrix3d {
235883
236185
  this.inverseState = InverseMatrixState.unknown;
235884
236186
  }
235885
236187
  /** create a Matrix3d whose columns are scaled copies of this Matrix3d.
235886
- * @param scaleX scale factor for columns x
236188
+ * @param scaleX scale factor for column x
235887
236189
  * @param scaleY scale factor for column y
235888
236190
  * @param scaleZ scale factor for column z
235889
236191
  * @param result optional result.
@@ -235891,11 +236193,10 @@ class Matrix3d {
235891
236193
  scaleColumns(scaleX, scaleY, scaleZ, result) {
235892
236194
  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);
235893
236195
  }
235894
- /** create a Matrix3d whose columns are scaled copies of this Matrix3d.
235895
- * @param scaleX scale factor for columns x
236196
+ /** Scale the columns of this Matrix3d.
236197
+ * @param scaleX scale factor for column x
235896
236198
  * @param scaleY scale factor for column y
235897
236199
  * @param scaleZ scale factor for column z
235898
- * @param result optional result.
235899
236200
  */
235900
236201
  scaleColumnsInPlace(scaleX, scaleY, scaleZ) {
235901
236202
  this.coffs[0] *= scaleX;
@@ -236071,7 +236372,9 @@ class Matrix3d {
236071
236372
  sumSkewSquares() {
236072
236373
  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]);
236073
236374
  }
236074
- /** Test if the matrix is a pure rotation. */
236375
+ /** Test if the matrix is a pure rotation.
236376
+ * @param allowMirror whether to widen the test to return true if the matrix is orthogonal (a pure rotation or a mirror)
236377
+ */
236075
236378
  isRigid(allowMirror = false) {
236076
236379
  return this.testPerpendicularUnitRowsAndColumns() && (allowMirror || this.determinant() > 0);
236077
236380
  }
@@ -236141,18 +236444,29 @@ class Matrix3d {
236141
236444
  }
236142
236445
  return undefined;
236143
236446
  }
236144
- /** create a new orthogonal matrix (perpendicular columns, unit length, transpose is inverse).
236145
- * columns are taken from the source Matrix3d in order indicated by the axis order.
236447
+ /** Adjust the matrix in place so that:
236448
+ * * columns are perpendicular and have unit length
236449
+ * * transpose equals inverse
236450
+ * * mirroring is removed
236451
+ * @param axisOrder how to reorder the matrix columns
236452
+ * @return whether the instance is rigid on return
236146
236453
  */
236147
- static createRigidFromMatrix3d(source, axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.XYZ, result) {
236148
- result = source.clone(result);
236149
- const maxAbs = result.maxAbs();
236454
+ makeRigid(axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.XYZ) {
236455
+ const maxAbs = this.maxAbs();
236150
236456
  if (_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(maxAbs))
236151
- return undefined;
236457
+ return false;
236152
236458
  const scale = 1.0 / maxAbs;
236153
- result.scaleColumnsInPlace(scale, scale, scale);
236154
- result.axisOrderCrossProductsInPlace(axisOrder);
236155
- if (result.normalizeColumnsInPlace())
236459
+ this.scaleColumnsInPlace(scale, scale, scale);
236460
+ this.axisOrderCrossProductsInPlace(axisOrder);
236461
+ return this.normalizeColumnsInPlace();
236462
+ }
236463
+ /** Create a new orthogonal matrix (perpendicular columns, unit length, transpose is inverse).
236464
+ * * Columns are taken from the source Matrix3d in order indicated by the axis order.
236465
+ * * Mirroring in the matrix is removed.
236466
+ */
236467
+ static createRigidFromMatrix3d(source, axisOrder = _Geometry__WEBPACK_IMPORTED_MODULE_0__.AxisOrder.XYZ, result) {
236468
+ result = source.clone(result);
236469
+ if (result.makeRigid(axisOrder))
236156
236470
  return result;
236157
236471
  return undefined;
236158
236472
  }
@@ -237585,9 +237899,19 @@ class Vector2d extends XY {
237585
237899
  }
237586
237900
  /** vector cross product {this CROSS vectorB} */
237587
237901
  crossProduct(vectorB) { return this.x * vectorB.y - this.y * vectorB.x; }
237588
- /** return the (signed) angle from this to vectorB. This is positive if the shortest turn is counterclockwise, negative if clockwise. */
237902
+ /**
237903
+ * return the (radians as a simple number, not strongly typed Angle) signed angle from this to vectorB.
237904
+ * This is positive if the shortest turn is counterclockwise, negative if clockwise.
237905
+ */
237906
+ radiansTo(vectorB) {
237907
+ return Math.atan2(this.crossProduct(vectorB), this.dotProduct(vectorB));
237908
+ }
237909
+ /**
237910
+ * return the (strongly typed) signed angle from this to vectorB.
237911
+ * This is positive if the shortest turn is counterclockwise, negative if clockwise.
237912
+ */
237589
237913
  angleTo(vectorB) {
237590
- return _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.createAtan2(this.crossProduct(vectorB), this.dotProduct(vectorB));
237914
+ return _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.createRadians(this.radiansTo(vectorB));
237591
237915
  }
237592
237916
  /* smallerUnorientedAngleTo(vectorB: Vector2d): Angle { }
237593
237917
  signedAngleTo(vectorB: Vector2d, upVector: Vector2d): Angle { }
@@ -237597,16 +237921,21 @@ class Vector2d extends XY {
237597
237921
  isInCCWSector(vectorA: Vector2d, vectorB: Vector2d, upVector: Vector2d): boolean { }
237598
237922
  */
237599
237923
  /**
237600
- * Test if `this` and `other` area parallel, with angle tolerance `Geometry.smallAngleRadiansSquared`.
237924
+ * Test if this vector is parallel to other.
237925
+ * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
237926
+ * so if you have a distance or angle tolerance t, you should pass in t * t.
237601
237927
  * @param other second vector for comparison.
237602
- * @param oppositeIsParallel if true, treat vectors 180 opposite as parallel. If false, treat those as non-parallel.
237928
+ * @param oppositeIsParallel whether to consider diametrically opposed vectors as parallel.
237929
+ * @param options optional radian and distance tolerances.
237603
237930
  */
237604
- isParallelTo(other, oppositeIsParallel = false) {
237931
+ isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false, options) {
237932
+ var _a, _b;
237933
+ const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared;
237934
+ const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared;
237605
237935
  const a2 = this.magnitudeSquared();
237606
237936
  const b2 = other.magnitudeSquared();
237607
- // we know both are 0 or positive -- no need for
237608
- if (a2 < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared || b2 < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared)
237609
- return false;
237937
+ if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)
237938
+ return returnValueIfAnInputIsZeroLength;
237610
237939
  const dot = this.dotProduct(other);
237611
237940
  if (dot < 0.0 && !oppositeIsParallel)
237612
237941
  return false;
@@ -237614,14 +237943,26 @@ class Vector2d extends XY {
237614
237943
  /* a2,b2,cross2 are squared lengths of respective vectors */
237615
237944
  /* cross2 = sin^2(theta) * a2 * b2 */
237616
237945
  /* For small theta, sin^2(theta)~~theta^2 */
237617
- return cross * cross <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared * a2 * b2;
237946
+ return cross * cross <= radianSquaredTol * a2 * b2;
237618
237947
  }
237619
237948
  /**
237620
- * Returns `true` if `this` vector is perpendicular to `other`.
237621
- * @param other second vector.
237949
+ * Test if this vector is perpendicular to other.
237950
+ * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
237951
+ * so if you have a distance or angle tolerance t, you should pass in t * t.
237952
+ * @param other second vector in comparison.
237953
+ * @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.
237954
+ * @param options optional radian and distance tolerances.
237622
237955
  */
237623
- isPerpendicularTo(other) {
237624
- return _Angle__WEBPACK_IMPORTED_MODULE_1__.Angle.isPerpendicularDotSet(this.magnitudeSquared(), other.magnitudeSquared(), this.dotProduct(other));
237956
+ isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false, options) {
237957
+ var _a, _b;
237958
+ const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared;
237959
+ const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared;
237960
+ const aa = this.magnitudeSquared();
237961
+ const bb = other.magnitudeSquared();
237962
+ if (aa < distanceSquaredTol || bb < distanceSquaredTol)
237963
+ return returnValueIfAnInputIsZeroLength;
237964
+ const ab = this.dotProduct(other);
237965
+ return ab * ab <= radianSquaredTol * aa * bb;
237625
237966
  }
237626
237967
  }
237627
237968
 
@@ -237912,24 +238253,42 @@ __webpack_require__.r(__webpack_exports__);
237912
238253
  * @public
237913
238254
  */
237914
238255
  class XYZ {
237915
- constructor(x = 0, y = 0, z = 0) { this.x = x; this.y = y; this.z = z; }
238256
+ constructor(x = 0, y = 0, z = 0) {
238257
+ this.x = x;
238258
+ this.y = y;
238259
+ this.z = z;
238260
+ }
237916
238261
  /**
237917
238262
  * Set the x,y,z parts.
237918
238263
  * @param x (optional) x part
237919
238264
  * @param y (optional) y part
237920
238265
  * @param z (optional) z part
237921
238266
  */
237922
- set(x = 0, y = 0, z = 0) { this.x = x; this.y = y; this.z = z; }
238267
+ set(x = 0, y = 0, z = 0) {
238268
+ this.x = x;
238269
+ this.y = y;
238270
+ this.z = z;
238271
+ }
237923
238272
  /** Set the x,y,z parts to zero. */
237924
- setZero() { this.x = 0; this.y = 0; this.z = 0; }
238273
+ setZero() {
238274
+ this.x = 0;
238275
+ this.y = 0;
238276
+ this.z = 0;
238277
+ }
237925
238278
  /** Type guard for XAndY.
237926
238279
  * @note this will return true for an XYAndZ. If you wish to distinguish between the two, call isXYAndZ first.
237927
238280
  */
237928
- static isXAndY(arg) { return arg.x !== undefined && arg.y !== undefined; }
238281
+ static isXAndY(arg) {
238282
+ return arg.x !== undefined && arg.y !== undefined;
238283
+ }
237929
238284
  /** Type guard to determine whether an object has a member called "z" */
237930
- static hasZ(arg) { return arg.z !== undefined; }
238285
+ static hasZ(arg) {
238286
+ return arg.z !== undefined;
238287
+ }
237931
238288
  /** Type guard for XYAndZ. */
237932
- static isXYAndZ(arg) { return this.isXAndY(arg) && this.hasZ(arg); }
238289
+ static isXYAndZ(arg) {
238290
+ return this.isXAndY(arg) && this.hasZ(arg);
238291
+ }
237933
238292
  /** Test if arg is any of:
237934
238293
  * * XAndY
237935
238294
  * * XYAndZ
@@ -238012,6 +238371,7 @@ class XYZ {
238012
238371
  /**
238013
238372
  * Set the x,y,z parts from a Vector3d
238014
238373
  * This is the same effect as `setFrom(other)` with no pretesting of variant input type
238374
+ * * Set to zeros if `other` is undefined.
238015
238375
  */
238016
238376
  setFromVector3d(other) {
238017
238377
  if (other) {
@@ -238042,13 +238402,21 @@ class XYZ {
238042
238402
  && _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSameCoordinate(this.y, other.y, tol);
238043
238403
  }
238044
238404
  /** Return a JSON object as array `[x,y,z]` */
238045
- toJSON() { return this.toArray(); }
238405
+ toJSON() {
238406
+ return this.toArray();
238407
+ }
238046
238408
  /** Return as an array `[x,y,z]` */
238047
- toArray() { return [this.x, this.y, this.z]; }
238409
+ toArray() {
238410
+ return [this.x, this.y, this.z];
238411
+ }
238048
238412
  /** Return a JSON object as key value pairs `{x: value, y: value, z: value}` */
238049
- toJSONXYZ() { return { x: this.x, y: this.y, z: this.z }; }
238413
+ toJSONXYZ() {
238414
+ return { x: this.x, y: this.y, z: this.z };
238415
+ }
238050
238416
  /** Pack the x,y,z values in a Float64Array. */
238051
- toFloat64Array() { return Float64Array.of(this.x, this.y, this.z); }
238417
+ toFloat64Array() {
238418
+ return Float64Array.of(this.x, this.y, this.z);
238419
+ }
238052
238420
  /**
238053
238421
  * Set the x,y,z properties from one of several json forms:
238054
238422
  *
@@ -238134,28 +238502,54 @@ class XYZ {
238134
238502
  }
238135
238503
  /** Return true if the x,y,z components are all nearly zero to tolerance Geometry.smallMetricDistance */
238136
238504
  get isAlmostZero() {
238137
- 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);
238505
+ return _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(this.x) &&
238506
+ _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(this.y) &&
238507
+ _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(this.z);
238138
238508
  }
238139
238509
  /** Return true if the x,y,z components are all exactly zero */
238140
- get isZero() { return this.x === 0.0 && this.y === 0.0 && this.z === 0.0; }
238510
+ get isZero() {
238511
+ return this.x === 0.0 && this.y === 0.0 && this.z === 0.0;
238512
+ }
238141
238513
  /** Return the largest absolute value of any component */
238142
- maxAbs() { return Math.max(Math.abs(this.x), Math.abs(this.y), Math.abs(this.z)); }
238514
+ maxAbs() {
238515
+ return Math.max(Math.abs(this.x), Math.abs(this.y), Math.abs(this.z));
238516
+ }
238143
238517
  /** Return the sqrt of the sum of squared x,y,z parts */
238144
- magnitude() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); }
238518
+ magnitude() {
238519
+ return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
238520
+ }
238145
238521
  /** Return the sum of squared x,y,z parts */
238146
- magnitudeSquared() { return this.x * this.x + this.y * this.y + this.z * this.z; }
238522
+ magnitudeSquared() {
238523
+ return this.x * this.x + this.y * this.y + this.z * this.z;
238524
+ }
238147
238525
  /** Return sqrt of the sum of squared x,y parts */
238148
- magnitudeXY() { return Math.sqrt(this.x * this.x + this.y * this.y); }
238526
+ magnitudeXY() {
238527
+ return Math.sqrt(this.x * this.x + this.y * this.y);
238528
+ }
238149
238529
  /** Return the sum of squared x,y parts */
238150
- magnitudeSquaredXY() { return this.x * this.x + this.y * this.y; }
238530
+ magnitudeSquaredXY() {
238531
+ return this.x * this.x + this.y * this.y;
238532
+ }
238151
238533
  /** exact equality test. */
238152
- isExactEqual(other) { return this.x === other.x && this.y === other.y && this.z === other.z; }
238534
+ isExactEqual(other) {
238535
+ return this.x === other.x && this.y === other.y && this.z === other.z;
238536
+ }
238153
238537
  /** equality test with Geometry.smallMetricDistance tolerance */
238154
- isAlmostEqualMetric(other) { return this.maxDiff(other) <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistance; }
238538
+ isAlmostEqualMetric(other) {
238539
+ return this.maxDiff(other) <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistance;
238540
+ }
238155
238541
  /** add x,y,z from other in place. */
238156
- addInPlace(other) { this.x += other.x; this.y += other.y; this.z += other.z; }
238542
+ addInPlace(other) {
238543
+ this.x += other.x;
238544
+ this.y += other.y;
238545
+ this.z += other.z;
238546
+ }
238157
238547
  /** add x,y,z from other in place. */
238158
- subtractInPlace(other) { this.x -= other.x; this.y -= other.y; this.z -= other.z; }
238548
+ subtractInPlace(other) {
238549
+ this.x -= other.x;
238550
+ this.y -= other.y;
238551
+ this.z -= other.z;
238552
+ }
238159
238553
  /** add (in place) the scaled x,y,z of other */
238160
238554
  addScaledInPlace(other, scale) {
238161
238555
  this.x += scale * other.x;
@@ -238163,11 +238557,21 @@ class XYZ {
238163
238557
  this.z += scale * other.z;
238164
238558
  }
238165
238559
  /** Multiply the x, y, z parts by scale. */
238166
- scaleInPlace(scale) { this.x *= scale; this.y *= scale; this.z *= scale; }
238560
+ scaleInPlace(scale) {
238561
+ this.x *= scale;
238562
+ this.y *= scale;
238563
+ this.z *= scale;
238564
+ }
238167
238565
  /** add to x, y, z parts */
238168
- addXYZInPlace(dx = 0.0, dy = 0.0, dz = 0.0) { this.x += dx; this.y += dy; this.z += dz; }
238566
+ addXYZInPlace(dx = 0.0, dy = 0.0, dz = 0.0) {
238567
+ this.x += dx;
238568
+ this.y += dy;
238569
+ this.z += dz;
238570
+ }
238169
238571
  /** Clone strongly typed as Point3d */
238170
- cloneAsPoint3d() { return Point3d.create(this.x, this.y, this.z); }
238572
+ cloneAsPoint3d() {
238573
+ return Point3d.create(this.x, this.y, this.z);
238574
+ }
238171
238575
  /** Return a (full length) vector from this point to other */
238172
238576
  vectorTo(other, result) {
238173
238577
  return Vector3d.create(other.x - this.x, other.y - this.y, other.z - this.z, result);
@@ -238180,9 +238584,13 @@ class XYZ {
238180
238584
  * @param other target of created vector.
238181
238585
  * @param result optional result vector.
238182
238586
  */
238183
- unitVectorTo(target, result) { return this.vectorTo(target, result).normalize(result); }
238587
+ unitVectorTo(target, result) {
238588
+ return this.vectorTo(target, result).normalize(result);
238589
+ }
238184
238590
  /** Freeze this XYZ */
238185
- freeze() { return Object.freeze(this); }
238591
+ freeze() {
238592
+ return Object.freeze(this);
238593
+ }
238186
238594
  /** access x part of XYZProps (which may be .x or [0]) */
238187
238595
  static x(xyz, defaultValue = 0) {
238188
238596
  if (xyz === undefined)
@@ -238219,7 +238627,9 @@ class XYZ {
238219
238627
  */
238220
238628
  class Point3d extends XYZ {
238221
238629
  /** Constructor for Point3d */
238222
- constructor(x = 0, y = 0, z = 0) { super(x, y, z); }
238630
+ constructor(x = 0, y = 0, z = 0) {
238631
+ super(x, y, z);
238632
+ }
238223
238633
  /**
238224
238634
  * Convert json to Point3d. Accepted forms are:
238225
238635
  * * `[1,2,3]` --- array of numbers
@@ -238227,9 +238637,15 @@ class Point3d extends XYZ {
238227
238637
  * * object with x,y, and (optional) z as numeric properties {x: xValue, y: yValue, z: zValue}
238228
238638
  * @param json json value.
238229
238639
  */
238230
- static fromJSON(json) { const val = new Point3d(); val.setFromJSON(json); return val; }
238640
+ static fromJSON(json) {
238641
+ const val = new Point3d();
238642
+ val.setFromJSON(json);
238643
+ return val;
238644
+ }
238231
238645
  /** Return a new Point3d with the same coordinates */
238232
- clone(result) { return Point3d.create(this.x, this.y, this.z, result); }
238646
+ clone(result) {
238647
+ return Point3d.create(this.x, this.y, this.z, result);
238648
+ }
238233
238649
  /** Create a new Point3d with given coordinates
238234
238650
  * @param x x part
238235
238651
  * @param y y part
@@ -238275,7 +238691,7 @@ class Point3d extends XYZ {
238275
238691
  /**
238276
238692
  * Copy and unweight xyzw.
238277
238693
  * @param xyzData flat array of x,y,z,w,x,y,z,w for multiple points
238278
- * @param pointIndex index of point to extract. This index is multiplied by 4 to obtain starting index in the array.
238694
+ * @param pointIndex index of point to extract. This index is multiplied by 4 to obtain starting index in the array.
238279
238695
  * @param result optional result point.
238280
238696
  */
238281
238697
  static createFromPackedXYZW(xyzData, pointIndex, result) {
@@ -238300,7 +238716,9 @@ class Point3d extends XYZ {
238300
238716
  return result;
238301
238717
  }
238302
238718
  /** Create a new point with 000 xyz */
238303
- static createZero(result) { return Point3d.create(0, 0, 0, result); }
238719
+ static createZero(result) {
238720
+ return Point3d.create(0, 0, 0, result);
238721
+ }
238304
238722
  /** Return the cross product of the vectors from this to pointA and pointB
238305
238723
  *
238306
238724
  * * the result is a vector
@@ -238318,7 +238736,7 @@ class Point3d extends XYZ {
238318
238736
  /** Return the triple product of the vectors from this to pointA, pointB, pointC
238319
238737
  *
238320
238738
  * * This is a scalar (number)
238321
- * * This is 6 times the (signed) volume of the tetrahedron on the 4 points.
238739
+ * * This is 6 times the (signed) volume of the tetrahedron on the 4 points.
238322
238740
  */
238323
238741
  tripleProductToPoints(pointA, pointB, pointC) {
238324
238742
  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);
@@ -238415,9 +238833,7 @@ class Point3d extends XYZ {
238415
238833
  (targetA.y - this.y) * (targetB.y - this.y) +
238416
238834
  (targetA.z - this.z) * (targetB.z - this.z);
238417
238835
  }
238418
- /** Return the fractional projection of this onto a line between points.
238419
- *
238420
- */
238836
+ /** Return the fractional projection of this onto a line between points. */
238421
238837
  fractionOfProjectionToLine(startPoint, endPoint, defaultFraction = 0) {
238422
238838
  const denominator = startPoint.distanceSquared(endPoint);
238423
238839
  if (denominator < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared)
@@ -238429,7 +238845,9 @@ class Point3d extends XYZ {
238429
238845
  * @public
238430
238846
  */
238431
238847
  class Vector3d extends XYZ {
238432
- constructor(x = 0, y = 0, z = 0) { super(x, y, z); }
238848
+ constructor(x = 0, y = 0, z = 0) {
238849
+ super(x, y, z);
238850
+ }
238433
238851
  /**
238434
238852
  * Return an array of vectors constructed from groups of 3 entries in a Float64Array.
238435
238853
  * Any incomplete group at the tail of the array is ignored.
@@ -238444,7 +238862,9 @@ class Vector3d extends XYZ {
238444
238862
  * Copy xyz from this instance to a new (or optionally reused) Vector3d
238445
238863
  * @param result optional instance to reuse.
238446
238864
  */
238447
- clone(result) { return Vector3d.create(this.x, this.y, this.z, result); }
238865
+ clone(result) {
238866
+ return Vector3d.create(this.x, this.y, this.z, result);
238867
+ }
238448
238868
  /**
238449
238869
  * return a Vector3d (new or reused from optional result)
238450
238870
  * @param x x component
@@ -238533,7 +238953,11 @@ class Vector3d extends XYZ {
238533
238953
  * * object with x,y, and (optional) z as numeric properties {x: xValue, y: yValue, z: zValue}
238534
238954
  * @param json json value.
238535
238955
  */
238536
- static fromJSON(json) { const val = new Vector3d(); val.setFromJSON(json); return val; }
238956
+ static fromJSON(json) {
238957
+ const val = new Vector3d();
238958
+ val.setFromJSON(json);
238959
+ return val;
238960
+ }
238537
238961
  /** Copy contents from another Point3d, Point2d, Vector2d, or Vector3d */
238538
238962
  static createFrom(data, result) {
238539
238963
  if (data instanceof Float64Array) {
@@ -238609,7 +239033,7 @@ class Vector3d extends XYZ {
238609
239033
  return undefined;
238610
239034
  }
238611
239035
  /**
238612
- * Set (replace) xzz components so they are a vector from point0 to point1
239036
+ * Set (replace) xyz components so they are a vector from point0 to point1
238613
239037
  * @param point0 start point of computed vector
238614
239038
  * @param point1 end point of computed vector.
238615
239039
  */
@@ -238619,13 +239043,21 @@ class Vector3d extends XYZ {
238619
239043
  this.z = point1.z - point0.z;
238620
239044
  }
238621
239045
  /** Return a vector with 000 xyz parts. */
238622
- static createZero(result) { return Vector3d.create(0, 0, 0, result); }
239046
+ static createZero(result) {
239047
+ return Vector3d.create(0, 0, 0, result);
239048
+ }
238623
239049
  /** Return a unit X vector optionally multiplied by a scale */
238624
- static unitX(scale = 1) { return new Vector3d(scale, 0, 0); }
238625
- /** Return a unit Y vector */
238626
- static unitY(scale = 1) { return new Vector3d(0, scale, 0); }
238627
- /** Return a unit Z vector */
238628
- static unitZ(scale = 1) { return new Vector3d(0, 0, scale); }
239050
+ static unitX(scale = 1) {
239051
+ return new Vector3d(scale, 0, 0);
239052
+ }
239053
+ /** Return a unit Y vector optionally multiplied by a scale */
239054
+ static unitY(scale = 1) {
239055
+ return new Vector3d(0, scale, 0);
239056
+ }
239057
+ /** Return a unit Z vector optionally multiplied by a scale */
239058
+ static unitZ(scale = 1) {
239059
+ return new Vector3d(0, 0, scale);
239060
+ }
238629
239061
  /** Divide by denominator, but return undefined if denominator is zero. */
238630
239062
  safeDivideOrNull(denominator, result) {
238631
239063
  if (denominator !== 0.0) {
@@ -238634,8 +239066,8 @@ class Vector3d extends XYZ {
238634
239066
  return undefined;
238635
239067
  }
238636
239068
  /**
238637
- * Return a pair object containing (a) property `v` which is a unit vector in the direction
238638
- * of the input and (b) property mag which is the magnitude (length) of the input (instance) prior to normalization.
239069
+ * Return a pair object containing (a) property `v` which is a unit vector in the direction of the input
239070
+ * and (b) property mag which is the magnitude (length) of the input (instance) prior to normalization.
238639
239071
  * If the instance (input) is a near zero length the `v` property of the output is undefined.
238640
239072
  * @param result optional result.
238641
239073
  */
@@ -238648,7 +239080,9 @@ class Vector3d extends XYZ {
238648
239080
  * Return a unit vector parallel with this. Return undefined if this.magnitude is near zero.
238649
239081
  * @param result optional result.
238650
239082
  */
238651
- normalize(result) { return this.normalizeWithLength(result).v; }
239083
+ normalize(result) {
239084
+ return this.normalizeWithLength(result).v;
239085
+ }
238652
239086
  /**
238653
239087
  * If this vector has nonzero length, divide by the length to change to a unit vector.
238654
239088
  * @returns true if normalization completed.
@@ -238683,7 +239117,7 @@ class Vector3d extends XYZ {
238683
239117
  /** Return a vector same length as this but rotate 90 degrees CCW */
238684
239118
  rotate90CCWXY(result) {
238685
239119
  result = result ? result : new Vector3d();
238686
- // save x,y to allow aliasing ..
239120
+ // save x,y to allow aliasing ("this" can be passed to the function as "result")
238687
239121
  const xx = this.x;
238688
239122
  const yy = this.y;
238689
239123
  result.x = -yy;
@@ -238729,17 +239163,23 @@ class Vector3d extends XYZ {
238729
239163
  return result;
238730
239164
  }
238731
239165
  /**
238732
- * Return a (new or optionally preallocated) vector that is rotated 90 degrees in the plane of this vector and the target vector.
239166
+ * Return a (new or optionally preallocated) vector that is rotated 90 degrees in
239167
+ * the plane of this vector and the target vector.
238733
239168
  * @param target Second vector which defines the plane of rotation.
238734
239169
  * @param result optional preallocated vector for result.
238735
- * @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)
239170
+ * @returns rotated vector, or undefined if the cross product of this and
239171
+ * the the target cannot be normalized (i.e. if the target and this are colinear)
238736
239172
  */
238737
239173
  rotate90Towards(target, result) {
238738
239174
  const normal = this.crossProduct(target).normalize();
238739
239175
  return normal ? normal.crossProduct(this, result) : undefined;
238740
239176
  }
238741
239177
  /** Rotate this vector 90 degrees around an axis vector.
238742
- * @returns the (new or optionally reused result) rotated vector, or undefined if the axis vector cannot be normalized.
239178
+ * * Note that simple cross is in the plane perpendicular to axis -- it loses the part
239179
+ * of "this" that is along the axis. The unit and scale is supposed to fix that.
239180
+ * This matches with Rodrigues' rotation formula because cos(theta) = 0 and sin(theta) = 1
239181
+ * @returns the (new or optionally reused result) rotated vector, or undefined if the axis
239182
+ * vector cannot be normalized.
238743
239183
  */
238744
239184
  rotate90Around(axis, result) {
238745
239185
  const unitNormal = axis.normalize();
@@ -238747,7 +239187,8 @@ class Vector3d extends XYZ {
238747
239187
  }
238748
239188
  /**
238749
239189
  * Return a vector computed at fractional position between this vector and vectorB
238750
- * @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".
239190
+ * @param fraction fractional position. 0 is at `this`. 1 is at `vectorB`.
239191
+ * True fractions are "between", negatives are "before this", beyond 1 is "beyond vectorB".
238751
239192
  * @param vectorB second vector
238752
239193
  * @param result optional preallocated result.
238753
239194
  */
@@ -238818,7 +239259,8 @@ class Vector3d extends XYZ {
238818
239259
  static createAdd2Scaled(vectorA, scaleA, vectorB, scaleB, result) {
238819
239260
  return Vector3d.create(vectorA.x * scaleA + vectorB.x * scaleB, vectorA.y * scaleA + vectorB.y * scaleB, vectorA.z * scaleA + vectorB.z * scaleB, result);
238820
239261
  }
238821
- /** Return the (strongly typed Vector3d) `thisVector3d + vectorA * scalarA + vectorB * scalarB` with all components presented as numbers */
239262
+ /** Return the (strongly typed Vector3d) `thisVector3d + vectorA * scalarA + vectorB * scalarB`
239263
+ * with all components presented as numbers */
238822
239264
  static createAdd2ScaledXYZ(ax, ay, az, scaleA, bx, by, bz, scaleB, result) {
238823
239265
  return Vector3d.create(ax * scaleA + bx * scaleB, ay * scaleA + by * scaleB, az * scaleA + bz * scaleB, result);
238824
239266
  }
@@ -238853,7 +239295,8 @@ class Vector3d extends XYZ {
238853
239295
  return this.crossProduct(vectorB, result).normalize(result);
238854
239296
  }
238855
239297
  /**
238856
- * Compute the cross product of this vector with `vectorB`. Normalize it, using given xyz as default if length is zero.
239298
+ * Compute the cross product of this vector with `vectorB`. Normalize it, using given xyz as
239299
+ * default if length is zero.
238857
239300
  * @param vectorB second vector of cross product
238858
239301
  * @param x x value for default result
238859
239302
  * @param y y value for default result
@@ -238986,17 +239429,18 @@ class Vector3d extends XYZ {
238986
239429
  return this.x * (pointB.x - pointA.x)
238987
239430
  + this.y * (pointB.y - pointA.y);
238988
239431
  }
238989
- /** Dot product with vector from pointA to pointB, with pointB given as (weighted) x,y,z,w
238990
- * * pointB is a homogeneous point that has to be unweighted
239432
+ /** Dot product with vector from pointA to pointB, with pointB given as (weighted) wx,wy,wz,w
239433
+ * * We need to unweight pointB (which is a homogeneous point) to be able to participate in the
239434
+ * vector dot product
238991
239435
  * * if the weight is near zero metric, the return is zero.
238992
239436
  */
238993
- dotProductStartEndXYZW(pointA, x, y, z, w) {
239437
+ dotProductStartEndXYZW(pointA, wx, wy, wz, w) {
238994
239438
  if (_Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.isSmallMetricDistance(w))
238995
239439
  return 0.0;
238996
239440
  const dw = 1.0 / w;
238997
- return this.x * (dw * x - pointA.x)
238998
- + this.y * (dw * y - pointA.y)
238999
- + this.z * (dw * z - pointA.z);
239441
+ return this.x * (dw * wx - pointA.x)
239442
+ + this.y * (dw * wy - pointA.y)
239443
+ + this.z * (dw * wz - pointA.z);
239000
239444
  }
239001
239445
  /** Return the dot product of the instance and vectorB, using only the x and y parts. */
239002
239446
  dotProductXY(vectorB) {
@@ -239038,46 +239482,93 @@ class Vector3d extends XYZ {
239038
239482
  return Vector3d.createCrossProduct(this.x, this.y, this.z, x, y, z, result);
239039
239483
  }
239040
239484
  /**
239041
- * Return the (Strongly typed) angle from this vector to vectorB.
239485
+ * Return the (radians as a simple number, not strongly typed Angle) angle from this vector to vectorB.
239486
+ * * The returned angle is always positive and no larger than 180 degrees (PI radians)
239487
+ * * The returned angle is "in the plane containing the two vectors"
239488
+ * * Use `planarRadiansTo` and `signedRadiansTo` to take have angle measured in specific plane.
239489
+ * @param vectorB target vector of rotation.
239490
+ */
239491
+ radiansTo(vectorB) {
239492
+ // ||axb|| = ||a|| ||b|| |sin(t)| and a.b = ||a|| ||b|| cos(t) ==>
239493
+ // ||axb|| / a.b = sin(t)/cos(t) = tan(t) ==> t = arctan(||axb|| / a.b).
239494
+ return Math.atan2(this.crossProductMagnitude(vectorB), this.dotProduct(vectorB));
239495
+ }
239496
+ /**
239497
+ * Return the (strongly typed) angle from this vector to vectorB.
239042
239498
  * * The returned angle is always positive and no larger than 180 degrees (PI radians)
239043
239499
  * * The returned angle is "in the plane containing the two vectors"
239044
- * * Use `planarAngleTo`, `signedAngleTo`, `angleToXY` to take have angle measured in specific plane.
239500
+ * * Use `planarAngleTo` and `signedAngleTo` to take have angle measured in specific plane.
239045
239501
  * @param vectorB target vector of rotation.
239046
239502
  */
239047
239503
  angleTo(vectorB) {
239048
- return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createAtan2(this.crossProductMagnitude(vectorB), this.dotProduct(vectorB));
239504
+ return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.radiansTo(vectorB));
239049
239505
  }
239050
239506
  /**
239051
- * Return the (Strongly typed) angle from this vector to the plane perpendicular to planeNormal.
239507
+ * Return the (strongly typed) angle from this vector to the plane perpendicular to planeNormal.
239052
239508
  * * The returned vector is signed
239053
- * * The returned vector is (as degrees) always less than or equal to 90 degrees.
239054
- * @param planeNormal a normal vector to the plane
239509
+ * * The returned vector is (as degrees) always between -90 and 90 degrees.
239510
+ * * The function returns "PI/2 - angleTo(planeNormal)"
239511
+ * @param planeNormal a normal vector to the plane.
239055
239512
  */
239056
- angleFromPerpendicular(vectorB) {
239057
- return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createAtan2(this.dotProduct(vectorB), this.crossProductMagnitude(vectorB));
239513
+ angleFromPerpendicular(planeNormal) {
239514
+ return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createAtan2(this.dotProduct(planeNormal), this.crossProductMagnitude(planeNormal));
239058
239515
  }
239059
239516
  /**
239060
- * Return the (Strongly typed) angle from this vector to vectorB,using only the xy parts.
239061
- * * 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.
239062
- * * Use `planarAngleTo`, `signedAngleTo`, `angleToXY` to take have angle measured in other planes.
239517
+ * Return the (Strongly typed) angle from this vector to vectorB, using only the xy parts.
239518
+ * * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180
239519
+ * * degrees (positive PI radians), not closed on the negative side.
239520
+ * * Use `planarAngleTo` and `signedAngleTo` to take have angle measured in other planes.
239063
239521
  * @param vectorB target vector of rotation.
239064
239522
  */
239065
239523
  angleToXY(vectorB) {
239066
239524
  return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createAtan2(this.crossProductXY(vectorB), this.dotProductXY(vectorB));
239067
239525
  }
239526
+ /**
239527
+ * Return the (simple number of radians, not Strongly typed Angle) angle from this vector to vectorB, measured
239528
+ * in the plane containing both, with vectorW indicating which side to view to control sign of the angle.
239529
+ * * The returned angle can range from negative PI to positive PI (not closed on negative side)
239530
+ * * The returned angle is "in the plane containing the two vectors"
239531
+ * * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
239532
+ * * vectorW does not have to be perpendicular to the plane.
239533
+ * @param vectorB target vector of rotation.
239534
+ * @param vectorW distinguishes between the sides of the plane.
239535
+ */
239536
+ signedRadiansTo(vectorB, vectorW) {
239537
+ const p = this.crossProduct(vectorB);
239538
+ const theta = Math.atan2(p.magnitude(), this.dotProduct(vectorB));
239539
+ if (vectorW.dotProduct(p) < 0.0)
239540
+ return -theta;
239541
+ else
239542
+ return theta;
239543
+ }
239544
+ /**
239545
+ * Return the (strongly typed Angle) angle from this vector to vectorB, measured in the plane containing both,
239546
+ * with vectorW indicating which side to view to control sign of the angle.
239547
+ * * The returned angle can range from negative 180 degrees (negative PI radians) to positive 180 degrees
239548
+ * * (positive PI radians), not closed on the negative side.
239549
+ * * The returned angle is "in the plane containing the two vectors"
239550
+ * * `vectorW` distinguishes between the sides of the plane, but does not have to be perpendicular.
239551
+ * * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
239552
+ * @param vectorB target vector of rotation.
239553
+ * @param vectorW distinguishes between the sides of the plane.
239554
+ */
239555
+ signedAngleTo(vectorB, vectorW) {
239556
+ return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.signedRadiansTo(vectorB, vectorW));
239557
+ }
239068
239558
  /**
239069
239559
  * Return the (radians as a simple number, not strongly typed Angle) radians from this vector to vectorB.
239070
239560
  * * The returned angle can be positive or negative, with magnitude no larger than PI radians
239071
239561
  * * Use signedRadiansTo` to take have angle measured in other planes.
239072
239562
  * @param vectorB target vector of rotation.
239563
+ * @param planeNormal a normal vector to the plane.
239073
239564
  */
239074
- planarRadiansTo(vector, planeNormal) {
239565
+ planarRadiansTo(vectorB, planeNormal) {
239075
239566
  const square = planeNormal.dotProduct(planeNormal);
239076
239567
  if (square === 0.0)
239077
239568
  return 0.0;
239078
239569
  const factor = 1.0 / square;
239079
239570
  const projection0 = this.plusScaled(planeNormal, -this.dotProduct(planeNormal) * factor);
239080
- const projection1 = vector.plusScaled(planeNormal, -vector.dotProduct(planeNormal) * factor);
239571
+ const projection1 = vectorB.plusScaled(planeNormal, -vectorB.dotProduct(planeNormal) * factor);
239081
239572
  return projection0.signedRadiansTo(projection1, planeNormal);
239082
239573
  }
239083
239574
  /**
@@ -239085,86 +239576,67 @@ class Vector3d extends XYZ {
239085
239576
  * * The returned angle can range from negative PI to positive PI (not closed on negative side)
239086
239577
  * * Use signedRadiansTo` to take have angle measured in other planes.
239087
239578
  * @param vectorB target vector of rotation.
239579
+ * @param planeNormal a normal vector to the plane.
239088
239580
  */
239089
- planarAngleTo(vector, planeNormal) {
239090
- return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.planarRadiansTo(vector, planeNormal));
239091
- }
239092
- /**
239093
- * 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.
239094
- * * The returned angle can range from negative PI to positive PI (not closed on negative side)
239095
- * * The returned angle is "in the plane containing the two vectors"
239096
- * * `vectorW` distinguishes between the sides of the plane, but does not have to be perpendicular.
239097
- * * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
239098
- * @param vectorB target vector of rotation.
239099
- */
239100
- signedRadiansTo(vector1, vectorW) {
239101
- const p = this.crossProduct(vector1);
239102
- const theta = Math.atan2(p.magnitude(), this.dotProduct(vector1));
239103
- if (vectorW.dotProduct(p) < 0.0)
239104
- return -theta;
239105
- else
239106
- return theta;
239107
- }
239108
- /**
239109
- * 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.
239110
- * * 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.
239111
- * * The returned angle is "in the plane containing the two vectors"
239112
- * * `vectorW` distinguishes between the sides of the plane, but does not have to be perpendicular.
239113
- * * The returned angle has the same sign as vectorW dot product (thisVector cross vectorB)
239114
- * @param vectorB target vector of rotation.
239115
- */
239116
- signedAngleTo(vector1, vectorW) { return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.signedRadiansTo(vector1, vectorW)); }
239117
- /** Return the smallest (strongly typed) angle from the (bidirectional) line containing `this` to the (bidirectional) line containing `vectorB` */
239118
- smallerUnorientedAngleTo(vectorB) {
239119
- return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.smallerUnorientedRadiansTo(vectorB));
239581
+ planarAngleTo(vectorB, planeNormal) {
239582
+ return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.planarRadiansTo(vectorB, planeNormal));
239120
239583
  }
239121
- /** Return the smallest angle (in radians) from the (bidirectional) line containing `this` to the (bidirectional) line containing `vectorB` */
239584
+ /** Return the smallest angle (in radians) from the (bidirectional) line containing `this`
239585
+ * to the (bidirectional) line containing `vectorB` */
239122
239586
  smallerUnorientedRadiansTo(vectorB) {
239123
239587
  const c = this.dotProduct(vectorB);
239124
239588
  const s = this.crossProductMagnitude(vectorB);
239125
239589
  return Math.atan2(Math.abs(s), Math.abs(c));
239126
239590
  }
239127
- /*
239128
- signedAngleTo(vectorB: Vector3d, upVector: Vector3d): Angle { }
239129
- // sectors
239130
- isInSmallerSector(vectorA: Vector3d, vectorB: Vector3d): boolean { }
239131
- isInCCWSector(vectorA: Vector3d, vectorB: Vector3d, upVector: Vector3d): boolean { }
239132
- */
239591
+ /** Return the smallest (strongly typed) angle from the (bidirectional) line containing `this`
239592
+ * to the (bidirectional) line containing `vectorB` */
239593
+ smallerUnorientedAngleTo(vectorB) {
239594
+ return _Angle__WEBPACK_IMPORTED_MODULE_2__.Angle.createRadians(this.smallerUnorientedRadiansTo(vectorB));
239595
+ }
239133
239596
  /**
239134
239597
  * Test if this vector is parallel to other.
239598
+ * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
239599
+ * so if you have a distance or angle tolerance t, you should pass in t * t.
239135
239600
  * @param other second vector in comparison
239136
- * @param oppositeIsParallel if the vectors are on the same line but in opposite directions, return this value.
239601
+ * @param oppositeIsParallel whether to consider diametrically opposed vectors as parallel
239137
239602
  * @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.
239603
+ * @param options optional radian and distance tolerances.
239138
239604
  */
239139
- isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false) {
239605
+ isParallelTo(other, oppositeIsParallel = false, returnValueIfAnInputIsZeroLength = false, options) {
239606
+ var _a, _b;
239607
+ const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared;
239608
+ const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared;
239140
239609
  const a2 = this.magnitudeSquared();
239141
239610
  const b2 = other.magnitudeSquared();
239142
- // we know both are 0 or positive -- no need for
239143
- if (a2 < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared || b2 < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared)
239611
+ if (a2 < distanceSquaredTol || b2 < distanceSquaredTol)
239144
239612
  return returnValueIfAnInputIsZeroLength;
239145
239613
  const dot = this.dotProduct(other);
239146
239614
  if (dot < 0.0 && !oppositeIsParallel)
239147
- return returnValueIfAnInputIsZeroLength;
239615
+ return false;
239148
239616
  const cross2 = this.crossProductMagnitudeSquared(other);
239149
239617
  /* a2,b2,cross2 are squared lengths of respective vectors */
239150
239618
  /* cross2 = sin^2(theta) * a2 * b2 */
239151
239619
  /* For small theta, sin^2(theta)~~theta^2 */
239152
- return cross2 <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared * a2 * b2;
239620
+ return cross2 <= radianSquaredTol * a2 * b2;
239153
239621
  }
239154
239622
  /**
239155
239623
  * Test if this vector is perpendicular to other.
239624
+ * * The input tolerances in `options`, if given, are considered to be squared for efficiency's sake,
239625
+ * so if you have a distance or angle tolerance t, you should pass in t * t.
239156
239626
  * @param other second vector in comparison
239157
239627
  * @param returnValueIfAnInputIsZeroLength if either vector is near zero length, return this value.
239628
+ * @param options optional radian and distance tolerances.
239158
239629
  */
239159
- isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false) {
239630
+ isPerpendicularTo(other, returnValueIfAnInputIsZeroLength = false, options) {
239631
+ var _a, _b;
239632
+ const radianSquaredTol = (_a = options === null || options === void 0 ? void 0 : options.radianSquaredTol) !== null && _a !== void 0 ? _a : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared;
239633
+ const distanceSquaredTol = (_b = options === null || options === void 0 ? void 0 : options.distanceSquaredTol) !== null && _b !== void 0 ? _b : _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared;
239160
239634
  const aa = this.magnitudeSquared();
239161
- if (aa < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared)
239162
- return returnValueIfAnInputIsZeroLength;
239163
239635
  const bb = other.magnitudeSquared();
239164
- if (bb < _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallMetricDistanceSquared)
239636
+ if (aa < distanceSquaredTol || bb < distanceSquaredTol)
239165
239637
  return returnValueIfAnInputIsZeroLength;
239166
239638
  const ab = this.dotProduct(other);
239167
- return ab * ab <= _Geometry__WEBPACK_IMPORTED_MODULE_0__.Geometry.smallAngleRadiansSquared * aa * bb;
239639
+ return ab * ab <= radianSquaredTol * aa * bb;
239168
239640
  }
239169
239641
  }
239170
239642
 
@@ -243025,7 +243497,6 @@ class Range1d extends RangeBase {
243025
243497
  return Range1d.createXXOrCorrectToNull(Math.max(this.low, other.low), Math.min(this.high, other.high), result);
243026
243498
  }
243027
243499
  /** Return the union of ranges. */
243028
- /** Return the intersection of ranges. */
243029
243500
  union(other, result) {
243030
243501
  // we trust null ranges have EXTREME values, so a null in either input leads to expected results.
243031
243502
  return Range1d.createXX(Math.min(this.low, other.low), Math.max(this.high, other.high), result);
@@ -270745,8 +271216,8 @@ var IModelJson;
270745
271216
  // optional specific X
270746
271217
  const radiusX = Reader.parseNumberProperty(json, "radiusX", radius);
270747
271218
  // missing Y and Z both pick up radiusX (which may have already been defaulted from unqualified radius)
270748
- const radiusY = Reader.parseNumberProperty(json, "radiusX", radiusX);
270749
- const radiusZ = Reader.parseNumberProperty(json, "radiusX", radiusX);
271219
+ const radiusY = Reader.parseNumberProperty(json, "radiusY", radiusX);
271220
+ const radiusZ = Reader.parseNumberProperty(json, "radiusZ", radiusX);
270750
271221
  const latitudeStartEnd = Reader.parseAngleSweepProps(json, "latitudeStartEnd"); // this may be undefined!!
270751
271222
  const axes = Reader.parseOrientation(json, true);
270752
271223
  const capped = Reader.parseBooleanProperty(json, "capped", false);
@@ -270771,7 +271242,7 @@ var IModelJson;
270771
271242
  }
270772
271243
  /** Parse TorusPipe props to TorusPipe instance. */
270773
271244
  static parseTorusPipe(json) {
270774
- const axes = Reader.parseOrientation(json, true);
271245
+ const axes = Reader.parseOrientation(json, true); // force frame to be pure rotation (no scale or mirror)!
270775
271246
  const center = Reader.parsePoint3dProperty(json, "center");
270776
271247
  const radiusA = Reader.parseNumberProperty(json, "majorRadius");
270777
271248
  const radiusB = Reader.parseNumberProperty(json, "minorRadius");
@@ -271103,6 +271574,7 @@ var IModelJson;
271103
271574
  const radiusB = data.getMinorRadius();
271104
271575
  const sweep = data.getSweepAngle();
271105
271576
  if (data.getIsReversed()) {
271577
+ // the TorusPipe was created with negative sweep that was forced positive; restore original values
271106
271578
  vectorY.scaleInPlace(-1.0);
271107
271579
  sweep.setRadians(-sweep.radians);
271108
271580
  }
@@ -272866,16 +273338,16 @@ class Sphere extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimitive
272866
273338
  const factors = this._localToWorld.matrix.factorRigidWithSignedScale();
272867
273339
  if (!factors)
272868
273340
  return undefined;
272869
- if (factors && factors.scale > 0)
273341
+ if (factors && factors.scale > 0) // why do we rule out mirror?
272870
273342
  return factors.scale;
272871
273343
  return undefined;
272872
273344
  }
272873
273345
  /**
272874
- * Return the larger of the primary xyz axis radii
273346
+ * Return the largest of the primary xyz axis radii
272875
273347
  */
272876
273348
  maxAxisRadius() {
272877
273349
  const matrix = this._localToWorld.matrix;
272878
- return _Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.maxXYZ(matrix.columnXMagnitude(), matrix.columnYMagnitude(), matrix.columnYMagnitude());
273350
+ return _Geometry__WEBPACK_IMPORTED_MODULE_4__.Geometry.maxXYZ(matrix.columnXMagnitude(), matrix.columnYMagnitude(), matrix.columnZMagnitude());
272879
273351
  }
272880
273352
  /**
272881
273353
  * Return a (clone of) the sphere's local to world transformation.
@@ -273364,13 +273836,13 @@ __webpack_require__.r(__webpack_exports__);
273364
273836
  * A torus pipe is a partial torus (donut). In a local coordinate system
273365
273837
  * * The z axis passes through the hole.
273366
273838
  * * The "major hoop" arc has
273367
- * * vectorTheta0 = (radiusA,0,0)
273368
- * * vectorTheta90 = (0, radiusA,0)
273839
+ * * vectorTheta0 = (radiusA, 0, 0)
273840
+ * * vectorTheta90 = (0, radiusA, 0)
273369
273841
  * * The major arc point at angle theta is `C(theta) = vectorTheta0 * cos(theta) + vectorTheta90 * sin(theta)
273370
273842
  * * The minor hoop at theta various with phi "around the minor hoop"
273371
- * * (x,y,z) = C(theta) + (radiusB *cos(theta), radiusB * sin(theta)) * cos(phi) + (0,radiusB,0) * sin(phi)
273843
+ * * (x,y,z) = C(theta) + (radiusB * cos(theta), radiusB * sin(theta), 0) * cos(phi) + (0, 0, radiusB) * sin(phi)
273372
273844
  * * The stored form of the torus pipe is oriented for positive volume:
273373
- * * Both radii are positive, with r0 >= r1 > 0
273845
+ * * Both radii are positive, with radiusA >= radiusB > 0
273374
273846
  * * The sweep is positive
273375
273847
  * * The coordinate system has positive determinant.
273376
273848
  * * For uv parameterization,
@@ -273381,6 +273853,7 @@ __webpack_require__.r(__webpack_exports__);
273381
273853
  * @public
273382
273854
  */
273383
273855
  class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimitive {
273856
+ // constructor captures the pointers!
273384
273857
  constructor(map, radiusA, radiusB, sweep, capped) {
273385
273858
  super(capped);
273386
273859
  /** String name for schema properties */
@@ -273407,11 +273880,12 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
273407
273880
  /** Clone this TorusPipe and transform the clone */
273408
273881
  cloneTransformed(transform) {
273409
273882
  const result = this.clone();
273410
- transform.multiplyTransformTransform(result._localToWorld, result._localToWorld);
273883
+ if (!result.tryTransformInPlace(transform))
273884
+ return undefined;
273411
273885
  return result;
273412
273886
  }
273413
273887
  /** Create a new `TorusPipe`
273414
- * @param frame local to world transformation
273888
+ * @param frame local to world transformation. For best results, the matrix part should be a pure rotation.
273415
273889
  * @param majorRadius major hoop radius
273416
273890
  * @param minorRadius minor hoop radius
273417
273891
  * @param sweep sweep angle for major circle, with positive sweep from x axis towards y axis.
@@ -273429,12 +273903,12 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
273429
273903
  return undefined;
273430
273904
  if (sweep.isAlmostZero)
273431
273905
  return undefined;
273432
- const xScale = 1.0;
273906
+ // remove mirror and negative sweep
273433
273907
  let yScale = 1.0;
273434
273908
  let zScale = 1.0;
273909
+ let isReversed = false;
273435
273910
  if (frame.matrix.determinant() < 0.0)
273436
273911
  zScale *= -1.0;
273437
- let isReversed = false;
273438
273912
  const sweep1 = sweep.clone();
273439
273913
  if (sweep.radians < 0.0) {
273440
273914
  sweep1.setRadians(-sweep.radians);
@@ -273443,15 +273917,14 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
273443
273917
  isReversed = true;
273444
273918
  }
273445
273919
  const frame1 = frame.clone();
273446
- frame1.matrix.scaleColumns(xScale, yScale, zScale, frame1.matrix);
273920
+ frame1.matrix.scaleColumnsInPlace(1, yScale, zScale);
273447
273921
  const result = new TorusPipe(frame1, majorRadius, minorRadius, sweep1, capped);
273448
273922
  result._isReversed = isReversed;
273449
273923
  return result;
273450
273924
  }
273451
273925
  /** Create a TorusPipe from the typical parameters of the Dgn file */
273452
273926
  static createDgnTorusPipe(center, vectorX, vectorY, majorRadius, minorRadius, sweep, capped) {
273453
- const vectorZ = vectorX.crossProduct(vectorY);
273454
- vectorZ.scaleToLength(vectorX.magnitude(), vectorZ);
273927
+ const vectorZ = vectorX.unitCrossProductWithDefault(vectorY, 0, 0, 1);
273455
273928
  const frame = _geometry3d_Transform__WEBPACK_IMPORTED_MODULE_2__.Transform.createOriginAndMatrixColumns(center, vectorX, vectorY, vectorZ);
273456
273929
  return TorusPipe.createInFrame(frame, majorRadius, minorRadius, sweep, capped);
273457
273930
  }
@@ -273466,28 +273939,41 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
273466
273939
  }
273467
273940
  /** Return a coordinate frame (right handed, unit axes)
273468
273941
  * * origin at center of major circle
273469
- * * major circle in xy plane
273470
- * * z axis perpendicular
273942
+ * * major circle in plane of first two columns
273943
+ * * last column perpendicular to first two
273471
273944
  */
273472
273945
  getConstructiveFrame() {
273473
273946
  return this._localToWorld.cloneRigid();
273474
273947
  }
273475
273948
  /** Return the center of the torus pipe (inside the donut hole) */
273476
273949
  cloneCenter() { return this._localToWorld.getOrigin(); }
273477
- /** return the vector along the x axis (in the major hoops plane) */
273478
- cloneVectorX() { return this._localToWorld.matrix.columnX(); }
273479
- /** return the vector along the y axis (in the major hoop plane) */
273480
- cloneVectorY() { return this._localToWorld.matrix.columnY(); }
273481
- /** get the minor hoop radius (`radiusA`) */
273482
- getMinorRadius() { return this._radiusB; }
273483
- /** get the major hoop radius (`radiusB`) */
273484
- getMajorRadius() { return this._radiusA; }
273950
+ /** return unit vector along the x axis (in the major hoop plane) */
273951
+ cloneVectorX() {
273952
+ const xAxis = this._localToWorld.matrix.columnX();
273953
+ return xAxis.normalizeWithDefault(1, 0, 0, xAxis);
273954
+ }
273955
+ /** return unit vector along the y axis (in the major hoop plane) */
273956
+ cloneVectorY() {
273957
+ const yAxis = this._localToWorld.matrix.columnY();
273958
+ return yAxis.normalizeWithDefault(0, 1, 0, yAxis);
273959
+ }
273960
+ /** return unit vector along the z axis */
273961
+ cloneVectorZ() {
273962
+ const zAxis = this._localToWorld.matrix.columnZ();
273963
+ return zAxis.normalizeWithDefault(0, 0, 1, zAxis);
273964
+ }
273965
+ /** get the major hoop radius (`radiusA`) in world coordinates */
273966
+ getMajorRadius() { return this._radiusA * this._localToWorld.matrix.columnXMagnitude(); }
273967
+ /** get the minor hoop radius (`radiusB`) in world coordinates */
273968
+ getMinorRadius() { return this._radiusB * this._localToWorld.matrix.columnZMagnitude(); }
273485
273969
  /** get the sweep angle along the major circle. */
273486
273970
  getSweepAngle() { return this._sweep.clone(); }
273487
273971
  /** Ask if this TorusPipe is labeled as reversed */
273488
273972
  getIsReversed() { return this._isReversed; }
273489
273973
  /** Return the sweep angle as a fraction of full 360 degrees (2PI radians) */
273490
273974
  getThetaFraction() { return this._sweep.radians / (Math.PI * 2.0); }
273975
+ /** Return a (clone of) the TorusPipe's local to world transformation. */
273976
+ cloneLocalToWorld() { return this._localToWorld.clone(); }
273491
273977
  /** ask if `other` is an instance of `TorusPipe` */
273492
273978
  isSameGeometryClass(other) { return other instanceof TorusPipe; }
273493
273979
  /** test if `this` and `other` have nearly equal geometry */
@@ -273495,11 +273981,24 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
273495
273981
  if (other instanceof TorusPipe) {
273496
273982
  if ((!this._sweep.isFullCircle) && this.capped !== other.capped)
273497
273983
  return false;
273498
- if (!this._localToWorld.isAlmostEqual(other._localToWorld))
273984
+ // Compare getter output so that we can equate TorusPipes created/transformed in equivalent ways.
273985
+ // In particular, the column vectors contribute their scale to the radii, so we ignore their length.
273986
+ if (!this.cloneCenter().isAlmostEqual(other.cloneCenter()))
273499
273987
  return false;
273500
- return _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isSameCoordinate(this._radiusA, other._radiusA)
273501
- && _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isSameCoordinate(this._radiusB, other._radiusB)
273502
- && this._sweep.isAlmostEqualNoPeriodShift(other._sweep);
273988
+ if (!this.cloneVectorX().isAlmostEqual(other.cloneVectorX()))
273989
+ return false;
273990
+ if (!this.cloneVectorY().isAlmostEqual(other.cloneVectorY()))
273991
+ return false;
273992
+ if (!this.cloneVectorZ().isAlmostEqual(other.cloneVectorZ()))
273993
+ return false;
273994
+ if (!_Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isSameCoordinate(this.getMinorRadius(), other.getMinorRadius()))
273995
+ return false;
273996
+ if (!_Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.isSameCoordinate(this.getMajorRadius(), other.getMajorRadius()))
273997
+ return false;
273998
+ if (!this.getSweepAngle().isAlmostEqualNoPeriodShift(other.getSweepAngle()))
273999
+ return false;
274000
+ // ignore _isReversed; it doesn't affect geometry
274001
+ return true;
273503
274002
  }
273504
274003
  return false;
273505
274004
  }
@@ -273518,19 +274017,19 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
273518
274017
  const thetaRadians = this.vFractionToRadians(v);
273519
274018
  const c0 = Math.cos(thetaRadians);
273520
274019
  const s0 = Math.sin(thetaRadians);
273521
- const majorRadius = this.getMajorRadius();
273522
- const minorRadius = this.getMinorRadius();
274020
+ const majorRadius = this._radiusA;
274021
+ const minorRadius = this._radiusB;
273523
274022
  const center = this._localToWorld.multiplyXYZ(majorRadius * c0, majorRadius * s0, 0);
273524
274023
  const vector0 = this._localToWorld.multiplyVectorXYZ(minorRadius * c0, minorRadius * s0, 0);
273525
274024
  const vector90 = this._localToWorld.multiplyVectorXYZ(0, 0, minorRadius);
273526
274025
  return _curve_Loop__WEBPACK_IMPORTED_MODULE_4__.Loop.create(_curve_Arc3d__WEBPACK_IMPORTED_MODULE_5__.Arc3d.create(center, vector0, vector90));
273527
274026
  }
273528
- /** Return an arc at constant u, and arc sweep matching this TorusPipe sweep. */
274027
+ /** Return an arc at constant u, and arc sweep matching this TorusPipe sweep. */
273529
274028
  constantUSection(uFraction) {
273530
274029
  const theta1Radians = this._sweep.radians;
273531
- const phiRadians = uFraction * Math.PI;
273532
- const majorRadius = this.getMajorRadius();
273533
- const minorRadius = this.getMinorRadius();
274030
+ const phiRadians = uFraction * 2 * Math.PI;
274031
+ const majorRadius = this._radiusA;
274032
+ const minorRadius = this._radiusB;
273534
274033
  const transform = this._localToWorld;
273535
274034
  const axes = transform.matrix;
273536
274035
  const center = this._localToWorld.multiplyXYZ(0, 0, minorRadius * Math.sin(phiRadians));
@@ -273542,8 +274041,8 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
273542
274041
  /** extend `rangeToExtend` to include this `TorusPipe` */
273543
274042
  extendRange(rangeToExtend, transform) {
273544
274043
  const theta1Radians = this._sweep.radians;
273545
- const majorRadius = this.getMajorRadius();
273546
- const minorRadius = this.getMinorRadius();
274044
+ const majorRadius = this._radiusA;
274045
+ const minorRadius = this._radiusB;
273547
274046
  const transform0 = this._localToWorld;
273548
274047
  const numThetaSample = Math.ceil(theta1Radians / (Math.PI / 16.0));
273549
274048
  const numHalfPhiSample = 16;
@@ -273583,7 +274082,7 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
273583
274082
  else {
273584
274083
  for (j = 0; j <= numPhiSample; j++) {
273585
274084
  phi = phi0 + j * dPhi;
273586
- rxy = majorRadius + minorRadius * Math.sin(phi);
274085
+ rxy = majorRadius + minorRadius * Math.cos(phi);
273587
274086
  rangeToExtend.extendTransformedXYZ(transform0, cosTheta * rxy, sinTheta * rxy, Math.sin(phi) * minorRadius);
273588
274087
  }
273589
274088
  }
@@ -273598,8 +274097,9 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
273598
274097
  const phiRadians = u * Math.PI * 2.0;
273599
274098
  const cosTheta = Math.cos(thetaRadians);
273600
274099
  const sinTheta = Math.sin(thetaRadians);
273601
- const minorRadius = this.getMinorRadius();
273602
- const rxy = this.getMajorRadius() + Math.cos(phiRadians) * minorRadius;
274100
+ const majorRadius = this._radiusA;
274101
+ const minorRadius = this._radiusB;
274102
+ const rxy = majorRadius + Math.cos(phiRadians) * minorRadius;
273603
274103
  return this._localToWorld.multiplyXYZ(rxy * cosTheta, rxy * sinTheta, minorRadius * Math.sin(phiRadians), result);
273604
274104
  }
273605
274105
  /** Evaluate as a uv surface, returning point and two vectors.
@@ -273615,8 +274115,9 @@ class TorusPipe extends _SolidPrimitive__WEBPACK_IMPORTED_MODULE_0__.SolidPrimit
273615
274115
  const sinTheta = Math.sin(thetaRadians);
273616
274116
  const sinPhi = Math.sin(phiRadians);
273617
274117
  const cosPhi = Math.cos(phiRadians);
273618
- const minorRadius = this.getMinorRadius();
273619
- const rxy = this.getMajorRadius() + Math.cos(phiRadians) * minorRadius;
274118
+ const majorRadius = this._radiusA;
274119
+ const minorRadius = this._radiusB;
274120
+ const rxy = majorRadius + Math.cos(phiRadians) * minorRadius;
273620
274121
  const rSinPhi = minorRadius * sinPhi;
273621
274122
  const rCosPhi = minorRadius * cosPhi; // appears only as derivative of rSinPhi.
273622
274123
  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);
@@ -274465,7 +274966,7 @@ class HalfEdge {
274465
274966
  }
274466
274967
  /**
274467
274968
  * Pinch this half edge out of its base vertex loop.
274468
- * * if this the half edge (possibly undefined)
274969
+ * @return the surviving HalfEdge in the vertex loop, or undefined if the instance HalfEdge is already dangling
274469
274970
  */
274470
274971
  yankFromVertexLoop() {
274471
274972
  const other = this.edgeMate.faceSuccessor;
@@ -278178,7 +278679,7 @@ __webpack_require__.r(__webpack_exports__);
278178
278679
  */
278179
278680
  class Triangulator {
278180
278681
  /** Given the six nodes that make up two bordering triangles, "pinch" and relocate the nodes to flip them
278181
- * * The shared edge mates are a and d.
278682
+ * * The shared edge mates are c and e.
278182
278683
  * * (abc) are a triangle in CCW order
278183
278684
  * * (dfe) are a triangle in CCW order. (!! node dfe instead of def.)
278184
278685
  */
@@ -310089,7 +310590,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
310089
310590
  /***/ ((module) => {
310090
310591
 
310091
310592
  "use strict";
310092
- 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"}}]}}');
310593
+ 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"}}]}}');
310093
310594
 
310094
310595
  /***/ })
310095
310596