@itwin/core-geometry 5.3.0-dev.17 → 5.3.0-dev.18

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 (106) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.d.ts +10 -13
  3. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.d.ts.map +1 -1
  4. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js +23 -22
  5. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  6. package/lib/cjs/curve/spiral/ClothoidSeries.d.ts +5 -5
  7. package/lib/cjs/curve/spiral/ClothoidSeries.d.ts.map +1 -1
  8. package/lib/cjs/curve/spiral/ClothoidSeries.js +28 -16
  9. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  10. package/lib/cjs/curve/spiral/CubicEvaluator.d.ts +7 -6
  11. package/lib/cjs/curve/spiral/CubicEvaluator.d.ts.map +1 -1
  12. package/lib/cjs/curve/spiral/CubicEvaluator.js +29 -14
  13. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  14. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.d.ts +30 -40
  15. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.d.ts.map +1 -1
  16. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js +43 -49
  17. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  18. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts +2 -2
  19. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts.map +1 -1
  20. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js +17 -7
  21. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  22. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +103 -95
  23. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  24. package/lib/cjs/curve/spiral/DirectSpiral3d.js +132 -106
  25. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  26. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +70 -52
  27. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  28. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +97 -65
  29. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  30. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts +7 -11
  31. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts.map +1 -1
  32. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +10 -12
  33. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  34. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts +29 -24
  35. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  36. package/lib/cjs/curve/spiral/NormalizedTransition.js +53 -35
  37. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  38. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.d.ts +12 -17
  39. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.d.ts.map +1 -1
  40. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js +20 -23
  41. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  42. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts +25 -23
  43. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  44. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js +34 -29
  45. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  46. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +43 -33
  47. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  48. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +56 -38
  49. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  50. package/lib/cjs/curve/spiral/XYCurveEvaluator.d.ts +27 -21
  51. package/lib/cjs/curve/spiral/XYCurveEvaluator.d.ts.map +1 -1
  52. package/lib/cjs/curve/spiral/XYCurveEvaluator.js +23 -18
  53. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  54. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.d.ts +10 -13
  55. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.d.ts.map +1 -1
  56. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js +23 -22
  57. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  58. package/lib/esm/curve/spiral/ClothoidSeries.d.ts +5 -5
  59. package/lib/esm/curve/spiral/ClothoidSeries.d.ts.map +1 -1
  60. package/lib/esm/curve/spiral/ClothoidSeries.js +28 -16
  61. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  62. package/lib/esm/curve/spiral/CubicEvaluator.d.ts +7 -6
  63. package/lib/esm/curve/spiral/CubicEvaluator.d.ts.map +1 -1
  64. package/lib/esm/curve/spiral/CubicEvaluator.js +29 -14
  65. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  66. package/lib/esm/curve/spiral/CzechSpiralEvaluator.d.ts +30 -40
  67. package/lib/esm/curve/spiral/CzechSpiralEvaluator.d.ts.map +1 -1
  68. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js +43 -49
  69. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  70. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts +2 -2
  71. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts.map +1 -1
  72. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js +17 -7
  73. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  74. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +103 -95
  75. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  76. package/lib/esm/curve/spiral/DirectSpiral3d.js +132 -106
  77. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  78. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +70 -52
  79. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  80. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +97 -65
  81. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  82. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts +7 -11
  83. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts.map +1 -1
  84. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +10 -12
  85. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  86. package/lib/esm/curve/spiral/NormalizedTransition.d.ts +29 -24
  87. package/lib/esm/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  88. package/lib/esm/curve/spiral/NormalizedTransition.js +53 -35
  89. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  90. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.d.ts +12 -17
  91. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.d.ts.map +1 -1
  92. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js +20 -23
  93. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  94. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts +25 -23
  95. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  96. package/lib/esm/curve/spiral/TransitionConditionalProperties.js +34 -29
  97. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  98. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +43 -33
  99. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  100. package/lib/esm/curve/spiral/TransitionSpiral3d.js +56 -38
  101. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  102. package/lib/esm/curve/spiral/XYCurveEvaluator.d.ts +27 -21
  103. package/lib/esm/curve/spiral/XYCurveEvaluator.d.ts.map +1 -1
  104. package/lib/esm/curve/spiral/XYCurveEvaluator.js +23 -18
  105. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  106. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Change Log - @itwin/core-geometry
2
2
 
3
- This log was last generated on Fri, 10 Oct 2025 14:50:50 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 16 Oct 2025 23:02:22 GMT and should not be manually modified.
4
+
5
+ ## 5.2.3
6
+ Thu, 16 Oct 2025 23:00:31 GMT
7
+
8
+ _Version update only_
4
9
 
5
10
  ## 5.2.2
6
11
  Fri, 10 Oct 2025 14:49:15 GMT
@@ -14,26 +14,23 @@ export declare class AustralianRailCorpXYEvaluator extends CubicEvaluator {
14
14
  get nominalRadius1(): number;
15
15
  clone(): AustralianRailCorpXYEvaluator;
16
16
  static create(nominalLength1: number, nominalRadius1: number): AustralianRailCorpXYEvaluator | undefined;
17
- /**
18
- * Compute the phi constant for AustralianRail spiral with given end radius and length along axis.
19
- * @param nominalRadius1
20
- * @param axisLength
21
- */
17
+ /** Compute the phi constant for AustralianRail spiral with given end radius and length along axis. */
22
18
  static radiusAndAxisLengthToPhi(nominalRadius1: number, axisLength: number): number;
23
19
  scaleInPlace(scaleFactor: number): void;
24
- /** Compute length along axis for AustralianRail spiral nominal radius and length.
25
- *
26
- */
20
+ /** Compute length along axis for AustralianRail spiral nominal radius and length. */
27
21
  static radiusAndNominalLengthToAxisLength(nominalRadius1: number, nominalLength1: number, tolerance?: number, requiredConvergenceCount?: number): number;
28
22
  isAlmostEqual(other: any): boolean;
29
23
  /**
30
24
  * Return a (quite good approximation) of fraction along x axis for given distance along spiral.
31
- * * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to an x coordinate.
32
- * * The `xToFraction(x)` method quickly (with a single divide) converts this x to fraction used fro this.fractionToX (fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.
25
+ * * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to
26
+ * an x coordinate.
27
+ * * The `xToFraction(x)` method quickly (with a single divide) converts this x to fraction used for
28
+ * this.fractionToX (fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.
33
29
  * * The x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.
34
- * * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the more accurate CurvePrimitive measurements.
35
- * * Round tripping distance through (a) distanceAlongSpiralToAustralianApproximateX, (b) xToFraction, and (c) curveLengthBetweenFractions has
36
- * * 10 digit accuracy for L/R = 4, 12 digit accuracy for L/R = 10
30
+ * * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the
31
+ * more accurate CurvePrimitive measurements.
32
+ * * Round tripping distance through (a) distanceAlongSpiralToAustralianApproximateX, (b) xToFraction, and
33
+ * (c) curveLengthBetweenFractions has 10 digit accuracy for L/R = 4, 12 digit accuracy for L/R = 10.
37
34
  * @param s distance along the axis.
38
35
  */
39
36
  distanceAlongSpiralToAustralianApproximateX(s: number): number;
@@ -1 +1 @@
1
- {"version":3,"file":"AustralianRailCorpXYEvaluator.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/AustralianRailCorpXYEvaluator.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD;;;;;;GAMG;AACH,qBAAa,6BAA8B,SAAQ,cAAc;IAC/D,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO;IAKP,IAAW,cAAc,WAAmC;IAC5D,IAA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GAC/G,MAAM;IAgCF,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;IASzC;;;;;;;;;;;;OAYG;IACI,2CAA2C,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;CAUtE"}
@@ -26,9 +26,15 @@ class AustralianRailCorpXYEvaluator extends CubicEvaluator_1.CubicEvaluator {
26
26
  this._nominalLength1 = nominalLength1;
27
27
  this._nominalRadius1 = nominalRadius1;
28
28
  }
29
- get nominalLength1() { return this._nominalLength1; }
30
- get nominalRadius1() { return this._nominalRadius1; }
31
- clone() { return new AustralianRailCorpXYEvaluator(this._nominalLength1, this._nominalRadius1, this._axisLength, this._cubicM); }
29
+ get nominalLength1() {
30
+ return this._nominalLength1;
31
+ }
32
+ get nominalRadius1() {
33
+ return this._nominalRadius1;
34
+ }
35
+ clone() {
36
+ return new AustralianRailCorpXYEvaluator(this._nominalLength1, this._nominalRadius1, this._axisLength, this._cubicM);
37
+ }
32
38
  static create(nominalLength1, nominalRadius1) {
33
39
  const axisLength = AustralianRailCorpXYEvaluator.radiusAndNominalLengthToAxisLength(nominalRadius1, nominalLength1);
34
40
  const phi = this.radiusAndAxisLengthToPhi(nominalRadius1, axisLength);
@@ -36,11 +42,7 @@ class AustralianRailCorpXYEvaluator extends CubicEvaluator_1.CubicEvaluator {
36
42
  const cubicM = Math.tan(phi) / (3.0 * xc2);
37
43
  return new AustralianRailCorpXYEvaluator(nominalLength1, nominalRadius1, axisLength, cubicM);
38
44
  }
39
- /**
40
- * Compute the phi constant for AustralianRail spiral with given end radius and length along axis.
41
- * @param nominalRadius1
42
- * @param axisLength
43
- */
45
+ /** Compute the phi constant for AustralianRail spiral with given end radius and length along axis. */
44
46
  static radiusAndAxisLengthToPhi(nominalRadius1, axisLength) {
45
47
  const xc = axisLength;
46
48
  const expr1 = (2. / Math.sqrt(3.));
@@ -53,26 +55,23 @@ class AustralianRailCorpXYEvaluator extends CubicEvaluator_1.CubicEvaluator {
53
55
  return Math.asin(expr1 * Math.cos(Math.acos(expr2) / 3. + expr3));
54
56
  }
55
57
  scaleInPlace(scaleFactor) {
56
- // apply the scale factor to all contents.
57
- // all distances scale directly . . .
58
+ // apply the scale factor to all contents; all distances scale directly
58
59
  this._nominalLength1 *= scaleFactor;
59
60
  this._nominalRadius1 *= scaleFactor;
60
61
  super.scaleInPlace(scaleFactor);
61
62
  }
62
- /** Compute length along axis for AustralianRail spiral nominal radius and length.
63
- *
64
- */
63
+ /** Compute length along axis for AustralianRail spiral nominal radius and length. */
65
64
  static radiusAndNominalLengthToAxisLength(nominalRadius1, nominalLength1, tolerance = 1.0e-5, requiredConvergenceCount = 2) {
66
65
  const R = nominalRadius1;
67
66
  let idx = 0;
68
67
  let m, phi, xc2;
69
68
  let xc = .7 * nominalLength1;
70
69
  let convergenceCount = 0;
71
- // remark: This converges quickly --
70
+ // remark: This converges quickly
72
71
  // for L=100, R=400
73
72
  // ** full precision at 7th iteration.
74
73
  // ** classic tolerance 1.0e-5 (7 digits from L) with requiredConvergenceCount = 1 gives 11 digits after 3 iterations
75
- // ** each iteration adds about 2 digits. This is quite good for a successive replacement without derivative !!!
74
+ // ** each iteration adds about 2 digits. This is quite good for a successive replacement without derivative
76
75
  // ** Unanswerable question: If this is only done once and reused over all evaluations, do you want:
77
76
  // * run the 7 iterations to get full precision
78
77
  // * stop with the classic tolerance to get compatibility?
@@ -81,8 +80,7 @@ class AustralianRailCorpXYEvaluator extends CubicEvaluator_1.CubicEvaluator {
81
80
  xc2 = xc * xc;
82
81
  m = Math.tan(phi) / (3.0 * xc2);
83
82
  const m2x4 = m * m * xc2 * xc2;
84
- const correction = xc * m2x4 * ((9. / 10) + m2x4 * (-(9. / 8.) + m2x4 * (+(729. / 208.) + m2x4 *
85
- -(32805. / 2176.))));
83
+ const correction = xc * m2x4 * ((9. / 10) + m2x4 * (-(9. / 8.) + m2x4 * (+(729. / 208.) + m2x4 * -(32805. / 2176.))));
86
84
  const correctedLength = xc + correction;
87
85
  xc = (nominalLength1 / correctedLength) * xc;
88
86
  if (Math.abs(nominalLength1 - correctedLength) < tolerance) {
@@ -107,12 +105,15 @@ class AustralianRailCorpXYEvaluator extends CubicEvaluator_1.CubicEvaluator {
107
105
  }
108
106
  /**
109
107
  * Return a (quite good approximation) of fraction along x axis for given distance along spiral.
110
- * * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to an x coordinate.
111
- * * The `xToFraction(x)` method quickly (with a single divide) converts this x to fraction used fro this.fractionToX (fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.
108
+ * * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to
109
+ * an x coordinate.
110
+ * * The `xToFraction(x)` method quickly (with a single divide) converts this x to fraction used for
111
+ * this.fractionToX (fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.
112
112
  * * The x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.
113
- * * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the more accurate CurvePrimitive measurements.
114
- * * Round tripping distance through (a) distanceAlongSpiralToAustralianApproximateX, (b) xToFraction, and (c) curveLengthBetweenFractions has
115
- * * 10 digit accuracy for L/R = 4, 12 digit accuracy for L/R = 10
113
+ * * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the
114
+ * more accurate CurvePrimitive measurements.
115
+ * * Round tripping distance through (a) distanceAlongSpiralToAustralianApproximateX, (b) xToFraction, and
116
+ * (c) curveLengthBetweenFractions has 10 digit accuracy for L/R = 4, 12 digit accuracy for L/R = 10.
116
117
  * @param s distance along the axis.
117
118
  */
118
119
  distanceAlongSpiralToAustralianApproximateX(s) {
@@ -1 +1 @@
1
- {"version":3,"file":"AustralianRailCorpXYEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/AustralianRailCorpXYEvaluator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,6CAA0C;AAC1C,kDAA+C;AAC/C,qDAAkD;AAClD;;;;;;GAMG;AACH,MAAa,6BAA8B,SAA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,CAAC,eAAe,CAAC;mBACzE,mBAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;QACjF,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD;;;;;;;;;OASG;IACI,2CAA2C,CAAC,CAAS;QAC1D,MAAM,EAAE,GAAG,MAAM,CAAC;QAClB,MAAM,EAAE,GAAG,MAAM,CAAC;QAClB,MAAM,EAAE,GAAG,OAAO,CAAC;QACnB,MAAM,EAAE,GAAG,QAAQ,CAAC;QACpB,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACvB,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAjHD,sEAiHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\nimport { Geometry } from \"../../Geometry\";\nimport { Angle } from \"../../geometry3d/Angle\";\nimport { CubicEvaluator } from \"./CubicEvaluator\";\n/**\n * AustralianRailCorp spiral (also known as New South Wales spiral)\n * * The ultimate curve is a cubic `y = m * x^3`.\n * * `m` is a constant throughout the curve.\n * * Computation of m from the R and L is an complicated sequence, but is only done at construction time.\n * @internal\n */\nexport class AustralianRailCorpXYEvaluator extends CubicEvaluator {\n private _nominalLength1: number;\n private _nominalRadius1: number;\n private constructor(nominalLength1: number, nominalRadius1: number, axisLength: number, cubicM: number) {\n super(axisLength, cubicM);\n this._nominalLength1 = nominalLength1;\n this._nominalRadius1 = nominalRadius1;\n }\n public get nominalLength1() { return this._nominalLength1; }\n public get nominalRadius1() { return this._nominalRadius1; }\n public clone(): AustralianRailCorpXYEvaluator { return new AustralianRailCorpXYEvaluator(this._nominalLength1, this._nominalRadius1, this._axisLength, this._cubicM); }\n public static create(nominalLength1: number, nominalRadius1: number): AustralianRailCorpXYEvaluator | undefined {\n const axisLength = AustralianRailCorpXYEvaluator.radiusAndNominalLengthToAxisLength(nominalRadius1, nominalLength1);\n const phi = this.radiusAndAxisLengthToPhi(nominalRadius1, axisLength);\n const xc2 = axisLength * axisLength;\n const cubicM = Math.tan(phi) / (3.0 * xc2);\n return new AustralianRailCorpXYEvaluator(nominalLength1, nominalRadius1, axisLength, cubicM);\n }\n /**\n * Compute the phi constant for AustralianRail spiral with given end radius and length along axis.\n * @param nominalRadius1\n * @param axisLength\n */\n public static radiusAndAxisLengthToPhi(nominalRadius1: number, axisLength: number): number {\n const xc = axisLength;\n const expr1 = (2. / Math.sqrt(3.));\n let expr2 = (-(3. / 4.) * Math.sqrt(3.) * xc / nominalRadius1);\n if (expr2 < -1.0)\n expr2 = -1.0;\n if (expr2 > 1.0)\n expr2 = 1.0;\n const expr3 = Angle.degreesToRadians(240);\n\n return Math.asin(expr1 * Math.cos(Math.acos(expr2) / 3. + expr3));\n }\n public override scaleInPlace(scaleFactor: number) {\n // apply the scale factor to all contents.\n // all distances scale directly . . .\n this._nominalLength1 *= scaleFactor;\n this._nominalRadius1 *= scaleFactor;\n super.scaleInPlace(scaleFactor);\n }\n /** Compute length along axis for AustralianRail spiral nominal radius and length.\n *\n */\n public static radiusAndNominalLengthToAxisLength(nominalRadius1: number, nominalLength1: number, tolerance: number = 1.0e-5,\n requiredConvergenceCount: number = 2) {\n const R = nominalRadius1;\n let idx = 0;\n let m, phi, xc2;\n\n let xc = .7 * nominalLength1;\n let convergenceCount = 0;\n // remark: This converges quickly --\n // for L=100, R=400\n // ** full precision at 7th iteration.\n // ** classic tolerance 1.0e-5 (7 digits from L) with requiredConvergenceCount = 1 gives 11 digits after 3 iterations\n // ** each iteration adds about 2 digits. This is quite good for a successive replacement without derivative !!!\n // ** Unanswerable question: If this is only done once and reused over all evaluations, do you want:\n // * run the 7 iterations to get full precision\n // * stop with the classic tolerance to get compatibility?\n for (idx = 0; idx < 100; ++idx) {\n phi = this.radiusAndAxisLengthToPhi(R, xc);\n xc2 = xc * xc;\n m = Math.tan(phi) / (3.0 * xc2);\n const m2x4 = m * m * xc2 * xc2;\n const correction = xc * m2x4 * (\n (9. / 10) + m2x4 * (\n -(9. / 8.) + m2x4 * (\n +(729. / 208.) + m2x4 *\n -(32805. / 2176.))));\n const correctedLength = xc + correction;\n xc = (nominalLength1 / correctedLength) * xc;\n\n if (Math.abs(nominalLength1 - correctedLength) < tolerance) {\n convergenceCount++;\n if (convergenceCount >= requiredConvergenceCount)\n break;\n } else {\n convergenceCount = 0;\n }\n }\n return xc;\n }\n public isAlmostEqual(other: any): boolean {\n if (other instanceof AustralianRailCorpXYEvaluator) {\n return Geometry.isAlmostEqualNumber(this._cubicM, other._cubicM)\n && Geometry.isAlmostEqualNumber(this._axisLength, other._axisLength)\n && Geometry.isAlmostEqualNumber(this._nominalLength1, other._nominalLength1)\n && Geometry.isAlmostEqualNumber(this._nominalRadius1, other._nominalRadius1);\n }\n return false;\n }\n /**\n * Return a (quite good approximation) of fraction along x axis for given distance along spiral.\n * * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to an x coordinate.\n * * The `xToFraction(x)` method quickly (with a single divide) converts this x to fraction used fro this.fractionToX (fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.\n * * The x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\n * * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the more accurate CurvePrimitive measurements.\n * * Round tripping distance through (a) distanceAlongSpiralToAustralianApproximateX, (b) xToFraction, and (c) curveLengthBetweenFractions has\n * * 10 digit accuracy for L/R = 4, 12 digit accuracy for L/R = 10\n * @param s distance along the axis.\n */\n public distanceAlongSpiralToAustralianApproximateX(s: number): number {\n const a1 = 0.9000;\n const a2 = 5.1750;\n const a3 = 43.1948;\n const a4 = 426.0564;\n const m = this._cubicM;\n const m2s4 = m * m * s * s * s * s;\n const x = s * (1.0 - m2s4 * (a1 - m2s4 * (a2 - m2s4 * (a3 - m2s4 * a4))));\n return x;\n }\n}\n"]}
1
+ {"version":3,"file":"AustralianRailCorpXYEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/AustralianRailCorpXYEvaluator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,6CAA0C;AAC1C,kDAA+C;AAC/C,qDAAkD;AAElD;;;;;;GAMG;AACH,MAAa,6BAA8B,SAAQ,+BAAc;IACvD,eAAe,CAAS;IACxB,eAAe,CAAS;IAChC,YAAoB,cAAsB,EAAE,cAAsB,EAAE,UAAkB,EAAE,MAAc;QACpG,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IACD,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IACD,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IACM,KAAK;QACV,OAAO,IAAI,6BAA6B,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACvH,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,cAAsB,EAAE,cAAsB;QACjE,MAAM,UAAU,GAAG,6BAA6B,CAAC,kCAAkC,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QACpH,MAAM,GAAG,GAAG,I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ACX,CAAC;CACF;AA7GD,sEA6GC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\nimport { Geometry } from \"../../Geometry\";\nimport { Angle } from \"../../geometry3d/Angle\";\nimport { CubicEvaluator } from \"./CubicEvaluator\";\n\n/**\n * AustralianRailCorp spiral (also known as New South Wales spiral)\n * * The ultimate curve is a cubic `y = m * x^3`.\n * * `m` is a constant throughout the curve.\n * * Computation of m from the R and L is an complicated sequence, but is only done at construction time.\n * @internal\n */\nexport class AustralianRailCorpXYEvaluator extends CubicEvaluator {\n private _nominalLength1: number;\n private _nominalRadius1: number;\n private constructor(nominalLength1: number, nominalRadius1: number, axisLength: number, cubicM: number) {\n super(axisLength, cubicM);\n this._nominalLength1 = nominalLength1;\n this._nominalRadius1 = nominalRadius1;\n }\n public get nominalLength1() {\n return this._nominalLength1;\n }\n public get nominalRadius1() {\n return this._nominalRadius1;\n }\n public clone(): AustralianRailCorpXYEvaluator {\n return new AustralianRailCorpXYEvaluator(this._nominalLength1, this._nominalRadius1, this._axisLength, this._cubicM);\n }\n public static create(nominalLength1: number, nominalRadius1: number): AustralianRailCorpXYEvaluator | undefined {\n const axisLength = AustralianRailCorpXYEvaluator.radiusAndNominalLengthToAxisLength(nominalRadius1, nominalLength1);\n const phi = this.radiusAndAxisLengthToPhi(nominalRadius1, axisLength);\n const xc2 = axisLength * axisLength;\n const cubicM = Math.tan(phi) / (3.0 * xc2);\n return new AustralianRailCorpXYEvaluator(nominalLength1, nominalRadius1, axisLength, cubicM);\n }\n /** Compute the phi constant for AustralianRail spiral with given end radius and length along axis. */\n public static radiusAndAxisLengthToPhi(nominalRadius1: number, axisLength: number): number {\n const xc = axisLength;\n const expr1 = (2. / Math.sqrt(3.));\n let expr2 = (-(3. / 4.) * Math.sqrt(3.) * xc / nominalRadius1);\n if (expr2 < -1.0)\n expr2 = -1.0;\n if (expr2 > 1.0)\n expr2 = 1.0;\n const expr3 = Angle.degreesToRadians(240);\n return Math.asin(expr1 * Math.cos(Math.acos(expr2) / 3. + expr3));\n }\n public override scaleInPlace(scaleFactor: number): void {\n // apply the scale factor to all contents; all distances scale directly\n this._nominalLength1 *= scaleFactor;\n this._nominalRadius1 *= scaleFactor;\n super.scaleInPlace(scaleFactor);\n }\n /** Compute length along axis for AustralianRail spiral nominal radius and length. */\n public static radiusAndNominalLengthToAxisLength(\n nominalRadius1: number, nominalLength1: number, tolerance: number = 1.0e-5, requiredConvergenceCount: number = 2,\n ): number {\n const R = nominalRadius1;\n let idx = 0;\n let m, phi, xc2;\n let xc = .7 * nominalLength1;\n let convergenceCount = 0;\n // remark: This converges quickly\n // for L=100, R=400\n // ** full precision at 7th iteration.\n // ** classic tolerance 1.0e-5 (7 digits from L) with requiredConvergenceCount = 1 gives 11 digits after 3 iterations\n // ** each iteration adds about 2 digits. This is quite good for a successive replacement without derivative\n // ** Unanswerable question: If this is only done once and reused over all evaluations, do you want:\n // * run the 7 iterations to get full precision\n // * stop with the classic tolerance to get compatibility?\n for (idx = 0; idx < 100; ++idx) {\n phi = this.radiusAndAxisLengthToPhi(R, xc);\n xc2 = xc * xc;\n m = Math.tan(phi) / (3.0 * xc2);\n const m2x4 = m * m * xc2 * xc2;\n const correction = xc * m2x4 * ((9. / 10) + m2x4 * (-(9. / 8.) + m2x4 * (+(729. / 208.) + m2x4 * -(32805. / 2176.))));\n const correctedLength = xc + correction;\n xc = (nominalLength1 / correctedLength) * xc;\n if (Math.abs(nominalLength1 - correctedLength) < tolerance) {\n convergenceCount++;\n if (convergenceCount >= requiredConvergenceCount)\n break;\n } else {\n convergenceCount = 0;\n }\n }\n return xc;\n }\n public isAlmostEqual(other: any): boolean {\n if (other instanceof AustralianRailCorpXYEvaluator) {\n return Geometry.isAlmostEqualNumber(this._cubicM, other._cubicM)\n && Geometry.isAlmostEqualNumber(this._axisLength, other._axisLength)\n && Geometry.isAlmostEqualNumber(this._nominalLength1, other._nominalLength1)\n && Geometry.isAlmostEqualNumber(this._nominalRadius1, other._nominalRadius1);\n }\n return false;\n }\n /**\n * Return a (quite good approximation) of fraction along x axis for given distance along spiral.\n * * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to\n * an x coordinate.\n * * The `xToFraction(x)` method quickly (with a single divide) converts this x to fraction used for\n * this.fractionToX (fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.\n * * The x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\n * * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the\n * more accurate CurvePrimitive measurements.\n * * Round tripping distance through (a) distanceAlongSpiralToAustralianApproximateX, (b) xToFraction, and\n * (c) curveLengthBetweenFractions has 10 digit accuracy for L/R = 4, 12 digit accuracy for L/R = 10.\n * @param s distance along the axis.\n */\n public distanceAlongSpiralToAustralianApproximateX(s: number): number {\n const a1 = 0.9000;\n const a2 = 5.1750;\n const a3 = 43.1948;\n const a4 = 426.0564;\n const m = this._cubicM;\n const m2s4 = m * m * s * s * s * s;\n const x = s * (1.0 - m2s4 * (a1 - m2s4 * (a2 - m2s4 * (a3 - m2s4 * a4))));\n return x;\n }\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  import { XYCurveEvaluator } from "./XYCurveEvaluator";
2
2
  /**
3
3
  * Methods to evaluate caller-specified number of terms of the x and y series for a clothoid.
4
- * Each instance has
5
- * * Number of x and y terms to use.
6
- * * constant for theta=c * x * x
7
- * * This value is c=1/(2 R L) for curve length L measured from inflection to point with radius R.
4
+ * Each instance has:
5
+ * * number of x and y terms to use.
6
+ * * constant for theta = c*x*x.
7
+ * * This value is c = 1/(2*R*L) for curve length L measured from inflection to point with radius R.
8
8
  * @internal
9
9
  */
10
10
  export declare class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {
@@ -16,7 +16,7 @@ export declare class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {
16
16
  /** Return a deep clone. */
17
17
  clone(): ClothoidSeriesRLEvaluator;
18
18
  scaleInPlace(scaleFactor: number): void;
19
- /** Member by member matchup ... */
19
+ /** Member by member matchup. */
20
20
  isAlmostEqual(other: any): boolean;
21
21
  /**
22
22
  * Evaluate the X series at a nominal distance along the curve.
@@ -1 +1 @@
1
- {"version":3,"file":"ClothoidSeries.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/ClothoidSeries.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;;GAOG;AACH,qBAAa,yBAA0B,SAAQ,gBAAgB;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;gBACX,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,GAAE,MAAU,EAAE,SAAS,GAAE,MAAU;IAO/G,2BAA2B;IACpB,KAAK,IAAI,yBAAyB;IAGlC,YAAY,CAAC,WAAW,EAAE,MAAM;IAIvC,mCAAmC;IAC5B,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;IASzC;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAC5C;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAE5C;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAC7C;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAE7C;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAC9C;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAE9C;;;;OAIG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MA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W,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG5C;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG7C;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG7C;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG9C;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG9C;;;;OAIG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAuBzD,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAsBzD,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAsB1D,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAsB1D,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAS3D,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAS3D,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAYvC,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAavC,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CASlD"}
@@ -13,10 +13,10 @@ const XYCurveEvaluator_1 = require("./XYCurveEvaluator");
13
13
  const Newton_1 = require("../../numerics/Newton");
14
14
  /**
15
15
  * Methods to evaluate caller-specified number of terms of the x and y series for a clothoid.
16
- * Each instance has
17
- * * Number of x and y terms to use.
18
- * * constant for theta=c * x * x
19
- * * This value is c=1/(2 R L) for curve length L measured from inflection to point with radius R.
16
+ * Each instance has:
17
+ * * number of x and y terms to use.
18
+ * * constant for theta = c*x*x.
19
+ * * This value is c = 1/(2*R*L) for curve length L measured from inflection to point with radius R.
20
20
  * @internal
21
21
  */
22
22
  class ClothoidSeriesRLEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
@@ -39,7 +39,7 @@ class ClothoidSeriesRLEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
39
39
  this.nominalLength1 *= scaleFactor;
40
40
  this.constantDiv2LR /= (scaleFactor * scaleFactor);
41
41
  }
42
- /** Member by member matchup ... */
42
+ /** Member by member matchup. */
43
43
  isAlmostEqual(other) {
44
44
  if (other instanceof ClothoidSeriesRLEvaluator) {
45
45
  return this.numXTerms === other.numXTerms
@@ -53,43 +53,55 @@ class ClothoidSeriesRLEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
53
53
  * Evaluate the X series at a nominal distance along the curve.
54
54
  * @param fraction fractional position along the curve.
55
55
  */
56
- fractionToX(fraction) { return this.fractionToXGo(fraction, this.numXTerms); }
56
+ fractionToX(fraction) {
57
+ return this.fractionToXGo(fraction, this.numXTerms);
58
+ }
57
59
  /**
58
60
  * Evaluate the Y series at a nominal distance along the curve.
59
61
  * @param fraction fractional position along the curve.
60
62
  */
61
- fractionToY(fraction) { return this.fractionToYGo(fraction, this.numYTerms); }
63
+ fractionToY(fraction) {
64
+ return this.fractionToYGo(fraction, this.numYTerms);
65
+ }
62
66
  /**
63
67
  * Evaluate the derivative of the X series at a nominal distance along the curve.
64
68
  * @param fraction fractional position along the curve.
65
69
  */
66
- fractionToDX(fraction) { return this.fractionToDXGo(fraction, this.numXTerms); }
70
+ fractionToDX(fraction) {
71
+ return this.fractionToDXGo(fraction, this.numXTerms);
72
+ }
67
73
  /**
68
74
  * Evaluate the derivative of the Y series at a nominal distance along the curve.
69
75
  * @param fraction fractional position along the curve.
70
76
  */
71
- fractionToDY(fraction) { return this.fractionToDYGo(fraction, this.numYTerms); }
77
+ fractionToDY(fraction) {
78
+ return this.fractionToDYGo(fraction, this.numYTerms);
79
+ }
72
80
  /**
73
81
  * Evaluate the derivative of the X series at a nominal distance along the curve.
74
82
  * @param fraction fractional position along the curve.
75
83
  */
76
- fractionToDDX(fraction) { return this.fractionToDDXGo(fraction, this.numXTerms); }
84
+ fractionToDDX(fraction) {
85
+ return this.fractionToDDXGo(fraction, this.numXTerms);
86
+ }
77
87
  /**
78
88
  * Evaluate the derivative of the Y series at a nominal distance along the curve.
79
89
  * @param fraction fractional position along the curve.
80
90
  */
81
- fractionToDDY(fraction) { return this.fractionToDDYGo(fraction, this.numYTerms); }
91
+ fractionToDDY(fraction) {
92
+ return this.fractionToDDYGo(fraction, this.numYTerms);
93
+ }
82
94
  /**
83
95
  * Evaluate the X series at a nominal distance along the curve.
84
96
  * @param fraction fractional position along the curve.
85
97
  * @param numTerms number of terms to use.
86
98
  */
87
99
  fractionToXGo(fraction, numTerms) {
88
- // Write the series for cos (theta)
100
+ // write the series for cos(theta)
89
101
  // replace theta by s*s*c
90
102
  // integrate wrt s
91
103
  // x = s - s^5 c^4/ 2 + s^9 c^8/(4!) - s^13 c^12 / 6!
92
- // x = s(1 - (s^4 c^2/2) ( 1/5 -s^4 c^2 / (3*4) ( 1/9 - ....) ) )
104
+ // x = s(1 - (s^4 c^2/2) ( 1/5 -s^4 c^2 / (3*4) (1/9 - ...) ) )
93
105
  const s = fraction * this.nominalLength1;
94
106
  let result = s;
95
107
  if (numTerms < 2)
@@ -108,7 +120,7 @@ class ClothoidSeriesRLEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
108
120
  return result;
109
121
  }
110
122
  fractionToYGo(fraction, numTerms) {
111
- // Write the series for sin (theta)
123
+ // write the series for sin(theta)
112
124
  // replace theta by s*s*c
113
125
  // integrate wrt s
114
126
  // x = s^3 c^2/ 3( (1/3)) - s^7 c^6/(3!) ((1/7)) - s^11 c^10 / 5! ((1/9) - ...)
@@ -130,7 +142,7 @@ class ClothoidSeriesRLEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
130
142
  return result;
131
143
  }
132
144
  fractionToDXGo(fraction, numTerms) {
133
- // Yes -- this does happen during derivatives of cosines with more than 0 terms !!
145
+ // yes -- this does happen during derivatives of cosines with more than 0 terms
134
146
  if (numTerms <= 0)
135
147
  return 0;
136
148
  // dX = 1 - s^4c^2/2 + s^8 c^4 / 4! -
@@ -185,7 +197,7 @@ class ClothoidSeriesRLEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
185
197
  fractionToDDYGo(fraction, numTerms) {
186
198
  // DY is "sine"
187
199
  // DDY is "cosine" series times chain rule dTheta/ds = 2 * s * this.constantDivLR
188
- // BUT .... derivative of the cosine series leading term is zero ... use one less term!
200
+ // BUT .... derivative of the cosine series leading term is zero ... use one less term
189
201
  const s = fraction * this.nominalLength1;
190
202
  const dTheta = 2 * this.constantDiv2LR * s;
191
203
  const cosine = this.fractionToDXGo(fraction, numTerms);
@@ -1 +1 @@
1
- {"version":3,"file":"ClothoidSeries.js","sourceRoot":"","sources":["../../../../src/curve/spiral/ClothoidSeries.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,6CAA0C;AAC1C,yDAAsD;AACtD,kDAAqD;AACrD;;;;;;;GAOG;AACH,MAAa,yBAA0B,SAAQ,mCAAgB;IACtD,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,cAAc,CAAS;IACvB,cAAc,CAAS;IAC9B,YAAmB,cAAsB,EAAE,cAAsB,EAAE,YAAoB,CAAC,EAAE,YAAoB,CAAC;QAC7G,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IACD,2BAA2B;IACpB,KAAK;QACV,OAAO,IAAI,yBAAyB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,SAA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GAAG,IAAI,CAAC,cAAc,CAAC;IACnG,CAAC;IACM,aAAa,CAAC,QAAgB;QACnC,eAAe;QACf,iFAAiF;QACjF,MAAM,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC;QACzC,MAAM,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,oCAAoC;QACpC,6FAA6F;QAC7F,wEAAwE;QACxE,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;QAC/D,OAAO,CAAC,CAAC,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAClG,CAAC;IAEM,WAAW,CAAC,CAAS;QAC1B,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,MAAM,SAAS,GAAG,qBAAY,CAAC,WAAW,CAAC,SAAS,EAClD,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EACxC,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS;YACzB,OAAO,SAAS,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AArND,8DAqNC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry } from \"../../Geometry\";\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\nimport { SimpleNewton } from \"../../numerics/Newton\";\n/**\n * Methods to evaluate caller-specified number of terms of the x and y series for a clothoid.\n * Each instance has\n * * Number of x and y terms to use.\n * * constant for theta=c * x * x\n * * This value is c=1/(2 R L) for curve length L measured from inflection to point with radius R.\n * @internal\n */\nexport class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {\n public numXTerms: number;\n public numYTerms: number;\n public constantDiv2LR: number;\n public nominalLength1: number;\n public constructor(nominalLength1: number, constantDiv2LR: number, numXTerms: number = 4, numYTerms: number = 4) {\n super();\n this.nominalLength1 = nominalLength1;\n this.constantDiv2LR = constantDiv2LR;\n this.numXTerms = numXTerms;\n this.numYTerms = numYTerms;\n }\n /** Return a deep clone. */\n public clone(): ClothoidSeriesRLEvaluator {\n return new ClothoidSeriesRLEvaluator(this.nominalLength1, this.constantDiv2LR, this.numXTerms, this.numYTerms);\n }\n public scaleInPlace(scaleFactor: number) {\n this.nominalLength1 *= scaleFactor;\n this.constantDiv2LR /= (scaleFactor * scaleFactor);\n }\n /** Member by member matchup ... */\n public isAlmostEqual(other: any): boolean {\n if (other instanceof ClothoidSeriesRLEvaluator) {\n return this.numXTerms === other.numXTerms\n && this.numYTerms === other.numYTerms\n && Geometry.isAlmostEqualNumber(this.constantDiv2LR, other.constantDiv2LR)\n && Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1);\n }\n return false;\n }\n /**\n * Evaluate the X series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToX(fraction: number): number { return this.fractionToXGo(fraction, this.numXTerms); }\n /**\n * Evaluate the Y series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToY(fraction: number): number { return this.fractionToYGo(fraction, this.numYTerms); }\n\n /**\n * Evaluate the derivative of the X series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToDX(fraction: number): number { return this.fractionToDXGo(fraction, this.numXTerms); }\n /**\n * Evaluate the derivative of the Y series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToDY(fraction: number): number { return this.fractionToDYGo(fraction, this.numYTerms); }\n\n /**\n * Evaluate the derivative of the X series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToDDX(fraction: number): number { return this.fractionToDDXGo(fraction, this.numXTerms); }\n /**\n * Evaluate the derivative of the Y series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToDDY(fraction: number): number { return this.fractionToDDYGo(fraction, this.numYTerms); }\n\n /**\n * Evaluate the X series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n * @param numTerms number of terms to use.\n */\n public fractionToXGo(fraction: number, numTerms: number): number {\n // Write the series for cos (theta)\n // replace theta by s*s*c\n // integrate wrt s\n // x = s - s^5 c^4/ 2 + s^9 c^8/(4!) - s^13 c^12 / 6!\n // x = s(1 - (s^4 c^2/2) ( 1/5 -s^4 c^2 / (3*4) ( 1/9 - ....) ) )\n const s = fraction * this.nominalLength1;\n let result = s;\n if (numTerms < 2)\n return result;\n const q1 = s * s * this.constantDiv2LR;\n const beta = - q1 * q1;\n let alpha = s;\n let m = 1;\n let n = 5;\n for (let i = 1; i < numTerms; i++) {\n alpha *= beta / (m * (m + 1));\n result += alpha / n;\n m += 2;\n n += 4;\n }\n return result;\n }\n public fractionToYGo(fraction: number, numTerms: number): number {\n // Write the series for sin (theta)\n // replace theta by s*s*c\n // integrate wrt s\n // x = s^3 c^2/ 3( (1/3)) - s^7 c^6/(3!) ((1/7)) - s^11 c^10 / 5! ((1/9) - ...)\n const s = fraction * this.nominalLength1;\n const q1 = s * s * this.constantDiv2LR;\n let result = q1 * s / 3;\n if (numTerms < 2)\n return result;\n const beta = - q1 * q1;\n let alpha = q1 * s;\n let m = 2;\n let n = 7;\n for (let i = 1; i < numTerms; i++) {\n alpha *= beta / (m * (m + 1));\n result += alpha / n;\n m += 2;\n n += 4;\n }\n return result;\n }\n public fractionToDXGo(fraction: number, numTerms: number): number {\n // Yes -- this does happen during derivatives of cosines with more than 0 terms !!\n if (numTerms <= 0)\n return 0;\n // dX = 1 - s^4c^2/2 + s^8 c^4 / 4! -\n // new Term = old Term * beta / (m(m+1))\n const s = fraction * this.nominalLength1;\n let result = 1;\n if (numTerms < 2) {\n return result * this.nominalLength1;\n }\n const q1 = s * s * this.constantDiv2LR;\n const beta = - q1 * q1;\n let alpha = 1.0;\n let m = 1;\n for (let i = 1; i < numTerms; i++) {\n alpha *= beta / (m * (m + 1));\n result += alpha;\n m += 2;\n }\n return result * this.nominalLength1;\n }\n public fractionToDYGo(fraction: number, numTerms: number): number {\n if (numTerms <= 0)\n return 0;\n // dY = q - q^3/3!\n // q = s^2 c\n // dY = s^2 c - s^6 c^3/3! + s^10 c^5/ 5!\n // recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))\n const s = fraction * this.nominalLength1;\n const q1 = s * s * this.constantDiv2LR;\n let result = q1;\n if (numTerms < 2)\n return result * this.nominalLength1;\n const beta = - q1 * q1;\n let alpha = q1;\n let m = 2;\n for (let i = 1; i < numTerms; i++) {\n alpha *= beta / (m * (m + 1));\n result += alpha;\n m += 2;\n }\n return result * this.nominalLength1;\n }\n\n public fractionToDDXGo(fraction: number, numTerms: number): number {\n // DX is \"cosine\"\n // DDX is \"- sine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\n const s = fraction * this.nominalLength1;\n\n const dTheta = 2 * this.constantDiv2LR * s;\n const sine = this.fractionToDYGo(fraction, numTerms - 1);\n const resultA = (- dTheta * sine * this.nominalLength1);\n return resultA;\n }\n public fractionToDDYGo(fraction: number, numTerms: number): number {\n // DY is \"sine\"\n // DDY is \"cosine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\n // BUT .... derivative of the cosine series leading term is zero ... use one less term!\n const s = fraction * this.nominalLength1;\n const dTheta = 2 * this.constantDiv2LR * s;\n const cosine = this.fractionToDXGo(fraction, numTerms);\n return cosine * dTheta * this.nominalLength1;\n }\n\n public fractionToD3X(fraction: number): number {\n if (this.numXTerms <= 1)\n return 0.0;\n // DX is \"cosine\"\n // DDX is \"- sine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\n const s = fraction * this.nominalLength1;\n const dTheta = 2.0 * this.constantDiv2LR * s;\n const d2Theta = 2.0 * this.constantDiv2LR;\n const sine = this.fractionToDYGo(fraction, this.numXTerms - 1);\n const cosine = this.fractionToDXGo(fraction, this.numXTerms - 1);\n return (- cosine * dTheta * dTheta - sine * d2Theta) * this.nominalLength1 * this.nominalLength1;\n }\n public fractionToD3Y(fraction: number): number {\n // DY is \"sine\"\n // DDY is \"cosine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\n const s = fraction * this.nominalLength1;\n const dTheta = 2.0 * this.constantDiv2LR * s;\n const d2Theta = 2.0 * this.constantDiv2LR;\n // dY is sine series with numYTerms.\n // ddY is cosine series. Leading term of sine series is non-constant, so numYTerms here also\n // d3Y is sine series. Derivative of preceding cosine killed first term.\n const cosine = this.fractionToDXGo(fraction, this.numYTerms);\n const sine = this.fractionToDYGo(fraction, this.numYTerms - 1);\n return (-sine * dTheta * dTheta + cosine * d2Theta) * this.nominalLength1 * this.nominalLength1;\n }\n\n public xToFraction(x: number): number | undefined {\n const fraction0 = x / this.nominalLength1;\n const fraction1 = SimpleNewton.runNewton1D(fraction0,\n (f: number) => (this.fractionToX(f) - x),\n (f: number) => this.fractionToDX(f));\n if (fraction1 === undefined)\n return undefined;\n return fraction1;\n }\n}\n"]}
1
+ {"version":3,"file":"ClothoidSeries.js","sourceRoot":"","sources":["../../../../src/curve/spiral/ClothoidSeries.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,6CAA0C;AAC1C,yDAAsD;AACtD,kDAAqD;AAErD;;;;;;;GAOG;AACH,MAAa,yBAA0B,SAAQ,mCAAgB;IACt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,SAAS,GAAG,qBAAY,CAAC,WAAW,CAAC,SAAS,EAClD,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EACxC,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS;YACzB,OAAO,SAAS,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA1ND,8DA0NC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry } from \"../../Geometry\";\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\nimport { SimpleNewton } from \"../../numerics/Newton\";\n\n/**\n * Methods to evaluate caller-specified number of terms of the x and y series for a clothoid.\n * Each instance has:\n * * number of x and y terms to use.\n * * constant for theta = c*x*x.\n * * This value is c = 1/(2*R*L) for curve length L measured from inflection to point with radius R.\n * @internal\n */\nexport class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {\n public numXTerms: number;\n public numYTerms: number;\n public constantDiv2LR: number;\n public nominalLength1: number;\n public constructor(nominalLength1: number, constantDiv2LR: number, numXTerms: number = 4, numYTerms: number = 4) {\n super();\n this.nominalLength1 = nominalLength1;\n this.constantDiv2LR = constantDiv2LR;\n this.numXTerms = numXTerms;\n this.numYTerms = numYTerms;\n }\n /** Return a deep clone. */\n public clone(): ClothoidSeriesRLEvaluator {\n return new ClothoidSeriesRLEvaluator(this.nominalLength1, this.constantDiv2LR, this.numXTerms, this.numYTerms);\n }\n public scaleInPlace(scaleFactor: number): void {\n this.nominalLength1 *= scaleFactor;\n this.constantDiv2LR /= (scaleFactor * scaleFactor);\n }\n /** Member by member matchup. */\n public isAlmostEqual(other: any): boolean {\n if (other instanceof ClothoidSeriesRLEvaluator) {\n return this.numXTerms === other.numXTerms\n && this.numYTerms === other.numYTerms\n && Geometry.isAlmostEqualNumber(this.constantDiv2LR, other.constantDiv2LR)\n && Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1);\n }\n return false;\n }\n /**\n * Evaluate the X series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToX(fraction: number): number {\n return this.fractionToXGo(fraction, this.numXTerms);\n }\n /**\n * Evaluate the Y series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToY(fraction: number): number {\n return this.fractionToYGo(fraction, this.numYTerms);\n }\n /**\n * Evaluate the derivative of the X series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToDX(fraction: number): number {\n return this.fractionToDXGo(fraction, this.numXTerms);\n }\n /**\n * Evaluate the derivative of the Y series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToDY(fraction: number): number {\n return this.fractionToDYGo(fraction, this.numYTerms);\n }\n /**\n * Evaluate the derivative of the X series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToDDX(fraction: number): number {\n return this.fractionToDDXGo(fraction, this.numXTerms);\n }\n /**\n * Evaluate the derivative of the Y series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToDDY(fraction: number): number {\n return this.fractionToDDYGo(fraction, this.numYTerms);\n }\n /**\n * Evaluate the X series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n * @param numTerms number of terms to use.\n */\n public fractionToXGo(fraction: number, numTerms: number): number {\n // write the series for cos(theta)\n // replace theta by s*s*c\n // integrate wrt s\n // x = s - s^5 c^4/ 2 + s^9 c^8/(4!) - s^13 c^12 / 6!\n // x = s(1 - (s^4 c^2/2) ( 1/5 -s^4 c^2 / (3*4) (1/9 - ...) ) )\n const s = fraction * this.nominalLength1;\n let result = s;\n if (numTerms < 2)\n return result;\n const q1 = s * s * this.constantDiv2LR;\n const beta = - q1 * q1;\n let alpha = s;\n let m = 1;\n let n = 5;\n for (let i = 1; i < numTerms; i++) {\n alpha *= beta / (m * (m + 1));\n result += alpha / n;\n m += 2;\n n += 4;\n }\n return result;\n }\n public fractionToYGo(fraction: number, numTerms: number): number {\n // write the series for sin(theta)\n // replace theta by s*s*c\n // integrate wrt s\n // x = s^3 c^2/ 3( (1/3)) - s^7 c^6/(3!) ((1/7)) - s^11 c^10 / 5! ((1/9) - ...)\n const s = fraction * this.nominalLength1;\n const q1 = s * s * this.constantDiv2LR;\n let result = q1 * s / 3;\n if (numTerms < 2)\n return result;\n const beta = - q1 * q1;\n let alpha = q1 * s;\n let m = 2;\n let n = 7;\n for (let i = 1; i < numTerms; i++) {\n alpha *= beta / (m * (m + 1));\n result += alpha / n;\n m += 2;\n n += 4;\n }\n return result;\n }\n public fractionToDXGo(fraction: number, numTerms: number): number {\n // yes -- this does happen during derivatives of cosines with more than 0 terms\n if (numTerms <= 0)\n return 0;\n // dX = 1 - s^4c^2/2 + s^8 c^4 / 4! -\n // new Term = old Term * beta / (m(m+1))\n const s = fraction * this.nominalLength1;\n let result = 1;\n if (numTerms < 2) {\n return result * this.nominalLength1;\n }\n const q1 = s * s * this.constantDiv2LR;\n const beta = - q1 * q1;\n let alpha = 1.0;\n let m = 1;\n for (let i = 1; i < numTerms; i++) {\n alpha *= beta / (m * (m + 1));\n result += alpha;\n m += 2;\n }\n return result * this.nominalLength1;\n }\n public fractionToDYGo(fraction: number, numTerms: number): number {\n if (numTerms <= 0)\n return 0;\n // dY = q - q^3/3!\n // q = s^2 c\n // dY = s^2 c - s^6 c^3/3! + s^10 c^5/ 5!\n // recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))\n const s = fraction * this.nominalLength1;\n const q1 = s * s * this.constantDiv2LR;\n let result = q1;\n if (numTerms < 2)\n return result * this.nominalLength1;\n const beta = - q1 * q1;\n let alpha = q1;\n let m = 2;\n for (let i = 1; i < numTerms; i++) {\n alpha *= beta / (m * (m + 1));\n result += alpha;\n m += 2;\n }\n return result * this.nominalLength1;\n }\n public fractionToDDXGo(fraction: number, numTerms: number): number {\n // DX is \"cosine\"\n // DDX is \"- sine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\n const s = fraction * this.nominalLength1;\n const dTheta = 2 * this.constantDiv2LR * s;\n const sine = this.fractionToDYGo(fraction, numTerms - 1);\n const resultA = (- dTheta * sine * this.nominalLength1);\n return resultA;\n }\n public fractionToDDYGo(fraction: number, numTerms: number): number {\n // DY is \"sine\"\n // DDY is \"cosine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\n // BUT .... derivative of the cosine series leading term is zero ... use one less term\n const s = fraction * this.nominalLength1;\n const dTheta = 2 * this.constantDiv2LR * s;\n const cosine = this.fractionToDXGo(fraction, numTerms);\n return cosine * dTheta * this.nominalLength1;\n }\n public fractionToD3X(fraction: number): number {\n if (this.numXTerms <= 1)\n return 0.0;\n // DX is \"cosine\"\n // DDX is \"- sine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\n const s = fraction * this.nominalLength1;\n const dTheta = 2.0 * this.constantDiv2LR * s;\n const d2Theta = 2.0 * this.constantDiv2LR;\n const sine = this.fractionToDYGo(fraction, this.numXTerms - 1);\n const cosine = this.fractionToDXGo(fraction, this.numXTerms - 1);\n return (- cosine * dTheta * dTheta - sine * d2Theta) * this.nominalLength1 * this.nominalLength1;\n }\n public fractionToD3Y(fraction: number): number {\n // DY is \"sine\"\n // DDY is \"cosine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\n const s = fraction * this.nominalLength1;\n const dTheta = 2.0 * this.constantDiv2LR * s;\n const d2Theta = 2.0 * this.constantDiv2LR;\n // dY is sine series with numYTerms.\n // ddY is cosine series. Leading term of sine series is non-constant, so numYTerms here also\n // d3Y is sine series. Derivative of preceding cosine killed first term.\n const cosine = this.fractionToDXGo(fraction, this.numYTerms);\n const sine = this.fractionToDYGo(fraction, this.numYTerms - 1);\n return (-sine * dTheta * dTheta + cosine * d2Theta) * this.nominalLength1 * this.nominalLength1;\n }\n public xToFraction(x: number): number | undefined {\n const fraction0 = x / this.nominalLength1;\n const fraction1 = SimpleNewton.runNewton1D(fraction0,\n (f: number) => (this.fractionToX(f) - x),\n (f: number) => this.fractionToDX(f));\n if (fraction1 === undefined)\n return undefined;\n return fraction1;\n }\n}\n"]}
@@ -2,9 +2,11 @@
2
2
  * @module Curve
3
3
  */
4
4
  import { XYCurveEvaluator } from "./XYCurveEvaluator";
5
- /** Intermediate class for evaluation of bare cubic spirals `y = m ^x^3` with x axis from [0..xLength]
5
+ /**
6
+ * Intermediate class for evaluation of bare cubic spirals `y = m ^x^3` with x axis from [0..xLength]
6
7
  * * This implements all the computations among fraction, x, and y.
7
- * * Derived classes implement specialized logic such as (a) precomputing `m` and (b) domain-specific fraction-to-distance approximations.
8
+ * * Derived classes implement specialized logic such as (a) precomputing `m` and (b) domain-specific fraction-to-distance
9
+ * approximations.
8
10
  * @internal
9
11
  */
10
12
  export declare abstract class CubicEvaluator extends XYCurveEvaluator {
@@ -18,16 +20,15 @@ export declare abstract class CubicEvaluator extends XYCurveEvaluator {
18
20
  /**
19
21
  * Apply `scaleFactor` to the xLength and cubicM.
20
22
  * * Derived classes commonly call this as `super.scaleInPlace()`, and additionally apply the scale to their members.
21
- * @param scaleFactor
22
23
  */
23
24
  scaleInPlace(scaleFactor: number): void;
24
25
  /** Evaluate X at fraction. */
25
26
  fractionToX(fraction: number): number;
26
- /** Evaluate derivative of X with respect to fraction */
27
+ /** Evaluate derivative of X with respect to fraction. */
27
28
  fractionToDX(_fraction: number): number;
28
- /** Evaluate second derivative of X with respect to fraction */
29
+ /** Evaluate second derivative of X with respect to fraction. */
29
30
  fractionToDDX(_fraction: number): number;
30
- /** Evaluate third derivative of X with respect to fraction */
31
+ /** Evaluate third derivative of X with respect to fraction. */
31
32
  fractionToD3X(_fraction: number): number;
32
33
  /** Evaluate Y at fraction. */
33
34
  fractionToY(fraction: number): number;
@@ -1 +1 @@
1
- {"version":3,"file":"CubicEvaluator.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/CubicEvaluator.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD;;;;GAIG;AACH,8BAAsB,cAAe,SAAQ,gBAAgB;IAC3D,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAC9B,SAAS,aAAa,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKxD,6BAA6B;IACtB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAItD,IAAW,UAAU,WAA+B;IACpD,IAAW,MAAM,WAA2B;IAC5C;;;;OAIG;IACI,YAAY,CAAC,WAAW,EAAE,MAAM;IAKvC,8BAA8B;IACvB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAC5C,wDAAwD;IACjD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAC9C,+DAA+D;IACxD,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAC/C,8DAA8D;IACvD,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAC/C,8BAA8B;IACvB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI5C,yDAAyD;IAClD,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI7C,gEAAgE;IACzD,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI9C,+DAA+D;IACxD,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAG/C,8BAA8B;IACvB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;CACtC"}
1
+ {"version":3,"file":"CubicEvaluator.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/CubicEvaluator.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;GAMG;AACH,8BAAsB,cAAe,SAAQ,gBAAgB;IAC3D,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;IAC9B,SAAS,aAAa,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKxD,6BAA6B;IACtB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAItD,IAAW,UAAU,WAEpB;IACD,IAAW,MAAM,WAEhB;IACD;;;OAGG;IACI,YAAY,CAAC,WAAW,EAAE,MAAM;IAKvC,8BAA8B;IACvB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG5C,yDAAyD;IAClD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAG9C,gEAAgE;IACzD,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAG/C,+DAA+D;IACxD,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAG/C,8BAA8B;IACvB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI5C,yDAAyD;IAClD,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI7C,gEAAgE;IACzD,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI9C,+DAA+D;IACxD,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAG/C,8BAA8B;IACvB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;CAGtC"}
@@ -9,9 +9,11 @@ exports.CubicEvaluator = void 0;
9
9
  * @module Curve
10
10
  */
11
11
  const XYCurveEvaluator_1 = require("./XYCurveEvaluator");
12
- /** Intermediate class for evaluation of bare cubic spirals `y = m ^x^3` with x axis from [0..xLength]
12
+ /**
13
+ * Intermediate class for evaluation of bare cubic spirals `y = m ^x^3` with x axis from [0..xLength]
13
14
  * * This implements all the computations among fraction, x, and y.
14
- * * Derived classes implement specialized logic such as (a) precomputing `m` and (b) domain-specific fraction-to-distance approximations.
15
+ * * Derived classes implement specialized logic such as (a) precomputing `m` and (b) domain-specific fraction-to-distance
16
+ * approximations.
15
17
  * @internal
16
18
  */
17
19
  class CubicEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
@@ -27,26 +29,37 @@ class CubicEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
27
29
  this._axisLength = axisLength;
28
30
  this._cubicM = cubicM;
29
31
  }
30
- get axisLength() { return this._axisLength; }
31
- get cubicM() { return this._cubicM; }
32
+ get axisLength() {
33
+ return this._axisLength;
34
+ }
35
+ get cubicM() {
36
+ return this._cubicM;
37
+ }
32
38
  /**
33
39
  * Apply `scaleFactor` to the xLength and cubicM.
34
40
  * * Derived classes commonly call this as `super.scaleInPlace()`, and additionally apply the scale to their members.
35
- * @param scaleFactor
36
41
  */
37
42
  scaleInPlace(scaleFactor) {
38
43
  this._axisLength *= scaleFactor;
39
- // "x" arriving at "m * x^3" will be scaled. "m" has to be divided by the scale to cancel 2 of the 3 . .
44
+ // "x" arriving at "m * x^3" will be scaled. "m" has to be divided by the scale to cancel 2 of the 3
40
45
  this._cubicM /= (scaleFactor * scaleFactor);
41
46
  }
42
47
  /** Evaluate X at fraction. */
43
- fractionToX(fraction) { return fraction * this._axisLength; }
44
- /** Evaluate derivative of X with respect to fraction */
45
- fractionToDX(_fraction) { return this._axisLength; }
46
- /** Evaluate second derivative of X with respect to fraction */
47
- fractionToDDX(_fraction) { return 0.0; }
48
- /** Evaluate third derivative of X with respect to fraction */
49
- fractionToD3X(_fraction) { return 0.0; }
48
+ fractionToX(fraction) {
49
+ return fraction * this._axisLength;
50
+ }
51
+ /** Evaluate derivative of X with respect to fraction. */
52
+ fractionToDX(_fraction) {
53
+ return this._axisLength;
54
+ }
55
+ /** Evaluate second derivative of X with respect to fraction. */
56
+ fractionToDDX(_fraction) {
57
+ return 0.0;
58
+ }
59
+ /** Evaluate third derivative of X with respect to fraction. */
60
+ fractionToD3X(_fraction) {
61
+ return 0.0;
62
+ }
50
63
  /** Evaluate Y at fraction. */
51
64
  fractionToY(fraction) {
52
65
  const x = fraction * this._axisLength;
@@ -67,7 +80,9 @@ class CubicEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
67
80
  return 6.0 * this._cubicM * this._axisLength * this._axisLength * this._axisLength;
68
81
  }
69
82
  /** Evaluate fraction at x. */
70
- xToFraction(x) { return x / this._axisLength; }
83
+ xToFraction(x) {
84
+ return x / this._axisLength;
85
+ }
71
86
  }
72
87
  exports.CubicEvaluator = CubicEvaluator;
73
88
  //# sourceMappingURL=CubicEvaluator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CubicEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/CubicEvaluator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,yDAAsD;AACtD;;;;GAIG;AACH,MAAsB,cAAe,SAAQ,mCAAgB;IACjD,OAAO,CAAS;IAChB,WAAW,CAAS;IAC9B,YAAsB,UAAkB,EAAE,MAAc;QACtD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IACD,6BAA6B;IACtB,YAAY,CAAC,UAAkB,EAAE,MAAc;QACpD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IACD,IAAW,UAAU,KAAK,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACpD,IAAW,MAAM,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC5C;;;;OAIG;IACI,YAAY,CAAC,WAAmB;QACrC,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC;QACh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ACvB,WAAW,CAAC,CAAS,IAAY,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;CACvE;AAtDD,wCAsDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\n/** Intermediate class for evaluation of bare cubic spirals `y = m ^x^3` with x axis from [0..xLength]\n * * This implements all the computations among fraction, x, and y.\n * * Derived classes implement specialized logic such as (a) precomputing `m` and (b) domain-specific fraction-to-distance approximations.\n * @internal\n */\nexport abstract class CubicEvaluator extends XYCurveEvaluator {\n protected _cubicM: number;\n protected _axisLength: number;\n protected constructor(axisLength: number, cubicM: number) {\n super();\n this._cubicM = cubicM;\n this._axisLength = axisLength;\n }\n /** Update both constants. */\n public setConstants(axisLength: number, cubicM: number) {\n this._axisLength = axisLength;\n this._cubicM = cubicM;\n }\n public get axisLength() { return this._axisLength; }\n public get cubicM() { return this._cubicM; }\n /**\n * Apply `scaleFactor` to the xLength and cubicM.\n * * Derived classes commonly call this as `super.scaleInPlace()`, and additionally apply the scale to their members.\n * @param scaleFactor\n */\n public scaleInPlace(scaleFactor: number) {\n this._axisLength *= scaleFactor;\n // \"x\" arriving at \"m * x^3\" will be scaled. \"m\" has to be divided by the scale to cancel 2 of the 3 . .\n this._cubicM /= (scaleFactor * scaleFactor);\n }\n /** Evaluate X at fraction. */\n public fractionToX(fraction: number): number { return fraction * this._axisLength; }\n /** Evaluate derivative of X with respect to fraction */\n public fractionToDX(_fraction: number): number { return this._axisLength; }\n /** Evaluate second derivative of X with respect to fraction */\n public fractionToDDX(_fraction: number): number { return 0.0; }\n /** Evaluate third derivative of X with respect to fraction */\n public fractionToD3X(_fraction: number): number { return 0.0; }\n /** Evaluate Y at fraction. */\n public fractionToY(fraction: number): number {\n const x = fraction * this._axisLength;\n return this._cubicM * x * x * x;\n }\n /** Evaluate derivative of Y with respect to fraction. */\n public fractionToDY(fraction: number): number {\n const x = fraction * this._axisLength;\n return 3.0 * this._cubicM * x * x * this._axisLength;\n }\n /** Evaluate second derivative of Y with respect to fraction. */\n public fractionToDDY(fraction: number): number {\n const x = fraction * this._axisLength;\n return 6.0 * this._cubicM * x * this._axisLength * this._axisLength;\n }\n /** Evaluate third derivative of Y with respect to fraction. */\n public fractionToD3Y(_fraction: number): number {\n return 6.0 * this._cubicM * this._axisLength * this._axisLength * this._axisLength;\n }\n /** Evaluate fraction at x. */\n public xToFraction(x: number): number { return x / this._axisLength; }\n}\n"]}
1
+ {"version":3,"file":"CubicEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/CubicEvaluator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,yDAAsD;AAEtD;;;;;;GAMG;AACH,MAAsB,cAAe,SAAQ,mCAAgB;IACjD,OAAO,CAAS;IAChB,WAAW,CAAS;IAC9B,YAAsB,UAAkB,EAAE,MAAc;QACtD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IACD,6BAA6B;IACtB,YAAY,CAAC,UAAkB,EAAE,MAAc;QACpD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IACD,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IACD,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IACD;;;OAGG;IACI,YAAY,CAAC,WAAmB;QACrC,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC;QAChC,oGAAoG;QACpG,IAAI,CAAC,OAAO,IAAI,CAAC,WAAW,GAAG,WAAW,C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9B,CAAC;CACF;AAnED,wCAmEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\n\n/**\n * Intermediate class for evaluation of bare cubic spirals `y = m ^x^3` with x axis from [0..xLength]\n * * This implements all the computations among fraction, x, and y.\n * * Derived classes implement specialized logic such as (a) precomputing `m` and (b) domain-specific fraction-to-distance\n * approximations.\n * @internal\n */\nexport abstract class CubicEvaluator extends XYCurveEvaluator {\n protected _cubicM: number;\n protected _axisLength: number;\n protected constructor(axisLength: number, cubicM: number) {\n super();\n this._cubicM = cubicM;\n this._axisLength = axisLength;\n }\n /** Update both constants. */\n public setConstants(axisLength: number, cubicM: number) {\n this._axisLength = axisLength;\n this._cubicM = cubicM;\n }\n public get axisLength() {\n return this._axisLength;\n }\n public get cubicM() {\n return this._cubicM;\n }\n /**\n * Apply `scaleFactor` to the xLength and cubicM.\n * * Derived classes commonly call this as `super.scaleInPlace()`, and additionally apply the scale to their members.\n */\n public scaleInPlace(scaleFactor: number) {\n this._axisLength *= scaleFactor;\n // \"x\" arriving at \"m * x^3\" will be scaled. \"m\" has to be divided by the scale to cancel 2 of the 3\n this._cubicM /= (scaleFactor * scaleFactor);\n }\n /** Evaluate X at fraction. */\n public fractionToX(fraction: number): number {\n return fraction * this._axisLength;\n }\n /** Evaluate derivative of X with respect to fraction. */\n public fractionToDX(_fraction: number): number {\n return this._axisLength;\n }\n /** Evaluate second derivative of X with respect to fraction. */\n public fractionToDDX(_fraction: number): number {\n return 0.0;\n }\n /** Evaluate third derivative of X with respect to fraction. */\n public fractionToD3X(_fraction: number): number {\n return 0.0;\n }\n /** Evaluate Y at fraction. */\n public fractionToY(fraction: number): number {\n const x = fraction * this._axisLength;\n return this._cubicM * x * x * x;\n }\n /** Evaluate derivative of Y with respect to fraction. */\n public fractionToDY(fraction: number): number {\n const x = fraction * this._axisLength;\n return 3.0 * this._cubicM * x * x * this._axisLength;\n }\n /** Evaluate second derivative of Y with respect to fraction. */\n public fractionToDDY(fraction: number): number {\n const x = fraction * this._axisLength;\n return 6.0 * this._cubicM * x * this._axisLength * this._axisLength;\n }\n /** Evaluate third derivative of Y with respect to fraction. */\n public fractionToD3Y(_fraction: number): number {\n return 6.0 * this._cubicM * this._axisLength * this._axisLength * this._axisLength;\n }\n /** Evaluate fraction at x. */\n public xToFraction(x: number): number {\n return x / this._axisLength;\n }\n}\n"]}