Add crossing prefab definitions
This commit is contained in:
parent
5d7cef846f
commit
4342bb41e8
@ -1,24 +1,8 @@
|
||||
import SwitchPrefab from "../switch-descriptions/switch-prefab";
|
||||
|
||||
const DefinedSwitches = {
|
||||
// "Crossing": [
|
||||
// 0,
|
||||
// 0,
|
||||
// [0,1],
|
||||
// new Vector3(-0.919, 0, -16.59),
|
||||
// new Vector3(0.919, 0, -16.59),
|
||||
// new Vector3(0.919, 0, 16.59),
|
||||
// new Vector3(-0.919, 0, 16.59)
|
||||
// ],
|
||||
// "Crossing4.444": [
|
||||
// 0,
|
||||
// 0,
|
||||
// [0,1],
|
||||
// new Vector3(-1.104, 0, -9.939),
|
||||
// new Vector3(1.104, 0, -9.939),
|
||||
// new Vector3(1.104, 0, 9.939),
|
||||
// new Vector3(-1.104, 0, 9.939)
|
||||
// ],
|
||||
"Crossing": SwitchPrefab.crossing(33.2294, 9.0),
|
||||
"Crossing4.444": SwitchPrefab.crossing(20.0, 4.444),
|
||||
// Rkp 60E1-190-1_9 ab
|
||||
// Rkp 60E1-190-1_9 ba
|
||||
// Rkpd 60E1-190-1_9
|
||||
|
||||
@ -75,13 +75,13 @@ export default class SwitchPrefab {
|
||||
},
|
||||
],
|
||||
),
|
||||
...SwitchPrefab._createSwitchTracks(
|
||||
...SwitchPrefab._createForkSwitchTracks(
|
||||
radiusA,
|
||||
curveLength,
|
||||
addedLength,
|
||||
'a',
|
||||
),
|
||||
...SwitchPrefab._createSwitchTracks(
|
||||
...SwitchPrefab._createForkSwitchTracks(
|
||||
radiusB,
|
||||
curveLength,
|
||||
addedLength,
|
||||
@ -92,7 +92,7 @@ export default class SwitchPrefab {
|
||||
return new SwitchPrefab(tracks);
|
||||
}
|
||||
|
||||
static _createSwitchTracks(radius, curveLength, addedLength, side) {
|
||||
static _createForkSwitchTracks(radius, curveLength, addedLength, side) {
|
||||
let curveEnd;
|
||||
let endAngle;
|
||||
if (radius === 0) {
|
||||
@ -174,4 +174,45 @@ export default class SwitchPrefab {
|
||||
|
||||
return tracks;
|
||||
}
|
||||
|
||||
static crossing(length, tangentInv) {
|
||||
const vectorA = Vector3.fromAngleY(Math.atan(1 / tangentInv / 2), length / 2);
|
||||
const vectorB = Vector3.fromAngleY(-Math.atan(1 / tangentInv / 2), length / 2);
|
||||
const tracks = {
|
||||
a: new SwitchPrefabTrack(
|
||||
vectorA.negate(),
|
||||
vectorA,
|
||||
0,
|
||||
0,
|
||||
[
|
||||
{
|
||||
type: SwitchTrackConnectionType.EXTERNAL,
|
||||
end: TrackConnectionEnd.START,
|
||||
},
|
||||
{
|
||||
type: SwitchTrackConnectionType.EXTERNAL,
|
||||
end: TrackConnectionEnd.END,
|
||||
},
|
||||
],
|
||||
),
|
||||
b: new SwitchPrefabTrack(
|
||||
vectorB.negate(),
|
||||
vectorB,
|
||||
0,
|
||||
1,
|
||||
[
|
||||
{
|
||||
type: SwitchTrackConnectionType.EXTERNAL,
|
||||
end: TrackConnectionEnd.START,
|
||||
},
|
||||
{
|
||||
type: SwitchTrackConnectionType.EXTERNAL,
|
||||
end: TrackConnectionEnd.END,
|
||||
},
|
||||
],
|
||||
),
|
||||
};
|
||||
|
||||
return new SwitchPrefab(tracks);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user