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