tested beam line animation

This commit is contained in:
Ryan Tang 2022-12-23 18:09:25 -05:00
parent 484ed688bd
commit 3c49d126ae

64
geo.js
View File

@ -299,7 +299,7 @@ let sourceLine;
let targetRoom1; let targetRoom1;
{ {
let dipole = new beamDipole(sourceLine.b0b.exitPos, 80, Math.PI/2, 0, color.Dipole); let dipole = new beamDipole(sourceLine.b0b.exitPos, 80, Math.PI/2, 0, color.Dipole);
let beampipe = new beamLine(dipole.exitPos, -Math.PI/2, 200, color.BeamPipe); let beampipe = new beamLine(dipole.exitPos, -Math.PI/2, 100, color.BeamPipe);
let fan = new beamSpliter(beampipe.exitPos, 50, -100 * deg, color.Deflector); let fan = new beamSpliter(beampipe.exitPos, 50, -100 * deg, color.Deflector);
let upperLine; let upperLine;
@ -363,7 +363,7 @@ let targetRoom2;
let ResolutLine; let ResolutLine;
{ {
let frac = 0.7; let frac = 0.7;
let b2a = new beamLine(fan2.GetExitPos(frac, 0), fan2.GetExitAng(frac), 500); let b2a = new beamLine(fan2.GetExitPos(frac, 0), fan2.GetExitAng(frac), 500); b2a.offset = 8;
let df2a_0 = new beamRectElement( fan2.GetExitPos(frac, 100), fan2.GetExitAng(frac), 30, 40, color.Deflector); let df2a_0 = new beamRectElement( fan2.GetExitPos(frac, 100), fan2.GetExitAng(frac), 30, 40, color.Deflector);
let q2a = new beamRectElement(df2a_0.GetExitPos(30), fan2.GetExitAng(frac), 60, 60, color.Qpole); let q2a = new beamRectElement(df2a_0.GetExitPos(30), fan2.GetExitAng(frac), 60, 60, color.Qpole);
let df2a_1 = new beamRectElement( q2a.GetExitPos(30), fan2.GetExitAng(frac), 30, 40, color.Deflector); let df2a_1 = new beamRectElement( q2a.GetExitPos(30), fan2.GetExitAng(frac), 30, 40, color.Deflector);
@ -378,7 +378,7 @@ let targetRoom2;
let AnasenLine; let AnasenLine;
{ {
let frac = 0.5; let frac = 0.5;
let b2b = new beamLine(fan2.GetExitPos(frac, 0), fan2.GetExitAng(frac), 500); let b2b = new beamLine(fan2.GetExitPos(frac, 0), fan2.GetExitAng(frac), 500); b2b.offset = 8;
let q2b = new beamRectElement(fan2.GetExitPos(frac, 150), fan2.GetExitAng(frac), 60, 60, color.Qpole); let q2b = new beamRectElement(fan2.GetExitPos(frac, 150), fan2.GetExitAng(frac), 60, 60, color.Qpole);
let df2b = new beamRectElement( fan2.GetExitPos(frac, 240), fan2.GetExitAng(frac), 30, 40, color.Deflector); let df2b = new beamRectElement( fan2.GetExitPos(frac, 240), fan2.GetExitAng(frac), 30, 40, color.Deflector);
let Anasen = new detectorStation(b2b.GetExitPos(0), "Anasen"); let Anasen = new detectorStation(b2b.GetExitPos(0), "Anasen");
@ -389,7 +389,7 @@ let targetRoom2;
let lowerLine; let lowerLine;
{ {
let frac = 0.3; let frac = 0.3;
let b2c = new beamLine(fan2.GetExitPos(frac, 0), fan2.GetExitAng(frac), 500); let b2c = new beamLine(fan2.GetExitPos(frac, 0), fan2.GetExitAng(frac), 500); b2c.offset = 8;
let q2c = new beamRectElement(fan2.GetExitPos(frac, 100), fan2.GetExitAng(frac), 60, 60, color.Qpole); let q2c = new beamRectElement(fan2.GetExitPos(frac, 100), fan2.GetExitAng(frac), 60, 60, color.Qpole);
let df2c = new beamRectElement( fan2.GetExitPos(frac, 200), fan2.GetExitAng(frac), 30, 40, color.Deflector); let df2c = new beamRectElement( fan2.GetExitPos(frac, 200), fan2.GetExitAng(frac), 30, 40, color.Deflector);
let fan2c = new beamSpliter(b2c.exitPos, 80, -130 * deg, color.Dipole); let fan2c = new beamSpliter(b2c.exitPos, 80, -130 * deg, color.Dipole);
@ -426,19 +426,21 @@ let targetRoom2;
ResolutLine, AnasenLine, lowerLine}; ResolutLine, AnasenLine, lowerLine};
} }
//============================== Draw
for( const ele in sourceLine){ for( const ele in sourceLine){
sourceLine[ele].draw(true); sourceLine[ele].draw(true);
} }
targetRoom1.dipole.draw(true); targetRoom1.dipole.draw(true);
targetRoom1.beampipe.draw(true); targetRoom1.beampipe.draw(false);
targetRoom1.fan.draw(true); targetRoom1.fan.draw(true);
targetRoom1.upperLine.b1a_0.draw(true); targetRoom1.upperLine.b1a_0.draw(false);
targetRoom1.upperLine.q1a.draw(true); targetRoom1.upperLine.q1a.draw(true);
targetRoom1.upperLine.df1a.draw(true); targetRoom1.upperLine.df1a.draw(true);
targetRoom1.upperLine.b1a_1.draw(false); targetRoom1.upperLine.b1a_1.draw(false);
targetRoom1.upperLine.GammaStation.draw(true); targetRoom1.upperLine.GammaStation.draw(false);
targetRoom1.upperLine.Catrina.draw(false); targetRoom1.upperLine.Catrina.draw(false);
targetRoom1.middleLine.b1b.draw( false); targetRoom1.middleLine.b1b.draw( false);
@ -463,11 +465,53 @@ for( const ele in targetRoom2){
} }
} }
let destination = 'Gamma';
function lineMotion(){ function lineMotion(){
sourceLine.b0a.march(); sourceLine.b0a.march();
sourceLine.b0b.march(); sourceLine.b0b.march();
targetRoom1.beampipe.march(); if( destination == 'Gamma' ){
targetRoom1.upperLine.b1a_0.march(); targetRoom1.beampipe.march();
setTimeout(lineMotion, 10); targetRoom1.upperLine.b1a_0.march();
targetRoom1.GammaStation.draw(true);
}
if( destination == 'Catrina'){
targetRoom1.beampipe.march();
targetRoom1.upperLine.b1a_0.march();
targetRoom1.upperLine.b1a_1.march();
targetRoom1.Catrina.draw(true);
}
if( destination == 'Resolut'){
targetRoom2.b2.march();
targetRoom2.b3.march();
targetRoom2.ResolutLine.b2a.march();
targetRoom2.ResolutLine.b2a_1.march();
targetRoom2.ResolutLine.Resolut.draw(true);
}
if( destination == 'Anasen'){
targetRoom2.b2.march();
targetRoom2.b3.march();
targetRoom2.AnasenLine.b2b.march();
targetRoom2.AnasenLine.Anasen.draw(true);
}
if( destination == 'SPS'){
targetRoom2.b2.march();
targetRoom2.b3.march();
targetRoom2.lowerLine.b2c.march();
targetRoom2.lowerLine.SplitPoleLine.b2c_1.march();
targetRoom2.lowerLine.SplitPoleLine.SPS.draw(true);
}
if( destination == 'Clarion2'){
targetRoom2.b2.march();
targetRoom2.b3.march();
targetRoom2.lowerLine.b2c.march();
targetRoom2.lowerLine.ClarionLine.b2c_2.march();
targetRoom2.lowerLine.ClarionLine.Clarion2.draw(true);
}
setTimeout(lineMotion, 20);
} }
destination = 'Clarion2';
lineMotion(); lineMotion();