PlanarArcGeometry.h 5.4 KB
 gsell committed Mar 15, 2012 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 ``````#ifndef CLASSIC_PlanarArcGeometry_HH #define CLASSIC_PlanarArcGeometry_HH // ------------------------------------------------------------------------ // \$RCSfile: PlanarArcGeometry.h,v \$ // ------------------------------------------------------------------------ // \$Revision: 1.1.1.1 \$ // ------------------------------------------------------------------------ // Copyright: see Copyright.readme // ------------------------------------------------------------------------ // // Class: PlanarArcGeometry // // ------------------------------------------------------------------------ // Class category: BeamlineGeometry // ------------------------------------------------------------------------ // // \$Date: 2000/03/27 09:32:34 \$ // \$Author: fci \$ // // ------------------------------------------------------------------------ #include "BeamlineGeometry/Geometry.h" // Class PlanarArcGeometry // ------------------------------------------------------------------------ /// A simple arc in the XZ plane. // A PlanarArcGeometry object represents a Geometry which is as simple // circular arc in the local XZ plane with no torsion. The origin is // defined at the centre of the geometry, and the geometry extends // from -length/2 to +length/2. Transformations generated by this // geometry are characterised by a displacement in the XZ plane and a // pure Y rotation. // [p] // This geometry can have two states: // [ul] // [li]Length L is non-zero: // The geometry is defined as a finite arc in the XZ plane. // In this state, the following changes are allowed: // [ul] // [li]Setting the angle phi: recompute the curvature as phi / L. // [li]Setting the curvature h: recompute the angle as h * L. // [li]Setting the length: if non-zero, recompute the angle as h * L, // otherwise set h to zero. // [/ul] // [li]Length is zero, implying curvature also zero: // The geometry is defined as sharp bend by phi in the XZ plane. // In this state, the following changes are allowed: // [ul] // [li]Setting the angle phi: leave both h and L as zero. // [li]Setting the curvature h: not accepted. // [li]Setting the length: if non-zero, recompute the angle as h * L. // [/ul] // [/ul] `````` Tuelin Kaman committed Jan 16, 2014 56 ``````class PlanarArcGeometry : public BGeometryBase { `````` gsell committed Mar 15, 2012 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 ``````public: /// Constructor. // Build PlanarArcGeometry from length [b]l[/b] and curvature [b]h[/b]. PlanarArcGeometry(double l, double h); /// Constructor. // Build PlanarArcGeometry from length zero and angle [b]phi[/b]. PlanarArcGeometry(double phi); PlanarArcGeometry(const PlanarArcGeometry &); virtual ~PlanarArcGeometry(); const PlanarArcGeometry &operator=(const PlanarArcGeometry &); /// Get arc length. // Return arc length along the design arc. virtual double getArcLength() const; /// Get element length. // Return element length measured along the design arc. virtual double getElementLength() const; /// Get angle. double getBendAngle() const; /// Get curvature. double getCurvature() const; /// Set angle. virtual void setBendAngle(double); /// Set curvature. void setCurvature(double); /// Set length. // Assign the arc length for this class. virtual void setElementLength(double); /// Get origin. // Return the distance from the entrance of the geometry to the origin // (non-negative). virtual double getOrigin() const; /// Get entrance. // Return the arc length from the origin to the entrance of the // geometry (non-positive). double getEntrance() const; /// Get exit. // Return the arc length from the origin to the exit of the // geometry (non-negative). double getExit() const; /// Get transform. // Return the transform of the local coordinate system from the // position [b]fromS[/b] to the position [b]toS[/b]. virtual Euclid3D getTransform(double fromS, double toS) const; /// Get transform. // Equivalent to getTransform(0.0, s). // Return the transform of the local coordinate system from the // origin and [b]s[/b]. virtual Euclid3D getTransform(double s) const; /// Get transform. // Equivalent to getTransform(getEntrance(), getExit()). // Return the transform of the local coordinate system from the // entrance to the exit of the element. virtual Euclid3D getTotalTransform() const; /// Get transform. // Equivalent to getTransform(0.0, getEntrance()). // Return the transform of the local coordinate system from the // origin to the entrance of the element. Euclid3D getEntranceFrame() const; /// Get transform. // Equivalent to getTransform(0.0, getExit()). // Return the transform of the local coordinate system from the // origin to the exit of the element. Euclid3D getExitFrame() const; private: double len; double h; double angle; }; // inlined (trivial) member functions inline PlanarArcGeometry::PlanarArcGeometry(double l, double hh): len(l), h(hh), angle(hh *l) {} inline PlanarArcGeometry::PlanarArcGeometry(double phi): len(0.0), h(0.0), angle(phi) {} inline PlanarArcGeometry::PlanarArcGeometry(const PlanarArcGeometry &rhs): `````` snuverink_j committed Apr 10, 2017 159 `````` BGeometryBase(rhs),len(rhs.len), h(rhs.h), angle(rhs.angle) `````` gsell committed Mar 15, 2012 160 161 162 163 164 165 166 167 168 169 170 171 172 ``````{} inline const PlanarArcGeometry &PlanarArcGeometry::operator= (const PlanarArcGeometry &rhs) { len = rhs.len; h = rhs.h; angle = rhs.angle; return *this; } #endif // CLASSIC_PlanarArcGeometry_HH ``````