@itwin/core-geometry 3.1.0-dev.6 → 3.2.0-dev.0

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.
Files changed (176) hide show
  1. package/CHANGELOG.md +43 -3
  2. package/lib/cjs/bspline/BSplineCurve.d.ts +8 -0
  3. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  4. package/lib/cjs/bspline/BSplineCurve.js +14 -0
  5. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  6. package/lib/cjs/bspline/BezierCurveBase.d.ts +8 -0
  7. package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
  8. package/lib/cjs/bspline/BezierCurveBase.js +16 -1
  9. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  10. package/lib/cjs/curve/Arc3d.d.ts +6 -0
  11. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  12. package/lib/cjs/curve/Arc3d.js +31 -0
  13. package/lib/cjs/curve/Arc3d.js.map +1 -1
  14. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +8 -1
  15. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  16. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +22 -2
  17. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  18. package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +1 -1
  19. package/lib/cjs/curve/CurveCurveIntersectXY.js +3 -1
  20. package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
  21. package/lib/cjs/curve/CurveFactory.d.ts +7 -3
  22. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  23. package/lib/cjs/curve/CurveFactory.js +30 -15
  24. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  25. package/lib/cjs/curve/CurvePrimitive.d.ts +23 -9
  26. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  27. package/lib/cjs/curve/CurvePrimitive.js +18 -0
  28. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  29. package/lib/cjs/curve/LineSegment3d.d.ts +6 -0
  30. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  31. package/lib/cjs/curve/LineSegment3d.js +14 -0
  32. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  33. package/lib/cjs/curve/LineString3d.d.ts +7 -0
  34. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  35. package/lib/cjs/curve/LineString3d.js +20 -0
  36. package/lib/cjs/curve/LineString3d.js.map +1 -1
  37. package/lib/cjs/curve/ProxyCurve.d.ts +6 -2
  38. package/lib/cjs/curve/ProxyCurve.d.ts.map +1 -1
  39. package/lib/cjs/curve/ProxyCurve.js +5 -0
  40. package/lib/cjs/curve/ProxyCurve.js.map +1 -1
  41. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts +11 -0
  42. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  43. package/lib/cjs/curve/Query/PlanarSubdivision.js +26 -17
  44. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  45. package/lib/cjs/curve/RegionOps.d.ts +15 -16
  46. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  47. package/lib/cjs/curve/RegionOps.js +14 -16
  48. package/lib/cjs/curve/RegionOps.js.map +1 -1
  49. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  50. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +3 -1
  51. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  52. package/lib/cjs/curve/StrokeOptions.d.ts +6 -0
  53. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  54. package/lib/cjs/curve/StrokeOptions.js +20 -0
  55. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  56. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.d.ts +36 -0
  57. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.d.ts.map +1 -0
  58. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js +73 -0
  59. package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -0
  60. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts +48 -24
  61. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  62. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +113 -112
  63. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  64. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  65. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +33 -7
  66. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  67. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +8 -0
  68. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  69. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +14 -0
  70. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  71. package/lib/cjs/geometry3d/Matrix3d.d.ts +4 -4
  72. package/lib/cjs/geometry3d/Matrix3d.js +4 -4
  73. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  74. package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
  75. package/lib/cjs/geometry4d/Matrix4d.js +21 -8
  76. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  77. package/lib/cjs/numerics/ClusterableArray.d.ts +1 -1
  78. package/lib/cjs/numerics/ClusterableArray.d.ts.map +1 -1
  79. package/lib/cjs/numerics/ClusterableArray.js +2 -2
  80. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  81. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +15 -1
  82. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  83. package/lib/cjs/polyface/PolyfaceBuilder.js +17 -11
  84. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  85. package/lib/cjs/topology/Merging.d.ts +22 -3
  86. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  87. package/lib/cjs/topology/Merging.js +97 -1
  88. package/lib/cjs/topology/Merging.js.map +1 -1
  89. package/lib/esm/bspline/BSplineCurve.d.ts +8 -0
  90. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  91. package/lib/esm/bspline/BSplineCurve.js +14 -0
  92. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  93. package/lib/esm/bspline/BezierCurveBase.d.ts +8 -0
  94. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  95. package/lib/esm/bspline/BezierCurveBase.js +16 -1
  96. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  97. package/lib/esm/curve/Arc3d.d.ts +6 -0
  98. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  99. package/lib/esm/curve/Arc3d.js +31 -0
  100. package/lib/esm/curve/Arc3d.js.map +1 -1
  101. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +8 -1
  102. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  103. package/lib/esm/curve/CurveChainWithDistanceIndex.js +22 -2
  104. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  105. package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +1 -1
  106. package/lib/esm/curve/CurveCurveIntersectXY.js +3 -1
  107. package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
  108. package/lib/esm/curve/CurveFactory.d.ts +7 -3
  109. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  110. package/lib/esm/curve/CurveFactory.js +30 -15
  111. package/lib/esm/curve/CurveFactory.js.map +1 -1
  112. package/lib/esm/curve/CurvePrimitive.d.ts +23 -9
  113. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  114. package/lib/esm/curve/CurvePrimitive.js +18 -0
  115. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  116. package/lib/esm/curve/LineSegment3d.d.ts +6 -0
  117. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  118. package/lib/esm/curve/LineSegment3d.js +15 -1
  119. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  120. package/lib/esm/curve/LineString3d.d.ts +7 -0
  121. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  122. package/lib/esm/curve/LineString3d.js +20 -0
  123. package/lib/esm/curve/LineString3d.js.map +1 -1
  124. package/lib/esm/curve/ProxyCurve.d.ts +6 -2
  125. package/lib/esm/curve/ProxyCurve.d.ts.map +1 -1
  126. package/lib/esm/curve/ProxyCurve.js +5 -0
  127. package/lib/esm/curve/ProxyCurve.js.map +1 -1
  128. package/lib/esm/curve/Query/PlanarSubdivision.d.ts +11 -0
  129. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  130. package/lib/esm/curve/Query/PlanarSubdivision.js +26 -17
  131. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  132. package/lib/esm/curve/RegionOps.d.ts +15 -16
  133. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  134. package/lib/esm/curve/RegionOps.js +15 -17
  135. package/lib/esm/curve/RegionOps.js.map +1 -1
  136. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  137. package/lib/esm/curve/RegionOpsClassificationSweeps.js +3 -1
  138. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  139. package/lib/esm/curve/StrokeOptions.d.ts +6 -0
  140. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  141. package/lib/esm/curve/StrokeOptions.js +20 -0
  142. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  143. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.d.ts +36 -0
  144. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.d.ts.map +1 -0
  145. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js +69 -0
  146. package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -0
  147. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts +48 -24
  148. package/lib/esm/curve/internalContexts/PolygonOffsetContext.d.ts.map +1 -1
  149. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +111 -111
  150. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  151. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  152. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +33 -7
  153. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  154. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +8 -0
  155. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  156. package/lib/esm/curve/spiral/TransitionSpiral3d.js +14 -0
  157. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  158. package/lib/esm/geometry3d/Matrix3d.d.ts +4 -4
  159. package/lib/esm/geometry3d/Matrix3d.js +4 -4
  160. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  161. package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
  162. package/lib/esm/geometry4d/Matrix4d.js +21 -8
  163. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  164. package/lib/esm/numerics/ClusterableArray.d.ts +1 -1
  165. package/lib/esm/numerics/ClusterableArray.d.ts.map +1 -1
  166. package/lib/esm/numerics/ClusterableArray.js +2 -2
  167. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  168. package/lib/esm/polyface/PolyfaceBuilder.d.ts +15 -1
  169. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  170. package/lib/esm/polyface/PolyfaceBuilder.js +17 -11
  171. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  172. package/lib/esm/topology/Merging.d.ts +22 -3
  173. package/lib/esm/topology/Merging.d.ts.map +1 -1
  174. package/lib/esm/topology/Merging.js +95 -0
  175. package/lib/esm/topology/Merging.js.map +1 -1
  176. package/package.json +7 -5
@@ -281,14 +281,40 @@ export class IntegratedSpiral3d extends TransitionSpiral3d {
281
281
  }
282
282
  /** Evaluate curve point with respect to fraction. */
283
283
  fractionToPoint(activeFraction, result) {
284
- let globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);
285
- globalFraction = Geometry.clampToStartEnd(globalFraction, 0, 1);
284
+ const targetGlobalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);
286
285
  const numStrokes = this._globalStrokes.packedPoints.length - 1;
287
- const index0 = Math.trunc(globalFraction * numStrokes); // This indexes the point to the left of the query.
288
- const globalFraction0 = index0 / numStrokes;
289
- result = this._globalStrokes.packedPoints.getPoint3dAtUncheckedPointIndex(index0, result);
290
- // console.log(" fractionToPoint ", activeFraction, this.activeFractionInterval, "( global integration " + globalFraction0 + " to " + globalFraction + ")", index0);
291
- this.fullSpiralIncrementalIntegral(result, globalFraction0, globalFraction, true);
286
+ if (activeFraction > 1.0) {
287
+ result = this._globalStrokes.packedPoints.back(result);
288
+ const integrationStep = 1.0 / numStrokes;
289
+ let currentGlobalFraction = 1.0;
290
+ let nextGlobalFraction = currentGlobalFraction + integrationStep;
291
+ while (nextGlobalFraction < targetGlobalFraction) {
292
+ this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);
293
+ currentGlobalFraction = nextGlobalFraction;
294
+ nextGlobalFraction += integrationStep;
295
+ }
296
+ this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);
297
+ }
298
+ else if (activeFraction < 0.0) {
299
+ result = this._globalStrokes.packedPoints.front(result);
300
+ const integrationStep = 1.0 / numStrokes;
301
+ let currentGlobalFraction = 0.0;
302
+ let nextGlobalFraction = currentGlobalFraction - integrationStep;
303
+ while (nextGlobalFraction > targetGlobalFraction) {
304
+ this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);
305
+ currentGlobalFraction = nextGlobalFraction;
306
+ nextGlobalFraction -= integrationStep;
307
+ }
308
+ this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);
309
+ }
310
+ else {
311
+ const clampedGlobalFraction = Geometry.clampToStartEnd(targetGlobalFraction, 0, 1);
312
+ const index0 = Math.trunc(clampedGlobalFraction * numStrokes); // This indexes the point to the left of the query.
313
+ const globalFraction0 = index0 / numStrokes;
314
+ result = this._globalStrokes.packedPoints.getPoint3dAtUncheckedPointIndex(index0, result);
315
+ // console.log(" fractionToPoint ", activeFraction, this.activeFractionInterval, "( global integration " + globalFraction0 + " to " + globalFraction + ")", index0);
316
+ this.fullSpiralIncrementalIntegral(result, globalFraction0, targetGlobalFraction, true);
317
+ }
292
318
  return result;
293
319
  }
294
320
  /** Evaluate curve point and derivative with respect to fraction. */
@@ -1 +1 @@
1
- {"version":3,"file":"IntegratedSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/IntegratedSpiral3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAA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,CAAC,IAAI,CAAC,yBAAyB,CAAC,cAAc,CAAC,CAAC,CAAC;QACrE,OAAO,yBAAyB,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACnF,CAAC;IACD,mFAAmF;IAC5E,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IACD,oDAAoD;IAC7C,WAAW,CAAC,aAAsB,EAAE,SAAqB;QAC9D,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IAC3D,CAAC;IACD,4CAA4C;IAC5B,aAAa,CAAC,KAAqB;QACjD,IAAI,KAAK,YAAY,kBAAkB,EAAE;YACvC,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC;mBAC7C,IAAI,CAAC,SAAS,CAAC,6BAA6B,CAAC,KAAK,CAAC,SAAS,CAAC;mBAC7D,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC;mBACnD,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC;mBAChE,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,KAAK,CAAC,sBAAsB,CAAC;mBACvE,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;SAC1D;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AAhWD,2CAA2C;AACpB,oCAAiB,GAAG,UAAU,CAAC;AAkWxD,sDAAsD;AACtD,kBAAkB,CAAC,aAAa,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { NormalizedTransition } from \"./NormalizedTransition\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { Quadrature } from \"../../numerics/Quadrature\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { AxisOrder, Geometry } from \"../../Geometry\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Plane3dByOriginAndVectors } from \"../../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Range3d } from \"../../geometry3d/Range\";\r\nimport { GeometryQuery } from \"../GeometryQuery\";\r\n/**\r\n * An IntegratedSpiral3d is a curve defined by integrating its curvature.\r\n * * The first integral of curvature (with respect to distance along the curve) is the bearing angle (in radians)\r\n * * Integrating (cos(theta), sin(theta)) gives displacement from the start point, and thus the actual curve position.\r\n * * The curvature functions of interest are all symmetric snap functions in the NormalizedTransition class.\r\n * * `TransitionConditionalProperties` implements the computations of the interrelationship of radii, bearing, and length.\r\n * @public\r\n */\r\nexport class IntegratedSpiral3d extends TransitionSpiral3d {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"transitionSpiral\";\r\n\r\n /** start and end radii as a Segment1d */\r\n public radius01: Segment1d;\r\n /** start and end bearings as an AngleSweep */\r\n public bearing01: AngleSweep;\r\n /** stroked approximation of entire spiral. */\r\n private _globalStrokes: LineString3d;\r\n /** stroked approximation of active spiral.\r\n * * Same count as global -- possibly overly fine, but it gives some consistency between same clothoid constructed as partial versus complete.\r\n * * If no trimming, this points to the same place as the _globalStrokes !!! Don't double transform!!!\r\n */\r\n private _activeStrokes?: LineString3d;\r\n /** Return the internal stroked form of the (possibly partial) spiral */\r\n public get activeStrokes(): LineString3d { return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes; }\r\n private _evaluator: NormalizedTransition;\r\n /** Total curve arc length (computed) */\r\n private _arcLength01: number;\r\n /** Curvatures (inverse radii) at start and end */\r\n private _curvature01: Segment1d;\r\n /** evaluator for transition */\r\n // constructor demands all bearing, radius, and length data -- caller determines usual dependency of \"any 4 determine the 5th\"\r\n private constructor(spiralType: string | undefined,\r\n evaluator: NormalizedTransition,\r\n radius01: Segment1d,\r\n bearing01: AngleSweep,\r\n activeFractionInterval: Segment1d,\r\n localToWorld: Transform,\r\n arcLength: number,\r\n properties: TransitionConditionalProperties | undefined) {\r\n super(spiralType, localToWorld, activeFractionInterval, properties);\r\n this._evaluator = evaluator;\r\n this.radius01 = radius01;\r\n this.bearing01 = bearing01;\r\n this._arcLength01 = arcLength;\r\n this._globalStrokes = LineString3d.create();\r\n // initialize for compiler -- but this will be recomputed in refreshComputeProperties ...\r\n this._curvature01 = Segment1d.create(0, 1);\r\n this.refreshComputedProperties();\r\n }\r\n /** default spiral type name. (clothoid) */\r\n public static readonly defaultSpiralType = \"clothoid\";\r\n\r\n /** use the integrated function to return an angle at fractional position. */\r\n\r\n public globalFractionToBearingRadians(fraction: number): number {\r\n const areaFraction = this._evaluator.fractionToArea(fraction);\r\n const dx = this._arcLength01;\r\n return this.bearing01.startRadians + areaFraction * dx * this._curvature01.signedDelta() + fraction * this._curvature01.x0 * dx;\r\n }\r\n /** use the integrated function to return an angle at fractional position. */\r\n public globalFractionToCurvature(fraction: number): number {\r\n const f = this._evaluator.fractionToCurvatureFraction(fraction);\r\n return this._curvature01.fractionToPoint(f);\r\n }\r\n\r\n /** Return the bearing at given fraction of the active interval .... */\r\n\r\n public fractionToBearingRadians(activeFraction: number): number {\r\n const fraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n return this.bearing01.startRadians + fraction * this._arcLength01 * (this._curvature01.x0 + 0.5 * fraction * (this._curvature01.x1 - this._curvature01.x0));\r\n }\r\n /** Return the curvature at given fraction of the active interval ...\r\n * * The `undefined` result is to match the abstract class -- it cannot actually occur.\r\n */\r\n public override fractionToCurvature(activeFraction: number): number | undefined {\r\n // BUG? active interval\r\n return this._curvature01.fractionToPoint(this.activeFractionInterval.fractionToPoint(activeFraction));\r\n }\r\n\r\n // These static variables are reused on calls to integrateFromStartFraction\r\n\r\n private static _gaussFraction: Float64Array;\r\n private static _gaussWeight: Float64Array;\r\n private static _gaussMapper: (xA: number, xB: number, arrayX: Float64Array, arrayW: Float64Array) => number;\r\n /** Initialize class level work arrays. */\r\n public static initWorkSpace() {\r\n IntegratedSpiral3d._gaussFraction = new Float64Array(5);\r\n IntegratedSpiral3d._gaussWeight = new Float64Array(5);\r\n IntegratedSpiral3d._gaussMapper = Quadrature.setupGauss5;\r\n }\r\n /** Evaluate and sum the gauss quadrature formulas to integrate cos(theta), sin(theta) fractional subset of a reference length.\r\n * (recall that theta is a nonlinear function of the fraction.)\r\n * * This is a single interval of gaussian integration.\r\n * * The fraction is on the full spiral (not in the mapped active interval)\r\n * @param xyz advancing integrated point.\r\n * @param fractionA fraction at start of interval\r\n * @param fractionB fraction at end of interval.\r\n * @param unitArcLength length of curve for 0 to 1 fractional\r\n */\r\n private fullSpiralIncrementalIntegral(xyz: Point3d, fractionA: number, fractionB: number, applyMatrix: boolean) {\r\n const gaussFraction = IntegratedSpiral3d._gaussFraction;\r\n const gaussWeight = IntegratedSpiral3d._gaussWeight;\r\n const numEval = IntegratedSpiral3d._gaussMapper(fractionA, fractionB, gaussFraction, gaussWeight);\r\n const deltaL = this._arcLength01;\r\n let w = 0;\r\n let dx = 0.0;\r\n let dy = 0.0;\r\n for (let k = 0; k < numEval; k++) {\r\n const radians = this.globalFractionToBearingRadians(gaussFraction[k]);\r\n w = gaussWeight[k] * deltaL;\r\n dx += w * Math.cos(radians);\r\n dy += w * Math.sin(radians);\r\n }\r\n if (applyMatrix)\r\n Matrix3d.xyzPlusMatrixTimesXYZ(xyz, this.localToWorld.matrix, { x: dx, y: dy, z: 0.0 }, xyz);\r\n else\r\n xyz.addXYZInPlace(dx, dy, 0.0);\r\n\r\n }\r\n /** Recompute strokes */\r\n public refreshComputedProperties() {\r\n this._curvature01 = Segment1d.create(\r\n TransitionSpiral3d.radiusToCurvature(this.radius01.x0),\r\n TransitionSpiral3d.radiusToCurvature(this.radius01.x1));\r\n this._globalStrokes.clear();\r\n const currentPoint = Point3d.create();\r\n this._globalStrokes.appendStrokePoint(currentPoint);\r\n const numInterval = 16;\r\n\r\n const fractionStep = 1.0 / numInterval;\r\n for (let i = 1; i <= numInterval; i++) {\r\n const fraction0 = (i - 1) * fractionStep;\r\n const fraction1 = i * fractionStep;\r\n this.fullSpiralIncrementalIntegral(currentPoint, fraction0, fraction1, false);\r\n this._globalStrokes.appendStrokePoint(currentPoint);\r\n }\r\n this._globalStrokes.tryTransformInPlace(this.localToWorld);\r\n if (!this.activeFractionInterval.isExact01) {\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = LineString3d.create();\r\n this._activeStrokes.clear();\r\n // finer strokes in the active interval ... same fraction step, but mapped\r\n // This assumes factionToPoint acts normally within refreshComputedProperties -- that depends on the global strokes we just computed, but not on the active strokes\r\n for (let i = 0; i <= numInterval; i++) {\r\n const localFraction = i * fractionStep;\r\n this._activeStrokes.addPoint(this.fractionToPoint(localFraction));\r\n }\r\n }\r\n }\r\n /**\r\n * Create a transition spiral with radius and bearing conditions.\r\n * @param radius01 radius (inverse curvature) at start and end. (radius of zero means straight line)\r\n * @param bearing01 bearing angles at start and end. bearings are measured from the x axis, positive clockwise towards y axis\r\n * @param activeFractionInterval fractional limits of the active portion of the spiral.\r\n * @param localToWorld placement frame. Fractional coordinate 0 is at the origin.\r\n */\r\n public static createRadiusRadiusBearingBearing(radius01: Segment1d, bearing01: AngleSweep, activeFractionInterval: Segment1d, localToWorld: Transform, typeName?: string) {\r\n const arcLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(radius01.x0, radius01.x1, bearing01.sweepRadians);\r\n if (typeName === undefined)\r\n typeName = \"clothoid\";\r\n const evaluator = NormalizedTransition.findEvaluator(typeName);\r\n if (!evaluator)\r\n return undefined;\r\n return new IntegratedSpiral3d(typeName, evaluator,\r\n radius01.clone(),\r\n bearing01.clone(), activeFractionInterval.clone(), localToWorld.clone(), arcLength,\r\n new TransitionConditionalProperties(radius01.x0, radius01.x1,\r\n bearing01.startAngle.clone(), bearing01.endAngle.clone(),\r\n undefined));\r\n }\r\n /**\r\n * Create a transition spiral.\r\n * * Inputs must provide exactly 4 of the 5 values `[radius0,radius1,bearing0,bearing1,length`.\r\n * @param spiralType one of \"clothoid\", \"bloss\", \"biquadratic\", \"cosine\", \"sine\". If undefined, \"clothoid\" is used.\r\n * @param radius0 radius (or 0 for tangent to line) at start\r\n * @param radius1 radius (or 0 for tangent to line) at end\r\n * @param bearing0 bearing, measured CCW from x axis at start.\r\n * @param bearing1 bearing, measured CCW from x axis at end.\r\n * @param fractionInterval optional fractional interval for an \"active\" portion of the curve. if omitted, the full [0,1] is used.\r\n * @param localToWorld placement transform\r\n */\r\n public static createFrom4OutOf5(\r\n spiralType: string | undefined,\r\n radius0: number | undefined,\r\n radius1: number | undefined,\r\n bearing0: Angle | undefined,\r\n bearing1: Angle | undefined,\r\n arcLength: number | undefined,\r\n fractionInterval: undefined | Segment1d,\r\n localToWorld: Transform): IntegratedSpiral3d | undefined {\r\n if (spiralType === undefined)\r\n spiralType = \"clothoid\";\r\n const evaluator = NormalizedTransition.findEvaluator(spiralType);\r\n if (!evaluator)\r\n return undefined;\r\n const data = new TransitionConditionalProperties(radius0, radius1, bearing0, bearing1, arcLength);\r\n const data1 = data.clone();\r\n if (!data.tryResolveAnySingleUnknown())\r\n return undefined;\r\n if (fractionInterval === undefined)\r\n fractionInterval = Segment1d.create(0, 1);\r\n return new IntegratedSpiral3d(\r\n spiralType,\r\n evaluator,\r\n Segment1d.create(data.radius0, data.radius1),\r\n AngleSweep.createStartEnd(data.bearing0!, data.bearing1!),\r\n fractionInterval ? fractionInterval.clone() : Segment1d.create(0, 1),\r\n localToWorld, data.curveLength!, data1);\r\n }\r\n /** Copy all defining data from another spiral. */\r\n public setFrom(other: IntegratedSpiral3d): IntegratedSpiral3d {\r\n this.localToWorld.setFrom(other.localToWorld);\r\n this.radius01.setFrom(other.radius01);\r\n this._curvature01.setFrom(other._curvature01);\r\n this.bearing01.setFrom(other.bearing01);\r\n this.localToWorld.setFrom(other.localToWorld);\r\n this.activeFractionInterval.setFrom(other.activeFractionInterval);\r\n this._arcLength01 = other._arcLength01;\r\n return this;\r\n }\r\n /** Deep clone of this spiral */\r\n public clone(): IntegratedSpiral3d {\r\n return new IntegratedSpiral3d(this._spiralType, this._evaluator,\r\n this.radius01.clone(), this.bearing01.clone(),\r\n this.activeFractionInterval.clone(), this.localToWorld.clone(), this._arcLength01,\r\n this._designProperties?.clone());\r\n }\r\n\r\n /** Return (if possible) a spiral which is a portion of this curve. */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): IntegratedSpiral3d | undefined {\r\n const spiralB = this.clone();\r\n const globalFractionA = this._activeFractionInterval.fractionToPoint(fractionA);\r\n const globalFractionB = this._activeFractionInterval.fractionToPoint(fractionB);\r\n spiralB._activeFractionInterval.set(globalFractionA, globalFractionB);\r\n spiralB.refreshComputedProperties();\r\n return spiralB;\r\n }\r\n\r\n /** apply `transform` to this spiral's local to world transform. */\r\n public tryTransformInPlace(transformA: Transform): boolean {\r\n\r\n const rigidData = this.applyRigidPartOfTransform(transformA);\r\n if (rigidData !== undefined) {\r\n this._curvature01.x0 /= rigidData.scale;\r\n this._curvature01.x1 /= rigidData.scale;\r\n this.radius01.x0 *= rigidData.scale;\r\n this.radius01.x1 *= rigidData.scale;\r\n this._arcLength01 *= rigidData.scale;\r\n }\r\n this.refreshComputedProperties();\r\n return true;\r\n }\r\n /** Clone with a transform applied */\r\n public cloneTransformed(transform: Transform): TransitionSpiral3d {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform); // ok, we're confident it will always work.\r\n return result;\r\n }\r\n /** Return the spiral start point. */\r\n public override startPoint(): Point3d { return this.activeStrokes.startPoint(); }\r\n /** return the spiral end point. */\r\n public override endPoint(): Point3d { return this.activeStrokes.endPoint(); }\r\n /** test if the local to world transform places the spiral xy plane into `plane` */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return plane.isPointInPlane(this.localToWorld.origin as Point3d)\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnX(plane.getNormalRef()))\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnY(plane.getNormalRef()));\r\n }\r\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public quickLength() { return this.curveLength(); }\r\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public override curveLength() { return this._arcLength01 * (this._activeFractionInterval.absoluteDelta()); }\r\n /** Return (unsigned) length of the spiral between fractions. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public override curveLengthBetweenFractions(fraction0: number, fraction1: number) {\r\n return this._arcLength01 * (this._activeFractionInterval.absoluteDelta() * Math.abs(fraction1 - fraction0));\r\n }\r\n /** Test if `other` is an instance of `TransitionSpiral3d` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof TransitionSpiral3d; }\r\n /** Add strokes from this spiral to `dest`.\r\n * * Linestrings will usually stroke as just their points.\r\n * * If maxEdgeLength is given, this will sub-stroke within the linestring -- not what we want.\r\n */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void { this.activeStrokes.emitStrokes(dest, options); }\r\n /** emit stroke fragments to `dest` handler. */\r\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\r\n const n = this.computeStrokeCountForOptions(options);\r\n dest.startParentCurvePrimitive(this);\r\n const activeStrokes = this.activeStrokes;\r\n const preferPrimary = dest.needPrimaryGeometryForStrokes === undefined ? false : dest.needPrimaryGeometryForStrokes();\r\n if (!preferPrimary && n <= activeStrokes.numPoints()) {\r\n this.activeStrokes.emitStrokableParts(dest, options);\r\n } else {\r\n dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);\r\n }\r\n dest.endParentCurvePrimitive(this);\r\n }\r\n\r\n /**\r\n * return the stroke count required for given options.\r\n * @param options StrokeOptions that determine count\r\n */\r\n\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n let numStroke;\r\n if (options) {\r\n const rMin = Math.min(Math.abs(this.radius01.x0), Math.abs(this.radius01.x1));\r\n numStroke = options.applyTolerancesToArc(rMin, this.bearing01.sweepRadians);\r\n numStroke = options.applyMaxEdgeLength(numStroke, this.curveLength());\r\n numStroke = options.applyMinStrokesPerPrimitive(numStroke);\r\n } else {\r\n numStroke = StrokeOptions.applyAngleTol(undefined, 4, this.bearing01.sweepRadians);\r\n }\r\n return numStroke;\r\n }\r\n\r\n /** Reverse the active interval and active strokes.\r\n * * Primary defining data remains unchanged !!!\r\n */\r\n\r\n public reverseInPlace(): void {\r\n this.activeFractionInterval.reverseInPlace();\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = this._globalStrokes.clone();\r\n this._activeStrokes.reverseInPlace();\r\n }\r\n /** Evaluate curve point with respect to fraction. */\r\n public fractionToPoint(activeFraction: number, result?: Point3d): Point3d {\r\n let globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n globalFraction = Geometry.clampToStartEnd(globalFraction, 0, 1);\r\n const numStrokes = this._globalStrokes.packedPoints.length - 1;\r\n const index0 = Math.trunc(globalFraction * numStrokes); // This indexes the point to the left of the query.\r\n const globalFraction0 = index0 / numStrokes;\r\n result = this._globalStrokes.packedPoints.getPoint3dAtUncheckedPointIndex(index0, result);\r\n // console.log(\" fractionToPoint \", activeFraction, this.activeFractionInterval, \"( global integration \" + globalFraction0 + \" to \" + globalFraction + \")\", index0);\r\n this.fullSpiralIncrementalIntegral(result, globalFraction0, globalFraction, true);\r\n return result;\r\n }\r\n /** Evaluate curve point and derivative with respect to fraction. */\r\n public fractionToPointAndDerivative(activeFraction: number, result?: Ray3d): Ray3d {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n result = result ? result : Ray3d.createZero();\r\n this.fractionToPoint(activeFraction, result.origin);\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const a = this._arcLength01 * this.activeFractionInterval.signedDelta();\r\n this.localToWorld.matrix.multiplyXY(a * Math.cos(radians), a * Math.sin(radians), result.direction);\r\n return result;\r\n }\r\n\r\n /** Return the frenet frame at fractional position. */\r\n\r\n public override fractionToFrenetFrame(activeFraction: number, result?: Transform): Transform {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n result = result ? result : Transform.createIdentity();\r\n result.origin.setFrom(this.fractionToPoint(activeFraction));\r\n Matrix3d.createRigidFromMatrix3d(this.localToWorld.matrix, AxisOrder.XYZ, result.matrix);\r\n\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const c = Math.cos(radians);\r\n const s = Math.sin(radians);\r\n result.matrix.applyGivensColumnOp(0, 1, c, s);\r\n return result;\r\n }\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n public fractionToPointAnd2Derivatives(activeFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n const origin = this.fractionToPoint(activeFraction);\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const c = Math.cos(radians);\r\n const s = Math.sin(radians);\r\n const delta = this.activeFractionInterval.signedDelta();\r\n const a = delta;\r\n const b = a * delta;\r\n const vectorX = this.localToWorld.matrix.multiplyXY(a * c, a * s);\r\n const vectorY = this.localToWorld.matrix.multiplyXY(-b * s, b * c);\r\n vectorY.scaleInPlace(this.globalFractionToCurvature(globalFraction));\r\n return Plane3dByOriginAndVectors.createCapture(origin, vectorX, vectorY, result);\r\n }\r\n /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleTransitionSpiral(this);\r\n }\r\n /** extend the range by the strokes of the spiral */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n this.activeStrokes.extendRange(rangeToExtend, transform);\r\n }\r\n /** compare various coordinate quantities */\r\n public override isAlmostEqual(other?: GeometryQuery): boolean {\r\n if (other instanceof IntegratedSpiral3d) {\r\n return this.radius01.isAlmostEqual(other.radius01)\r\n && this.bearing01.isAlmostEqualAllowPeriodShift(other.bearing01)\r\n && this.localToWorld.isAlmostEqual(other.localToWorld)\r\n && Geometry.isSameCoordinate(this._arcLength01, other._arcLength01)\r\n && this.activeFractionInterval.isAlmostEqual(other.activeFractionInterval)\r\n && this._curvature01.isAlmostEqual(other._curvature01);\r\n }\r\n return false;\r\n }\r\n\r\n}\r\n// at load time, initialize gauss quadrature workspace\r\nIntegratedSpiral3d.initWorkSpace();\r\n"]}
1
+ {"version":3,"file":"IntegratedSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/IntegratedSpiral3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,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B,CAAC,aAAa,CAAC,KAAK,CAAC,sBAAsB,CAAC;mBACvE,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;SAC1D;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;AAzXD,2CAA2C;AACpB,oCAAiB,GAAG,UAAU,CAAC;AA2XxD,sDAAsD;AACtD,kBAAkB,CAAC,aAAa,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { AngleSweep } from \"../../geometry3d/AngleSweep\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { NormalizedTransition } from \"./NormalizedTransition\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { Quadrature } from \"../../numerics/Quadrature\";\r\nimport { Point3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { AxisOrder, Geometry } from \"../../Geometry\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\nimport { GeometryHandler, IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Plane3dByOriginAndVectors } from \"../../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Range3d } from \"../../geometry3d/Range\";\r\nimport { GeometryQuery } from \"../GeometryQuery\";\r\n/**\r\n * An IntegratedSpiral3d is a curve defined by integrating its curvature.\r\n * * The first integral of curvature (with respect to distance along the curve) is the bearing angle (in radians)\r\n * * Integrating (cos(theta), sin(theta)) gives displacement from the start point, and thus the actual curve position.\r\n * * The curvature functions of interest are all symmetric snap functions in the NormalizedTransition class.\r\n * * `TransitionConditionalProperties` implements the computations of the interrelationship of radii, bearing, and length.\r\n * @public\r\n */\r\nexport class IntegratedSpiral3d extends TransitionSpiral3d {\r\n /** String name for schema properties */\r\n public readonly curvePrimitiveType = \"transitionSpiral\";\r\n\r\n /** start and end radii as a Segment1d */\r\n public radius01: Segment1d;\r\n /** start and end bearings as an AngleSweep */\r\n public bearing01: AngleSweep;\r\n /** stroked approximation of entire spiral. */\r\n private _globalStrokes: LineString3d;\r\n /** stroked approximation of active spiral.\r\n * * Same count as global -- possibly overly fine, but it gives some consistency between same clothoid constructed as partial versus complete.\r\n * * If no trimming, this points to the same place as the _globalStrokes !!! Don't double transform!!!\r\n */\r\n private _activeStrokes?: LineString3d;\r\n /** Return the internal stroked form of the (possibly partial) spiral */\r\n public get activeStrokes(): LineString3d { return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes; }\r\n private _evaluator: NormalizedTransition;\r\n /** Total curve arc length (computed) */\r\n private _arcLength01: number;\r\n /** Curvatures (inverse radii) at start and end */\r\n private _curvature01: Segment1d;\r\n /** evaluator for transition */\r\n // constructor demands all bearing, radius, and length data -- caller determines usual dependency of \"any 4 determine the 5th\"\r\n private constructor(spiralType: string | undefined,\r\n evaluator: NormalizedTransition,\r\n radius01: Segment1d,\r\n bearing01: AngleSweep,\r\n activeFractionInterval: Segment1d,\r\n localToWorld: Transform,\r\n arcLength: number,\r\n properties: TransitionConditionalProperties | undefined) {\r\n super(spiralType, localToWorld, activeFractionInterval, properties);\r\n this._evaluator = evaluator;\r\n this.radius01 = radius01;\r\n this.bearing01 = bearing01;\r\n this._arcLength01 = arcLength;\r\n this._globalStrokes = LineString3d.create();\r\n // initialize for compiler -- but this will be recomputed in refreshComputeProperties ...\r\n this._curvature01 = Segment1d.create(0, 1);\r\n this.refreshComputedProperties();\r\n }\r\n /** default spiral type name. (clothoid) */\r\n public static readonly defaultSpiralType = \"clothoid\";\r\n\r\n /** use the integrated function to return an angle at fractional position. */\r\n\r\n public globalFractionToBearingRadians(fraction: number): number {\r\n const areaFraction = this._evaluator.fractionToArea(fraction);\r\n const dx = this._arcLength01;\r\n return this.bearing01.startRadians + areaFraction * dx * this._curvature01.signedDelta() + fraction * this._curvature01.x0 * dx;\r\n }\r\n /** use the integrated function to return an angle at fractional position. */\r\n public globalFractionToCurvature(fraction: number): number {\r\n const f = this._evaluator.fractionToCurvatureFraction(fraction);\r\n return this._curvature01.fractionToPoint(f);\r\n }\r\n\r\n /** Return the bearing at given fraction of the active interval .... */\r\n\r\n public fractionToBearingRadians(activeFraction: number): number {\r\n const fraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n return this.bearing01.startRadians + fraction * this._arcLength01 * (this._curvature01.x0 + 0.5 * fraction * (this._curvature01.x1 - this._curvature01.x0));\r\n }\r\n /** Return the curvature at given fraction of the active interval ...\r\n * * The `undefined` result is to match the abstract class -- it cannot actually occur.\r\n */\r\n public override fractionToCurvature(activeFraction: number): number | undefined {\r\n // BUG? active interval\r\n return this._curvature01.fractionToPoint(this.activeFractionInterval.fractionToPoint(activeFraction));\r\n }\r\n\r\n // These static variables are reused on calls to integrateFromStartFraction\r\n\r\n private static _gaussFraction: Float64Array;\r\n private static _gaussWeight: Float64Array;\r\n private static _gaussMapper: (xA: number, xB: number, arrayX: Float64Array, arrayW: Float64Array) => number;\r\n /** Initialize class level work arrays. */\r\n public static initWorkSpace() {\r\n IntegratedSpiral3d._gaussFraction = new Float64Array(5);\r\n IntegratedSpiral3d._gaussWeight = new Float64Array(5);\r\n IntegratedSpiral3d._gaussMapper = Quadrature.setupGauss5;\r\n }\r\n /** Evaluate and sum the gauss quadrature formulas to integrate cos(theta), sin(theta) fractional subset of a reference length.\r\n * (recall that theta is a nonlinear function of the fraction.)\r\n * * This is a single interval of gaussian integration.\r\n * * The fraction is on the full spiral (not in the mapped active interval)\r\n * @param xyz advancing integrated point.\r\n * @param fractionA fraction at start of interval\r\n * @param fractionB fraction at end of interval.\r\n * @param unitArcLength length of curve for 0 to 1 fractional\r\n */\r\n private fullSpiralIncrementalIntegral(xyz: Point3d, fractionA: number, fractionB: number, applyMatrix: boolean) {\r\n const gaussFraction = IntegratedSpiral3d._gaussFraction;\r\n const gaussWeight = IntegratedSpiral3d._gaussWeight;\r\n const numEval = IntegratedSpiral3d._gaussMapper(fractionA, fractionB, gaussFraction, gaussWeight);\r\n const deltaL = this._arcLength01;\r\n let w = 0;\r\n let dx = 0.0;\r\n let dy = 0.0;\r\n for (let k = 0; k < numEval; k++) {\r\n const radians = this.globalFractionToBearingRadians(gaussFraction[k]);\r\n w = gaussWeight[k] * deltaL;\r\n dx += w * Math.cos(radians);\r\n dy += w * Math.sin(radians);\r\n }\r\n if (applyMatrix)\r\n Matrix3d.xyzPlusMatrixTimesXYZ(xyz, this.localToWorld.matrix, { x: dx, y: dy, z: 0.0 }, xyz);\r\n else\r\n xyz.addXYZInPlace(dx, dy, 0.0);\r\n\r\n }\r\n /** Recompute strokes */\r\n public refreshComputedProperties() {\r\n this._curvature01 = Segment1d.create(\r\n TransitionSpiral3d.radiusToCurvature(this.radius01.x0),\r\n TransitionSpiral3d.radiusToCurvature(this.radius01.x1));\r\n this._globalStrokes.clear();\r\n const currentPoint = Point3d.create();\r\n this._globalStrokes.appendStrokePoint(currentPoint);\r\n const numInterval = 16;\r\n\r\n const fractionStep = 1.0 / numInterval;\r\n for (let i = 1; i <= numInterval; i++) {\r\n const fraction0 = (i - 1) * fractionStep;\r\n const fraction1 = i * fractionStep;\r\n this.fullSpiralIncrementalIntegral(currentPoint, fraction0, fraction1, false);\r\n this._globalStrokes.appendStrokePoint(currentPoint);\r\n }\r\n this._globalStrokes.tryTransformInPlace(this.localToWorld);\r\n if (!this.activeFractionInterval.isExact01) {\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = LineString3d.create();\r\n this._activeStrokes.clear();\r\n // finer strokes in the active interval ... same fraction step, but mapped\r\n // This assumes factionToPoint acts normally within refreshComputedProperties -- that depends on the global strokes we just computed, but not on the active strokes\r\n for (let i = 0; i <= numInterval; i++) {\r\n const localFraction = i * fractionStep;\r\n this._activeStrokes.addPoint(this.fractionToPoint(localFraction));\r\n }\r\n }\r\n }\r\n /**\r\n * Create a transition spiral with radius and bearing conditions.\r\n * @param radius01 radius (inverse curvature) at start and end. (radius of zero means straight line)\r\n * @param bearing01 bearing angles at start and end. bearings are measured from the x axis, positive clockwise towards y axis\r\n * @param activeFractionInterval fractional limits of the active portion of the spiral.\r\n * @param localToWorld placement frame. Fractional coordinate 0 is at the origin.\r\n */\r\n public static createRadiusRadiusBearingBearing(radius01: Segment1d, bearing01: AngleSweep, activeFractionInterval: Segment1d, localToWorld: Transform, typeName?: string) {\r\n const arcLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(radius01.x0, radius01.x1, bearing01.sweepRadians);\r\n if (typeName === undefined)\r\n typeName = \"clothoid\";\r\n const evaluator = NormalizedTransition.findEvaluator(typeName);\r\n if (!evaluator)\r\n return undefined;\r\n return new IntegratedSpiral3d(typeName, evaluator,\r\n radius01.clone(),\r\n bearing01.clone(), activeFractionInterval.clone(), localToWorld.clone(), arcLength,\r\n new TransitionConditionalProperties(radius01.x0, radius01.x1,\r\n bearing01.startAngle.clone(), bearing01.endAngle.clone(),\r\n undefined));\r\n }\r\n /**\r\n * Create a transition spiral.\r\n * * Inputs must provide exactly 4 of the 5 values `[radius0,radius1,bearing0,bearing1,length`.\r\n * @param spiralType one of \"clothoid\", \"bloss\", \"biquadratic\", \"cosine\", \"sine\". If undefined, \"clothoid\" is used.\r\n * @param radius0 radius (or 0 for tangent to line) at start\r\n * @param radius1 radius (or 0 for tangent to line) at end\r\n * @param bearing0 bearing, measured CCW from x axis at start.\r\n * @param bearing1 bearing, measured CCW from x axis at end.\r\n * @param fractionInterval optional fractional interval for an \"active\" portion of the curve. if omitted, the full [0,1] is used.\r\n * @param localToWorld placement transform\r\n */\r\n public static createFrom4OutOf5(\r\n spiralType: string | undefined,\r\n radius0: number | undefined,\r\n radius1: number | undefined,\r\n bearing0: Angle | undefined,\r\n bearing1: Angle | undefined,\r\n arcLength: number | undefined,\r\n fractionInterval: undefined | Segment1d,\r\n localToWorld: Transform): IntegratedSpiral3d | undefined {\r\n if (spiralType === undefined)\r\n spiralType = \"clothoid\";\r\n const evaluator = NormalizedTransition.findEvaluator(spiralType);\r\n if (!evaluator)\r\n return undefined;\r\n const data = new TransitionConditionalProperties(radius0, radius1, bearing0, bearing1, arcLength);\r\n const data1 = data.clone();\r\n if (!data.tryResolveAnySingleUnknown())\r\n return undefined;\r\n if (fractionInterval === undefined)\r\n fractionInterval = Segment1d.create(0, 1);\r\n return new IntegratedSpiral3d(\r\n spiralType,\r\n evaluator,\r\n Segment1d.create(data.radius0, data.radius1),\r\n AngleSweep.createStartEnd(data.bearing0!, data.bearing1!),\r\n fractionInterval ? fractionInterval.clone() : Segment1d.create(0, 1),\r\n localToWorld, data.curveLength!, data1);\r\n }\r\n /** Copy all defining data from another spiral. */\r\n public setFrom(other: IntegratedSpiral3d): IntegratedSpiral3d {\r\n this.localToWorld.setFrom(other.localToWorld);\r\n this.radius01.setFrom(other.radius01);\r\n this._curvature01.setFrom(other._curvature01);\r\n this.bearing01.setFrom(other.bearing01);\r\n this.localToWorld.setFrom(other.localToWorld);\r\n this.activeFractionInterval.setFrom(other.activeFractionInterval);\r\n this._arcLength01 = other._arcLength01;\r\n return this;\r\n }\r\n /** Deep clone of this spiral */\r\n public clone(): IntegratedSpiral3d {\r\n return new IntegratedSpiral3d(this._spiralType, this._evaluator,\r\n this.radius01.clone(), this.bearing01.clone(),\r\n this.activeFractionInterval.clone(), this.localToWorld.clone(), this._arcLength01,\r\n this._designProperties?.clone());\r\n }\r\n\r\n /** Return (if possible) a spiral which is a portion of this curve. */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): IntegratedSpiral3d | undefined {\r\n const spiralB = this.clone();\r\n const globalFractionA = this._activeFractionInterval.fractionToPoint(fractionA);\r\n const globalFractionB = this._activeFractionInterval.fractionToPoint(fractionB);\r\n spiralB._activeFractionInterval.set(globalFractionA, globalFractionB);\r\n spiralB.refreshComputedProperties();\r\n return spiralB;\r\n }\r\n\r\n /** apply `transform` to this spiral's local to world transform. */\r\n public tryTransformInPlace(transformA: Transform): boolean {\r\n\r\n const rigidData = this.applyRigidPartOfTransform(transformA);\r\n if (rigidData !== undefined) {\r\n this._curvature01.x0 /= rigidData.scale;\r\n this._curvature01.x1 /= rigidData.scale;\r\n this.radius01.x0 *= rigidData.scale;\r\n this.radius01.x1 *= rigidData.scale;\r\n this._arcLength01 *= rigidData.scale;\r\n }\r\n this.refreshComputedProperties();\r\n return true;\r\n }\r\n /** Clone with a transform applied */\r\n public cloneTransformed(transform: Transform): TransitionSpiral3d {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform); // ok, we're confident it will always work.\r\n return result;\r\n }\r\n /** Return the spiral start point. */\r\n public override startPoint(): Point3d { return this.activeStrokes.startPoint(); }\r\n /** return the spiral end point. */\r\n public override endPoint(): Point3d { return this.activeStrokes.endPoint(); }\r\n /** test if the local to world transform places the spiral xy plane into `plane` */\r\n public isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean {\r\n return plane.isPointInPlane(this.localToWorld.origin as Point3d)\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnX(plane.getNormalRef()))\r\n && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnY(plane.getNormalRef()));\r\n }\r\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public quickLength() { return this.curveLength(); }\r\n /** Return length of the spiral. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public override curveLength() { return this._arcLength01 * (this._activeFractionInterval.absoluteDelta()); }\r\n /** Return (unsigned) length of the spiral between fractions. Because TransitionSpiral is parameterized directly in terms of distance along, this is a simple return value. */\r\n public override curveLengthBetweenFractions(fraction0: number, fraction1: number) {\r\n return this._arcLength01 * (this._activeFractionInterval.absoluteDelta() * Math.abs(fraction1 - fraction0));\r\n }\r\n /** Test if `other` is an instance of `TransitionSpiral3d` */\r\n public isSameGeometryClass(other: any): boolean { return other instanceof TransitionSpiral3d; }\r\n /** Add strokes from this spiral to `dest`.\r\n * * Linestrings will usually stroke as just their points.\r\n * * If maxEdgeLength is given, this will sub-stroke within the linestring -- not what we want.\r\n */\r\n public emitStrokes(dest: LineString3d, options?: StrokeOptions): void { this.activeStrokes.emitStrokes(dest, options); }\r\n /** emit stroke fragments to `dest` handler. */\r\n public emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void {\r\n const n = this.computeStrokeCountForOptions(options);\r\n dest.startParentCurvePrimitive(this);\r\n const activeStrokes = this.activeStrokes;\r\n const preferPrimary = dest.needPrimaryGeometryForStrokes === undefined ? false : dest.needPrimaryGeometryForStrokes();\r\n if (!preferPrimary && n <= activeStrokes.numPoints()) {\r\n this.activeStrokes.emitStrokableParts(dest, options);\r\n } else {\r\n dest.announceIntervalForUniformStepStrokes(this, n, 0.0, 1.0);\r\n }\r\n dest.endParentCurvePrimitive(this);\r\n }\r\n\r\n /**\r\n * return the stroke count required for given options.\r\n * @param options StrokeOptions that determine count\r\n */\r\n\r\n public computeStrokeCountForOptions(options?: StrokeOptions): number {\r\n let numStroke;\r\n if (options) {\r\n const rMin = Math.min(Math.abs(this.radius01.x0), Math.abs(this.radius01.x1));\r\n numStroke = options.applyTolerancesToArc(rMin, this.bearing01.sweepRadians);\r\n numStroke = options.applyMaxEdgeLength(numStroke, this.curveLength());\r\n numStroke = options.applyMinStrokesPerPrimitive(numStroke);\r\n } else {\r\n numStroke = StrokeOptions.applyAngleTol(undefined, 4, this.bearing01.sweepRadians);\r\n }\r\n return numStroke;\r\n }\r\n\r\n /** Reverse the active interval and active strokes.\r\n * * Primary defining data remains unchanged !!!\r\n */\r\n\r\n public reverseInPlace(): void {\r\n this.activeFractionInterval.reverseInPlace();\r\n if (this._activeStrokes === undefined)\r\n this._activeStrokes = this._globalStrokes.clone();\r\n this._activeStrokes.reverseInPlace();\r\n }\r\n /** Evaluate curve point with respect to fraction. */\r\n public fractionToPoint(activeFraction: number, result?: Point3d): Point3d {\r\n const targetGlobalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n const numStrokes = this._globalStrokes.packedPoints.length - 1;\r\n if (activeFraction > 1.0) {\r\n result = this._globalStrokes.packedPoints.back(result)!;\r\n const integrationStep = 1.0 / numStrokes;\r\n let currentGlobalFraction = 1.0;\r\n let nextGlobalFraction = currentGlobalFraction + integrationStep;\r\n while (nextGlobalFraction < targetGlobalFraction) {\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);\r\n currentGlobalFraction = nextGlobalFraction;\r\n nextGlobalFraction += integrationStep;\r\n }\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);\r\n } else if (activeFraction < 0.0) {\r\n result = this._globalStrokes.packedPoints.front(result)!;\r\n const integrationStep = 1.0 / numStrokes;\r\n let currentGlobalFraction = 0.0;\r\n let nextGlobalFraction = currentGlobalFraction - integrationStep;\r\n while (nextGlobalFraction > targetGlobalFraction) {\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, nextGlobalFraction, true);\r\n currentGlobalFraction = nextGlobalFraction;\r\n nextGlobalFraction -= integrationStep;\r\n }\r\n this.fullSpiralIncrementalIntegral(result, currentGlobalFraction, targetGlobalFraction, true);\r\n } else {\r\n const clampedGlobalFraction = Geometry.clampToStartEnd(targetGlobalFraction, 0, 1);\r\n const index0 = Math.trunc(clampedGlobalFraction * numStrokes); // This indexes the point to the left of the query.\r\n const globalFraction0 = index0 / numStrokes;\r\n result = this._globalStrokes.packedPoints.getPoint3dAtUncheckedPointIndex(index0, result);\r\n // console.log(\" fractionToPoint \", activeFraction, this.activeFractionInterval, \"( global integration \" + globalFraction0 + \" to \" + globalFraction + \")\", index0);\r\n this.fullSpiralIncrementalIntegral(result, globalFraction0, targetGlobalFraction, true);\r\n\r\n }\r\n return result;\r\n }\r\n /** Evaluate curve point and derivative with respect to fraction. */\r\n public fractionToPointAndDerivative(activeFraction: number, result?: Ray3d): Ray3d {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n result = result ? result : Ray3d.createZero();\r\n this.fractionToPoint(activeFraction, result.origin);\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const a = this._arcLength01 * this.activeFractionInterval.signedDelta();\r\n this.localToWorld.matrix.multiplyXY(a * Math.cos(radians), a * Math.sin(radians), result.direction);\r\n return result;\r\n }\r\n\r\n /** Return the frenet frame at fractional position. */\r\n\r\n public override fractionToFrenetFrame(activeFraction: number, result?: Transform): Transform {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n result = result ? result : Transform.createIdentity();\r\n result.origin.setFrom(this.fractionToPoint(activeFraction));\r\n Matrix3d.createRigidFromMatrix3d(this.localToWorld.matrix, AxisOrder.XYZ, result.matrix);\r\n\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const c = Math.cos(radians);\r\n const s = Math.sin(radians);\r\n result.matrix.applyGivensColumnOp(0, 1, c, s);\r\n return result;\r\n }\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n public fractionToPointAnd2Derivatives(activeFraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined {\r\n const globalFraction = this.activeFractionInterval.fractionToPoint(activeFraction);\r\n const origin = this.fractionToPoint(activeFraction);\r\n const radians = this.globalFractionToBearingRadians(globalFraction);\r\n const c = Math.cos(radians);\r\n const s = Math.sin(radians);\r\n const delta = this.activeFractionInterval.signedDelta();\r\n const a = delta;\r\n const b = a * delta;\r\n const vectorX = this.localToWorld.matrix.multiplyXY(a * c, a * s);\r\n const vectorY = this.localToWorld.matrix.multiplyXY(-b * s, b * c);\r\n vectorY.scaleInPlace(this.globalFractionToCurvature(globalFraction));\r\n return Plane3dByOriginAndVectors.createCapture(origin, vectorX, vectorY, result);\r\n }\r\n /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleTransitionSpiral(this);\r\n }\r\n /** extend the range by the strokes of the spiral */\r\n public extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n this.activeStrokes.extendRange(rangeToExtend, transform);\r\n }\r\n /** compare various coordinate quantities */\r\n public override isAlmostEqual(other?: GeometryQuery): boolean {\r\n if (other instanceof IntegratedSpiral3d) {\r\n return this.radius01.isAlmostEqual(other.radius01)\r\n && this.bearing01.isAlmostEqualAllowPeriodShift(other.bearing01)\r\n && this.localToWorld.isAlmostEqual(other.localToWorld)\r\n && Geometry.isSameCoordinate(this._arcLength01, other._arcLength01)\r\n && this.activeFractionInterval.isAlmostEqual(other.activeFractionInterval)\r\n && this._curvature01.isAlmostEqual(other._curvature01);\r\n }\r\n return false;\r\n }\r\n\r\n}\r\n// at load time, initialize gauss quadrature workspace\r\nIntegratedSpiral3d.initWorkSpace();\r\n"]}
@@ -7,6 +7,7 @@ import { Segment1d } from "../../geometry3d/Segment1d";
7
7
  import { Transform } from "../../geometry3d/Transform";
8
8
  import { TransitionConditionalProperties } from "./TransitionConditionalProperties";
9
9
  import { LineString3d } from "../LineString3d";
10
+ import { OffsetOptions } from "../internalContexts/PolygonOffsetContext";
10
11
  /**
11
12
  * This is the set of valid type names for "integrated" spirals
12
13
  * * Behavior is expressed by a `NormalizedTransition` snap function.
@@ -97,5 +98,12 @@ export declare abstract class TransitionSpiral3d extends CurvePrimitive {
97
98
  rigidAxes: Matrix3d;
98
99
  scale: number;
99
100
  } | undefined;
101
+ /**
102
+ * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).
103
+ * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset
104
+ * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.
105
+ * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object
106
+ */
107
+ constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined;
100
108
  }
101
109
  //# sourceMappingURL=TransitionSpiral3d.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransitionSpiral3d.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionSpiral3d.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C;;;;;;;;;;;;GAYG;AACH,oBAAY,wBAAwB,GAAG,UAAU,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEhG;;;;GAIG;AACH,oBAAY,oBAAoB,GAC7B,eAAe,GACd,OAAO,GACP,cAAc,GACd,YAAY,GACZ,oBAAoB,GACpB,mBAAmB,GACnB,OAAO,GACP,iBAAiB,GACjB,QAAQ,GACR,SAAS,CACV;AAEH;;;;;;;;;;;;GAYG;AACH,8BAAsB,kBAAmB,SAAQ,cAAc;IAC7D,iCAAiC;IACjC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAC9B,oCAAoC;IACpC,SAA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,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAGzG,sFAAsF;WACxE,kCAAkC,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAGzG,iFAAiF;IACjF,IAAW,gBAAgB,IAAI,+BAA+B,GAAG,SAAS,CAAmC;IAC7G;;;;;OAKG;IACH,SAAS,CAAC,yBAAyB,CAAC,UAAU,EAAE,SAAS,GAAG;QAAE,SAAS,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;IAiB9G;;;;;OAKG;IACa,iBAAiB,CAAC,uBAAuB,EAAE,MAAM,GAAG,aAAa,GAAG,cAAc,GAAG,cAAc,EAAE,GAAG,SAAS;CAMlI"}
@@ -9,6 +9,8 @@ import { CurvePrimitive } from "../CurvePrimitive";
9
9
  import { Segment1d } from "../../geometry3d/Segment1d";
10
10
  import { Transform } from "../../geometry3d/Transform";
11
11
  import { Geometry } from "../../Geometry";
12
+ import { CurveOffsetXYHandler } from "../internalContexts/CurveOffsetXYHandler";
13
+ import { OffsetOptions } from "../internalContexts/PolygonOffsetContext";
12
14
  /**
13
15
  * TransitionSpiral3d is a base class for multiple variants of spirals.
14
16
  * * The menagerie of spiral types have 2 broad categories:
@@ -102,5 +104,17 @@ export class TransitionSpiral3d extends CurvePrimitive {
102
104
  }
103
105
  return undefined;
104
106
  }
107
+ /**
108
+ * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).
109
+ * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset
110
+ * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.
111
+ * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object
112
+ */
113
+ constructOffsetXY(offsetDistanceOrOptions) {
114
+ const options = OffsetOptions.create(offsetDistanceOrOptions);
115
+ const handler = new CurveOffsetXYHandler(this, options.leftOffsetDistance);
116
+ this.emitStrokableParts(handler, options.strokeOptions);
117
+ return handler.claimResult();
118
+ }
105
119
  }
106
120
  //# sourceMappingURL=TransitionSpiral3d.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransitionSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionSpiral3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAmC1C;;;;;;;;;;;;GAYG;AACH,MAAM,OAAgB,kBAAmB,SAAQ,cAAc;IAmB7D,YAAsB,UAA8B,EAAE,YAAuB,EAAE,sBAA6C,EAAE,gBAA6D;QACzL,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC;QACjE,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;QAC1C,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,uBAAuB,GAAG,sBAAsB,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1G,CAAC;IAfD,wEAAwE;IACxE,IAAW,sBAAsB,KAAgB,OAAO,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAKvF,0CAA0C;IAC1C,IAAW,YAAY,KAAgB,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IAUnE,IAAW,UAAU,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5D,iIAAiI;IAC1H,MAAM,CAAC,iBAAiB,CAAC,MAAc,IAA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,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAE1D,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { LineString3d } from \"../LineString3d\";\r\n/**\r\n * This is the set of valid type names for \"integrated\" spirals\r\n * * Behavior is expressed by a `NormalizedTransition` snap function.\r\n * * The snap function varies smoothly from f(0)=0 to f(1)=1\r\n * * The various snap functions are:\r\n * * clothoid: linear\r\n * * biquadratic: 2 quadratics pieced together, joining with 1st derivative continuity at f(0.) = 0.5, with zero slope f'(0)=0 and f'(1)= 0\r\n * * bloss: A single cubic with zero slope at 0 and 1\r\n * * cosine: half of a cosine wave, centered around 0.5\r\n * * sine: full period of a sine wave added to the line f(u)=u\r\n * *\r\n * @public\r\n */\r\nexport type IntegratedSpiralTypeName = \"clothoid\" | \"bloss\" | \"biquadratic\" | \"cosine\" | \"sine\";\r\n\r\n/**\r\n * This is the set of valid type names for \"direct\" spirals.\r\n * \"Direct\" spirals can evaluate fractionToPoint by direct equations, i.e. not requiring the numeric integrations in \"Integrated\" spiral types.\r\n * @public\r\n */\r\nexport type DirectSpiralTypeName =\r\n \"JapaneseCubic\" // 1 term from each of the X,Y clothoid series expansions: y = x^3 / (6RL)\r\n | \"Arema\" // 2 terms from each of the X,Y clothoid series expansions. Identical to ChineseCubic!\r\n | \"ChineseCubic\" // Identical to Arema!\r\n | \"HalfCosine\" // high continuity cosine variation from quadratic.\r\n | \"AustralianRailCorp\" // cubic with high accuracy distance series\r\n | \"WesternAustralian\" // simple cubic -- 2 terms of x series, 1 term of y series.\r\n | \"Czech\" // simple cubic with two term distance approximation\r\n | \"MXCubicAlongArc\" // x obtained from fractional distance via 2-terms from series, y = x^3/ (6RL)\r\n | \"Polish\"\r\n | \"Italian\"\r\n ;\r\n\r\n/**\r\n * TransitionSpiral3d is a base class for multiple variants of spirals.\r\n * * The menagerie of spiral types have 2 broad categories:\r\n * * IntegratedSpiral3d -- a spiral whose direct function for curvature versus distance must be integrated to determine x,y\r\n * * The IntegratedSpiral3d types are enumerated in `IntegratedSpiralTypes`\r\n * * DirectSpiral3d -- a spiral implemented with direct calculation of x,y from fractional position along the spiral.\r\n * * The direct spiral types are enumerated in the `DirectSpiralType`\r\n * * The method set for CurvePrimitive support includes a `handleTransitionSpiral(g: TransitionSpiral3d)` which receives all the spiral types.\r\n * * The spiral class may impose expectations that its inflection is at the origin, with tangent along the x axis.\r\n * * This is generally necessary for direct spirals.\r\n * * This is not necessary for integrated spirals.\r\n * @public\r\n */\r\nexport abstract class TransitionSpiral3d extends CurvePrimitive {\r\n /** string name of spiral type */\r\n protected _spiralType: string;\r\n /** Original defining properties. */\r\n protected _designProperties: TransitionConditionalProperties | undefined;\r\n\r\n /** Fractional interval for the \"active\" part of a containing spiral.\r\n * (The radius, angle, and length conditions define a complete spiral, and some portion of it is \"active\")\r\n */\r\n protected _activeFractionInterval: Segment1d;\r\n /** Return (reference to) the active portion of the reference spiral. */\r\n public get activeFractionInterval(): Segment1d { return this._activeFractionInterval; }\r\n /** strokes in the active portion */\r\n public abstract get activeStrokes(): LineString3d;\r\n /** Placement transform */\r\n protected _localToWorld: Transform;\r\n /** (reference to) placement transform. */\r\n public get localToWorld(): Transform { return this._localToWorld; }\r\n\r\n protected constructor(spiralType: string | undefined, localToWorld: Transform, activeFractionInterval: Segment1d | undefined, designProperties: TransitionConditionalProperties | undefined) {\r\n super();\r\n this._spiralType = spiralType ? spiralType : \"unknownSpiralType\";\r\n this._designProperties = designProperties;\r\n this._localToWorld = localToWorld;\r\n this._activeFractionInterval = activeFractionInterval ? activeFractionInterval : Segment1d.create(0, 1);\r\n }\r\n\r\n public get spiralType(): string { return this._spiralType; }\r\n /** Return 1/r with convention that if true zero is given as radius it represents infinite radius (0 curvature, straight line) */\r\n public static radiusToCurvature(radius: number): number { return (radius === 0.0) ? 0.0 : 1.0 / radius; }\r\n\r\n /** Return 1/k with convention that if near-zero is given as curvature, its infinite radius is returned as 0 */\r\n public static curvatureToRadius(curvature: number): number {\r\n if (Math.abs(curvature) < Geometry.smallAngleRadians)\r\n return 0.0;\r\n return 1.0 / curvature;\r\n }\r\n\r\n /** Return the average of the start and end curvatures. */\r\n public static averageCurvature(radiusLimits: Segment1d): number {\r\n return 0.5 * (TransitionSpiral3d.radiusToCurvature(radiusLimits.x0) + TransitionSpiral3d.radiusToCurvature(radiusLimits.x1));\r\n }\r\n /**\r\n * Given two radii (or zeros for 0 curvature) return the average curvature\r\n * @param r0 start radius, or 0 for line\r\n * @param r1 end radius, or 0 for line\r\n */\r\n public static averageCurvatureR0R1(r0: number, r1: number): number {\r\n return 0.5 * (TransitionSpiral3d.radiusToCurvature(r0) + TransitionSpiral3d.radiusToCurvature(r1));\r\n }\r\n /**\r\n * Given two radii (or zeros for 0 curvature) return the average curvature\r\n * @param r0 start radius, or 0 for line\r\n * @param r1 end radius, or 0 for line\r\n */\r\n public static interpolateCurvatureR0R1(r0: number, fraction: number, r1: number): number {\r\n return Geometry.interpolate(TransitionSpiral3d.radiusToCurvature(r0), fraction, TransitionSpiral3d.radiusToCurvature(r1));\r\n }\r\n\r\n /** Return the arc length of a transition spiral with given sweep and radius pair. */\r\n public static radiusRadiusSweepRadiansToArcLength(radius0: number, radius1: number, sweepRadians: number): number {\r\n return Math.abs(sweepRadians / TransitionSpiral3d.averageCurvatureR0R1(radius0, radius1));\r\n }\r\n\r\n /** Return the turn angle for spiral of given length between two radii */\r\n public static radiusRadiusLengthToSweepRadians(radius0: number, radius1: number, arcLength: number): number {\r\n return TransitionSpiral3d.averageCurvatureR0R1(radius0, radius1) * arcLength;\r\n }\r\n\r\n /** Return the end radius for spiral of given start radius, length, and turn angle. */\r\n public static radius0LengthSweepRadiansToRadius1(radius0: number, arcLength: number, sweepRadians: number) {\r\n return TransitionSpiral3d.curvatureToRadius((2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius0));\r\n }\r\n /** Return the start radius for spiral of given end radius, length, and turn angle. */\r\n public static radius1LengthSweepRadiansToRadius0(radius1: number, arcLength: number, sweepRadians: number) {\r\n return TransitionSpiral3d.curvatureToRadius((2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius1));\r\n }\r\n /** Return the original defining properties (if any) saved by the constructor. */\r\n public get designProperties(): TransitionConditionalProperties | undefined { return this._designProperties; }\r\n /**\r\n * * If transformA is rigid with uniform scale, apply the rigid part of transformA to the localToWorld transform and return the scale and rigid separation.\r\n * * If not rigid, do nothing and return undefined.\r\n * * Also apply the scale factor to the designProperties.\r\n * @param transformA\r\n */\r\n protected applyRigidPartOfTransform(transformA: Transform): { rigidAxes: Matrix3d, scale: number } | undefined {\r\n const rigidData = transformA.matrix.factorRigidWithSignedScale();\r\n if (rigidData !== undefined) {\r\n // [sQ a][R b] = [sQ*R sQb+a]\r\n // but we save it as [Q*R sQb+a] with spiral data scaled by s.\r\n const transformC0 = transformA.multiplyTransformTransform(this.localToWorld);\r\n // BUT pull the scale part out of the matrix ...\r\n const matrixC = rigidData.rigidAxes.multiplyMatrixMatrix(this.localToWorld.matrix);\r\n this._localToWorld = Transform.createOriginAndMatrix(transformC0.origin, matrixC);\r\n if (this.designProperties)\r\n this.designProperties.applyScaleFactor(rigidData.scale);\r\n\r\n return rigidData;\r\n }\r\n return undefined;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"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,CAAC,KAAK,CAAC,CAAC;YAE1D,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACa,iBAAiB,CAAC,uBAA+C;QAC/E,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC3E,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QACxD,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;IAC/B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { CurveOffsetXYHandler } from \"../internalContexts/CurveOffsetXYHandler\";\r\nimport { OffsetOptions } from \"../internalContexts/PolygonOffsetContext\";\r\n/**\r\n * This is the set of valid type names for \"integrated\" spirals\r\n * * Behavior is expressed by a `NormalizedTransition` snap function.\r\n * * The snap function varies smoothly from f(0)=0 to f(1)=1\r\n * * The various snap functions are:\r\n * * clothoid: linear\r\n * * biquadratic: 2 quadratics pieced together, joining with 1st derivative continuity at f(0.) = 0.5, with zero slope f'(0)=0 and f'(1)= 0\r\n * * bloss: A single cubic with zero slope at 0 and 1\r\n * * cosine: half of a cosine wave, centered around 0.5\r\n * * sine: full period of a sine wave added to the line f(u)=u\r\n * *\r\n * @public\r\n */\r\nexport type IntegratedSpiralTypeName = \"clothoid\" | \"bloss\" | \"biquadratic\" | \"cosine\" | \"sine\";\r\n\r\n/**\r\n * This is the set of valid type names for \"direct\" spirals.\r\n * \"Direct\" spirals can evaluate fractionToPoint by direct equations, i.e. not requiring the numeric integrations in \"Integrated\" spiral types.\r\n * @public\r\n */\r\nexport type DirectSpiralTypeName =\r\n \"JapaneseCubic\" // 1 term from each of the X,Y clothoid series expansions: y = x^3 / (6RL)\r\n | \"Arema\" // 2 terms from each of the X,Y clothoid series expansions. Identical to ChineseCubic!\r\n | \"ChineseCubic\" // Identical to Arema!\r\n | \"HalfCosine\" // high continuity cosine variation from quadratic.\r\n | \"AustralianRailCorp\" // cubic with high accuracy distance series\r\n | \"WesternAustralian\" // simple cubic -- 2 terms of x series, 1 term of y series.\r\n | \"Czech\" // simple cubic with two term distance approximation\r\n | \"MXCubicAlongArc\" // x obtained from fractional distance via 2-terms from series, y = x^3/ (6RL)\r\n | \"Polish\"\r\n | \"Italian\"\r\n ;\r\n\r\n/**\r\n * TransitionSpiral3d is a base class for multiple variants of spirals.\r\n * * The menagerie of spiral types have 2 broad categories:\r\n * * IntegratedSpiral3d -- a spiral whose direct function for curvature versus distance must be integrated to determine x,y\r\n * * The IntegratedSpiral3d types are enumerated in `IntegratedSpiralTypes`\r\n * * DirectSpiral3d -- a spiral implemented with direct calculation of x,y from fractional position along the spiral.\r\n * * The direct spiral types are enumerated in the `DirectSpiralType`\r\n * * The method set for CurvePrimitive support includes a `handleTransitionSpiral(g: TransitionSpiral3d)` which receives all the spiral types.\r\n * * The spiral class may impose expectations that its inflection is at the origin, with tangent along the x axis.\r\n * * This is generally necessary for direct spirals.\r\n * * This is not necessary for integrated spirals.\r\n * @public\r\n */\r\nexport abstract class TransitionSpiral3d extends CurvePrimitive {\r\n /** string name of spiral type */\r\n protected _spiralType: string;\r\n /** Original defining properties. */\r\n protected _designProperties: TransitionConditionalProperties | undefined;\r\n\r\n /** Fractional interval for the \"active\" part of a containing spiral.\r\n * (The radius, angle, and length conditions define a complete spiral, and some portion of it is \"active\")\r\n */\r\n protected _activeFractionInterval: Segment1d;\r\n /** Return (reference to) the active portion of the reference spiral. */\r\n public get activeFractionInterval(): Segment1d { return this._activeFractionInterval; }\r\n /** strokes in the active portion */\r\n public abstract get activeStrokes(): LineString3d;\r\n /** Placement transform */\r\n protected _localToWorld: Transform;\r\n /** (reference to) placement transform. */\r\n public get localToWorld(): Transform { return this._localToWorld; }\r\n\r\n protected constructor(spiralType: string | undefined, localToWorld: Transform, activeFractionInterval: Segment1d | undefined, designProperties: TransitionConditionalProperties | undefined) {\r\n super();\r\n this._spiralType = spiralType ? spiralType : \"unknownSpiralType\";\r\n this._designProperties = designProperties;\r\n this._localToWorld = localToWorld;\r\n this._activeFractionInterval = activeFractionInterval ? activeFractionInterval : Segment1d.create(0, 1);\r\n }\r\n\r\n public get spiralType(): string { return this._spiralType; }\r\n /** Return 1/r with convention that if true zero is given as radius it represents infinite radius (0 curvature, straight line) */\r\n public static radiusToCurvature(radius: number): number { return (radius === 0.0) ? 0.0 : 1.0 / radius; }\r\n\r\n /** Return 1/k with convention that if near-zero is given as curvature, its infinite radius is returned as 0 */\r\n public static curvatureToRadius(curvature: number): number {\r\n if (Math.abs(curvature) < Geometry.smallAngleRadians)\r\n return 0.0;\r\n return 1.0 / curvature;\r\n }\r\n\r\n /** Return the average of the start and end curvatures. */\r\n public static averageCurvature(radiusLimits: Segment1d): number {\r\n return 0.5 * (TransitionSpiral3d.radiusToCurvature(radiusLimits.x0) + TransitionSpiral3d.radiusToCurvature(radiusLimits.x1));\r\n }\r\n /**\r\n * Given two radii (or zeros for 0 curvature) return the average curvature\r\n * @param r0 start radius, or 0 for line\r\n * @param r1 end radius, or 0 for line\r\n */\r\n public static averageCurvatureR0R1(r0: number, r1: number): number {\r\n return 0.5 * (TransitionSpiral3d.radiusToCurvature(r0) + TransitionSpiral3d.radiusToCurvature(r1));\r\n }\r\n /**\r\n * Given two radii (or zeros for 0 curvature) return the average curvature\r\n * @param r0 start radius, or 0 for line\r\n * @param r1 end radius, or 0 for line\r\n */\r\n public static interpolateCurvatureR0R1(r0: number, fraction: number, r1: number): number {\r\n return Geometry.interpolate(TransitionSpiral3d.radiusToCurvature(r0), fraction, TransitionSpiral3d.radiusToCurvature(r1));\r\n }\r\n\r\n /** Return the arc length of a transition spiral with given sweep and radius pair. */\r\n public static radiusRadiusSweepRadiansToArcLength(radius0: number, radius1: number, sweepRadians: number): number {\r\n return Math.abs(sweepRadians / TransitionSpiral3d.averageCurvatureR0R1(radius0, radius1));\r\n }\r\n\r\n /** Return the turn angle for spiral of given length between two radii */\r\n public static radiusRadiusLengthToSweepRadians(radius0: number, radius1: number, arcLength: number): number {\r\n return TransitionSpiral3d.averageCurvatureR0R1(radius0, radius1) * arcLength;\r\n }\r\n\r\n /** Return the end radius for spiral of given start radius, length, and turn angle. */\r\n public static radius0LengthSweepRadiansToRadius1(radius0: number, arcLength: number, sweepRadians: number) {\r\n return TransitionSpiral3d.curvatureToRadius((2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius0));\r\n }\r\n /** Return the start radius for spiral of given end radius, length, and turn angle. */\r\n public static radius1LengthSweepRadiansToRadius0(radius1: number, arcLength: number, sweepRadians: number) {\r\n return TransitionSpiral3d.curvatureToRadius((2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius1));\r\n }\r\n /** Return the original defining properties (if any) saved by the constructor. */\r\n public get designProperties(): TransitionConditionalProperties | undefined { return this._designProperties; }\r\n /**\r\n * * If transformA is rigid with uniform scale, apply the rigid part of transformA to the localToWorld transform and return the scale and rigid separation.\r\n * * If not rigid, do nothing and return undefined.\r\n * * Also apply the scale factor to the designProperties.\r\n * @param transformA\r\n */\r\n protected applyRigidPartOfTransform(transformA: Transform): { rigidAxes: Matrix3d, scale: number } | undefined {\r\n const rigidData = transformA.matrix.factorRigidWithSignedScale();\r\n if (rigidData !== undefined) {\r\n // [sQ a][R b] = [sQ*R sQb+a]\r\n // but we save it as [Q*R sQb+a] with spiral data scaled by s.\r\n const transformC0 = transformA.multiplyTransformTransform(this.localToWorld);\r\n // BUT pull the scale part out of the matrix ...\r\n const matrixC = rigidData.rigidAxes.multiplyMatrixMatrix(this.localToWorld.matrix);\r\n this._localToWorld = Transform.createOriginAndMatrix(transformC0.origin, matrixC);\r\n if (this.designProperties)\r\n this.designProperties.applyScaleFactor(rigidData.scale);\r\n\r\n return rigidData;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\r\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object\r\n */\r\n public override constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined {\r\n const options = OffsetOptions.create(offsetDistanceOrOptions);\r\n const handler = new CurveOffsetXYHandler(this, options.leftOffsetDistance);\r\n this.emitStrokableParts(handler, options.strokeOptions);\r\n return handler.claimResult();\r\n }\r\n}\r\n"]}
@@ -258,7 +258,7 @@ export declare class Matrix3d implements BeJSONFunctions {
258
258
  */
259
259
  static createUniformScale(scaleFactor: number): Matrix3d;
260
260
  /**
261
- * Construct a rigid matrix using createHeadsUpPerpendicular to generate a vector perpendicular to vectorA..
261
+ * Construct a rigid matrix using createPerpendicularVectorFavorXYPlane to generate a vector perpendicular to vectorA.
262
262
  * *
263
263
  */
264
264
  static createRigidHeadsUp(vectorA: Vector3d, axisOrder?: AxisOrder, result?: Matrix3d): Matrix3d;
@@ -274,7 +274,7 @@ export declare class Matrix3d implements BeJSONFunctions {
274
274
  * return a vector that is perpendicular to the input direction.
275
275
  * * Among the infinite number of perpendiculars possible, this method
276
276
  * favors having one near the Z.
277
- * That is achieved by crossing "this" vector with the result of createHeadsUpPerpendicularFavorXYPlane.
277
+ * That is achieved by crossing "this" vector with the result of createPerpendicularVectorFavorXYPlane.
278
278
  */
279
279
  static createPerpendicularVectorFavorPlaneContainingZ(vector: Vector3d, result?: Vector3d): Vector3d;
280
280
  /** Create a matrix with distinct x,y,z diagonal (scale) entries.
@@ -664,8 +664,8 @@ export declare class Matrix3d implements BeJSONFunctions {
664
664
  * * if either input cffA or coffB is undefined, set state to `InverseMatrixState.unknown` (but leave the inverseCoffs untouched)
665
665
  */
666
666
  private finishInverseCoffs;
667
- /** Multiply two matrices.
668
- * @return the matrix result
667
+ /** Multiply the instance matrix A by the input matrix B.
668
+ * @return the matrix product A * B
669
669
  */
670
670
  multiplyMatrixMatrix(other: Matrix3d, result?: Matrix3d): Matrix3d;
671
671
  private static _productBuffer;
@@ -468,7 +468,7 @@ export class Matrix3d {
468
468
  return Matrix3d.createScale(scaleFactor, scaleFactor, scaleFactor);
469
469
  }
470
470
  /**
471
- * Construct a rigid matrix using createHeadsUpPerpendicular to generate a vector perpendicular to vectorA..
471
+ * Construct a rigid matrix using createPerpendicularVectorFavorXYPlane to generate a vector perpendicular to vectorA.
472
472
  * *
473
473
  */
474
474
  static createRigidHeadsUp(vectorA, axisOrder = AxisOrder.ZXY, result) {
@@ -499,7 +499,7 @@ export class Matrix3d {
499
499
  * return a vector that is perpendicular to the input direction.
500
500
  * * Among the infinite number of perpendiculars possible, this method
501
501
  * favors having one near the Z.
502
- * That is achieved by crossing "this" vector with the result of createHeadsUpPerpendicularFavorXYPlane.
502
+ * That is achieved by crossing "this" vector with the result of createPerpendicularVectorFavorXYPlane.
503
503
  */
504
504
  static createPerpendicularVectorFavorPlaneContainingZ(vector, result) {
505
505
  result = Matrix3d.createPerpendicularVectorFavorXYPlane(vector, result);
@@ -1538,8 +1538,8 @@ export class Matrix3d {
1538
1538
  * 4) M = ATranspose * B MInverse = BInverse * AInverseTranspose
1539
1539
  * 5) M = A * BTranspose MInverse = BInverseTranspose * AInverse
1540
1540
  */
1541
- /** Multiply two matrices.
1542
- * @return the matrix result
1541
+ /** Multiply the instance matrix A by the input matrix B.
1542
+ * @return the matrix product A * B
1543
1543
  */
1544
1544
  multiplyMatrixMatrix(other, result) {
1545
1545
  result = result ? result : new Matrix3d();