@itwin/core-geometry 5.3.0-dev.9 → 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
@@ -18,10 +18,10 @@ import { MXCubicAlongArcEvaluator } from "./MXCubicAlongArcSpiralEvaluator";
18
18
  import { PolishCubicEvaluator } from "./PolishCubicSpiralEvaluator";
19
19
  import { TransitionSpiral3d } from "./TransitionSpiral3d";
20
20
  /**
21
- * DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have "direct" xy calculations without the integrations required
22
- * for IntegratedSpiral3d.
21
+ * DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have
22
+ * "direct" xy calculations without the integrations required for IntegratedSpiral3d.
23
23
  * * Each DirectSpiral3d carries an XYCurveEvaluator to give it specialized behavior.
24
- * * Direct spirals that flow through serialization to native imodel02 are create with these static methods:
24
+ * * Direct spirals that flow through serialization to native imodel02 are created with these static methods:
25
25
  * * createArema
26
26
  * * createJapaneseCubic
27
27
  * * createAustralianRail
@@ -34,32 +34,45 @@ import { TransitionSpiral3d } from "./TransitionSpiral3d";
34
34
  * @public
35
35
  */
36
36
  export class DirectSpiral3d extends TransitionSpiral3d {
37
- /** String name for schema properties */
37
+ /** String name for schema properties. */
38
38
  curvePrimitiveType = "transitionSpiral";
39
- /** stroked approximation of entire spiral. This is AFTER the localToWorld transform ... */
39
+ /** Stroked approximation of entire spiral. This is AFTER the localToWorld transform. */
40
40
  _globalStrokes;
41
- /** stroked approximation of active spiral. This is AFTER the localToWorld transfomr ...
42
- * * Same count as global -- possibly overly fine, but it gives some consistency between same clothoid constructed as partial versus complete.
43
- * * If no trimming, this points to the same place as the _globalStrokes !!! Don't double transform!!!
41
+ /**
42
+ * Stroked approximation of active spiral. This is AFTER the localToWorld transform.
43
+ * * Same count as global; possibly overly fine, but it gives some consistency between same clothoid constructed as
44
+ * partial versus complete.
45
+ * * If no trimming, this points to the same place as the _globalStrokes. DO NOT double transform.
44
46
  */
45
47
  _activeStrokes;
46
- /** Return the internal stroked form of the (possibly partial) spiral */
47
- get activeStrokes() { return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes; }
48
+ /** Return the internal stroked form of the (possibly partial) spiral. */
49
+ get activeStrokes() {
50
+ return this._activeStrokes !== undefined ? this._activeStrokes : this._globalStrokes;
51
+ }
48
52
  _nominalL1;
49
53
  _nominalR1;
50
54
  _evaluator;
51
55
  /** Return the nominal end radius. */
52
- get nominalR1() { return this._nominalR1; }
56
+ get nominalR1() {
57
+ return this._nominalR1;
58
+ }
53
59
  /** Return the nominal distance from inflection to endpoint. */
54
- get nominalL1() { return this._nominalL1; }
60
+ get nominalL1() {
61
+ return this._nominalL1;
62
+ }
55
63
  /** Return the nominal end curvature */
56
- get nominalCurvature1() { return TransitionSpiral3d.radiusToCurvature(this._nominalR1); }
57
- /** Return the low level evaluator
64
+ get nominalCurvature1() {
65
+ return TransitionSpiral3d.radiusToCurvature(this._nominalR1);
66
+ }
67
+ /**
68
+ * Return the low level evaluator.
58
69
  * @internal
59
70
  */
60
- get evaluator() { return this._evaluator; }
71
+ get evaluator() {
72
+ return this._evaluator;
73
+ }
61
74
  // constructor demands radius1 and distance1 for nominal construction.
62
- // caller is responsible for managing intervals of partial spiral
75
+ // caller is responsible for managing intervals of partial spiral.
63
76
  constructor(localToWorld, spiralType, originalProperties, nominalL1, nominalR1, activeFractionInterval, evaluator) {
64
77
  super(spiralType, localToWorld, activeFractionInterval, originalProperties);
65
78
  this._nominalL1 = nominalL1;
@@ -67,14 +80,16 @@ export class DirectSpiral3d extends TransitionSpiral3d {
67
80
  this._evaluator = evaluator;
68
81
  this._globalStrokes = LineString3d.create();
69
82
  this._activeStrokes = LineString3d.create();
70
- // initialize for compiler -- but this will be recomputed in refreshComputeProperties ...
83
+ // initialize for compiler; but this will be recomputed in refreshComputeProperties
71
84
  this.refreshComputedProperties();
72
85
  }
73
86
  /**
74
87
  * Compute stroke data in an interval.
75
88
  * @param strokes strokes to clear and refill.
76
- * @param fraction0 start fraction
77
- * @param fraction1 end fraction
89
+ * @param fractionA start fraction.
90
+ * @param fractionB end fraction.
91
+ * @param numInterval number of intervals.
92
+ * @param applyLocalToWorld if true, apply the localToWorld transform.
78
93
  */
79
94
  computeStrokes(strokes, fractionA, fractionB, numInterval, applyLocalToWorld = true) {
80
95
  if (numInterval < 1)
@@ -103,7 +118,7 @@ export class DirectSpiral3d extends TransitionSpiral3d {
103
118
  trueDistance0 = trueDistance1;
104
119
  }
105
120
  }
106
- /** Recompute strokes */
121
+ /** Recompute strokes. */
107
122
  refreshComputedProperties() {
108
123
  const sweepRadians = this.nominalL1 / (2.0 * this.nominalR1);
109
124
  const radiansStep = 0.02;
@@ -115,12 +130,14 @@ export class DirectSpiral3d extends TransitionSpiral3d {
115
130
  }
116
131
  /**
117
132
  * Create a spiral object which uses numXTerm terms from the clothoid X series and numYTerm from the clothoid Y series.
118
- * @param numXTerm number of terms to use from X series
133
+ * @param spiralType type of spiral.
134
+ * @param localToWorld placement frame. Inflection point is at origin, initial direction is along x axis.
135
+ * @param numXTerm number of terms to use from X series
119
136
  * @param numYTerm number of terms to use from Y series
120
- * @param localToWorld placement frame. Inflection point is at origin, initial direction is along x axis.
137
+ * @param originalProperties (optional) transition conditional properties.
121
138
  * @param nominalL1 design distance from inflection to end point.
122
139
  * @param nominalR1 design radius at end point.
123
- * @param activeInterval active interval (as fractions of nominalL1 !!!)
140
+ * @param activeInterval (optional) active interval (as fractions of nominalL1)
124
141
  */
125
142
  static createTruncatedClothoid(spiralType, localToWorld, numXTerm, numYTerm, originalProperties, nominalL1, nominalR1, activeInterval) {
126
143
  if (numXTerm < 1)
@@ -130,29 +147,16 @@ export class DirectSpiral3d extends TransitionSpiral3d {
130
147
  const evaluator = new ClothoidSeriesRLEvaluator(nominalL1, 1.0 / (2.0 * nominalL1 * nominalR1), numXTerm, numYTerm);
131
148
  return new DirectSpiral3d(localToWorld.clone(), spiralType, originalProperties, nominalL1, nominalR1, activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);
132
149
  }
133
- /**
134
- * Create an Japanese spiral clothoid approximation
135
- * * X is 1 terms of the clothoid series as a function of nominal distance along.
136
- * * Y is 1 terms f the clothoid series as a function of nominal distance along.
137
- * * Remark: This is identical to the ChineseCubic
138
- * @param localToWorld axes with inflection at origin, tangent along x axis
139
- * @param nominalL1 nominal length as used in series LR terms.
140
- * @param nominalR1 nominal final radius as used in series LR terms
141
- * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along
142
- */
143
- static createJapaneseCubic(localToWorld, nominalL1, nominalR1, activeInterval) {
144
- return this.createTruncatedClothoid("JapaneseCubic", localToWorld, 1, 1, undefined, nominalL1, nominalR1, activeInterval);
145
- }
146
150
  /**
147
151
  * Create a czech cubic.
148
- * This is y= m*x^3 with
149
- * * x any point on the x axis
150
- * * `fraction` along the spiral goes to `x = fraction * L`
151
- * * m is gamma / (6RL)
152
+ * This is y = m*x^3 with
153
+ * * x any point on the x axis.
154
+ * * `fraction` along the spiral goes to `x = fraction * L`.
155
+ * * m is gamma/(6RL).
152
156
  * * 1/(6RL) is the leading term of the sine series.
153
- * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.
157
+ * * `gamma = 2R/sqrt(4RR-LL)` pushes y up a little bit to simulate the lost series terms.
154
158
  * @param localToWorld
155
- * @param nominalLx nominal length along x axis
159
+ * @param nominalLx nominal length along x axis.
156
160
  * @param nominalR1
157
161
  * @param activeInterval
158
162
  */
@@ -164,15 +168,14 @@ export class DirectSpiral3d extends TransitionSpiral3d {
164
168
  }
165
169
  /**
166
170
  * Create an italian spiral
167
- * This is y= m*x^3 with
168
- * * x any point on the x axis
169
- * * `fraction` along the spiral goes to `x = fraction * L`
170
- * * m is gamma / (6RL)
171
+ * This is y = m*x^3 with
172
+ * * x any point on the x axis.
173
+ * * `fraction` along the spiral goes to `x = fraction * L`.
174
+ * * m is gamma/(6RL).
171
175
  * * 1/(6RL) is the leading term of the sine series.
172
- * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.
173
- * * L in gamma and m is the
176
+ * * `gamma = 2R/sqrt(4RR-LL)` pushes y up a little bit to simulate the lost series terms.
174
177
  * @param localToWorld
175
- * @param nominalL1 nominal length along the spiral
178
+ * @param nominalL1 nominal length along the spiral.
176
179
  * @param nominalR1
177
180
  * @param activeInterval
178
181
  */
@@ -184,12 +187,12 @@ export class DirectSpiral3d extends TransitionSpiral3d {
184
187
  }
185
188
  /**
186
189
  * Create an MX Cubic whose nominal length is close to along the curve.
187
- * This is y= m*x^3 with
188
- * * m is 1/ (6RL1)
190
+ * This is y = m*x^3 with
191
+ * * m is 1/(6RL1).
189
192
  * * 1/(6RL) is the leading term of the sine series.
190
- * * L1 is an along-the-x-axis distance that is slightly LESS THAN the nominal length
191
- * * x is axis position that is slightly LESS than nominal distance along
192
- * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 R R L L))
193
+ * * L1 is an along-the-x-axis distance that is slightly LESS THAN the nominal length.
194
+ * * x is axis position that is slightly LESS than nominal distance along.
195
+ * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 R R L L))
193
196
  * @param localToWorld
194
197
  * @param nominalL1
195
198
  * @param nominalR1
@@ -203,12 +206,12 @@ export class DirectSpiral3d extends TransitionSpiral3d {
203
206
  }
204
207
  /**
205
208
  * Create a polish cubic
206
- * This is y= m*x^3 with
207
- * * m is 1/ (6RL)
209
+ * This is y = m*x^3 with
210
+ * * m is 1/(6RL).
208
211
  * * 1/(6RL) is the leading term of the sine series.
209
- * * L is nominal length
212
+ * * L is nominal length.
210
213
  * * R is nominal end radius.
211
- * * x ranges up to the x axis distance for which the polish distance series produces f(x)=L
214
+ * * x ranges up to the x axis distance for which the polish distance series produces f(x) = L.
212
215
  * * The support class PolishCubicEvaluator has static methods for the distance series and its inversion.
213
216
  */
214
217
  static createPolishCubic(localToWorld, nominalL1, nominalR1, activeInterval) {
@@ -219,12 +222,12 @@ export class DirectSpiral3d extends TransitionSpiral3d {
219
222
  }
220
223
  /**
221
224
  * Create an AustralianRailCorp spiral
222
- * This is y= m*x^3 with
223
- * * x any point on the x axis
224
- * * `fraction` along the spiral goes to `x = fraction * L`
225
- * * m is gamma / (6RL)
225
+ * This is y = m*x^3 with
226
+ * * x any point on the x axis.
227
+ * * `fraction` along the spiral goes to `x = fraction * L`.
228
+ * * m is gamma/(6RL).
226
229
  * * 1/(6RL) is the leading term of the sine series.
227
- * * `gamma = 2R/sqrt (4RR-LL)` pushes y up a little bit to simulate the lost series terms.
230
+ * * `gamma = 2R/sqrt(4RR-LL)` pushes y up a little bit to simulate the lost series terms.
228
231
  * @param localToWorld
229
232
  * @param nominalL1
230
233
  * @param nominalR1
@@ -237,64 +240,78 @@ export class DirectSpiral3d extends TransitionSpiral3d {
237
240
  return new DirectSpiral3d(localToWorld.clone(), "AustralianRailCorp", undefined, nominalL1, nominalR1, activeInterval ? activeInterval.clone() : Segment1d.create(0, 1), evaluator);
238
241
  }
239
242
  static createDirectHalfCosine(localToWorld, nominalL1, nominalR1, activeInterval) {
240
- return new this(localToWorld, "HalfCosine", undefined, nominalL1, nominalR1, activeInterval, new DirectHalfCosineSpiralEvaluator(nominalL1, nominalR1));
243
+ return new DirectSpiral3d(localToWorld, "HalfCosine", undefined, nominalL1, nominalR1, activeInterval, new DirectHalfCosineSpiralEvaluator(nominalL1, nominalR1));
241
244
  }
242
245
  /**
243
246
  * Create an Arema spiral clothoid approximation
244
- * * X is 2 terms of the clothoid series as a function of nominal distance along
245
- * * Y is 2 terms f the clothoid series as a function of nominal distance along
246
- * * Remark: This is identical to the ChineseCubic
247
- * @param localToWorld axes with inflection at origin, tangent along x axis
247
+ * * X is 2 terms of the clothoid series as a function of nominal distance along.
248
+ * * Y is 2 terms f the clothoid series as a function of nominal distance along.
249
+ * * Remark: This is identical to the ChineseCubic.
250
+ * @param localToWorld axes with inflection at origin, tangent along x axis.
248
251
  * @param nominalL1 nominal length as used in series LR terms.
249
- * @param nominalR1 nominal final radius as used in series LR terms
250
- * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along
252
+ * @param nominalR1 nominal final radius as used in series LR terms.
253
+ * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along.
251
254
  */
252
255
  static createArema(localToWorld, nominalL1, nominalR1, activeInterval) {
253
256
  return this.createTruncatedClothoid("Arema", localToWorld, 2, 2, undefined, nominalL1, nominalR1, activeInterval);
254
257
  }
255
258
  /**
256
- * Create a Chinese clothoid approximation
257
- * * X is 2 terms of the clothoid series as a function of nominal distance along
258
- * * Y is 2 terms f the clothoid series as a function of nominal distance along
259
- * * Remark: This is identical to the Arema spiral
260
- * @param localToWorld axes with inflection at origin, tangent along x axis
259
+ * Create a Japanese spiral clothoid approximation.
260
+ * * X is 1 terms of the clothoid series as a function of nominal distance along.
261
+ * * Y is 1 terms of the clothoid series as a function of nominal distance along.
262
+ * * Remark: This is identical to the ChineseCubic.
263
+ * @param localToWorld axes with inflection at origin, tangent along x axis.
261
264
  * @param nominalL1 nominal length as used in series LR terms.
262
- * @param nominalR1 nominal final radius as used in series LR terms
265
+ * @param nominalR1 nominal final radius as used in series LR terms.
263
266
  * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along
264
267
  */
268
+ static createJapaneseCubic(localToWorld, nominalL1, nominalR1, activeInterval) {
269
+ return this.createTruncatedClothoid("JapaneseCubic", localToWorld, 1, 1, undefined, nominalL1, nominalR1, activeInterval);
270
+ }
271
+ /**
272
+ * Create a Chinese clothoid approximation
273
+ * * X is 2 terms of the clothoid series as a function of nominal distance along.
274
+ * * Y is 2 terms f the clothoid series as a function of nominal distance along.
275
+ * * Remark: This is identical to the Arema spiral.
276
+ * @param localToWorld axes with inflection at origin, tangent along x axis.
277
+ * @param nominalL1 nominal length as used in series LR terms.
278
+ * @param nominalR1 nominal final radius as used in series LR terms.
279
+ * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along.
280
+ */
265
281
  static createChineseCubic(localToWorld, nominalL1, nominalR1, activeInterval) {
266
282
  return this.createTruncatedClothoid("ChineseCubic", localToWorld, 2, 2, undefined, nominalL1, nominalR1, activeInterval);
267
283
  }
268
284
  /**
269
285
  * Create a Western Australian direct spiral.
270
- * * X is 2 terms of the clothoid series as a function of distance along
271
- * * Y is 1 term (cubic in nominal distance along)
272
- * @param localToWorld axes with inflection at origin, tangent along x axis
286
+ * * X is 2 terms of the clothoid series as a function of distance along.
287
+ * * Y is 1 term (cubic in nominal distance along).
288
+ * @param localToWorld axes with inflection at origin, tangent along x axis.
273
289
  * @param nominalL1 nominal length as used in series LR terms.
274
- * @param nominalR1 nominal final radius as used in series LR terms
275
- * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along
290
+ * @param nominalR1 nominal final radius as used in series LR terms.
291
+ * @param activeInterval fractional interval with (0, nominalL1) range for nominal distance along.
276
292
  */
277
293
  static createWesternAustralian(localToWorld, nominalL1, nominalR1, activeInterval) {
278
294
  return this.createTruncatedClothoid("WesternAustralian", localToWorld, 2, 1, undefined, nominalL1, nominalR1, activeInterval);
279
295
  }
280
296
  /**
281
297
  * Create (if possible) a DirectSpiral3d, applying various strict conditions appropriate to the spiral type.
282
- * The parameter list includes extraneous values in order to directly match IntegratedSpiral3d.create, which has greater flexibility about
283
- * mixtures of values.
284
- * * IMPORTANT RESTRICTIONS
298
+ * The parameter list includes extraneous values in order to directly match IntegratedSpiral3d.create, which has
299
+ * greater flexibility about mixtures of values.
300
+ * * IMPORTANT RESTRICTIONS:
285
301
  * * Direct spirals must have the inflection at the origin of their coordinate system, aligned with the x axis.
286
- * * hence bearing0 = 0
287
- * * hence radius0 = 0
288
- * * bearing1 is ignored
302
+ * * hence bearing0 = 0.
303
+ * * hence radius0 = 0.
304
+ * * bearing1 is ignored.
289
305
  * * radius1 must be given.
290
306
  * * arcLength must be given,
291
- * @param spiralType one of the types in `DirectSpiralTypeNames`
292
- * @param radius0 radius (or 0 for tangent to line) at start. Must be ZERO or UNDEFINED
307
+ * @param spiralType one of the types in `DirectSpiralTypeName`
308
+ * @param radius0 radius (or 0 for tangent to line) at start. Must be ZERO or UNDEFINED
293
309
  * @param radius1 radius (or 0 for tangent to line) at end.
294
- * @param bearing0 bearing, measured CCW from x axis at start. Must be ZERO or UNDEFINED
295
- * @param bearing1 bearing, measured CCW from x axis at end. IGNORED.
296
- * @param fractionInterval optional fractional interval for an "active" portion of the curve. if omitted, the full [0,1] is used.
297
- * @param localToWorld placement transform
310
+ * @param bearing0 bearing, measured CCW from x axis at start. Must be ZERO or UNDEFINED
311
+ * @param bearing1 bearing, measured CCW from x axis at end. IGNORED.
312
+ * @param fractionInterval (optional) fractional interval for an "active" portion of the curve. If omitted, the
313
+ * full [0,1] is used.
314
+ * @param localToWorld placement transform.
298
315
  */
299
316
  static createFromLengthAndRadius(spiralType, radius0, radius1, bearing0, _bearing1, arcLength, activeInterval, localToWorld) {
300
317
  if (bearing0 !== undefined && !bearing0.isAlmostZero)
@@ -327,11 +344,11 @@ export class DirectSpiral3d extends TransitionSpiral3d {
327
344
  return this.createPolishCubic(localToWorld, arcLength, radius1, activeInterval);
328
345
  return undefined;
329
346
  }
330
- /** Deep clone of this spiral */
347
+ /** Deep clone of this spiral. */
331
348
  clone() {
332
349
  return new DirectSpiral3d(this.localToWorld.clone(), this._spiralType, this.designProperties?.clone(), this._nominalL1, this._nominalR1, this._activeFractionInterval?.clone(), this._evaluator.clone());
333
350
  }
334
- /** apply `transform` to this spiral's local to world transform. */
351
+ /** Apply `transform` to this spiral's local to world transform. */
335
352
  tryTransformInPlace(transformA) {
336
353
  const rigidData = this.applyRigidPartOfTransform(transformA);
337
354
  if (rigidData !== undefined) {
@@ -346,17 +363,18 @@ export class DirectSpiral3d extends TransitionSpiral3d {
346
363
  startPoint(result) {
347
364
  return this.activeStrokes.startPoint(result);
348
365
  }
349
- /** return the spiral end point. */
366
+ /** Return the spiral end point. */
350
367
  endPoint(result) {
351
368
  return this.activeStrokes.endPoint(result);
352
369
  }
353
- /** test if the local to world transform places the spiral xy plane into `plane` */
370
+ /** Test if the local to world transform places the spiral xy plane into `plane`. */
354
371
  isInPlane(plane) {
355
372
  return plane.isPointInPlane(this.localToWorld.origin)
356
373
  && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnX(plane.getNormalRef()))
357
374
  && Geometry.isSameCoordinate(0.0, this.localToWorld.matrix.dotColumnY(plane.getNormalRef()));
358
375
  }
359
- /** Return quick length of the spiral.
376
+ /**
377
+ * Return quick length of the spiral.
360
378
  * The tangent vector of a true clothoid is length 1 everywhere, so simple proportion of nominalL1 is a good approximation.
361
379
  */
362
380
  quickLength() {
@@ -364,18 +382,24 @@ export class DirectSpiral3d extends TransitionSpiral3d {
364
382
  const n = distanceData.length;
365
383
  return distanceData.getYAtUncheckedPointIndex(n - 1);
366
384
  }
367
- /** Return length of the spiral.
368
- * * True length is stored at back of uvParams . . .
369
- */
370
- // use the generic integrator ... public override curveLength() { return this.quickLength(); }
385
+ // We claim true length is stored at the back of `packedUVParams`.
386
+ // Nevertheless defer to the generic integrator in the default implementation.
387
+ // public override curveLength() {
388
+ // return this.quickLength();
389
+ // }
371
390
  /** Test if `other` is an instance of `TransitionSpiral3d` */
372
- isSameGeometryClass(other) { return other instanceof DirectSpiral3d; }
373
- /** Add strokes from this spiral to `dest`.
374
- * * Linestrings will usually stroke as just their points.
391
+ isSameGeometryClass(other) {
392
+ return other instanceof TransitionSpiral3d;
393
+ }
394
+ /**
395
+ * Add strokes from this spiral to `dest`.
396
+ * * Line strings will usually stroke as just their points.
375
397
  * * If maxEdgeLength is given, this will sub-stroke within the linestring -- not what we want.
376
398
  */
377
- emitStrokes(dest, options) { this.activeStrokes.emitStrokes(dest, options); }
378
- /** emit stroke fragments to `dest` handler. */
399
+ emitStrokes(dest, options) {
400
+ this.activeStrokes.emitStrokes(dest, options);
401
+ }
402
+ /** Emit stroke fragments to `dest` handler. */
379
403
  emitStrokableParts(dest, options) {
380
404
  const n = this.computeStrokeCountForOptions(options);
381
405
  const activeStrokes = this.activeStrokes;
@@ -396,8 +420,8 @@ export class DirectSpiral3d extends TransitionSpiral3d {
396
420
  dest.endParentCurvePrimitive(this);
397
421
  }
398
422
  /**
399
- * return the stroke count required for given options.
400
- * @param options StrokeOptions that determine count
423
+ * Return the stroke count required for given options.
424
+ * @param options StrokeOptions that determine count.
401
425
  */
402
426
  computeStrokeCountForOptions(options) {
403
427
  let numStroke;
@@ -414,8 +438,9 @@ export class DirectSpiral3d extends TransitionSpiral3d {
414
438
  numStroke = Math.ceil(this._activeFractionInterval.absoluteDelta() * numStroke);
415
439
  return numStroke;
416
440
  }
417
- /** Reverse the active interval and active strokes.
418
- * * Primary defining data remains unchanged !!!
441
+ /**
442
+ * Reverse the active interval and active strokes.
443
+ * * Primary defining data remains unchanged.
419
444
  */
420
445
  reverseInPlace() {
421
446
  this._activeFractionInterval.reverseInPlace();
@@ -438,10 +463,11 @@ export class DirectSpiral3d extends TransitionSpiral3d {
438
463
  result.transformInPlace(this.localToWorld);
439
464
  return result;
440
465
  }
441
- /** Return a plane with
442
- *
443
- * * origin at fractional position along the curve
444
- * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.
466
+ /**
467
+ * Return a plane with
468
+ * * origin at fractional position along the curve.
469
+ * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to
470
+ * the fraction.
445
471
  * * vectorV is the second derivative, i.e.derivative of vectorU.
446
472
  */
447
473
  fractionToPointAnd2Derivatives(activeFraction, result) {
@@ -453,11 +479,11 @@ export class DirectSpiral3d extends TransitionSpiral3d {
453
479
  result.transformInPlace(this.localToWorld);
454
480
  return result;
455
481
  }
456
- /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)` */
482
+ /** Second step of double dispatch: call `handler.handleTransitionSpiral(this)`. */
457
483
  dispatchToGeometryHandler(handler) {
458
484
  return handler.handleTransitionSpiral(this);
459
485
  }
460
- /** compare various coordinate quantities */
486
+ /** Compare various coordinate quantities. */
461
487
  isAlmostEqual(other) {
462
488
  if (other instanceof DirectSpiral3d) {
463
489
  return Geometry.isSameCoordinate(this._nominalL1, other._nominalL1)