@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
@@ -23,9 +23,15 @@ export class AustralianRailCorpXYEvaluator extends CubicEvaluator {
23
23
  this._nominalLength1 = nominalLength1;
24
24
  this._nominalRadius1 = nominalRadius1;
25
25
  }
26
- get nominalLength1() { return this._nominalLength1; }
27
- get nominalRadius1() { return this._nominalRadius1; }
28
- clone() { return new AustralianRailCorpXYEvaluator(this._nominalLength1, this._nominalRadius1, this._axisLength, this._cubicM); }
26
+ get nominalLength1() {
27
+ return this._nominalLength1;
28
+ }
29
+ get nominalRadius1() {
30
+ return this._nominalRadius1;
31
+ }
32
+ clone() {
33
+ return new AustralianRailCorpXYEvaluator(this._nominalLength1, this._nominalRadius1, this._axisLength, this._cubicM);
34
+ }
29
35
  static create(nominalLength1, nominalRadius1) {
30
36
  const axisLength = AustralianRailCorpXYEvaluator.radiusAndNominalLengthToAxisLength(nominalRadius1, nominalLength1);
31
37
  const phi = this.radiusAndAxisLengthToPhi(nominalRadius1, axisLength);
@@ -33,11 +39,7 @@ export class AustralianRailCorpXYEvaluator extends CubicEvaluator {
33
39
  const cubicM = Math.tan(phi) / (3.0 * xc2);
34
40
  return new AustralianRailCorpXYEvaluator(nominalLength1, nominalRadius1, axisLength, cubicM);
35
41
  }
36
- /**
37
- * Compute the phi constant for AustralianRail spiral with given end radius and length along axis.
38
- * @param nominalRadius1
39
- * @param axisLength
40
- */
42
+ /** Compute the phi constant for AustralianRail spiral with given end radius and length along axis. */
41
43
  static radiusAndAxisLengthToPhi(nominalRadius1, axisLength) {
42
44
  const xc = axisLength;
43
45
  const expr1 = (2. / Math.sqrt(3.));
@@ -50,26 +52,23 @@ export class AustralianRailCorpXYEvaluator extends CubicEvaluator {
50
52
  return Math.asin(expr1 * Math.cos(Math.acos(expr2) / 3. + expr3));
51
53
  }
52
54
  scaleInPlace(scaleFactor) {
53
- // apply the scale factor to all contents.
54
- // all distances scale directly . . .
55
+ // apply the scale factor to all contents; all distances scale directly
55
56
  this._nominalLength1 *= scaleFactor;
56
57
  this._nominalRadius1 *= scaleFactor;
57
58
  super.scaleInPlace(scaleFactor);
58
59
  }
59
- /** Compute length along axis for AustralianRail spiral nominal radius and length.
60
- *
61
- */
60
+ /** Compute length along axis for AustralianRail spiral nominal radius and length. */
62
61
  static radiusAndNominalLengthToAxisLength(nominalRadius1, nominalLength1, tolerance = 1.0e-5, requiredConvergenceCount = 2) {
63
62
  const R = nominalRadius1;
64
63
  let idx = 0;
65
64
  let m, phi, xc2;
66
65
  let xc = .7 * nominalLength1;
67
66
  let convergenceCount = 0;
68
- // remark: This converges quickly --
67
+ // remark: This converges quickly
69
68
  // for L=100, R=400
70
69
  // ** full precision at 7th iteration.
71
70
  // ** classic tolerance 1.0e-5 (7 digits from L) with requiredConvergenceCount = 1 gives 11 digits after 3 iterations
72
- // ** each iteration adds about 2 digits. This is quite good for a successive replacement without derivative !!!
71
+ // ** each iteration adds about 2 digits. This is quite good for a successive replacement without derivative
73
72
  // ** Unanswerable question: If this is only done once and reused over all evaluations, do you want:
74
73
  // * run the 7 iterations to get full precision
75
74
  // * stop with the classic tolerance to get compatibility?
@@ -78,8 +77,7 @@ export class AustralianRailCorpXYEvaluator extends CubicEvaluator {
78
77
  xc2 = xc * xc;
79
78
  m = Math.tan(phi) / (3.0 * xc2);
80
79
  const m2x4 = m * m * xc2 * xc2;
81
- const correction = xc * m2x4 * ((9. / 10) + m2x4 * (-(9. / 8.) + m2x4 * (+(729. / 208.) + m2x4 *
82
- -(32805. / 2176.))));
80
+ const correction = xc * m2x4 * ((9. / 10) + m2x4 * (-(9. / 8.) + m2x4 * (+(729. / 208.) + m2x4 * -(32805. / 2176.))));
83
81
  const correctedLength = xc + correction;
84
82
  xc = (nominalLength1 / correctedLength) * xc;
85
83
  if (Math.abs(nominalLength1 - correctedLength) < tolerance) {
@@ -104,12 +102,15 @@ export class AustralianRailCorpXYEvaluator extends CubicEvaluator {
104
102
  }
105
103
  /**
106
104
  * Return a (quite good approximation) of fraction along x axis for given distance along spiral.
107
- * * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to an x coordinate.
108
- * * 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.
105
+ * * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to
106
+ * an x coordinate.
107
+ * * The `xToFraction(x)` method quickly (with a single divide) converts this x to fraction used for
108
+ * this.fractionToX (fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.
109
109
  * * The x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.
110
- * * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the more accurate CurvePrimitive measurements.
111
- * * Round tripping distance through (a) distanceAlongSpiralToAustralianApproximateX, (b) xToFraction, and (c) curveLengthBetweenFractions has
112
- * * 10 digit accuracy for L/R = 4, 12 digit accuracy for L/R = 10
110
+ * * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the
111
+ * more accurate CurvePrimitive measurements.
112
+ * * Round tripping distance through (a) distanceAlongSpiralToAustralianApproximateX, (b) xToFraction, and
113
+ * (c) curveLengthBetweenFractions has 10 digit accuracy for L/R = 4, 12 digit accuracy for L/R = 10.
113
114
  * @param s distance along the axis.
114
115
  */
115
116
  distanceAlongSpiralToAustralianApproximateX(s) {
@@ -1 +1 @@
1
- {"version":3,"file":"AustralianRailCorpXYEvaluator.js","sourceRoot":"","sources":["../../../../src/cur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AAI,KAAK,YAAY,6BAA6B,EAAE,CAAC;YACnD,OAAO,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;mBAC3D,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC;mBACjE,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,eAAe,CAAC;mBACzE,QAAQ,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","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,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,OAAO,6BAA8B,SAAQ,cAAc;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,c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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","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,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AC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CASlD"}
@@ -10,10 +10,10 @@ import { XYCurveEvaluator } from "./XYCurveEvaluator";
10
10
  import { SimpleNewton } from "../../numerics/Newton";
11
11
  /**
12
12
  * Methods to evaluate caller-specified number of terms of the x and y series for a clothoid.
13
- * Each instance has
14
- * * Number of x and y terms to use.
15
- * * constant for theta=c * x * x
16
- * * This value is c=1/(2 R L) for curve length L measured from inflection to point with radius R.
13
+ * Each instance has:
14
+ * * number of x and y terms to use.
15
+ * * constant for theta = c*x*x.
16
+ * * This value is c = 1/(2*R*L) for curve length L measured from inflection to point with radius R.
17
17
  * @internal
18
18
  */
19
19
  export class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {
@@ -36,7 +36,7 @@ export class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {
36
36
  this.nominalLength1 *= scaleFactor;
37
37
  this.constantDiv2LR /= (scaleFactor * scaleFactor);
38
38
  }
39
- /** Member by member matchup ... */
39
+ /** Member by member matchup. */
40
40
  isAlmostEqual(other) {
41
41
  if (other instanceof ClothoidSeriesRLEvaluator) {
42
42
  return this.numXTerms === other.numXTerms
@@ -50,43 +50,55 @@ export class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {
50
50
  * Evaluate the X series at a nominal distance along the curve.
51
51
  * @param fraction fractional position along the curve.
52
52
  */
53
- fractionToX(fraction) { return this.fractionToXGo(fraction, this.numXTerms); }
53
+ fractionToX(fraction) {
54
+ return this.fractionToXGo(fraction, this.numXTerms);
55
+ }
54
56
  /**
55
57
  * Evaluate the Y series at a nominal distance along the curve.
56
58
  * @param fraction fractional position along the curve.
57
59
  */
58
- fractionToY(fraction) { return this.fractionToYGo(fraction, this.numYTerms); }
60
+ fractionToY(fraction) {
61
+ return this.fractionToYGo(fraction, this.numYTerms);
62
+ }
59
63
  /**
60
64
  * Evaluate the derivative of the X series at a nominal distance along the curve.
61
65
  * @param fraction fractional position along the curve.
62
66
  */
63
- fractionToDX(fraction) { return this.fractionToDXGo(fraction, this.numXTerms); }
67
+ fractionToDX(fraction) {
68
+ return this.fractionToDXGo(fraction, this.numXTerms);
69
+ }
64
70
  /**
65
71
  * Evaluate the derivative of the Y series at a nominal distance along the curve.
66
72
  * @param fraction fractional position along the curve.
67
73
  */
68
- fractionToDY(fraction) { return this.fractionToDYGo(fraction, this.numYTerms); }
74
+ fractionToDY(fraction) {
75
+ return this.fractionToDYGo(fraction, this.numYTerms);
76
+ }
69
77
  /**
70
78
  * Evaluate the derivative of the X series at a nominal distance along the curve.
71
79
  * @param fraction fractional position along the curve.
72
80
  */
73
- fractionToDDX(fraction) { return this.fractionToDDXGo(fraction, this.numXTerms); }
81
+ fractionToDDX(fraction) {
82
+ return this.fractionToDDXGo(fraction, this.numXTerms);
83
+ }
74
84
  /**
75
85
  * Evaluate the derivative of the Y series at a nominal distance along the curve.
76
86
  * @param fraction fractional position along the curve.
77
87
  */
78
- fractionToDDY(fraction) { return this.fractionToDDYGo(fraction, this.numYTerms); }
88
+ fractionToDDY(fraction) {
89
+ return this.fractionToDDYGo(fraction, this.numYTerms);
90
+ }
79
91
  /**
80
92
  * Evaluate the X series at a nominal distance along the curve.
81
93
  * @param fraction fractional position along the curve.
82
94
  * @param numTerms number of terms to use.
83
95
  */
84
96
  fractionToXGo(fraction, numTerms) {
85
- // Write the series for cos (theta)
97
+ // write the series for cos(theta)
86
98
  // replace theta by s*s*c
87
99
  // integrate wrt s
88
100
  // x = s - s^5 c^4/ 2 + s^9 c^8/(4!) - s^13 c^12 / 6!
89
- // x = s(1 - (s^4 c^2/2) ( 1/5 -s^4 c^2 / (3*4) ( 1/9 - ....) ) )
101
+ // x = s(1 - (s^4 c^2/2) ( 1/5 -s^4 c^2 / (3*4) (1/9 - ...) ) )
90
102
  const s = fraction * this.nominalLength1;
91
103
  let result = s;
92
104
  if (numTerms < 2)
@@ -105,7 +117,7 @@ export class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {
105
117
  return result;
106
118
  }
107
119
  fractionToYGo(fraction, numTerms) {
108
- // Write the series for sin (theta)
120
+ // write the series for sin(theta)
109
121
  // replace theta by s*s*c
110
122
  // integrate wrt s
111
123
  // x = s^3 c^2/ 3( (1/3)) - s^7 c^6/(3!) ((1/7)) - s^11 c^10 / 5! ((1/9) - ...)
@@ -127,7 +139,7 @@ export class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {
127
139
  return result;
128
140
  }
129
141
  fractionToDXGo(fraction, numTerms) {
130
- // Yes -- this does happen during derivatives of cosines with more than 0 terms !!
142
+ // yes -- this does happen during derivatives of cosines with more than 0 terms
131
143
  if (numTerms <= 0)
132
144
  return 0;
133
145
  // dX = 1 - s^4c^2/2 + s^8 c^4 / 4! -
@@ -182,7 +194,7 @@ export class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {
182
194
  fractionToDDYGo(fraction, numTerms) {
183
195
  // DY is "sine"
184
196
  // DDY is "cosine" series times chain rule dTheta/ds = 2 * s * this.constantDivLR
185
- // BUT .... derivative of the cosine series leading term is zero ... use one less term!
197
+ // BUT .... derivative of the cosine series leading term is zero ... use one less term
186
198
  const s = fraction * this.nominalLength1;
187
199
  const dTheta = 2 * this.constantDiv2LR * s;
188
200
  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,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD;;;;;;;GAOG;AACH,MAAM,OAAO,yBAA0B,SAAQ,gBAAgB;IACtD,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,cAAc,CAAS;IACvB,cAAc,CAAS;IAC9B,YAAmB,cAAsB,EA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AAC,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","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,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,OAAO,yBAA0B,SAAQ,gBAAgB;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,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACjH,CAAC;IACM,YAAY,CAAC,WAAmB;QACrC,IAAI,CAAC,cAAc,IAAI,WAAW,CAAC;QACnC,IAAI,CAAC,cAAc,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,CAAC;IACrD,CAAC;IACD,gCAAgC;IACzB,aAAa,CAAC,KAAU;QAC7B,IAAI,KAAK,YAAY,yBAAyB,EAAE,CAAC;YAC/C,OA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ACpC,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;IACM,WAAW,CAAC,CAAS;QAC1B,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,MAAM,SAAS,GAAG,YAAY,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","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,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AAyD;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"}
@@ -6,9 +6,11 @@
6
6
  * @module Curve
7
7
  */
8
8
  import { XYCurveEvaluator } from "./XYCurveEvaluator";
9
- /** Intermediate class for evaluation of bare cubic spirals `y = m ^x^3` with x axis from [0..xLength]
9
+ /**
10
+ * Intermediate class for evaluation of bare cubic spirals `y = m ^x^3` with x axis from [0..xLength]
10
11
  * * This implements all the computations among fraction, x, and y.
11
- * * Derived classes implement specialized logic such as (a) precomputing `m` and (b) domain-specific fraction-to-distance approximations.
12
+ * * Derived classes implement specialized logic such as (a) precomputing `m` and (b) domain-specific fraction-to-distance
13
+ * approximations.
12
14
  * @internal
13
15
  */
14
16
  export class CubicEvaluator extends XYCurveEvaluator {
@@ -24,26 +26,37 @@ export class CubicEvaluator extends XYCurveEvaluator {
24
26
  this._axisLength = axisLength;
25
27
  this._cubicM = cubicM;
26
28
  }
27
- get axisLength() { return this._axisLength; }
28
- get cubicM() { return this._cubicM; }
29
+ get axisLength() {
30
+ return this._axisLength;
31
+ }
32
+ get cubicM() {
33
+ return this._cubicM;
34
+ }
29
35
  /**
30
36
  * Apply `scaleFactor` to the xLength and cubicM.
31
37
  * * Derived classes commonly call this as `super.scaleInPlace()`, and additionally apply the scale to their members.
32
- * @param scaleFactor
33
38
  */
34
39
  scaleInPlace(scaleFactor) {
35
40
  this._axisLength *= scaleFactor;
36
- // "x" arriving at "m * x^3" will be scaled. "m" has to be divided by the scale to cancel 2 of the 3 . .
41
+ // "x" arriving at "m * x^3" will be scaled. "m" has to be divided by the scale to cancel 2 of the 3
37
42
  this._cubicM /= (scaleFactor * scaleFactor);
38
43
  }
39
44
  /** Evaluate X at fraction. */
40
- fractionToX(fraction) { return fraction * this._axisLength; }
41
- /** Evaluate derivative of X with respect to fraction */
42
- fractionToDX(_fraction) { return this._axisLength; }
43
- /** Evaluate second derivative of X with respect to fraction */
44
- fractionToDDX(_fraction) { return 0.0; }
45
- /** Evaluate third derivative of X with respect to fraction */
46
- fractionToD3X(_fraction) { return 0.0; }
45
+ fractionToX(fraction) {
46
+ return fraction * this._axisLength;
47
+ }
48
+ /** Evaluate derivative of X with respect to fraction. */
49
+ fractionToDX(_fraction) {
50
+ return this._axisLength;
51
+ }
52
+ /** Evaluate second derivative of X with respect to fraction. */
53
+ fractionToDDX(_fraction) {
54
+ return 0.0;
55
+ }
56
+ /** Evaluate third derivative of X with respect to fraction. */
57
+ fractionToD3X(_fraction) {
58
+ return 0.0;
59
+ }
47
60
  /** Evaluate Y at fraction. */
48
61
  fractionToY(fraction) {
49
62
  const x = fraction * this._axisLength;
@@ -64,6 +77,8 @@ export class CubicEvaluator extends XYCurveEvaluator {
64
77
  return 6.0 * this._cubicM * this._axisLength * this._axisLength * this._axisLength;
65
78
  }
66
79
  /** Evaluate fraction at x. */
67
- xToFraction(x) { return x / this._axisLength; }
80
+ xToFraction(x) {
81
+ return x / this._axisLength;
82
+ }
68
83
  }
69
84
  //# 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,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD;;;;GAIG;AACH,MAAM,OAAgB,cAAe,SAAQ,gBAAgB;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,WA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EAAgE;IACzD,aAAa,CAAC,QAAgB;QACnC,MAAM,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC;QACtC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACtE,CAAC;IACD,+DAA+D;IACxD,aAAa,CAAC,SAAiB;QACpC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACrF,CAAC;IACD,8BAA8B;IACvB,WAAW,CAAC,CAAS,IAAY,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;CACvE","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,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,OAAgB,cAAe,SAAQ,gBAAgB;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;I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,GAAG,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC;QACtC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACtE,CAAC;IACD,+DAA+D;IACxD,aAAa,CAAC,SAAiB;QACpC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACrF,CAAC;IACD,8BAA8B;IACvB,WAAW,CAAC,CAAS;QAC1B,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;IAC9B,CAAC;CACF","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"]}