@itwin/core-geometry 5.4.0-dev.6 → 5.5.0-dev.1

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 (94) hide show
  1. package/CHANGELOG.md +38 -1
  2. package/lib/cjs/bspline/SurfaceLocationDetail.d.ts +1 -1
  3. package/lib/cjs/bspline/SurfaceLocationDetail.js +1 -1
  4. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  5. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  6. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  7. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +13 -0
  8. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  9. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +78 -3
  10. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  11. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.d.ts +1 -1
  12. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js +1 -1
  13. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  14. package/lib/cjs/curve/spiral/ClothoidSeries.d.ts +3 -3
  15. package/lib/cjs/curve/spiral/ClothoidSeries.d.ts.map +1 -1
  16. package/lib/cjs/curve/spiral/ClothoidSeries.js +15 -11
  17. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  18. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.d.ts +2 -5
  19. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.d.ts.map +1 -1
  20. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js +4 -12
  21. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  22. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +7 -6
  23. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  24. package/lib/cjs/curve/spiral/DirectSpiral3d.js +8 -6
  25. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  26. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
  27. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  28. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +9 -5
  29. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  30. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts +8 -7
  31. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  32. package/lib/cjs/curve/spiral/NormalizedTransition.js +32 -16
  33. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  34. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  35. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js +1 -0
  36. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  37. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +1 -1
  38. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  39. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +1 -0
  40. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  41. package/lib/cjs/geometry3d/Ray3d.d.ts +1 -2
  42. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  43. package/lib/cjs/geometry3d/Ray3d.js +1 -2
  44. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  45. package/lib/cjs/numerics/Newton.d.ts +1 -1
  46. package/lib/cjs/numerics/Newton.js +1 -1
  47. package/lib/cjs/numerics/Newton.js.map +1 -1
  48. package/lib/esm/bspline/SurfaceLocationDetail.d.ts +1 -1
  49. package/lib/esm/bspline/SurfaceLocationDetail.js +1 -1
  50. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  51. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  52. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  53. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +13 -0
  54. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  55. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +78 -3
  56. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  57. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.d.ts +1 -1
  58. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js +1 -1
  59. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  60. package/lib/esm/curve/spiral/ClothoidSeries.d.ts +3 -3
  61. package/lib/esm/curve/spiral/ClothoidSeries.d.ts.map +1 -1
  62. package/lib/esm/curve/spiral/ClothoidSeries.js +15 -11
  63. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  64. package/lib/esm/curve/spiral/CzechSpiralEvaluator.d.ts +2 -5
  65. package/lib/esm/curve/spiral/CzechSpiralEvaluator.d.ts.map +1 -1
  66. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js +4 -12
  67. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  68. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +7 -6
  69. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  70. package/lib/esm/curve/spiral/DirectSpiral3d.js +8 -6
  71. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  72. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
  73. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  74. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +9 -5
  75. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  76. package/lib/esm/curve/spiral/NormalizedTransition.d.ts +8 -7
  77. package/lib/esm/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  78. package/lib/esm/curve/spiral/NormalizedTransition.js +32 -16
  79. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  80. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  81. package/lib/esm/curve/spiral/TransitionConditionalProperties.js +1 -0
  82. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  83. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +1 -1
  84. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  85. package/lib/esm/curve/spiral/TransitionSpiral3d.js +1 -0
  86. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  87. package/lib/esm/geometry3d/Ray3d.d.ts +1 -2
  88. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  89. package/lib/esm/geometry3d/Ray3d.js +1 -2
  90. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  91. package/lib/esm/numerics/Newton.d.ts +1 -1
  92. package/lib/esm/numerics/Newton.js +1 -1
  93. package/lib/esm/numerics/Newton.js.map +1 -1
  94. package/package.json +3 -3
@@ -14,10 +14,12 @@
14
14
  * * Each implementation provides:
15
15
  * * fractionToCurvature -- the f(u) function described above
16
16
  * * fractionToCurvatureDerivative -- df(u)/du
17
- * * fractionToArea -- integral of the area under f(u) from 0 to u.
18
- * * The symmetry condition ensures that the integral from 0 to 1 is 1/2.
17
+ * * fractionToArea -- antiderivative A of f, chosen such that A(0) = 0. The value of this function at
18
+ * fraction u is the area under f from 0 to u. In particular, the symmetry condition on f implies that
19
+ * 1/2 = "integral of f over [0,1]" = A(1) - A(0) = A(1).
19
20
  * @internal
20
21
  */
22
+ // see internaldocs/Spiral.md for more info
21
23
  export class NormalizedTransition {
22
24
  /** Constructor initializes with 0..1 values. Call "setBearingCurvatureLengthCurvature" to apply real values. */
23
25
  constructor() { }
@@ -54,10 +56,13 @@ export class NormalizedTransition {
54
56
  }
55
57
  /**
56
58
  * Transition functions for clothoid spiral.
57
- * * curvature variation is linear from (0,0) to (1,1)
59
+ * * Curvature variation is linear from (0,0) to (1,1).
58
60
  * @internal
59
61
  */
60
62
  export class NormalizedClothoidTransition extends NormalizedTransition {
63
+ // clothoid curvature is f(x) = x
64
+ // derivative f'(x) = 1
65
+ // integral If(x) = x^2 / 2
61
66
  constructor() {
62
67
  super();
63
68
  }
@@ -83,13 +88,12 @@ export class NormalizedClothoidTransition extends NormalizedTransition {
83
88
  * @internal
84
89
  */
85
90
  export class NormalizedBlossTransition extends NormalizedTransition {
86
- // bloss curve is (3 - 2x) x ^2 = 3 x^2 - 2 x^3
91
+ // bloss curvature is x^2 (3 - 2x)
87
92
  // derivative 6x (1-x)
88
- // 2nd derivative 6 - 12 x
89
- // derivatives zero at 0,1
90
- // inflection zero at 0.5
91
- // integral is x^3 - x^4 / 2 = x^3 (1-x/2)
92
- constructor() { super(); }
93
+ // integral is x^3 (1-x/2)
94
+ constructor() {
95
+ super();
96
+ }
93
97
  /** At fractional position on the x axis, return the (normalized) curvature fraction. */
94
98
  fractionToCurvatureFraction(u) {
95
99
  return u * u * (3 - 2 * u);
@@ -128,17 +132,17 @@ export class NormalizedBiQuadraticTransition extends NormalizedTransition {
128
132
  }
129
133
  /**
130
134
  * At fractional position on the x axis, return the (normalized) curvature fraction.
131
- * * For [u <= 0.5, u >= 0.5]
132
- * * f(u) = [2 u^2, 1 - 2 (1-u)^2]
133
- * * f'(u) = [4 u, 4 (1-u)]
134
- * * If(u) = [2 u^3 / 3, 0.5 (1 -u )^3/3]
135
+ * * For [u <= 0.5, u > 0.5]
136
+ * * f(u) = [2u^2, 1 - 2(1-u)^2]
137
+ * * f'(u) = [4u, 4(1-u)]
138
+ * * If(u) = [2u^3 / 3, u + 2(1-u)^3 /3]
135
139
  */
136
140
  fractionToCurvatureFraction(u) {
137
141
  return u <= 0.5 ? this.basis(u) : 1.0 - this.basis(1.0 - u);
138
142
  }
139
143
  /** Return the derivative of the (normalized) curvature fraction. */
140
144
  fractionToCurvatureFractionDerivative(u) {
141
- return u < 0.5 ? this.basisDerivative(u) : this.basisDerivative(1 - u);
145
+ return u <= 0.5 ? this.basisDerivative(u) : this.basisDerivative(1 - u);
142
146
  }
143
147
  /**
144
148
  * Return the integrated area under the curve.
@@ -147,6 +151,7 @@ export class NormalizedBiQuadraticTransition extends NormalizedTransition {
147
151
  fractionToArea(u) {
148
152
  if (u <= 0.5)
149
153
  return this.integratedBasis(u);
154
+ // if u > 0.5, integral[0 to u] would be integral[0 to 0.5] of "2u^2" + integral[0.5 to u] of "1 - 2(1-u)^2"
150
155
  const v = 1 - u;
151
156
  return 0.5 - v + this.integratedBasis(v);
152
157
  }
@@ -159,7 +164,13 @@ export class NormalizedBiQuadraticTransition extends NormalizedTransition {
159
164
  * @internal
160
165
  */
161
166
  export class NormalizedSineTransition extends NormalizedTransition {
162
- constructor() { super(); }
167
+ // sine transition curvature is x - sin(2 pi x) / (2 pi)
168
+ // derivative 1 - cos(2 pi x)
169
+ // integral x^2 / 2 + (cos(2 pi x) - 1) / (4 pi^2)
170
+ // note: this is the only snap function whose antiderivative is chosen with nonzero integration constant.
171
+ constructor() {
172
+ super();
173
+ }
163
174
  /** At fractional position on the x axis, return the (normalized) curvature fraction. */
164
175
  fractionToCurvatureFraction(u) {
165
176
  const a = 2.0 * Math.PI;
@@ -185,7 +196,12 @@ export class NormalizedSineTransition extends NormalizedTransition {
185
196
  * @internal
186
197
  */
187
198
  export class NormalizedCosineTransition extends NormalizedTransition {
188
- constructor() { super(); }
199
+ // cosine transition curvature is 0.5 (1 - cos(pi x))
200
+ // derivative 0.5 pi sin(pi x)
201
+ // integral 0.5 (x - sin(pi x) / pi)
202
+ constructor() {
203
+ super();
204
+ }
189
205
  /** At fractional position on the x axis, return the (normalized) curvature fraction. */
190
206
  fractionToCurvatureFraction(u) {
191
207
  const a = Math.PI;
@@ -1 +1 @@
1
- {"version":3,"file":"NormalizedTransition.js","sourceRoot":"","sources":["../../../../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qC,CAAC,CAAS;QACpD,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,CAAC;IACD;;;OAGG;IACI,cAAc,CAAC,CAAS;QAC7B,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACzD,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,0BAA2B,SAAQ,oBAAoB;IAClE,gBAAgB,KAAK,EAAE,CAAC,CAAC,CAAC;IAC1B,wFAAwF;IACjF,2BAA2B,CAAC,CAAS;QAC1C,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,OAAO,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,oEAAoE;IAC7D,qCAAqC,CAAC,CAAS;QACpD,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,OAAO,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,CAAC;IACD;;;OAGG;IACI,cAAc,CAAC,CAAS;QAC7B,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7C,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\n/**\r\n * NormalizedTransition is the (abstract) base class for clothoid, bloss, biquadratic, sine, and cosine transition functions.\r\n * * Each function maps fractional progress to a curvature value.\r\n * * f(0) === 0\r\n * * f(1) === 1\r\n * * f(u) === 1 - f(1-u)\r\n * * Each implementation provides:\r\n * * fractionToCurvature -- the f(u) function described above\r\n * * fractionToCurvatureDerivative -- df(u)/du\r\n * * fractionToArea -- integral of the area under f(u) from 0 to u.\r\n * * The symmetry condition ensures that the integral from 0 to 1 is 1/2.\r\n * @internal\r\n */\r\nexport abstract class NormalizedTransition {\r\n /** Constructor initializes with 0..1 values. Call \"setBearingCurvatureLengthCurvature\" to apply real values. */\r\n constructor() { }\r\n /** At fractional position on the x axis, return the (normalized) curvature fraction. */\r\n public abstract fractionToCurvatureFraction(fractionX: number): number;\r\n /** Return the derivative of the (normalized) curvature fraction. */\r\n public abstract fractionToCurvatureFractionDerivative(fractionX: number): number;\r\n /**\r\n * Return the integrated area under the curve.\r\n * * This is equal to the accumulated angle change.\r\n */\r\n public abstract fractionToArea(fractionX: number): number;\r\n private static _clothoidEvaluator?: NormalizedClothoidTransition;\r\n private static _biquadraticEvaluator?: NormalizedBiQuadraticTransition;\r\n private static _blossEvaluator?: NormalizedBlossTransition;\r\n private static _sineEvaluator?: NormalizedSineTransition;\r\n private static _cosineEvaluator?: NormalizedCosineTransition;\r\n /**\r\n * Return a standard evaluator identified by string as:\r\n * * clothoid\r\n * * bloss\r\n * * biquadratic\r\n * * sine\r\n * * cosine\r\n * Each of these types\r\n * * is instantiated (only once) as a single static object within the NormalizedTransition class.\r\n * * has no instance data or mutator methods.\r\n * @param name string name of the transition.\r\n */\r\n public static findEvaluator(name: string): NormalizedTransition | undefined {\r\n if (name === \"clothoid\")\r\n return this._clothoidEvaluator ? this._clothoidEvaluator : (this._clothoidEvaluator = new NormalizedClothoidTransition());\r\n if (name === \"bloss\")\r\n return this._blossEvaluator ? this._blossEvaluator : (this._blossEvaluator = new NormalizedBlossTransition());\r\n if (name === \"biquadratic\")\r\n return this._biquadraticEvaluator ? this._biquadraticEvaluator : (this._biquadraticEvaluator = new NormalizedBiQuadraticTransition());\r\n if (name === \"sine\")\r\n return this._sineEvaluator ? this._sineEvaluator : (this._sineEvaluator = new NormalizedSineTransition());\r\n if (name === \"cosine\")\r\n return this._cosineEvaluator ? this._cosineEvaluator : (this._cosineEvaluator = new NormalizedCosineTransition());\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Transition functions for clothoid spiral.\r\n * * curvature variation is linear from (0,0) to (1,1)\r\n * @internal\r\n */\r\nexport class NormalizedClothoidTransition extends NormalizedTransition {\r\n constructor() {\r\n super();\r\n }\r\n /** At fractional position on the x axis, return the (normalized) curvature fraction. */\r\n public fractionToCurvatureFraction(fractionX: number): number {\r\n return fractionX;\r\n }\r\n /** Return the derivative of the (normalized) curvature fraction. */\r\n public fractionToCurvatureFractionDerivative(_u: number): number {\r\n return 1.0;\r\n }\r\n /**\r\n * Return the integrated area under the curve.\r\n * * This fraction is the angular change fraction.\r\n */\r\n public fractionToArea(fractionX: number): number {\r\n return fractionX * fractionX * 0.5;\r\n }\r\n}\r\n\r\n/**\r\n * Transition functions for bloss spiral.\r\n * * curvature variation is cubic from (0,0) with slope 0 to (1,1) with slope 1.\r\n * @internal\r\n */\r\nexport class NormalizedBlossTransition extends NormalizedTransition {\r\n // bloss curve is (3 - 2x) x ^2 = 3 x^2 - 2 x^3\r\n // derivative 6x (1-x)\r\n // 2nd derivative 6 - 12 x\r\n // derivatives zero at 0,1\r\n // inflection zero at 0.5\r\n // integral is x^3 - x^4 / 2 = x^3 (1-x/2)\r\n constructor() { super(); }\r\n /** At fractional position on the x axis, return the (normalized) curvature fraction. */\r\n public fractionToCurvatureFraction(u: number): number {\r\n return u * u * (3 - 2 * u);\r\n }\r\n /** Return the derivative of the (normalized) curvature fraction. */\r\n public fractionToCurvatureFractionDerivative(u: number): number {\r\n return 6.0 * u * (1.0 - u);\r\n }\r\n /**\r\n * Return the integrated area under the curve.\r\n * * This fraction is the angular change fraction.\r\n */\r\n public fractionToArea(u: number): number {\r\n return u * u * u * (1 - 0.5 * u);\r\n }\r\n}\r\n\r\n/**\r\n * Transition functions for biquadratic transition.\r\n * * Curvature is a pair of joining quadratics.\r\n * * In lower half of the interval, the quadratic is from (0,0) to (0.5, 0.5) with zero slope at origin.\r\n * * In upper half of the interval, the quadratic is from (0.5,0.5) to (1,1) with zero slope at 1.\r\n * @internal\r\n */\r\nexport class NormalizedBiQuadraticTransition extends NormalizedTransition {\r\n constructor() {\r\n super();\r\n }\r\n private integratedBasis(u: number): number {\r\n return u * u * u * (2.0 / 3.0);\r\n }\r\n private basis(u: number): number {\r\n return 2 * u * u;\r\n }\r\n private basisDerivative(u: number): number {\r\n return 4 * u;\r\n }\r\n /**\r\n * At fractional position on the x axis, return the (normalized) curvature fraction.\r\n * * For [u <= 0.5, u >= 0.5]\r\n * * f(u) = [2 u^2, 1 - 2 (1-u)^2]\r\n * * f'(u) = [4 u, 4 (1-u)]\r\n * * If(u) = [2 u^3 / 3, 0.5 (1 -u )^3/3]\r\n */\r\n public fractionToCurvatureFraction(u: number): number {\r\n return u <= 0.5 ? this.basis(u) : 1.0 - this.basis(1.0 - u);\r\n }\r\n /** Return the derivative of the (normalized) curvature fraction. */\r\n public fractionToCurvatureFractionDerivative(u: number): number {\r\n return u < 0.5 ? this.basisDerivative(u) : this.basisDerivative(1 - u);\r\n }\r\n /**\r\n * Return the integrated area under the curve.\r\n * * This fraction is the angular change fraction.\r\n */\r\n public fractionToArea(u: number): number {\r\n if (u <= 0.5)\r\n return this.integratedBasis(u);\r\n const v = 1 - u;\r\n return 0.5 - v + this.integratedBasis(v);\r\n }\r\n}\r\n\r\n/**\r\n * Transition functions for sine transition.\r\n * * curvature variation is the sum of\r\n * * straight line from (0,0) to (1,1), like clothoid.\r\n * * additional full period of a sine wave, producing 0 slope at both ends.\r\n * @internal\r\n */\r\nexport class NormalizedSineTransition extends NormalizedTransition {\r\n constructor() { super(); }\r\n /** At fractional position on the x axis, return the (normalized) curvature fraction. */\r\n public fractionToCurvatureFraction(u: number): number {\r\n const a = 2.0 * Math.PI;\r\n return u - Math.sin(u * a) / a;\r\n }\r\n /** Return the derivative of the (normalized) curvature fraction. */\r\n public fractionToCurvatureFractionDerivative(u: number): number {\r\n const a = 2.0 * Math.PI;\r\n return 1 - Math.cos(u * a);\r\n }\r\n /**\r\n * Return the integrated area under the curve.\r\n * * This fraction is the angular change fraction.\r\n */\r\n public fractionToArea(u: number): number {\r\n const a = 2.0 * Math.PI;\r\n return 0.5 * u * u + (Math.cos(u * a) - 1.0) / (a * a);\r\n }\r\n}\r\n\r\n/**\r\n * Transition functions for cosine.\r\n * * curvature variation is a half period of a cosine.\r\n * @internal\r\n */\r\nexport class NormalizedCosineTransition extends NormalizedTransition {\r\n constructor() { super(); }\r\n /** At fractional position on the x axis, return the (normalized) curvature fraction. */\r\n public fractionToCurvatureFraction(u: number): number {\r\n const a = Math.PI;\r\n return 0.5 * (1 - Math.cos(u * a));\r\n }\r\n /** Return the derivative of the (normalized) curvature fraction. */\r\n public fractionToCurvatureFractionDerivative(u: number): number {\r\n const a = Math.PI;\r\n return 0.5 * a * Math.sin(u * a);\r\n }\r\n /**\r\n * Return the integrated area under the curve.\r\n * * This fraction is the angular change fraction.\r\n */\r\n public fractionToArea(u: number): number {\r\n const a = Math.PI;\r\n return 0.5 * u - 0.5 * Math.sin(u * a) / a;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"NormalizedTransition.js","sourceRoot":"","sources":["../../../../src/curve/spiral/NormalizedTransition.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AACH,2CAA2C;AAC3C,MAAM,OAAgB,oBAAoB;IACxC,gHAAgH;IAChH,gBAAgB,C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GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,CAAC;IACD;;;OAGG;IACI,cAAc,CAAC,CAAS;QAC7B,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACzD,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,0BAA2B,SAAQ,oBAAoB;IAClE,qDAAqD;IACrD,8BAA8B;IAC9B,oCAAoC;IACpC;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IACD,wFAAwF;IACjF,2BAA2B,CAAC,CAAS;QAC1C,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,OAAO,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,oEAAoE;IAC7D,qCAAqC,CAAC,CAAS;QACpD,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,OAAO,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,CAAC;IACD;;;OAGG;IACI,cAAc,CAAC,CAAS;QAC7B,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7C,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\n/**\r\n * NormalizedTransition is the (abstract) base class for clothoid, bloss, biquadratic, sine, and cosine transition functions.\r\n * * Each function maps fractional progress to a curvature value.\r\n * * f(0) === 0\r\n * * f(1) === 1\r\n * * f(u) === 1 - f(1-u)\r\n * * Each implementation provides:\r\n * * fractionToCurvature -- the f(u) function described above\r\n * * fractionToCurvatureDerivative -- df(u)/du\r\n * * fractionToArea -- antiderivative A of f, chosen such that A(0) = 0. The value of this function at\r\n * fraction u is the area under f from 0 to u. In particular, the symmetry condition on f implies that\r\n * 1/2 = \"integral of f over [0,1]\" = A(1) - A(0) = A(1).\r\n * @internal\r\n */\r\n// see internaldocs/Spiral.md for more info\r\nexport abstract class NormalizedTransition {\r\n /** Constructor initializes with 0..1 values. Call \"setBearingCurvatureLengthCurvature\" to apply real values. */\r\n constructor() { }\r\n /** At fractional position on the x axis, return the (normalized) curvature fraction. */\r\n public abstract fractionToCurvatureFraction(fractionX: number): number;\r\n /** Return the derivative of the (normalized) curvature fraction. */\r\n public abstract fractionToCurvatureFractionDerivative(fractionX: number): number;\r\n /**\r\n * Return the integrated area under the curve.\r\n * * This is equal to the accumulated angle change.\r\n */\r\n public abstract fractionToArea(fractionX: number): number;\r\n private static _clothoidEvaluator?: NormalizedClothoidTransition;\r\n private static _biquadraticEvaluator?: NormalizedBiQuadraticTransition;\r\n private static _blossEvaluator?: NormalizedBlossTransition;\r\n private static _sineEvaluator?: NormalizedSineTransition;\r\n private static _cosineEvaluator?: NormalizedCosineTransition;\r\n /**\r\n * Return a standard evaluator identified by string as:\r\n * * clothoid\r\n * * bloss\r\n * * biquadratic\r\n * * sine\r\n * * cosine\r\n * Each of these types\r\n * * is instantiated (only once) as a single static object within the NormalizedTransition class.\r\n * * has no instance data or mutator methods.\r\n * @param name string name of the transition.\r\n */\r\n public static findEvaluator(name: string): NormalizedTransition | undefined {\r\n if (name === \"clothoid\")\r\n return this._clothoidEvaluator ? this._clothoidEvaluator : (this._clothoidEvaluator = new NormalizedClothoidTransition());\r\n if (name === \"bloss\")\r\n return this._blossEvaluator ? this._blossEvaluator : (this._blossEvaluator = new NormalizedBlossTransition());\r\n if (name === \"biquadratic\")\r\n return this._biquadraticEvaluator ? this._biquadraticEvaluator : (this._biquadraticEvaluator = new NormalizedBiQuadraticTransition());\r\n if (name === \"sine\")\r\n return this._sineEvaluator ? this._sineEvaluator : (this._sineEvaluator = new NormalizedSineTransition());\r\n if (name === \"cosine\")\r\n return this._cosineEvaluator ? this._cosineEvaluator : (this._cosineEvaluator = new NormalizedCosineTransition());\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Transition functions for clothoid spiral.\r\n * * Curvature variation is linear from (0,0) to (1,1).\r\n * @internal\r\n */\r\nexport class NormalizedClothoidTransition extends NormalizedTransition {\r\n // clothoid curvature is f(x) = x\r\n // derivative f'(x) = 1\r\n // integral If(x) = x^2 / 2\r\n constructor() {\r\n super();\r\n }\r\n /** At fractional position on the x axis, return the (normalized) curvature fraction. */\r\n public fractionToCurvatureFraction(fractionX: number): number {\r\n return fractionX;\r\n }\r\n /** Return the derivative of the (normalized) curvature fraction. */\r\n public fractionToCurvatureFractionDerivative(_u: number): number {\r\n return 1.0;\r\n }\r\n /**\r\n * Return the integrated area under the curve.\r\n * * This fraction is the angular change fraction.\r\n */\r\n public fractionToArea(fractionX: number): number {\r\n return fractionX * fractionX * 0.5;\r\n }\r\n}\r\n\r\n/**\r\n * Transition functions for bloss spiral.\r\n * * curvature variation is cubic from (0,0) with slope 0 to (1,1) with slope 1.\r\n * @internal\r\n */\r\nexport class NormalizedBlossTransition extends NormalizedTransition {\r\n // bloss curvature is x^2 (3 - 2x)\r\n // derivative 6x (1-x)\r\n // integral is x^3 (1-x/2)\r\n constructor() {\r\n super();\r\n }\r\n /** At fractional position on the x axis, return the (normalized) curvature fraction. */\r\n public fractionToCurvatureFraction(u: number): number {\r\n return u * u * (3 - 2 * u);\r\n }\r\n /** Return the derivative of the (normalized) curvature fraction. */\r\n public fractionToCurvatureFractionDerivative(u: number): number {\r\n return 6.0 * u * (1.0 - u);\r\n }\r\n /**\r\n * Return the integrated area under the curve.\r\n * * This fraction is the angular change fraction.\r\n */\r\n public fractionToArea(u: number): number {\r\n return u * u * u * (1 - 0.5 * u);\r\n }\r\n}\r\n\r\n/**\r\n * Transition functions for biquadratic transition.\r\n * * Curvature is a pair of joining quadratics.\r\n * * In lower half of the interval, the quadratic is from (0,0) to (0.5, 0.5) with zero slope at origin.\r\n * * In upper half of the interval, the quadratic is from (0.5,0.5) to (1,1) with zero slope at 1.\r\n * @internal\r\n */\r\nexport class NormalizedBiQuadraticTransition extends NormalizedTransition {\r\n constructor() {\r\n super();\r\n }\r\n private integratedBasis(u: number): number {\r\n return u * u * u * (2.0 / 3.0);\r\n }\r\n private basis(u: number): number {\r\n return 2 * u * u;\r\n }\r\n private basisDerivative(u: number): number {\r\n return 4 * u;\r\n }\r\n /**\r\n * At fractional position on the x axis, return the (normalized) curvature fraction.\r\n * * For [u <= 0.5, u > 0.5]\r\n * * f(u) = [2u^2, 1 - 2(1-u)^2]\r\n * * f'(u) = [4u, 4(1-u)]\r\n * * If(u) = [2u^3 / 3, u + 2(1-u)^3 /3]\r\n */\r\n public fractionToCurvatureFraction(u: number): number {\r\n return u <= 0.5 ? this.basis(u) : 1.0 - this.basis(1.0 - u);\r\n }\r\n /** Return the derivative of the (normalized) curvature fraction. */\r\n public fractionToCurvatureFractionDerivative(u: number): number {\r\n return u <= 0.5 ? this.basisDerivative(u) : this.basisDerivative(1 - u);\r\n }\r\n /**\r\n * Return the integrated area under the curve.\r\n * * This fraction is the angular change fraction.\r\n */\r\n public fractionToArea(u: number): number {\r\n if (u <= 0.5)\r\n return this.integratedBasis(u);\r\n // if u > 0.5, integral[0 to u] would be integral[0 to 0.5] of \"2u^2\" + integral[0.5 to u] of \"1 - 2(1-u)^2\"\r\n const v = 1 - u;\r\n return 0.5 - v + this.integratedBasis(v);\r\n }\r\n}\r\n\r\n/**\r\n * Transition functions for sine transition.\r\n * * curvature variation is the sum of\r\n * * straight line from (0,0) to (1,1), like clothoid.\r\n * * additional full period of a sine wave, producing 0 slope at both ends.\r\n * @internal\r\n */\r\nexport class NormalizedSineTransition extends NormalizedTransition {\r\n // sine transition curvature is x - sin(2 pi x) / (2 pi)\r\n // derivative 1 - cos(2 pi x)\r\n // integral x^2 / 2 + (cos(2 pi x) - 1) / (4 pi^2)\r\n // note: this is the only snap function whose antiderivative is chosen with nonzero integration constant.\r\n constructor() {\r\n super();\r\n }\r\n /** At fractional position on the x axis, return the (normalized) curvature fraction. */\r\n public fractionToCurvatureFraction(u: number): number {\r\n const a = 2.0 * Math.PI;\r\n return u - Math.sin(u * a) / a;\r\n }\r\n /** Return the derivative of the (normalized) curvature fraction. */\r\n public fractionToCurvatureFractionDerivative(u: number): number {\r\n const a = 2.0 * Math.PI;\r\n return 1 - Math.cos(u * a);\r\n }\r\n /**\r\n * Return the integrated area under the curve.\r\n * * This fraction is the angular change fraction.\r\n */\r\n public fractionToArea(u: number): number {\r\n const a = 2.0 * Math.PI;\r\n return 0.5 * u * u + (Math.cos(u * a) - 1.0) / (a * a);\r\n }\r\n}\r\n\r\n/**\r\n * Transition functions for cosine.\r\n * * curvature variation is a half period of a cosine.\r\n * @internal\r\n */\r\nexport class NormalizedCosineTransition extends NormalizedTransition {\r\n // cosine transition curvature is 0.5 (1 - cos(pi x))\r\n // derivative 0.5 pi sin(pi x)\r\n // integral 0.5 (x - sin(pi x) / pi)\r\n constructor() {\r\n super();\r\n }\r\n /** At fractional position on the x axis, return the (normalized) curvature fraction. */\r\n public fractionToCurvatureFraction(u: number): number {\r\n const a = Math.PI;\r\n return 0.5 * (1 - Math.cos(u * a));\r\n }\r\n /** Return the derivative of the (normalized) curvature fraction. */\r\n public fractionToCurvatureFractionDerivative(u: number): number {\r\n const a = Math.PI;\r\n return 0.5 * a * Math.sin(u * a);\r\n }\r\n /**\r\n * Return the integrated area under the curve.\r\n * * This fraction is the angular change fraction.\r\n */\r\n public fractionToArea(u: number): number {\r\n const a = Math.PI;\r\n return 0.5 * u - 0.5 * Math.sin(u * a) / a;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TransitionConditionalProperties.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionConditionalProperties.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAG/C;;;;;;;;;;;;GAYG;AACH,qBAAa,+BAA+B;IAC1C;;;OAGG;IACI,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;OAGG;IACI,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;OAGG;IACI,QAAQ,EAAE,KAAK,GAAG,SAAS,CAAC;IACnC;;;OAGG;IACI,QAAQ,EAAE,KAAK,GAAG,SAAS,CAAC;IACnC,oBAAoB;IACb,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC;;;;;;;OAOG;gBAED,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,QAAQ,EAAE,KAAK,GAAG,SAAS,EAC3B,QAAQ,EAAE,KAAK,GAAG,SAAS,EAC3B,SAAS,EAAE,MAAM,GAAG,SAAS;IAQ/B,kEAAkE;IAC3D,oBAAoB;IAO3B,qEAAqE;IAC9D,KAAK,IAAI,+BAA+B;IAS/C,0EAA0E;IACnE,qBAAqB,IAAI,OAAO;IAUvC;;;OAGG;IACI,0BAA0B,IAAI,OAAO;IAsC5C,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,kBAAkB;IAO1B,8EAA8E;IACvE,aAAa,CAAC,KAAK,CAAC,EAAE,+BAA+B,GAAG,OAAO;IAetE,iFAAiF;IAC1E,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAUxC,uEAAuE;WACzD,cAAc,CAC1B,CAAC,EAAE,+BAA+B,GAAG,SAAS,EAAE,CAAC,EAAE,+BAA+B,GAAG,SAAS,GAC7F,OAAO;CAKX"}
1
+ {"version":3,"file":"TransitionConditionalProperties.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionConditionalProperties.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAG/C;;;;;;;;;;;;GAYG;AAEH,qBAAa,+BAA+B;IAC1C;;;OAGG;IACI,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;OAGG;IACI,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;OAGG;IACI,QAAQ,EAAE,KAAK,GAAG,SAAS,CAAC;IACnC;;;OAGG;IACI,QAAQ,EAAE,KAAK,GAAG,SAAS,CAAC;IACnC,oBAAoB;IACb,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC;;;;;;;OAOG;gBAED,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,QAAQ,EAAE,KAAK,GAAG,SAAS,EAC3B,QAAQ,EAAE,KAAK,GAAG,SAAS,EAC3B,SAAS,EAAE,MAAM,GAAG,SAAS;IAQ/B,kEAAkE;IAC3D,oBAAoB;IAO3B,qEAAqE;IAC9D,KAAK,IAAI,+BAA+B;IAS/C,0EAA0E;IACnE,qBAAqB,IAAI,OAAO;IAUvC;;;OAGG;IACI,0BAA0B,IAAI,OAAO;IAsC5C,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,kBAAkB;IAO1B,8EAA8E;IACvE,aAAa,CAAC,KAAK,CAAC,EAAE,+BAA+B,GAAG,OAAO;IAetE,iFAAiF;IAC1E,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAUxC,uEAAuE;WACzD,cAAc,CAC1B,CAAC,EAAE,+BAA+B,GAAG,SAAS,EAAE,CAAC,EAAE,+BAA+B,GAAG,SAAS,GAC7F,OAAO;CAKX"}
@@ -21,6 +21,7 @@ import { TransitionSpiral3d } from "./TransitionSpiral3d";
21
21
  * determines the remaining one.
22
22
  * @public
23
23
  */
24
+ // see internaldocs/Spiral.md for more info
24
25
  export class TransitionConditionalProperties {
25
26
  /**
26
27
  * Radius at start (radius of the osculating circle at the spiral segment's start).
@@ -1 +1 @@
1
- {"version":3,"file":"TransitionConditionalProperties.js","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionConditionalProperties.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,+BAA+B;IAC1C;;;OAGG;IACI,OAAO,CAAqB;IACnC;;;OAGG;IACI,OAAO,CAAqB;IACnC;;;OAGG;IACI,QAAQ,CAAoB;IACnC;;;OAGG;IACI,QAAQ,CAAoB;IACnC,oBAAoB;IACb,WAAW,CAAqB;IACvC;;;;;;;OAOG;IACH,YACE,OAA2B,EAC3B,OAA2B,EAC3B,QAA2B,EAC3B,QAA2B,EAC3B,SAA6B;QAE7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;IAC/B,CAAC;IACD,kEAAkE;IAC3D,oBAAoB;QACzB,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC;cACnC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC;cAChC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,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,EAAE,KAAK,CAAC,OAAO,CAAC;YAC1D,OAAO,KAAK,CAAC;QACf,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;YAC1D,OAAO,KAAK,CAAC;QACf,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;YACzD,OAAO,KAAK,CAAC;QACf,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;YACzD,OAAO,KAAK,CAAC;QACf,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC;YAClE,OAAO,KAAK,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IACD,iFAAiF;IAC1E,gBAAgB,CAAC,CAAS;QAC/B,IAAI,CAAC,KAAK,CAAC;YACT,OAAO;QACT,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS;YAC5B,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;QACpB,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS;YAC5B,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;QACpB,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS;YAChC,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC;IAC1B,CAAC;IACD,uEAAuE;IAChE,MAAM,CAAC,cAAc,CAC1B,CAA8C,EAAE,CAA8C;QAE9F,IAAI,CAAC,KAAK,SAAS;YACjB,OAAO,CAAC,KAAK,SAAS,CAAC;QACzB,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAC5B,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\nimport { Geometry } from \"../../Geometry\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\r\n\r\n/**\r\n * A true transition spiral is a curve defined by its curvature, with the curvature function symmetric about midpoint.\r\n * * The symmetry condition creates a relationship among the following 4 quantities:\r\n * ** curvature0 = curvature (i.e. 1/radius) at start.\r\n * ** curvature1 = curvature (i.e. 1/radius) at end.\r\n * ** sweepRadians = signed turning angle from start to end.\r\n * ** arcLength = length of curve.\r\n * * The relationship is the equation:\r\n * ** `sweepRadians = arcLength * average Curvature = arcLength * 0.5 * (curvature0 + curvature1)`\r\n * * That is, regardless of any curvature properties other than symmetry, specifying any 3 of the quantities fully\r\n * determines the remaining one.\r\n * @public\r\n */\r\nexport class TransitionConditionalProperties {\r\n /**\r\n * Radius at start (radius of the osculating circle at the spiral segment's start).\r\n * radius0 === 0 means straight line at start.\r\n */\r\n public radius0: number | undefined;\r\n /**\r\n * Radius at end (radius of the osculating circle at the spiral segment's end).\r\n * radius1 === 0 means straight line at end.\r\n */\r\n public radius1: number | undefined;\r\n /**\r\n * Bearing at start (the signed angle from global x-axis to the start tangent of the spiral).\r\n * * If the direction from x-axis to start tangent is CCW, the start bearing is positive.\r\n */\r\n public bearing0: Angle | undefined;\r\n /**\r\n * Bearing at end (the signed angle from global x-axis to the end tangent of the spiral).\r\n * * If the direction from x-axis to end tangent is CCW, the end bearing is positive.\r\n */\r\n public bearing1: Angle | undefined;\r\n /** Curve length. */\r\n public curveLength: number | undefined;\r\n /**\r\n * Capture numeric or undefined values.\r\n * @param radius0 start radius or undefined.\r\n * @param radius1 end radius or undefined.\r\n * @param bearing0 start bearing or undefined.\r\n * @param bearing1 end bearing or undefined.\r\n * @param arcLength arc length or undefined.\r\n */\r\n public constructor(\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 ) {\r\n this.radius0 = radius0;\r\n this.radius1 = radius1;\r\n this.bearing0 = bearing0;\r\n this.bearing1 = bearing1;\r\n this.curveLength = arcLength;\r\n }\r\n /** Return the number of defined values among the 5 properties. */\r\n public numDefinedProperties() {\r\n return Geometry.defined01(this.radius0)\r\n + Geometry.defined01(this.radius1)\r\n + Geometry.defined01(this.bearing0)\r\n + Geometry.defined01(this.bearing1)\r\n + Geometry.defined01(this.curveLength);\r\n }\r\n /** Clone with all 5 properties (i.e., preserve undefined states). */\r\n public clone(): TransitionConditionalProperties {\r\n return new TransitionConditionalProperties(\r\n this.radius0,\r\n this.radius1,\r\n this.bearing0 === undefined ? undefined : this.bearing0.clone(),\r\n this.bearing1 === undefined ? undefined : this.bearing1.clone(),\r\n this.curveLength,\r\n );\r\n }\r\n /** Return true if all 5 properties are defined and agree equationally. */\r\n public getIsValidCompleteSet(): boolean {\r\n if (this.curveLength !== undefined && this.bearing0 !== undefined && this.bearing1 !== undefined\r\n && this.radius0 !== undefined && this.radius1 !== undefined) {\r\n const arcLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(\r\n this.radius0, this.radius1, this.bearing1.radians - this.bearing0.radians,\r\n );\r\n return Geometry.isSameCoordinate(this.curveLength, arcLength);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Examine which properties are defined and compute the (single) undefined.\r\n * @returns true if the input state had precisely one undefined member.\r\n */\r\n public tryResolveAnySingleUnknown(): boolean {\r\n if (this.getIsValidCompleteSet())\r\n return true;\r\n if (this.bearing0 && this.bearing1) {\r\n const sweepRadians = this.bearing1.radians - this.bearing0.radians;\r\n if (this.curveLength === undefined && this.radius0 !== undefined && this.radius1 !== undefined) {\r\n this.curveLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(this.radius0, this.radius1, sweepRadians);\r\n return true;\r\n }\r\n if (this.curveLength !== undefined && this.radius0 === undefined && this.radius1 !== undefined) {\r\n this.radius0 = TransitionSpiral3d.radius1LengthSweepRadiansToRadius0(this.radius1, this.curveLength, sweepRadians);\r\n return true;\r\n }\r\n if (this.curveLength !== undefined && this.radius0 !== undefined && this.radius1 === undefined) {\r\n this.radius1 = TransitionSpiral3d.radius0LengthSweepRadiansToRadius1(this.radius0, this.curveLength, sweepRadians);\r\n return true;\r\n }\r\n return false;\r\n }\r\n // at least one bearing is undefined\r\n if (this.curveLength === undefined || this.radius0 === undefined || this.radius1 === undefined)\r\n return false;\r\n if (this.bearing0) { // bearing 1 is undefined\r\n this.bearing1 = Angle.createRadians(\r\n this.bearing0.radians +\r\n TransitionSpiral3d.radiusRadiusLengthToSweepRadians(this.radius0, this.radius1, this.curveLength),\r\n );\r\n return true;\r\n }\r\n if (this.bearing1) { // bearing 0 is undefined\r\n this.bearing0 = Angle.createRadians(\r\n this.bearing1.radians -\r\n TransitionSpiral3d.radiusRadiusLengthToSweepRadians(this.radius0, this.radius1, this.curveLength),\r\n );\r\n return true;\r\n }\r\n return false;\r\n }\r\n private almostEqualCoordinate(a: number | undefined, b: number | undefined): boolean {\r\n if (a === undefined && b === undefined)\r\n return true;\r\n if (a !== undefined && b !== undefined)\r\n return Geometry.isSameCoordinate(a, b);\r\n return false;\r\n }\r\n private almostEqualBearing(a: Angle | undefined, b: Angle | undefined): boolean {\r\n if (a === undefined && b === undefined)\r\n return true;\r\n if (a !== undefined && b !== undefined)\r\n return a.isAlmostEqualNoPeriodShift(b);\r\n return false;\r\n }\r\n /** Test if `this` and `other` have matching numeric and undefined members. */\r\n public isAlmostEqual(other?: TransitionConditionalProperties): boolean {\r\n if (!other)\r\n return false;\r\n if (!this.almostEqualCoordinate(this.radius0, other.radius0))\r\n return false;\r\n if (!this.almostEqualCoordinate(this.radius1, other.radius1))\r\n return false;\r\n if (!this.almostEqualBearing(this.bearing0, other.bearing0))\r\n return false;\r\n if (!this.almostEqualBearing(this.bearing1, other.bearing1))\r\n return false;\r\n if (!this.almostEqualCoordinate(this.curveLength, other.curveLength))\r\n return false;\r\n return true;\r\n }\r\n /** Apply a NONZERO scale factor to all distances. If `a` is zero, do nothing. */\r\n public applyScaleFactor(a: number): void {\r\n if (a === 0)\r\n return;\r\n if (this.radius0 !== undefined)\r\n this.radius0 *= a;\r\n if (this.radius1 !== undefined)\r\n this.radius1 *= a;\r\n if (this.curveLength !== undefined)\r\n this.curveLength *= a;\r\n }\r\n /** Test if `a` and `b` have matching numeric and undefined members. */\r\n public static areAlmostEqual(\r\n a: TransitionConditionalProperties | undefined, b: TransitionConditionalProperties | undefined,\r\n ): boolean {\r\n if (a === undefined)\r\n return b === undefined;\r\n return a.isAlmostEqual(b);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TransitionConditionalProperties.js","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionConditionalProperties.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,2CAA2C;AAC3C,MAAM,OAAO,+BAA+B;IAC1C;;;OAGG;IACI,OAAO,CAAqB;IACnC;;;OAGG;IACI,OAAO,CAAqB;IACnC;;;OAGG;IACI,QAAQ,CAAoB;IACnC;;;OAGG;IACI,QAAQ,CAAoB;IACnC,oBAAoB;IACb,WAAW,CAAqB;IACvC;;;;;;;OAOG;IACH,YACE,OAA2B,EAC3B,OAA2B,EAC3B,QAA2B,EAC3B,QAA2B,EAC3B,SAA6B;QAE7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG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CAAC,KAAK,SAAS,CAAC;QACzB,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAC5B,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\nimport { Geometry } from \"../../Geometry\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { TransitionSpiral3d } from \"./TransitionSpiral3d\";\r\n\r\n/**\r\n * A true transition spiral is a curve defined by its curvature, with the curvature function symmetric about midpoint.\r\n * * The symmetry condition creates a relationship among the following 4 quantities:\r\n * ** curvature0 = curvature (i.e. 1/radius) at start.\r\n * ** curvature1 = curvature (i.e. 1/radius) at end.\r\n * ** sweepRadians = signed turning angle from start to end.\r\n * ** arcLength = length of curve.\r\n * * The relationship is the equation:\r\n * ** `sweepRadians = arcLength * average Curvature = arcLength * 0.5 * (curvature0 + curvature1)`\r\n * * That is, regardless of any curvature properties other than symmetry, specifying any 3 of the quantities fully\r\n * determines the remaining one.\r\n * @public\r\n */\r\n// see internaldocs/Spiral.md for more info\r\nexport class TransitionConditionalProperties {\r\n /**\r\n * Radius at start (radius of the osculating circle at the spiral segment's start).\r\n * radius0 === 0 means straight line at start.\r\n */\r\n public radius0: number | undefined;\r\n /**\r\n * Radius at end (radius of the osculating circle at the spiral segment's end).\r\n * radius1 === 0 means straight line at end.\r\n */\r\n public radius1: number | undefined;\r\n /**\r\n * Bearing at start (the signed angle from global x-axis to the start tangent of the spiral).\r\n * * If the direction from x-axis to start tangent is CCW, the start bearing is positive.\r\n */\r\n public bearing0: Angle | undefined;\r\n /**\r\n * Bearing at end (the signed angle from global x-axis to the end tangent of the spiral).\r\n * * If the direction from x-axis to end tangent is CCW, the end bearing is positive.\r\n */\r\n public bearing1: Angle | undefined;\r\n /** Curve length. */\r\n public curveLength: number | undefined;\r\n /**\r\n * Capture numeric or undefined values.\r\n * @param radius0 start radius or undefined.\r\n * @param radius1 end radius or undefined.\r\n * @param bearing0 start bearing or undefined.\r\n * @param bearing1 end bearing or undefined.\r\n * @param arcLength arc length or undefined.\r\n */\r\n public constructor(\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 ) {\r\n this.radius0 = radius0;\r\n this.radius1 = radius1;\r\n this.bearing0 = bearing0;\r\n this.bearing1 = bearing1;\r\n this.curveLength = arcLength;\r\n }\r\n /** Return the number of defined values among the 5 properties. */\r\n public numDefinedProperties() {\r\n return Geometry.defined01(this.radius0)\r\n + Geometry.defined01(this.radius1)\r\n + Geometry.defined01(this.bearing0)\r\n + Geometry.defined01(this.bearing1)\r\n + Geometry.defined01(this.curveLength);\r\n }\r\n /** Clone with all 5 properties (i.e., preserve undefined states). */\r\n public clone(): TransitionConditionalProperties {\r\n return new TransitionConditionalProperties(\r\n this.radius0,\r\n this.radius1,\r\n this.bearing0 === undefined ? undefined : this.bearing0.clone(),\r\n this.bearing1 === undefined ? undefined : this.bearing1.clone(),\r\n this.curveLength,\r\n );\r\n }\r\n /** Return true if all 5 properties are defined and agree equationally. */\r\n public getIsValidCompleteSet(): boolean {\r\n if (this.curveLength !== undefined && this.bearing0 !== undefined && this.bearing1 !== undefined\r\n && this.radius0 !== undefined && this.radius1 !== undefined) {\r\n const arcLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(\r\n this.radius0, this.radius1, this.bearing1.radians - this.bearing0.radians,\r\n );\r\n return Geometry.isSameCoordinate(this.curveLength, arcLength);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Examine which properties are defined and compute the (single) undefined.\r\n * @returns true if the input state had precisely one undefined member.\r\n */\r\n public tryResolveAnySingleUnknown(): boolean {\r\n if (this.getIsValidCompleteSet())\r\n return true;\r\n if (this.bearing0 && this.bearing1) {\r\n const sweepRadians = this.bearing1.radians - this.bearing0.radians;\r\n if (this.curveLength === undefined && this.radius0 !== undefined && this.radius1 !== undefined) {\r\n this.curveLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(this.radius0, this.radius1, sweepRadians);\r\n return true;\r\n }\r\n if (this.curveLength !== undefined && this.radius0 === undefined && this.radius1 !== undefined) {\r\n this.radius0 = TransitionSpiral3d.radius1LengthSweepRadiansToRadius0(this.radius1, this.curveLength, sweepRadians);\r\n return true;\r\n }\r\n if (this.curveLength !== undefined && this.radius0 !== undefined && this.radius1 === undefined) {\r\n this.radius1 = TransitionSpiral3d.radius0LengthSweepRadiansToRadius1(this.radius0, this.curveLength, sweepRadians);\r\n return true;\r\n }\r\n return false;\r\n }\r\n // at least one bearing is undefined\r\n if (this.curveLength === undefined || this.radius0 === undefined || this.radius1 === undefined)\r\n return false;\r\n if (this.bearing0) { // bearing 1 is undefined\r\n this.bearing1 = Angle.createRadians(\r\n this.bearing0.radians +\r\n TransitionSpiral3d.radiusRadiusLengthToSweepRadians(this.radius0, this.radius1, this.curveLength),\r\n );\r\n return true;\r\n }\r\n if (this.bearing1) { // bearing 0 is undefined\r\n this.bearing0 = Angle.createRadians(\r\n this.bearing1.radians -\r\n TransitionSpiral3d.radiusRadiusLengthToSweepRadians(this.radius0, this.radius1, this.curveLength),\r\n );\r\n return true;\r\n }\r\n return false;\r\n }\r\n private almostEqualCoordinate(a: number | undefined, b: number | undefined): boolean {\r\n if (a === undefined && b === undefined)\r\n return true;\r\n if (a !== undefined && b !== undefined)\r\n return Geometry.isSameCoordinate(a, b);\r\n return false;\r\n }\r\n private almostEqualBearing(a: Angle | undefined, b: Angle | undefined): boolean {\r\n if (a === undefined && b === undefined)\r\n return true;\r\n if (a !== undefined && b !== undefined)\r\n return a.isAlmostEqualNoPeriodShift(b);\r\n return false;\r\n }\r\n /** Test if `this` and `other` have matching numeric and undefined members. */\r\n public isAlmostEqual(other?: TransitionConditionalProperties): boolean {\r\n if (!other)\r\n return false;\r\n if (!this.almostEqualCoordinate(this.radius0, other.radius0))\r\n return false;\r\n if (!this.almostEqualCoordinate(this.radius1, other.radius1))\r\n return false;\r\n if (!this.almostEqualBearing(this.bearing0, other.bearing0))\r\n return false;\r\n if (!this.almostEqualBearing(this.bearing1, other.bearing1))\r\n return false;\r\n if (!this.almostEqualCoordinate(this.curveLength, other.curveLength))\r\n return false;\r\n return true;\r\n }\r\n /** Apply a NONZERO scale factor to all distances. If `a` is zero, do nothing. */\r\n public applyScaleFactor(a: number): void {\r\n if (a === 0)\r\n return;\r\n if (this.radius0 !== undefined)\r\n this.radius0 *= a;\r\n if (this.radius1 !== undefined)\r\n this.radius1 *= a;\r\n if (this.curveLength !== undefined)\r\n this.curveLength *= a;\r\n }\r\n /** Test if `a` and `b` have matching numeric and undefined members. */\r\n public static areAlmostEqual(\r\n a: TransitionConditionalProperties | undefined, b: TransitionConditionalProperties | undefined,\r\n ): boolean {\r\n if (a === undefined)\r\n return b === undefined;\r\n return a.isAlmostEqual(b);\r\n }\r\n}\r\n"]}
@@ -33,7 +33,7 @@ export type IntegratedSpiralTypeName = "clothoid" | "bloss" | "biquadratic" | "c
33
33
  * "Integrated" spiral types.
34
34
  * @public
35
35
  */
36
- export type DirectSpiralTypeName = "JapaneseCubic" | "Arema" | "ChineseCubic" | "HalfCosine" | "AustralianRailCorp" | "WesternAustralian" | "Czech" | "MXCubicAlongArc" | "Polish" | "Italian";
36
+ export type DirectSpiralTypeName = "Arema" | "JapaneseCubic" | "ChineseCubic" | "WesternAustralian" | "HalfCosine" | "AustralianRailCorp" | "Czech" | "Italian" | "MXCubicAlongArc" | "Polish";
37
37
  /**
38
38
  * TransitionSpiral3d is a base class for multiple variants of spirals.
39
39
  * * The menagerie of spiral types have 2 broad categories:
@@ -1 +1 @@
1
- {"version":3,"file":"TransitionSpiral3d.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionSpiral3d.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH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G;QAAE,SAAS,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;IAe9G;;;;;OAKG;IACa,iBAAiB,CAAC,uBAAuB,EAAE,MAAM,GAAG,aAAa,GAAG,cAAc,GAAG,SAAS;IAM9G,qDAAqD;IACrC,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI;IAGhF;;;OAGG;IACa,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO;IAQ3G;;;;;;;OAOG;IACa,uBAAuB,CAAC,GAAG,EAAE,QAAQ,GAAG,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS;CAGvG"}
@@ -25,6 +25,7 @@ import { OffsetOptions } from "../OffsetOptions";
25
25
  * * This is not necessary for integrated spirals.
26
26
  * @public
27
27
  */
28
+ // see internaldocs/Spiral.md for more info
28
29
  export class TransitionSpiral3d extends CurvePrimitive {
29
30
  /** String name of spiral type. */
30
31
  _spiralType;
@@ -1 +1 @@
1
- {"version":3,"file":"TransitionSpiral3d.js","sourceRoot":"","sources":["../../../../src/curve/spiral/TransitionSpiral3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAO/F,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAW,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAE1F,OAAO,EAAE,aAAa,EAAE,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,CAAC,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC;QAC7E,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,4BAA4B,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IACxF,CAAC;IACD;;;;;;;OAOG;IACa,uBAAuB,CAAC,GAAqB,EAAE,OAAiB;QAC9E,OAAO,yBAAyB,CAAC,kCAAkC,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1F,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 { BSplineCurve3d } from \"../../bspline/BSplineCurve\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Range1d, Range3d } from \"../../geometry3d/Range\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { CurveOffsetXYHandler } from \"../internalContexts/CurveOffsetXYHandler\";\r\nimport { PlaneAltitudeRangeContext } from \"../internalContexts/PlaneAltitudeRangeContext\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { OffsetOptions } from \"../OffsetOptions\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\n\r\nimport type { Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport type { Ray3d } from \"../../geometry3d/Ray3d\";\r\n\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.5) = 0.5, with zero\r\n * 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\r\n * \"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\r\n * 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\r\n * 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 /** Placement transform. */\r\n protected _localToWorld: Transform;\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 {\r\n return this._activeFractionInterval;\r\n }\r\n /** Strokes in the active portion. */\r\n public abstract get activeStrokes(): LineString3d;\r\n /** (Reference to) placement transform. */\r\n public get localToWorld(): Transform {\r\n return this._localToWorld;\r\n }\r\n protected constructor(\r\n spiralType: string | undefined,\r\n localToWorld: Transform,\r\n activeFractionInterval: Segment1d | undefined,\r\n designProperties: TransitionConditionalProperties | undefined,\r\n ) {\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 public get spiralType(): string {\r\n return this._spiralType;\r\n }\r\n /** Return 1/r with convention that exact zero input returns 0 (straight line, zero curvature, infinite radius). */\r\n public static radiusToCurvature(radius: number): number {\r\n return (radius === 0.0) ? 0.0 : 1.0 / radius;\r\n }\r\n /** Return 1/k with convention that near-zero input returns 0 (straight line, zero curvature, infinite radius). */\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 /** Return a deep clone. */\r\n public abstract override clone(): TransitionSpiral3d;\r\n /** Recompute strokes. */\r\n public abstract refreshComputedProperties(): void;\r\n /** Return (if possible) a spiral which is a portion of this curve. */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): TransitionSpiral3d {\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 /** Clone with a transform applied. */\r\n public override cloneTransformed(transform: Transform): TransitionSpiral3d {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform); // we're confident it will always work\r\n return result;\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 curvature at the given fraction.\r\n * @param r0 start radius, or 0 for line.\r\n * @param fraction fractional position between the curvatures defined by r0 and r1.\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 /** 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 /** 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 /** 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(\r\n (2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius0),\r\n );\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(\r\n (2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius1),\r\n );\r\n }\r\n /** Return the original defining properties (if any) saved by the constructor. */\r\n public get designProperties(): TransitionConditionalProperties | undefined {\r\n return this._designProperties;\r\n }\r\n /**\r\n * * If transformA is rigid with uniform scale, apply the rigid part of transformA to the localToWorld transform and\r\n * 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 return rigidData;\r\n }\r\n return undefined;\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 for an\r\n * 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): BSplineCurve3d | 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 /** Extend the range by the strokes of the spiral. */\r\n public override extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n rangeToExtend.extendRange(this.rangeBetweenFractions(0.0, 1.0, transform));\r\n }\r\n /**\r\n * Return the range of spiral between fractions of the activeStrokes.\r\n * * Use activeStrokes point count times interval factor for initial evaluation count, but do at least 5.\r\n */\r\n public override rangeBetweenFractions(fractionA: number, fractionB: number, transform?: Transform): Range3d {\r\n const strokes = this.activeStrokes;\r\n if (undefined === strokes)\r\n return Range3d.createNull();\r\n let count = Math.ceil(strokes.numPoints() * Math.abs(fractionB - fractionA));\r\n count = Geometry.clamp(5, count, 30);\r\n return this.rangeBetweenFractionsByCount(fractionA, fractionB, count, transform, 0.5);\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of\r\n * projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public override projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TransitionS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C;QACxD,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;IAC/B,CAAC;IACD,qDAAqD;IACrC,WAAW,CAAC,aAAsB,EAAE,SAAqB;QACvE,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;IAC7E,CAAC;IACD;;;OAGG;IACa,qBAAqB,CAAC,SAAiB,EAAE,SAAiB,EAAE,SAAqB;QAC/F,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC;QACnC,IAAI,SAAS,KAAK,OAAO;YACvB,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC;QAC9B,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC;QAC7E,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,4BAA4B,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IACxF,CAAC;IACD;;;;;;;OAOG;IACa,uBAAuB,CAAC,GAAqB,EAAE,OAAiB;QAC9E,OAAO,yBAAyB,CAAC,kCAAkC,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1F,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 { BSplineCurve3d } from \"../../bspline/BSplineCurve\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Range1d, Range3d } from \"../../geometry3d/Range\";\r\nimport { Segment1d } from \"../../geometry3d/Segment1d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { CurveOffsetXYHandler } from \"../internalContexts/CurveOffsetXYHandler\";\r\nimport { PlaneAltitudeRangeContext } from \"../internalContexts/PlaneAltitudeRangeContext\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { OffsetOptions } from \"../OffsetOptions\";\r\nimport { TransitionConditionalProperties } from \"./TransitionConditionalProperties\";\r\n\r\nimport type { Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport type { Ray3d } from \"../../geometry3d/Ray3d\";\r\n\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.5) = 0.5, with zero\r\n * 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\r\n * \"Integrated\" spiral types.\r\n * @public\r\n */\r\nexport type DirectSpiralTypeName =\r\n \"Arema\" // 2 terms from each of the X,Y clothoid series expansions; identical to ChineseCubic\r\n | \"JapaneseCubic\" // 1 term from each of the X,Y clothoid series expansions; y = x^3 / (6RL)\r\n | \"ChineseCubic\" // identical to Arema\r\n | \"WesternAustralian\" // simple cubic; 2 terms of x series, 1 term of y series\r\n | \"HalfCosine\" // high continuity cosine variation from quadratic\r\n | \"AustralianRailCorp\" // cubic with high accuracy distance series\r\n | \"Czech\" // simple cubic with two term distance approximation\r\n | \"Italian\" // similar to Czech\r\n | \"MXCubicAlongArc\" // x obtained from fractional distance via 2-terms from series, y = x^3 / (6RL)\r\n | \"Polish\" // similar to MXCubicAlongArc\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\r\n * 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\r\n * 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\n// see internaldocs/Spiral.md for more info\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 /** Placement transform. */\r\n protected _localToWorld: Transform;\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 {\r\n return this._activeFractionInterval;\r\n }\r\n /** Strokes in the active portion. */\r\n public abstract get activeStrokes(): LineString3d;\r\n /** (Reference to) placement transform. */\r\n public get localToWorld(): Transform {\r\n return this._localToWorld;\r\n }\r\n protected constructor(\r\n spiralType: string | undefined,\r\n localToWorld: Transform,\r\n activeFractionInterval: Segment1d | undefined,\r\n designProperties: TransitionConditionalProperties | undefined,\r\n ) {\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 public get spiralType(): string {\r\n return this._spiralType;\r\n }\r\n /** Return 1/r with convention that exact zero input returns 0 (straight line, zero curvature, infinite radius). */\r\n public static radiusToCurvature(radius: number): number {\r\n return (radius === 0.0) ? 0.0 : 1.0 / radius;\r\n }\r\n /** Return 1/k with convention that near-zero input returns 0 (straight line, zero curvature, infinite radius). */\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 /** Return a deep clone. */\r\n public abstract override clone(): TransitionSpiral3d;\r\n /** Recompute strokes. */\r\n public abstract refreshComputedProperties(): void;\r\n /** Return (if possible) a spiral which is a portion of this curve. */\r\n public override clonePartialCurve(fractionA: number, fractionB: number): TransitionSpiral3d {\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 /** Clone with a transform applied. */\r\n public override cloneTransformed(transform: Transform): TransitionSpiral3d {\r\n const result = this.clone();\r\n result.tryTransformInPlace(transform); // we're confident it will always work\r\n return result;\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 curvature at the given fraction.\r\n * @param r0 start radius, or 0 for line.\r\n * @param fraction fractional position between the curvatures defined by r0 and r1.\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 /** 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 /** 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 /** 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(\r\n (2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius0),\r\n );\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(\r\n (2.0 * sweepRadians / arcLength) - TransitionSpiral3d.radiusToCurvature(radius1),\r\n );\r\n }\r\n /** Return the original defining properties (if any) saved by the constructor. */\r\n public get designProperties(): TransitionConditionalProperties | undefined {\r\n return this._designProperties;\r\n }\r\n /**\r\n * * If transformA is rigid with uniform scale, apply the rigid part of transformA to the localToWorld transform and\r\n * 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 return rigidData;\r\n }\r\n return undefined;\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 for an\r\n * 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): BSplineCurve3d | 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 /** Extend the range by the strokes of the spiral. */\r\n public override extendRange(rangeToExtend: Range3d, transform?: Transform): void {\r\n rangeToExtend.extendRange(this.rangeBetweenFractions(0.0, 1.0, transform));\r\n }\r\n /**\r\n * Return the range of spiral between fractions of the activeStrokes.\r\n * * Use activeStrokes point count times interval factor for initial evaluation count, but do at least 5.\r\n */\r\n public override rangeBetweenFractions(fractionA: number, fractionB: number, transform?: Transform): Range3d {\r\n const strokes = this.activeStrokes;\r\n if (undefined === strokes)\r\n return Range3d.createNull();\r\n let count = Math.ceil(strokes.numPoints() * Math.abs(fractionB - fractionA));\r\n count = Geometry.clamp(5, count, 30);\r\n return this.rangeBetweenFractionsByCount(fractionA, fractionB, count, transform, 0.5);\r\n }\r\n /**\r\n * Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of\r\n * projection.\r\n * @param ray ray onto which the instance is projected. A `Vector3d` is treated as a `Ray3d` with zero origin.\r\n * @param lowHigh optional receiver for output\r\n * @returns range of fractional projection parameters onto the ray, where 0.0 is start of the ray and 1.0 is the\r\n * end of the ray.\r\n */\r\n public override projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): Range1d | undefined {\r\n return PlaneAltitudeRangeContext.findExtremeFractionsAlongDirection(this, ray, lowHigh);\r\n }\r\n}\r\n"]}
@@ -44,8 +44,7 @@ export declare class Ray3d implements BeJSONFunctions {
44
44
  */
45
45
  isAlmostEqual(other: Ray3d, tolerance?: number): boolean;
46
46
  /**
47
- * Return the dot product of the ray's direction vector with a vector from the ray origin
48
- * to the `spacePoint`.
47
+ * Return the dot product of the ray's direction vector with a vector from the ray origin to the `spacePoint`.
49
48
  * * If the instance is the unit normal of a plane, then this method returns the (signed) altitude
50
49
  * of `spacePoint` with respect to the plane.
51
50
  * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane
@@ -1 +1 @@
1
- {"version":3,"file":"Ray3d.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/Ray3d.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAA+C,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACpH,OAAO,EAAa,eAAe,EAAY,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE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AAC,EAAE,MAAM,GAAG,OAAO;IAS5D,sDAAsD;IAC/C,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM;IAS5C;;;;;;;;;;OAUG;IACI,qBAAqB,CAAC,KAAK,EAAE,4BAA4B,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;IAgBvG;;;;OAIG;IACI,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IASzE;;;;;;;;;;;;MAYE;IACK,wBAAwB,CAC7B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAClH,OAAO,GAAG,SAAS;IAkEtB;;;OAGG;IACI,iCAAiC,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ;IAO1F;;;;;;;;;;;;OAYG;WACW,yBAAyB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,uBAAuB;IAgC1F;;;;;;;;OAQG;WACW,0BAA0B,CACtC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,GAC/E,KAAK;CAcT"}
@@ -72,8 +72,7 @@ export class Ray3d {
72
72
  return this.origin.isAlmostEqual(other.origin, tolerance) && this.direction.isAlmostEqual(other.direction, tolerance);
73
73
  }
74
74
  /**
75
- * Return the dot product of the ray's direction vector with a vector from the ray origin
76
- * to the `spacePoint`.
75
+ * Return the dot product of the ray's direction vector with a vector from the ray origin to the `spacePoint`.
77
76
  * * If the instance is the unit normal of a plane, then this method returns the (signed) altitude
78
77
  * of `spacePoint` with respect to the plane.
79
78
  * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane