From 3c49d126ae6bbb05ab418fdfaa3687e49c4986c3 Mon Sep 17 00:00:00 2001 From: Ryan Tang Date: Fri, 23 Dec 2022 18:09:25 -0500 Subject: [PATCH] tested beam line animation --- geo.js | 66 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 11 deletions(-) diff --git a/geo.js b/geo.js index 8523566..971303f 100644 --- a/geo.js +++ b/geo.js @@ -299,7 +299,7 @@ let sourceLine; let targetRoom1; { 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 upperLine; @@ -363,7 +363,7 @@ let targetRoom2; let ResolutLine; { 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 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); @@ -378,7 +378,7 @@ let targetRoom2; let AnasenLine; { 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 df2b = new beamRectElement( fan2.GetExitPos(frac, 240), fan2.GetExitAng(frac), 30, 40, color.Deflector); let Anasen = new detectorStation(b2b.GetExitPos(0), "Anasen"); @@ -389,7 +389,7 @@ let targetRoom2; let lowerLine; { 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 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); @@ -397,7 +397,7 @@ let targetRoom2; let SplitPoleLine; { let frac = 0.7; - let b2c_1 = new beamLine(fan2c.GetExitPos(frac, 0), fan2c.GetExitAng(frac), 500); + let b2c_1 = new beamLine(fan2c.GetExitPos(frac, 0), fan2c.GetExitAng(frac), 500); let q2c_1 = new beamRectElement(fan2c.GetExitPos(frac, 100), fan2c.GetExitAng(frac), 60, 60, color.Qpole); let df2c_1a = new beamRectElement( q2c_1.GetExitPos(30), fan2c.GetExitAng(frac), 30, 40, color.Deflector); let df2c_1b = new beamRectElement( df2c_1a.GetExitPos(30), fan2c.GetExitAng(frac), 30, 40, color.Deflector); @@ -426,19 +426,21 @@ let targetRoom2; ResolutLine, AnasenLine, lowerLine}; } +//============================== Draw + for( const ele in sourceLine){ sourceLine[ele].draw(true); } targetRoom1.dipole.draw(true); -targetRoom1.beampipe.draw(true); +targetRoom1.beampipe.draw(false); targetRoom1.fan.draw(true); -targetRoom1.upperLine.b1a_0.draw(true); +targetRoom1.upperLine.b1a_0.draw(false); targetRoom1.upperLine.q1a.draw(true); targetRoom1.upperLine.df1a.draw(true); targetRoom1.upperLine.b1a_1.draw(false); -targetRoom1.upperLine.GammaStation.draw(true); +targetRoom1.upperLine.GammaStation.draw(false); targetRoom1.upperLine.Catrina.draw(false); targetRoom1.middleLine.b1b.draw( false); @@ -463,11 +465,53 @@ for( const ele in targetRoom2){ } } +let destination = 'Gamma'; + function lineMotion(){ sourceLine.b0a.march(); sourceLine.b0b.march(); - targetRoom1.beampipe.march(); - targetRoom1.upperLine.b1a_0.march(); - setTimeout(lineMotion, 10); + if( destination == 'Gamma' ){ + targetRoom1.beampipe.march(); + 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();