OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
SRotatedGeometry.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: SRotatedGeometry.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: SRotatedGeometry
10 // A Geometry which wraps another arbitrary geometry in two s-rotations.
11 //
12 // ------------------------------------------------------------------------
13 // Class category: BeamlineGeometry
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:32:34 $
17 // $Author: fci $
18 //
19 // ------------------------------------------------------------------------
20 
23 
24 
25 // Class SRotatedGeometry.
26 // ------------------------------------------------------------------------
27 
29  double sin, double sout):
30  srotIn(sin), srotOut(sout), geom(g)
31 {}
32 
33 
35  double srot, BalanceMode mode):
36  srotIn(srot), srotOut(0), geom(g) {
37  balanceSrots(mode);
38 }
39 
41  BGeometryBase(rhs),
42  srotIn(rhs.srotIn), srotOut(rhs.srotOut), geom(rhs.geom)
43 {}
44 
45 
47 {}
48 
49 
51  return geom.getArcLength();
52 }
53 
54 
56  return geom.getElementLength();
57 }
58 
59 
61  return srotIn;
62 }
63 
64 
66  return srotOut;
67 }
68 
69 
70 void SRotatedGeometry::setSrotIn(double phi) {
71  srotIn = phi;
72 }
73 
74 
75 void SRotatedGeometry::setSrotOut(double phi) {
76  srotOut = phi;
77 }
78 
80  // switch(mode) {
81  // tilt:
82  // srotOut = -srotIn;
83  // break;
84  // balanceX:
85  // // to be implemented
86  // break;
87  // }
88  if(mode == tilt)
89  srotOut = -srotIn;
90  else {
91  // balanceX to be implemented
92  }
93 }
94 
95 
97  return geom.getOrigin();
98 }
99 
100 
102  return geom.getEntrance();
103 }
104 
105 
107  return geom.getExit();
108 }
109 
110 
111 Euclid3D SRotatedGeometry::getTransform(double fromS, double toS) const {
112  Euclid3D t = geom.getTransform(fromS, toS);
113 
114  if(fromS == geom.getEntrance())
115  t = t * Euclid3D::ZRotation(srotIn);
116  else if(fromS == geom.getExit())
117  t = t * Euclid3D::ZRotation(-srotOut);
118 
119  if(toS == geom.getEntrance())
121  else if(toS == geom.getExit())
123 
124  return t;
125 }
126 
127 
132 
133  return tout * t * tin;
134 }
135 
136 
138  return getTransform(0, s);
139 }
140 
141 
143  Euclid3D t = geom.getExitFrame();
144  return Euclid3D::ZRotation(srotOut) * t;
145 }
146 
147 
150  return t * Euclid3D::ZRotation(srotIn);
151 }
152 
153 
155  return Euclid3D::ZRotation(srotIn);
156 }
157 
158 
161 }
virtual double getArcLength() const
Get arc length.
virtual double getElementLength() const
Get design length.
BalanceMode
Balance mode.
const BGeometryBase & geom
virtual Euclid3D getTransform(double fromS, double toS) const =0
Get transform.
Euclid3D getExitPatch() const
Get patch.
srotOut is set to -srotIn.
Tps< T > sin(const Tps< T > &x)
Sine.
Definition: TpsMath.h:111
double getEntrance() const
Get entrance.
Euclid3D getTransform(double fromS, double toS) const
Get transform.
virtual double getEntrance() const
Get entrance position.
Definition: Geometry.cpp:41
virtual Euclid3D getEntranceFrame() const
Get transform.
Definition: Geometry.cpp:61
virtual double getOrigin() const
Get origin position.
Definition: Geometry.cpp:36
virtual double getExit() const
Get exit position.
Definition: Geometry.cpp:46
double getSrotIn() const
Get entrance rotation.
virtual double getElementLength() const =0
Get geometry length.
Abstract base class for accelerator geometry classes.
Definition: Geometry.h:43
Euclid3D getExitFrame() const
Get transform.
SRotatedGeometry(const BGeometryBase &geom, double srotIn, double srotOut)
Constructor.
void setSrotIn(double)
Set entrance rotation.
double getOrigin() const
Get origin.
double getExit() const
Get exit.
virtual Euclid3D getTotalTransform() const
Get transform.
Definition: Geometry.cpp:51
Displacement and rotation in space.
Definition: Euclid3D.h:68
void setSrotOut(double)
Set exit rotation.
Euclid3D getEntranceFrame() const
Get transform.
virtual double getArcLength() const =0
Get arc length.
void balanceSrots(BalanceMode mode=tilt)
Balance rotations.
double getSrotOut() const
Get exit rotation.
A Geometry which wraps an arbitrary geometry in two s-rotations.
virtual ~SRotatedGeometry()
Euclid3D getTotalTransform() const
Get transform.
static Euclid3D ZRotation(double angle)
Make rotation.
Definition: Euclid3D.cpp:171
virtual Euclid3D getExitFrame() const
Get transform.
Definition: Geometry.cpp:66
Euclid3D getEntrancePatch() const
Get patch.