@itwin/core-geometry 5.3.0-dev.8 → 5.4.0-dev.2

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 (162) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/lib/cjs/curve/Arc3d.d.ts +15 -1
  3. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  4. package/lib/cjs/curve/Arc3d.js +31 -2
  5. package/lib/cjs/curve/Arc3d.js.map +1 -1
  6. package/lib/cjs/curve/CurveFactory.d.ts +25 -8
  7. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  8. package/lib/cjs/curve/CurveFactory.js +51 -55
  9. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  10. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.d.ts +10 -13
  11. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.d.ts.map +1 -1
  12. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js +23 -22
  13. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  14. package/lib/cjs/curve/spiral/ClothoidSeries.d.ts +10 -6
  15. package/lib/cjs/curve/spiral/ClothoidSeries.d.ts.map +1 -1
  16. package/lib/cjs/curve/spiral/ClothoidSeries.js +36 -19
  17. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  18. package/lib/cjs/curve/spiral/CubicEvaluator.d.ts +7 -6
  19. package/lib/cjs/curve/spiral/CubicEvaluator.d.ts.map +1 -1
  20. package/lib/cjs/curve/spiral/CubicEvaluator.js +29 -14
  21. package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
  22. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.d.ts +34 -44
  23. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.d.ts.map +1 -1
  24. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js +47 -53
  25. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  26. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts +2 -2
  27. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts.map +1 -1
  28. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js +17 -7
  29. package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  30. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +112 -104
  31. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  32. package/lib/cjs/curve/spiral/DirectSpiral3d.js +143 -117
  33. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  34. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +71 -53
  35. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  36. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +99 -66
  37. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  38. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts +8 -12
  39. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts.map +1 -1
  40. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +11 -13
  41. package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  42. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts +36 -29
  43. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  44. package/lib/cjs/curve/spiral/NormalizedTransition.js +62 -40
  45. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  46. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.d.ts +13 -18
  47. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.d.ts.map +1 -1
  48. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js +21 -24
  49. package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  50. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts +41 -27
  51. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  52. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js +50 -33
  53. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  54. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +45 -34
  55. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  56. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +56 -38
  57. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  58. package/lib/cjs/curve/spiral/XYCurveEvaluator.d.ts +27 -21
  59. package/lib/cjs/curve/spiral/XYCurveEvaluator.d.ts.map +1 -1
  60. package/lib/cjs/curve/spiral/XYCurveEvaluator.js +23 -18
  61. package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
  62. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +96 -98
  63. package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
  64. package/lib/cjs/geometry3d/GrowableXYArray.js +121 -110
  65. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  66. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +135 -142
  67. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  68. package/lib/cjs/geometry3d/GrowableXYZArray.js +165 -160
  69. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  70. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts +51 -34
  71. package/lib/cjs/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  72. package/lib/cjs/geometry3d/IndexedXYCollection.js +16 -6
  73. package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
  74. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +78 -77
  75. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  76. package/lib/cjs/geometry3d/IndexedXYZCollection.js +38 -35
  77. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  78. package/lib/cjs/geometry3d/PolygonOps.d.ts +27 -7
  79. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  80. package/lib/cjs/geometry3d/PolygonOps.js +30 -9
  81. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  82. package/lib/esm/curve/Arc3d.d.ts +15 -1
  83. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  84. package/lib/esm/curve/Arc3d.js +31 -2
  85. package/lib/esm/curve/Arc3d.js.map +1 -1
  86. package/lib/esm/curve/CurveFactory.d.ts +25 -8
  87. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  88. package/lib/esm/curve/CurveFactory.js +51 -55
  89. package/lib/esm/curve/CurveFactory.js.map +1 -1
  90. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.d.ts +10 -13
  91. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.d.ts.map +1 -1
  92. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js +23 -22
  93. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  94. package/lib/esm/curve/spiral/ClothoidSeries.d.ts +10 -6
  95. package/lib/esm/curve/spiral/ClothoidSeries.d.ts.map +1 -1
  96. package/lib/esm/curve/spiral/ClothoidSeries.js +36 -19
  97. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  98. package/lib/esm/curve/spiral/CubicEvaluator.d.ts +7 -6
  99. package/lib/esm/curve/spiral/CubicEvaluator.d.ts.map +1 -1
  100. package/lib/esm/curve/spiral/CubicEvaluator.js +29 -14
  101. package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
  102. package/lib/esm/curve/spiral/CzechSpiralEvaluator.d.ts +34 -44
  103. package/lib/esm/curve/spiral/CzechSpiralEvaluator.d.ts.map +1 -1
  104. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js +47 -53
  105. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  106. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts +2 -2
  107. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.d.ts.map +1 -1
  108. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js +17 -7
  109. package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
  110. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +112 -104
  111. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  112. package/lib/esm/curve/spiral/DirectSpiral3d.js +143 -117
  113. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  114. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +71 -53
  115. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  116. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +99 -66
  117. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  118. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts +8 -12
  119. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.d.ts.map +1 -1
  120. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js +11 -13
  121. package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
  122. package/lib/esm/curve/spiral/NormalizedTransition.d.ts +36 -29
  123. package/lib/esm/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  124. package/lib/esm/curve/spiral/NormalizedTransition.js +62 -40
  125. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  126. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.d.ts +13 -18
  127. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.d.ts.map +1 -1
  128. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js +21 -24
  129. package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
  130. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts +41 -27
  131. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  132. package/lib/esm/curve/spiral/TransitionConditionalProperties.js +50 -33
  133. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  134. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +45 -34
  135. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  136. package/lib/esm/curve/spiral/TransitionSpiral3d.js +56 -38
  137. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  138. package/lib/esm/curve/spiral/XYCurveEvaluator.d.ts +27 -21
  139. package/lib/esm/curve/spiral/XYCurveEvaluator.d.ts.map +1 -1
  140. package/lib/esm/curve/spiral/XYCurveEvaluator.js +23 -18
  141. package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
  142. package/lib/esm/geometry3d/GrowableXYArray.d.ts +96 -98
  143. package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
  144. package/lib/esm/geometry3d/GrowableXYArray.js +122 -111
  145. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  146. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +135 -142
  147. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  148. package/lib/esm/geometry3d/GrowableXYZArray.js +165 -160
  149. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  150. package/lib/esm/geometry3d/IndexedXYCollection.d.ts +51 -34
  151. package/lib/esm/geometry3d/IndexedXYCollection.d.ts.map +1 -1
  152. package/lib/esm/geometry3d/IndexedXYCollection.js +14 -5
  153. package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
  154. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +78 -77
  155. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  156. package/lib/esm/geometry3d/IndexedXYZCollection.js +38 -35
  157. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  158. package/lib/esm/geometry3d/PolygonOps.d.ts +27 -7
  159. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  160. package/lib/esm/geometry3d/PolygonOps.js +30 -9
  161. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  162. package/package.json +3 -3
@@ -1,107 +1,97 @@
1
1
  import { CubicEvaluator } from "./CubicEvaluator";
2
2
  /**
3
3
  * Czech cubic.
4
- * This is y= m*x^3 with
5
- * * x any point on the x axis
6
- * * `fraction` along the spiral goes to `x = fraction * L`
7
- * * m is gamma / (6RL)
4
+ * This is y = m*x^3 with
5
+ * * x any point on the x axis.
6
+ * * `fraction` along the spiral goes to `x = fraction * L`.
7
+ * * m is gamma/(6RL).
8
8
  * * 1/(6RL) is the leading term of the sine series.
9
- * * `gamma = 2R/sqrt (4RR-LL)` pushes y down a little bit to simulate the lost series terms.
10
- * @param localToWorld
11
- * @param nominalL1
12
- * @param nominalR1
13
- * @param activeInterval
9
+ * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.
14
10
  * @internal
15
11
  */
16
12
  export declare class CzechSpiralEvaluator extends CubicEvaluator {
17
13
  nominalLength1: number;
18
14
  nominalRadius1: number;
19
- /** Constructor is private. Caller responsible for cubicM validity. */
15
+ /** Constructor is private. Caller responsible for cubicM validity. */
20
16
  private constructor();
21
17
  /**
22
18
  * Return the scale factor between simple x^3 / (6RL) cubic and the czech correction.
23
19
  * * For typical case with l1/R1 smallish, this is just less than 1.0:
24
20
  * (0.25==>0.99215), (0.15==>0.997184), (0.10==>0.998749), (0.05==>999687)
25
- * @param length1
26
- * @param radius1
27
21
  */
28
22
  static gammaConstant(length1: number, radius1: number): number | undefined;
29
23
  /** Compute the czech cubic constant. */
30
24
  static computeCubicM(length1: number, radius1: number): number | undefined;
31
25
  static create(length1: number, radius1: number): CzechSpiralEvaluator | undefined;
32
26
  scaleInPlace(scaleFactor: number): void;
33
- /** return a deep copy of the evaluator */
27
+ /** Return a deep copy of the evaluator. */
34
28
  clone(): CzechSpiralEvaluator;
35
- /** Member by member matchup ... */
29
+ /** Member by member matchup. */
36
30
  isAlmostEqual(other: any): boolean;
37
31
  /**
38
32
  * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.
39
33
  * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.
40
- * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate CurvePrimitive measurements.
34
+ * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate
35
+ * CurvePrimitive measurements.
41
36
  * @param x distance along the x axis.
42
37
  */
43
38
  xToCzechApproximateDistance(x: number): number;
44
39
  /**
45
40
  * Return the inverse of the `forwardL2R2Map` function.
46
41
  * * The undefined result can only occur for distances outside the usual spirals.
47
- * @param s (approximate) distance along the spiral.
48
- *
42
+ * @param d (approximate) distance along the spiral.
49
43
  */
50
44
  czechApproximateDistanceToX(d: number): number | undefined;
51
45
  /**
52
- * evaluate a series expansion that is used with varying signs (plus or minus 1) in czech and italian spirals.
53
- * @param x distance along the x axis.
54
- */
46
+ * Evaluate a series expansion that is used with varying signs (plus or minus 1) in czech and italian spirals.
47
+ * @param x distance along the x axis.
48
+ */
55
49
  static forwardL2R2Map(x: number, sign: number, length: number, radius: number): number;
56
50
  /**
57
51
  * Return the inverse of the `forwardL2R2Map` function.
58
52
  * * The undefined result can only occur for distances outside the usual spirals.
59
- * @param s (approximate) distance along the spiral.
60
- *
53
+ * @param d (approximate) distance along the spiral.
61
54
  */
62
- static inverseL2R2Map(b: number, sign: number, length: number, radius: number): number | undefined;
55
+ static inverseL2R2Map(d: number, sign: number, length: number, radius: number): number | undefined;
63
56
  }
64
57
  /**
65
58
  * Italian cubic.
66
- * This is y= m*x^3 with
67
- * * x any point on the x axis
68
- * * `fraction` along the spiral goes to `x = fraction * L`
69
- * * m is gamma / (6RL)
59
+ * This is y = m*x^3 with
60
+ * * x any point on the x axis.
61
+ * * `fraction` along the spiral goes to `x = fraction * L`.
62
+ * * m is gamma/(6RL).
70
63
  * * 1/(6RL) is the leading term of the sine series.
71
- * * `gamma = 2R/sqrt (4RR-LL)` pushes y down a little bit to simulate the lost series terms.
72
- * @param localToWorld
73
- * @param nominalL1
74
- * @param nominalR1
75
- * @param activeInterval
64
+ * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.
76
65
  * @internal
77
66
  */
78
67
  export declare class ItalianSpiralEvaluator extends CubicEvaluator {
79
68
  nominalLength1: number;
80
69
  nominalRadius1: number;
81
- /** Compute the czech cubic constant.
82
- * ** funky mixture of lengths ....
70
+ /**
71
+ * Compute the czech cubic constant.
72
+ * * Funky mixture of lengths.
83
73
  */
84
74
  private static computeCubicM;
85
- /** Constructor is private. Caller responsible for cubicM validity. */
75
+ /** Constructor is private. Caller responsible for cubicM validity. */
86
76
  private constructor();
87
77
  static create(length1: number, radius1: number): ItalianSpiralEvaluator | undefined;
88
78
  scaleInPlace(scaleFactor: number): void;
89
- /** return a deep copy of the evaluator */
79
+ /** Return a deep copy of the evaluator. */
90
80
  clone(): ItalianSpiralEvaluator;
91
- /** Member by member matchup ... */
81
+ /** Member by member matchup. */
92
82
  isAlmostEqual(other: any): boolean;
93
83
  /**
94
- * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.
95
- * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.
96
- * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate CurvePrimitive measurements.
97
- * @param x distance along the x axis.
98
- */
84
+ * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.
85
+ * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.
86
+ * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate
87
+ * CurvePrimitive measurements.
88
+ * @param x distance along the x axis.
89
+ */
99
90
  distanceToItalianApproximateX(x: number): number;
100
91
  /**
101
92
  * Return the inverse of the `forwardL2R2Map` function.
102
93
  * * The undefined result can only occur for distances outside the usual spirals.
103
- * @param s (approximate) distance along the spiral.
104
- *
94
+ * @param d (approximate) distance along the spiral.
105
95
  */
106
96
  xToItalianApproximateDistance(d: number): number | undefined;
107
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CzechSpiralEvaluator.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/CzechSpiralEvaluator.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;;;;;;;;;GAaG;AACH,qBAAa,oBAAqB,SAAQ,cAAc;IAC/C,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IAE9B,uEAAuE;IACvE,OAAO;IAKP;;;;;;OAMG;WACW,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAGjF,wCAAwC;WAC1B,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;WASnE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAOxE,YAAY,CAAC,WAAW,EAAE,MAAM;IAKhD,0CAA0C;IACnC,KAAK,IAAI,oBAAoB;IACpC,mCAAmC;IAC5B,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;IAQzC;;;;;OAKG;IACI,2BAA2B,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAGrD;;;;;OAKG;IACI,2BAA2B,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIjE;;;SAGK;WACS,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAO7F;;;;;OAKG;WACW,c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10,22 +10,18 @@ import { CubicEvaluator } from "./CubicEvaluator";
10
10
  import { SimpleNewton } from "../../numerics/Newton";
11
11
  /**
12
12
  * Czech cubic.
13
- * This is y= m*x^3 with
14
- * * x any point on the x axis
15
- * * `fraction` along the spiral goes to `x = fraction * L`
16
- * * m is gamma / (6RL)
13
+ * This is y = m*x^3 with
14
+ * * x any point on the x axis.
15
+ * * `fraction` along the spiral goes to `x = fraction * L`.
16
+ * * m is gamma/(6RL).
17
17
  * * 1/(6RL) is the leading term of the sine series.
18
- * * `gamma = 2R/sqrt (4RR-LL)` pushes y down a little bit to simulate the lost series terms.
19
- * @param localToWorld
20
- * @param nominalL1
21
- * @param nominalR1
22
- * @param activeInterval
18
+ * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.
23
19
  * @internal
24
20
  */
25
21
  export class CzechSpiralEvaluator extends CubicEvaluator {
26
22
  nominalLength1;
27
23
  nominalRadius1;
28
- /** Constructor is private. Caller responsible for cubicM validity. */
24
+ /** Constructor is private. Caller responsible for cubicM validity. */
29
25
  constructor(length1, radius1, cubicM) {
30
26
  super(length1, cubicM);
31
27
  this.nominalLength1 = length1;
@@ -35,8 +31,6 @@ export class CzechSpiralEvaluator extends CubicEvaluator {
35
31
  * Return the scale factor between simple x^3 / (6RL) cubic and the czech correction.
36
32
  * * For typical case with l1/R1 smallish, this is just less than 1.0:
37
33
  * (0.25==>0.99215), (0.15==>0.997184), (0.10==>0.998749), (0.05==>999687)
38
- * @param length1
39
- * @param radius1
40
34
  */
41
35
  static gammaConstant(length1, radius1) {
42
36
  return 2.0 * radius1 / Math.sqrt(4.0 * radius1 * radius1 - length1 * length1);
@@ -44,10 +38,10 @@ export class CzechSpiralEvaluator extends CubicEvaluator {
44
38
  /** Compute the czech cubic constant. */
45
39
  static computeCubicM(length1, radius1) {
46
40
  const gamma = CzechSpiralEvaluator.gammaConstant(length1, radius1);
47
- // In the private update method, the LR values should have been vetted.
41
+ // in the private update method, the LR values should have been vetted
48
42
  if (gamma === undefined)
49
43
  return undefined;
50
- // If radius is negative, it shows up in gamma. But the a signed denominator undoes it. So take abs of denominator.
44
+ // if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator
51
45
  return gamma / Math.abs((6.0 * radius1 * length1));
52
46
  }
53
47
  static create(length1, radius1) {
@@ -61,9 +55,11 @@ export class CzechSpiralEvaluator extends CubicEvaluator {
61
55
  this.nominalRadius1 *= scaleFactor;
62
56
  super.scaleInPlace(scaleFactor);
63
57
  }
64
- /** return a deep copy of the evaluator */
65
- clone() { return new CzechSpiralEvaluator(this.nominalLength1, this.nominalRadius1, this.cubicM); }
66
- /** Member by member matchup ... */
58
+ /** Return a deep copy of the evaluator. */
59
+ clone() {
60
+ return new CzechSpiralEvaluator(this.nominalLength1, this.nominalRadius1, this.cubicM);
61
+ }
62
+ /** Member by member matchup. */
67
63
  isAlmostEqual(other) {
68
64
  if (other instanceof CzechSpiralEvaluator) {
69
65
  return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)
@@ -74,7 +70,8 @@ export class CzechSpiralEvaluator extends CubicEvaluator {
74
70
  /**
75
71
  * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.
76
72
  * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.
77
- * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate CurvePrimitive measurements.
73
+ * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate
74
+ * CurvePrimitive measurements.
78
75
  * @param x distance along the x axis.
79
76
  */
80
77
  xToCzechApproximateDistance(x) {
@@ -83,16 +80,15 @@ export class CzechSpiralEvaluator extends CubicEvaluator {
83
80
  /**
84
81
  * Return the inverse of the `forwardL2R2Map` function.
85
82
  * * The undefined result can only occur for distances outside the usual spirals.
86
- * @param s (approximate) distance along the spiral.
87
- *
83
+ * @param d (approximate) distance along the spiral.
88
84
  */
89
85
  czechApproximateDistanceToX(d) {
90
86
  return CzechSpiralEvaluator.inverseL2R2Map(d, 1.0, this.nominalLength1, this.nominalRadius1);
91
87
  }
92
88
  /**
93
- * evaluate a series expansion that is used with varying signs (plus or minus 1) in czech and italian spirals.
94
- * @param x distance along the x axis.
95
- */
89
+ * Evaluate a series expansion that is used with varying signs (plus or minus 1) in czech and italian spirals.
90
+ * @param x distance along the x axis.
91
+ */
96
92
  static forwardL2R2Map(x, sign, length, radius) {
97
93
  const l2 = length * length;
98
94
  const r2 = radius * radius;
@@ -103,17 +99,16 @@ export class CzechSpiralEvaluator extends CubicEvaluator {
103
99
  /**
104
100
  * Return the inverse of the `forwardL2R2Map` function.
105
101
  * * The undefined result can only occur for distances outside the usual spirals.
106
- * @param s (approximate) distance along the spiral.
107
- *
102
+ * @param d (approximate) distance along the spiral.
108
103
  */
109
- static inverseL2R2Map(b, sign, length, radius) {
104
+ static inverseL2R2Map(d, sign, length, radius) {
110
105
  const l2 = length * length;
111
106
  const r2 = radius * radius;
112
107
  const Q = 4.0 * r2 - l2;
113
108
  const a = sign / (10.0 * Q * l2);
114
- return SimpleNewton.runNewton1D(b, (x) => {
109
+ return SimpleNewton.runNewton1D(d, (x) => {
115
110
  const xx = x * x;
116
- return x * (1.0 + xx * xx * a) - b;
111
+ return x * (1.0 + xx * xx * a) - d;
117
112
  }, (x) => {
118
113
  const xx = x * x;
119
114
  return 1.0 + 5 * xx * xx * a;
@@ -122,40 +117,37 @@ export class CzechSpiralEvaluator extends CubicEvaluator {
122
117
  }
123
118
  /**
124
119
  * Italian cubic.
125
- * This is y= m*x^3 with
126
- * * x any point on the x axis
127
- * * `fraction` along the spiral goes to `x = fraction * L`
128
- * * m is gamma / (6RL)
120
+ * This is y = m*x^3 with
121
+ * * x any point on the x axis.
122
+ * * `fraction` along the spiral goes to `x = fraction * L`.
123
+ * * m is gamma/(6RL).
129
124
  * * 1/(6RL) is the leading term of the sine series.
130
- * * `gamma = 2R/sqrt (4RR-LL)` pushes y down a little bit to simulate the lost series terms.
131
- * @param localToWorld
132
- * @param nominalL1
133
- * @param nominalR1
134
- * @param activeInterval
125
+ * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.
135
126
  * @internal
136
127
  */
137
128
  export class ItalianSpiralEvaluator extends CubicEvaluator {
138
129
  nominalLength1;
139
130
  nominalRadius1;
140
- /** Compute the czech cubic constant.
141
- * ** funky mixture of lengths ....
131
+ /**
132
+ * Compute the czech cubic constant.
133
+ * * Funky mixture of lengths.
142
134
  */
143
135
  static computeCubicM(lengthXByForward, radius1) {
144
136
  const gamma = CzechSpiralEvaluator.gammaConstant(lengthXByForward, radius1);
145
- // In the private update method, the LR values should have been vetted.
137
+ // in the private update method, the LR values should have been vetted
146
138
  if (gamma === undefined)
147
139
  return undefined;
148
- // If radius is negative, it shows up in gamma. But the a signed denominator undoes it. So take abs of denominator.
140
+ // if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator
149
141
  return gamma / Math.abs((6.0 * radius1 * lengthXByForward));
150
142
  }
151
- /** Constructor is private. Caller responsible for cubicM validity. */
143
+ /** Constructor is private. Caller responsible for cubicM validity. */
152
144
  constructor(length1, radius1, lengthX, cubicM) {
153
145
  super(lengthX, cubicM);
154
146
  this.nominalLength1 = length1;
155
147
  this.nominalRadius1 = radius1;
156
148
  }
157
149
  static create(length1, radius1) {
158
- // um ... this seems goofy. lengthX from forward, then invert for another . But that's what the native code does ...
150
+ // this seems goofy.; lengthX from forward, then invert for another but that's what the native code does too
159
151
  const lengthX = CzechSpiralEvaluator.forwardL2R2Map(length1, -1.0, length1, radius1);
160
152
  const lengthX1 = CzechSpiralEvaluator.inverseL2R2Map(length1, 1.0, lengthX, radius1);
161
153
  if (lengthX1 === undefined)
@@ -170,9 +162,11 @@ export class ItalianSpiralEvaluator extends CubicEvaluator {
170
162
  this.nominalRadius1 *= scaleFactor;
171
163
  super.scaleInPlace(scaleFactor);
172
164
  }
173
- /** return a deep copy of the evaluator */
174
- clone() { return new ItalianSpiralEvaluator(this.nominalLength1, this.nominalRadius1, super.axisLength, this.cubicM); }
175
- /** Member by member matchup ... */
165
+ /** Return a deep copy of the evaluator. */
166
+ clone() {
167
+ return new ItalianSpiralEvaluator(this.nominalLength1, this.nominalRadius1, super.axisLength, this.cubicM);
168
+ }
169
+ /** Member by member matchup. */
176
170
  isAlmostEqual(other) {
177
171
  if (other instanceof ItalianSpiralEvaluator) {
178
172
  return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)
@@ -181,19 +175,19 @@ export class ItalianSpiralEvaluator extends CubicEvaluator {
181
175
  return false;
182
176
  }
183
177
  /**
184
- * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.
185
- * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.
186
- * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate CurvePrimitive measurements.
187
- * @param x distance along the x axis.
188
- */
178
+ * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.
179
+ * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.
180
+ * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate
181
+ * CurvePrimitive measurements.
182
+ * @param x distance along the x axis.
183
+ */
189
184
  distanceToItalianApproximateX(x) {
190
185
  return CzechSpiralEvaluator.forwardL2R2Map(x, -1.0, this.nominalLength1, this.nominalRadius1);
191
186
  }
192
187
  /**
193
188
  * Return the inverse of the `forwardL2R2Map` function.
194
189
  * * The undefined result can only occur for distances outside the usual spirals.
195
- * @param s (approximate) distance along the spiral.
196
- *
190
+ * @param d (approximate) distance along the spiral.
197
191
  */
198
192
  xToItalianApproximateDistance(d) {
199
193
  return CzechSpiralEvaluator.inverseL2R2Map(d, -1.0, this.nominalLength1, this.nominalRadius1);
@@ -1 +1 @@
1
- {"version":3,"file":"CzechSpiralEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/CzechSpiralEvaluator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,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,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACtJ,mCAAmC;IAC5B,aAAa,CAAC,KAAU;QAC7B,IAAI,KAAK,YAAY,sBAAsB,EAAE,CAAC;YAC5C,OAAO,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC;mBACtE,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD;;;;;SAKK;IACE,6BAA6B,CAAC,CAAS;QAC5C,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAChG,CAAC;IACD;;;;;OAKG;IACI,6BAA6B,CAAC,CAAS;QAC5C,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAChG,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 { CubicEvaluator } from \"./CubicEvaluator\";\nimport { SimpleNewton } from \"../../numerics/Newton\";\n/**\n * Czech cubic.\n * This is y= m*x^3 with\n * * x any point on the x axis\n * * `fraction` along the spiral goes to `x = fraction * L`\n * * m is gamma / (6RL)\n * * 1/(6RL) is the leading term of the sine series.\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y down a little bit to simulate the lost series terms.\n * @param localToWorld\n * @param nominalL1\n * @param nominalR1\n * @param activeInterval\n * @internal\n */\nexport class CzechSpiralEvaluator extends CubicEvaluator {\n public nominalLength1: number;\n public nominalRadius1: number;\n\n /** Constructor is private. Caller responsible for cubicM validity. */\n private constructor(length1: number, radius1: number, cubicM: number) {\n super(length1, cubicM);\n this.nominalLength1 = length1;\n this.nominalRadius1 = radius1;\n }\n /**\n * Return the scale factor between simple x^3 / (6RL) cubic and the czech correction.\n * * For typical case with l1/R1 smallish, this is just less than 1.0:\n * (0.25==>0.99215), (0.15==>0.997184), (0.10==>0.998749), (0.05==>999687)\n * @param length1\n * @param radius1\n */\n public static gammaConstant(length1: number, radius1: number): number | undefined {\n return 2.0 * radius1 / Math.sqrt(4.0 * radius1 * radius1 - length1 * length1);\n }\n /** Compute the czech cubic constant. */\n public static computeCubicM(length1: number, radius1: number): number | undefined {\n const gamma = CzechSpiralEvaluator.gammaConstant(length1, radius1);\n // In the private update method, the LR values should have been vetted.\n if (gamma === undefined)\n return undefined;\n // If radius is negative, it shows up in gamma. But the a signed denominator undoes it. So take abs of denominator.\n return gamma / Math.abs((6.0 * radius1 * length1));\n }\n\n public static create(length1: number, radius1: number): CzechSpiralEvaluator | undefined {\n const m = this.computeCubicM(length1, radius1);\n if (m === undefined)\n return undefined;\n return new CzechSpiralEvaluator(length1, radius1, m);\n }\n\n public override scaleInPlace(scaleFactor: number) {\n this.nominalLength1 *= scaleFactor;\n this.nominalRadius1 *= scaleFactor;\n super.scaleInPlace(scaleFactor);\n }\n /** return a deep copy of the evaluator */\n public clone(): CzechSpiralEvaluator { return new CzechSpiralEvaluator(this.nominalLength1, this.nominalRadius1, this.cubicM); }\n /** Member by member matchup ... */\n public isAlmostEqual(other: any): boolean {\n if (other instanceof CzechSpiralEvaluator) {\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\n }\n return false;\n }\n\n /**\n * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.\n * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\n * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate CurvePrimitive measurements.\n * @param x distance along the x axis.\n */\n public xToCzechApproximateDistance(x: number): number {\n return CzechSpiralEvaluator.forwardL2R2Map(x, 1.0, this.nominalLength1, this.nominalRadius1);\n }\n /**\n * Return the inverse of the `forwardL2R2Map` function.\n * * The undefined result can only occur for distances outside the usual spirals.\n * @param s (approximate) distance along the spiral.\n *\n */\n public czechApproximateDistanceToX(d: number): number | undefined {\n return CzechSpiralEvaluator.inverseL2R2Map(d, 1.0, this.nominalLength1, this.nominalRadius1);\n }\n\n /**\n * evaluate a series expansion that is used with varying signs (plus or minus 1) in czech and italian spirals.\n * @param x distance along the x axis.\n */\n public static forwardL2R2Map(x: number, sign: number, length: number, radius: number): number {\n const l2 = length * length;\n const r2 = radius * radius;\n const Q = 4.0 * r2 - l2;\n const xx = x * x;\n return x * (1.0 + sign * xx * xx / (10.0 * Q * l2));\n }\n /**\n * Return the inverse of the `forwardL2R2Map` function.\n * * The undefined result can only occur for distances outside the usual spirals.\n * @param s (approximate) distance along the spiral.\n *\n */\n public static inverseL2R2Map(b: number, sign: number, length: number, radius: number): number | undefined {\n const l2 = length * length;\n const r2 = radius * radius;\n const Q = 4.0 * r2 - l2;\n const a = sign / (10.0 * Q * l2);\n return SimpleNewton.runNewton1D(b,\n (x: number) => {\n const xx = x * x;\n return x * (1.0 + xx * xx * a) - b;\n },\n (x: number) => {\n const xx = x * x;\n return 1.0 + 5 * xx * xx * a;\n });\n }\n}\n/**\n * Italian cubic.\n * This is y= m*x^3 with\n * * x any point on the x axis\n * * `fraction` along the spiral goes to `x = fraction * L`\n * * m is gamma / (6RL)\n * * 1/(6RL) is the leading term of the sine series.\n * * `gamma = 2R/sqrt (4RR-LL)` pushes y down a little bit to simulate the lost series terms.\n * @param localToWorld\n * @param nominalL1\n * @param nominalR1\n * @param activeInterval\n * @internal\n */\nexport class ItalianSpiralEvaluator extends CubicEvaluator {\n public nominalLength1: number;\n public nominalRadius1: number;\n\n /** Compute the czech cubic constant.\n * ** funky mixture of lengths ....\n */\n private static computeCubicM(lengthXByForward: number, radius1: number): number | undefined {\n const gamma = CzechSpiralEvaluator.gammaConstant(lengthXByForward, radius1);\n // In the private update method, the LR values should have been vetted.\n if (gamma === undefined)\n return undefined;\n // If radius is negative, it shows up in gamma. But the a signed denominator undoes it. So take abs of denominator.\n return gamma / Math.abs((6.0 * radius1 * lengthXByForward));\n }\n\n /** Constructor is private. Caller responsible for cubicM validity. */\n private constructor(length1: number, radius1: number, lengthX: number, cubicM: number) {\n super(lengthX, cubicM);\n this.nominalLength1 = length1;\n this.nominalRadius1 = radius1;\n }\n public static create(length1: number, radius1: number): ItalianSpiralEvaluator | undefined {\n // um ... this seems goofy. lengthX from forward, then invert for another . But that's what the native code does ...\n const lengthX = CzechSpiralEvaluator.forwardL2R2Map(length1, -1.0, length1, radius1);\n const lengthX1 = CzechSpiralEvaluator.inverseL2R2Map(length1, 1.0, lengthX, radius1);\n if (lengthX1 === undefined)\n return undefined;\n const m = ItalianSpiralEvaluator.computeCubicM(lengthX, radius1);\n if (m === undefined)\n return undefined;\n return new ItalianSpiralEvaluator(length1, radius1, lengthX1, m);\n }\n\n public override scaleInPlace(scaleFactor: number) {\n this.nominalLength1 *= scaleFactor;\n this.nominalRadius1 *= scaleFactor;\n super.scaleInPlace(scaleFactor);\n }\n /** return a deep copy of the evaluator */\n public clone(): ItalianSpiralEvaluator { return new ItalianSpiralEvaluator(this.nominalLength1, this.nominalRadius1, super.axisLength, this.cubicM); }\n /** Member by member matchup ... */\n public isAlmostEqual(other: any): boolean {\n if (other instanceof ItalianSpiralEvaluator) {\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\n }\n return false;\n }\n /**\n * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.\n * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\n * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate CurvePrimitive measurements.\n * @param x distance along the x axis.\n */\n public distanceToItalianApproximateX(x: number): number {\n return CzechSpiralEvaluator.forwardL2R2Map(x, -1.0, this.nominalLength1, this.nominalRadius1);\n }\n /**\n * Return the inverse of the `forwardL2R2Map` function.\n * * The undefined result can only occur for distances outside the usual spirals.\n * @param s (approximate) distance along the spiral.\n *\n */\n public xToItalianApproximateDistance(d: number): number | undefined {\n return CzechSpiralEvaluator.inverseL2R2Map(d, -1.0, this.nominalLength1, this.nominalRadius1);\n }\n}\n"]}
1
+ {"version":3,"file":"CzechSpiralEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/CzechSpiralEvaluator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;;;;;;;GASG;AACH,MAAM,OAAO,oBAAqB,SAAQ,cAAc;IAC/C,cAAc,CAAS;IACvB,cAAc,CAAS;IAC9B,sEAAsE;IACtE,YAAoB,OAAe,EAAE,OAAe,EAAE,MAAc;QAClE,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;IAChC,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,aAAa,CAAC,OAAe,EAAE,OAAe;QAC1D,OAAO,GAAG,GAAG,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC;IAChF,CAAC;IACD,wCAAwC;IACjC,MAAM,CAAC,aAAa,CAAC,OAAe,EAAE,OAAe;QAC1D,MAAM,KAAK,GAAG,oB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------------------------------------------\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 { CubicEvaluator } from \"./CubicEvaluator\";\nimport { SimpleNewton } from \"../../numerics/Newton\";\n\n/**\n * Czech cubic.\n * This is y = m*x^3 with\n * * x any point on the x axis.\n * * `fraction` along the spiral goes to `x = fraction * L`.\n * * m is gamma/(6RL).\n * * 1/(6RL) is the leading term of the sine series.\n * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.\n * @internal\n */\nexport class CzechSpiralEvaluator extends CubicEvaluator {\n public nominalLength1: number;\n public nominalRadius1: number;\n /** Constructor is private. Caller responsible for cubicM validity. */\n private constructor(length1: number, radius1: number, cubicM: number) {\n super(length1, cubicM);\n this.nominalLength1 = length1;\n this.nominalRadius1 = radius1;\n }\n /**\n * Return the scale factor between simple x^3 / (6RL) cubic and the czech correction.\n * * For typical case with l1/R1 smallish, this is just less than 1.0:\n * (0.25==>0.99215), (0.15==>0.997184), (0.10==>0.998749), (0.05==>999687)\n */\n public static gammaConstant(length1: number, radius1: number): number | undefined {\n return 2.0 * radius1 / Math.sqrt(4.0 * radius1 * radius1 - length1 * length1);\n }\n /** Compute the czech cubic constant. */\n public static computeCubicM(length1: number, radius1: number): number | undefined {\n const gamma = CzechSpiralEvaluator.gammaConstant(length1, radius1);\n // in the private update method, the LR values should have been vetted\n if (gamma === undefined)\n return undefined;\n // if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator\n return gamma / Math.abs((6.0 * radius1 * length1));\n }\n public static create(length1: number, radius1: number): CzechSpiralEvaluator | undefined {\n const m = this.computeCubicM(length1, radius1);\n if (m === undefined)\n return undefined;\n return new CzechSpiralEvaluator(length1, radius1, m);\n }\n public override scaleInPlace(scaleFactor: number) {\n this.nominalLength1 *= scaleFactor;\n this.nominalRadius1 *= scaleFactor;\n super.scaleInPlace(scaleFactor);\n }\n /** Return a deep copy of the evaluator. */\n public clone(): CzechSpiralEvaluator {\n return new CzechSpiralEvaluator(this.nominalLength1, this.nominalRadius1, this.cubicM);\n }\n /** Member by member matchup. */\n public isAlmostEqual(other: any): boolean {\n if (other instanceof CzechSpiralEvaluator) {\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\n }\n return false;\n }\n /**\n * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.\n * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\n * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate\n * CurvePrimitive measurements.\n * @param x distance along the x axis.\n */\n public xToCzechApproximateDistance(x: number): number {\n return CzechSpiralEvaluator.forwardL2R2Map(x, 1.0, this.nominalLength1, this.nominalRadius1);\n }\n /**\n * Return the inverse of the `forwardL2R2Map` function.\n * * The undefined result can only occur for distances outside the usual spirals.\n * @param d (approximate) distance along the spiral.\n */\n public czechApproximateDistanceToX(d: number): number | undefined {\n return CzechSpiralEvaluator.inverseL2R2Map(d, 1.0, this.nominalLength1, this.nominalRadius1);\n }\n /**\n * Evaluate a series expansion that is used with varying signs (plus or minus 1) in czech and italian spirals.\n * @param x distance along the x axis.\n */\n public static forwardL2R2Map(x: number, sign: number, length: number, radius: number): number {\n const l2 = length * length;\n const r2 = radius * radius;\n const Q = 4.0 * r2 - l2;\n const xx = x * x;\n return x * (1.0 + sign * xx * xx / (10.0 * Q * l2));\n }\n /**\n * Return the inverse of the `forwardL2R2Map` function.\n * * The undefined result can only occur for distances outside the usual spirals.\n * @param d (approximate) distance along the spiral.\n */\n public static inverseL2R2Map(d: number, sign: number, length: number, radius: number): number | undefined {\n const l2 = length * length;\n const r2 = radius * radius;\n const Q = 4.0 * r2 - l2;\n const a = sign / (10.0 * Q * l2);\n return SimpleNewton.runNewton1D(\n d,\n (x: number) => {\n const xx = x * x;\n return x * (1.0 + xx * xx * a) - d;\n },\n (x: number) => {\n const xx = x * x;\n return 1.0 + 5 * xx * xx * a;\n },\n );\n }\n}\n\n/**\n * Italian cubic.\n * This is y = m*x^3 with\n * * x any point on the x axis.\n * * `fraction` along the spiral goes to `x = fraction * L`.\n * * m is gamma/(6RL).\n * * 1/(6RL) is the leading term of the sine series.\n * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.\n * @internal\n */\nexport class ItalianSpiralEvaluator extends CubicEvaluator {\n public nominalLength1: number;\n public nominalRadius1: number;\n\n /**\n * Compute the czech cubic constant.\n * * Funky mixture of lengths.\n */\n private static computeCubicM(lengthXByForward: number, radius1: number): number | undefined {\n const gamma = CzechSpiralEvaluator.gammaConstant(lengthXByForward, radius1);\n // in the private update method, the LR values should have been vetted\n if (gamma === undefined)\n return undefined;\n // if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator\n return gamma / Math.abs((6.0 * radius1 * lengthXByForward));\n }\n /** Constructor is private. Caller responsible for cubicM validity. */\n private constructor(length1: number, radius1: number, lengthX: number, cubicM: number) {\n super(lengthX, cubicM);\n this.nominalLength1 = length1;\n this.nominalRadius1 = radius1;\n }\n public static create(length1: number, radius1: number): ItalianSpiralEvaluator | undefined {\n // this seems goofy.; lengthX from forward, then invert for another but that's what the native code does too\n const lengthX = CzechSpiralEvaluator.forwardL2R2Map(length1, -1.0, length1, radius1);\n const lengthX1 = CzechSpiralEvaluator.inverseL2R2Map(length1, 1.0, lengthX, radius1);\n if (lengthX1 === undefined)\n return undefined;\n const m = ItalianSpiralEvaluator.computeCubicM(lengthX, radius1);\n if (m === undefined)\n return undefined;\n return new ItalianSpiralEvaluator(length1, radius1, lengthX1, m);\n }\n public override scaleInPlace(scaleFactor: number) {\n this.nominalLength1 *= scaleFactor;\n this.nominalRadius1 *= scaleFactor;\n super.scaleInPlace(scaleFactor);\n }\n /** Return a deep copy of the evaluator. */\n public clone(): ItalianSpiralEvaluator {\n return new ItalianSpiralEvaluator(this.nominalLength1, this.nominalRadius1, super.axisLength, this.cubicM);\n }\n /** Member by member matchup. */\n public isAlmostEqual(other: any): boolean {\n if (other instanceof ItalianSpiralEvaluator) {\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\n }\n return false;\n }\n /**\n * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.\n * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\n * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate\n * CurvePrimitive measurements.\n * @param x distance along the x axis.\n */\n public distanceToItalianApproximateX(x: number): number {\n return CzechSpiralEvaluator.forwardL2R2Map(x, -1.0, this.nominalLength1, this.nominalRadius1);\n }\n /**\n * Return the inverse of the `forwardL2R2Map` function.\n * * The undefined result can only occur for distances outside the usual spirals.\n * @param d (approximate) distance along the spiral.\n */\n public xToItalianApproximateDistance(d: number): number | undefined {\n return CzechSpiralEvaluator.inverseL2R2Map(d, -1.0, this.nominalLength1, this.nominalRadius1);\n }\n}\n"]}
@@ -11,9 +11,9 @@ export declare class DirectHalfCosineSpiralEvaluator extends XYCurveEvaluator {
11
11
  constructor(length1: number, radius1: number);
12
12
  private updateConstants;
13
13
  scaleInPlace(scaleFactor: number): void;
14
- /** return a deep copy of the evaluator */
14
+ /** Return a deep copy of the evaluator. */
15
15
  clone(): DirectHalfCosineSpiralEvaluator;
16
- /** Member by member matchup ... */
16
+ /** Member by member matchup. */
17
17
  isAlmostEqual(other: any): boolean;
18
18
  /** Evaluate X at fractional position. */
19
19
  fractionToX(fraction: number): number;
@@ -1 +1 @@
1
- {"version":3,"file":"DirectHalfCosineSpiralEvaluator.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/DirectHalfCosineSpiralEvaluator.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CA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stants();
37
37
  }
38
- /** return a deep copy of the evaluator */
39
- clone() { return new DirectHalfCosineSpiralEvaluator(this.nominalLength1, this.nominalRadius1); }
40
- /** Member by member matchup ... */
38
+ /** Return a deep copy of the evaluator. */
39
+ clone() {
40
+ return new DirectHalfCosineSpiralEvaluator(this.nominalLength1, this.nominalRadius1);
41
+ }
42
+ /** Member by member matchup. */
41
43
  isAlmostEqual(other) {
42
44
  if (other instanceof DirectHalfCosineSpiralEvaluator) {
43
45
  return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)
@@ -47,14 +49,18 @@ export class DirectHalfCosineSpiralEvaluator extends XYCurveEvaluator {
47
49
  return false;
48
50
  }
49
51
  /** Evaluate X at fractional position. */
50
- fractionToX(fraction) { return fraction * this.nominalLength1; }
52
+ fractionToX(fraction) {
53
+ return fraction * this.nominalLength1;
54
+ }
51
55
  /** Evaluate Y at fractional position. */
52
56
  fractionToY(fraction) {
53
57
  const theta = fraction * Math.PI;
54
58
  return this._c * (this._c2 * fraction * fraction - this._c1 * (1.0 - Math.cos(theta)));
55
59
  }
56
60
  /** Evaluate derivative of X with respect to fraction at fractional position. */
57
- fractionToDX(_fraction) { return this.nominalLength1; }
61
+ fractionToDX(_fraction) {
62
+ return this.nominalLength1;
63
+ }
58
64
  /** Evaluate derivative of Y with respect to fraction at fractional position. */
59
65
  fractionToDY(fraction) {
60
66
  const pi = Math.PI;
@@ -62,7 +68,9 @@ export class DirectHalfCosineSpiralEvaluator extends XYCurveEvaluator {
62
68
  return this._c * (2.0 * this._c2 * fraction - this._c1 * pi * Math.sin(theta));
63
69
  }
64
70
  /** Evaluate second derivative of X with respect to fraction at fractional position. */
65
- fractionToDDX(_fraction) { return 0.0; }
71
+ fractionToDDX(_fraction) {
72
+ return 0.0;
73
+ }
66
74
  /** Evaluate third derivative of Y with respect to fraction at fractional position. */
67
75
  fractionToDDY(fraction) {
68
76
  const pi = Math.PI;
@@ -70,7 +78,9 @@ export class DirectHalfCosineSpiralEvaluator extends XYCurveEvaluator {
70
78
  return this._c * (2.0 * this._c2 - this._c1 * pi * pi * Math.cos(theta));
71
79
  }
72
80
  /** Evaluate second derivative of X with respect to fraction at fractional position. */
73
- fractionToD3X(_fraction) { return 0.0; }
81
+ fractionToD3X(_fraction) {
82
+ return 0.0;
83
+ }
74
84
  /** Evaluate third derivative of Y with respect to fraction at fractional position. */
75
85
  fractionToD3Y(fraction) {
76
86
  const pi = Math.PI;
@@ -1 +1 @@
1
- {"version":3,"file":"DirectHalfCosineSpiralEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/DirectHalfCosineSpiralEvaluator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,gBAAgB;IAC5D,cAAc,CAAS;IACvB,cAAc,CAAS;IACtB,EAAE,CAAS;IACX,GAAG,CAAS;IACZ,GAAG,CAAS;IACpB,YAAmB,OAAe,EAAE,OAAe;QACjD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,sBAAsB;QACrC,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAEO,eAAe;QACrB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,cAAc,GAAG,IAAI,CA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AAS;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;IAEnB,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 { XYCurveEvaluator } from \"./XYCurveEvaluator\";\nimport { SimpleNewton } from \"../../numerics/Newton\";\n/**\n * @internal\n */\nexport class DirectHalfCosineSpiralEvaluator extends XYCurveEvaluator {\n public nominalLength1: number;\n public nominalRadius1: number;\n private _c: number;\n private _c1: number;\n private _c2: number;\n public constructor(length1: number, radius1: number) {\n super();\n this.nominalLength1 = length1;\n this.nominalRadius1 = radius1;\n const pi = Math.PI;\n this._c1 = 1.0 / (2.0 * pi * pi);\n this._c2 = 0.25;\n this._c = 0.0; // TO BE UPDATED BELOW\n this.updateConstants();\n }\n\n private updateConstants() {\n this._c = this.nominalLength1 * this.nominalLength1 / this.nominalRadius1;\n }\n public scaleInPlace(scaleFactor: number) {\n this.nominalLength1 *= scaleFactor;\n this.nominalRadius1 *= scaleFactor;\n this.updateConstants();\n }\n /** return a deep copy of the evaluator */\n public clone(): DirectHalfCosineSpiralEvaluator { return new DirectHalfCosineSpiralEvaluator(this.nominalLength1, this.nominalRadius1); }\n /** Member by member matchup ... */\n public isAlmostEqual(other: any): boolean {\n if (other instanceof DirectHalfCosineSpiralEvaluator) {\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\n // remark: c,c1,c2 are computed, need not be tested.\n }\n return false;\n }\n /** Evaluate X at fractional position. */\n public fractionToX(fraction: number): number { return fraction * this.nominalLength1; }\n /** Evaluate Y at fractional position. */\n public fractionToY(fraction: number): number {\n const theta = fraction * Math.PI;\n return this._c * (this._c2 * fraction * fraction - this._c1 * (1.0 - Math.cos(theta)));\n }\n /** Evaluate derivative of X with respect to fraction at fractional position. */\n public fractionToDX(_fraction: number): number { return this.nominalLength1; }\n\n /** Evaluate derivative of Y with respect to fraction at fractional position. */\n\n public fractionToDY(fraction: number): number {\n const pi = Math.PI;\n const theta = fraction * pi;\n return this._c * (2.0 * this._c2 * fraction - this._c1 * pi * Math.sin(theta));\n }\n /** Evaluate second derivative of X with respect to fraction at fractional position. */\n public fractionToDDX(_fraction: number): number { return 0.0; }\n\n /** Evaluate third derivative of Y with respect to fraction at fractional position. */\n\n public fractionToDDY(fraction: number): number {\n const pi = Math.PI;\n const theta = fraction * pi;\n return this._c * (2.0 * this._c2 - this._c1 * pi * pi * Math.cos(theta));\n }\n /** Evaluate second derivative of X with respect to fraction at fractional position. */\n public fractionToD3X(_fraction: number): number { return 0.0; }\n\n /** Evaluate third derivative of Y with respect to fraction at fractional position. */\n\n public fractionToD3Y(fraction: number): number {\n const pi = Math.PI;\n const theta = fraction * pi;\n return this._c * this._c1 * pi * pi * pi * Math.sin(theta);\n }\n\n /** Return the magnitude of the first vector at fractional coordinate. */\n\n public override fractionToTangentMagnitude(fraction: number): number {\n return Geometry.hypotenuseXY(this.fractionToDX(fraction), this.fractionToDY(fraction));\n\n }\n /** Invert the fractionToX function for given X. */\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}\n"]}
1
+ {"version":3,"file":"DirectHalfCosineSpiralEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/DirectHalfCosineSpiralEvaluator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,gBAAgB;IAC5D,cAAc,CAAS;IACvB,cAAc,CAAS;IACtB,EAAE,CAAS;IACX,GAAG,CAAS;IACZ,GAAG,CAAS;IACpB,YAAmB,OAAe,EAAE,OAAe;QACjD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,sBAAsB;QACrC,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IACO,eAAe;QACrB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAC5E,CAAC;IACM,YAAY,CAAC,WAAmB;QACrC,IAAI,CAAC,cAAc,IAAI,WAAW,CAAC;QACnC,IAAI,CAAC,cAAc,IAAI,WAAW,CAAC;QACnC,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IACD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AS,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CACpC,CAAC;QACF,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 */\nimport { Geometry } from \"../../Geometry\";\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\nimport { SimpleNewton } from \"../../numerics/Newton\";\n\n/**\n * @internal\n */\nexport class DirectHalfCosineSpiralEvaluator extends XYCurveEvaluator {\n public nominalLength1: number;\n public nominalRadius1: number;\n private _c: number;\n private _c1: number;\n private _c2: number;\n public constructor(length1: number, radius1: number) {\n super();\n this.nominalLength1 = length1;\n this.nominalRadius1 = radius1;\n const pi = Math.PI;\n this._c1 = 1.0 / (2.0 * pi * pi);\n this._c2 = 0.25;\n this._c = 0.0; // TO BE UPDATED BELOW\n this.updateConstants();\n }\n private updateConstants() {\n this._c = this.nominalLength1 * this.nominalLength1 / this.nominalRadius1;\n }\n public scaleInPlace(scaleFactor: number) {\n this.nominalLength1 *= scaleFactor;\n this.nominalRadius1 *= scaleFactor;\n this.updateConstants();\n }\n /** Return a deep copy of the evaluator. */\n public clone(): DirectHalfCosineSpiralEvaluator {\n return new DirectHalfCosineSpiralEvaluator(this.nominalLength1, this.nominalRadius1);\n }\n /** Member by member matchup. */\n public isAlmostEqual(other: any): boolean {\n if (other instanceof DirectHalfCosineSpiralEvaluator) {\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\n // remark: c,c1,c2 are computed, need not be tested.\n }\n return false;\n }\n /** Evaluate X at fractional position. */\n public fractionToX(fraction: number): number {\n return fraction * this.nominalLength1;\n }\n /** Evaluate Y at fractional position. */\n public fractionToY(fraction: number): number {\n const theta = fraction * Math.PI;\n return this._c * (this._c2 * fraction * fraction - this._c1 * (1.0 - Math.cos(theta)));\n }\n /** Evaluate derivative of X with respect to fraction at fractional position. */\n public fractionToDX(_fraction: number): number {\n return this.nominalLength1;\n }\n /** Evaluate derivative of Y with respect to fraction at fractional position. */\n public fractionToDY(fraction: number): number {\n const pi = Math.PI;\n const theta = fraction * pi;\n return this._c * (2.0 * this._c2 * fraction - this._c1 * pi * Math.sin(theta));\n }\n /** Evaluate second derivative of X with respect to fraction at fractional position. */\n public fractionToDDX(_fraction: number): number {\n return 0.0;\n }\n /** Evaluate third derivative of Y with respect to fraction at fractional position. */\n public fractionToDDY(fraction: number): number {\n const pi = Math.PI;\n const theta = fraction * pi;\n return this._c * (2.0 * this._c2 - this._c1 * pi * pi * Math.cos(theta));\n }\n /** Evaluate second derivative of X with respect to fraction at fractional position. */\n public fractionToD3X(_fraction: number): number {\n return 0.0;\n }\n /** Evaluate third derivative of Y with respect to fraction at fractional position. */\n public fractionToD3Y(fraction: number): number {\n const pi = Math.PI;\n const theta = fraction * pi;\n return this._c * this._c1 * pi * pi * pi * Math.sin(theta);\n }\n /** Return the magnitude of the first vector at fractional coordinate. */\n public override fractionToTangentMagnitude(fraction: number): number {\n return Geometry.hypotenuseXY(this.fractionToDX(fraction), this.fractionToDY(fraction));\n }\n /** Invert the fractionToX function for given X. */\n public xToFraction(x: number): number | undefined {\n const fraction0 = x / this.nominalLength1;\n const fraction1 = SimpleNewton.runNewton1D(\n fraction0,\n (f: number) => (this.fractionToX(f) - x),\n (f: number) => this.fractionToDX(f),\n );\n if (fraction1 === undefined)\n return undefined;\n return fraction1;\n }\n}\n"]}