Geant4 Cross Reference |
1 // -*- C++ -*- 1 // -*- C++ -*- >> 2 // $Id:$ 2 // ------------------------------------------- 3 // --------------------------------------------------------------------------- 3 // 4 // 4 // This file is a part of the CLHEP - a Class 5 // This file is a part of the CLHEP - a Class Library for High Energy Physics. 5 // 6 // 6 // Hep geometrical 3D Transformation class 7 // Hep geometrical 3D Transformation class 7 // 8 // 8 // Author: Evgeni Chernyaev <Evgueni.Tcherniae 9 // Author: Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch> 9 // 10 // 10 // ********************************** 11 // ****************************************** 11 // * 12 // * * 12 // * Transform 13 // * Transform * 13 // * / / \ \ 14 // * / / \ \ * 14 // * -------- / \ -------- 15 // * -------- / \ -------- * 15 // * / / \ \ 16 // * / / \ \ * 16 // * Rotate Translate Reflect Sc 17 // * Rotate Translate Reflect Scale * 17 // * / | \ / | \ / | \ / 18 // * / | \ / | \ / | \ / | \ * 18 // * X Y Z X Y Z X Y Z X 19 // * X Y Z X Y Z X Y Z X Y Z * 19 // * 20 // * * 20 // ********************************** 21 // ****************************************** 21 // 22 // 22 // Identity transformation: 23 // Identity transformation: 23 // Transform3D::Identity - global identity 24 // Transform3D::Identity - global identity transformation; 24 // any constructor without parameters, e.g. 25 // any constructor without parameters, e.g. Transform3D(); 25 // m.setIdentity() - set "m" to i 26 // m.setIdentity() - set "m" to identity; 26 // 27 // 27 // General transformations: 28 // General transformations: 28 // Transform3D(m,v) - transformation 29 // Transform3D(m,v) - transformation given by Rotation "m" 29 // and CLHEP::Hep 30 // and CLHEP::Hep3Vector "v"; 30 // Transform3D(a0,a1,a2, b0,b1,b2) - transfo 31 // Transform3D(a0,a1,a2, b0,b1,b2) - transformation given by initial 31 // and transform 32 // and transformed positions of three points; 32 // Rotations: 33 // Rotations: 33 // Rotate3D(m) - rotation given 34 // Rotate3D(m) - rotation given by CLHEP::HepRotation "m"; 34 // Rotate3D(ang,v) - rotation throu 35 // Rotate3D(ang,v) - rotation through the angle "ang" around 35 // vector "v"; 36 // vector "v"; 36 // Rotate3D(ang,p1,p2) - rotation throu 37 // Rotate3D(ang,p1,p2) - rotation through the angle "ang" 37 // counterclockwi 38 // counterclockwise around the axis given by 38 // two points p1- 39 // two points p1->p2; 39 // Rotate3D(a1,a2, b1,b2) - rotation aroun 40 // Rotate3D(a1,a2, b1,b2) - rotation around the origin defined by initial 40 // and transforme 41 // and transformed positions of two points; 41 // RotateX3D(ang) - rotation aroun 42 // RotateX3D(ang) - rotation around X-axis; 42 // RotateY3D(ang) - rotation aroun 43 // RotateY3D(ang) - rotation around Y-axis; 43 // RotateZ3D(ang) - rotation aroun 44 // RotateZ3D(ang) - rotation around Z-axis; 44 // 45 // 45 // Translations: 46 // Translations: 46 // Translate3D(v) - translation gi 47 // Translate3D(v) - translation given by CLHEP::Hep3Vector "v"; 47 // Translate3D(dx,dy,dz) - translation on 48 // Translate3D(dx,dy,dz) - translation on vector (dx,dy,dz); 48 // TraslateX3D(dx) - translation al 49 // TraslateX3D(dx) - translation along X-axis; 49 // TraslateY3D(dy) - translation al 50 // TraslateY3D(dy) - translation along Y-axis; 50 // TraslateZ3D(dz) - translation al 51 // TraslateZ3D(dz) - translation along Z-axis; 51 // 52 // 52 // Reflections: 53 // Reflections: 53 // Reflect3D(a,b,c,d) - reflection in 54 // Reflect3D(a,b,c,d) - reflection in the plane a*x+b*y+c*z+d=0; 54 // Reflect3D(normal,p) - reflection in 55 // Reflect3D(normal,p) - reflection in the plane going through "p" 55 // and whose norm 56 // and whose normal is equal to "normal"; 56 // ReflectX3D(a) - reflect X in t 57 // ReflectX3D(a) - reflect X in the plane x=a (default a=0); 57 // ReflectY3D(a) - reflect Y in t 58 // ReflectY3D(a) - reflect Y in the plane y=a (default a=0); 58 // ReflectZ3D(a) - reflect Z in t 59 // ReflectZ3D(a) - reflect Z in the plane z=a (default a=0); 59 // 60 // 60 // Scalings: 61 // Scalings: 61 // Scale3D(sx,sy,sz) - general scalin 62 // Scale3D(sx,sy,sz) - general scaling with factors "sx","sy","sz" 62 // along X, Y 63 // along X, Y and Z; 63 // Scale3D(s) - scaling with c << 64 // Scale3D(s) - scaling with constant factor "s" along all 64 // directions; 65 // directions; 65 // ScaleX3D(sx) - scale X; 66 // ScaleX3D(sx) - scale X; 66 // ScaleY3D(sy) - scale Y; 67 // ScaleY3D(sy) - scale Y; 67 // ScaleZ3D(sz) - scale Z; 68 // ScaleZ3D(sz) - scale Z; 68 // 69 // 69 // Inverse transformation: 70 // Inverse transformation: 70 // m.inverse() or - returns invers 71 // m.inverse() or - returns inverse transformation; 71 // 72 // 72 // Compound transformation: 73 // Compound transformation: 73 // m3 = m2 * m1 - it is relative 74 // m3 = m2 * m1 - it is relatively slow in comparison with 74 // transformation 75 // transformation of a vector. Use parenthesis 75 // to avoid this 76 // to avoid this operation (see example below); 76 // Transformation of point: 77 // Transformation of point: 77 // p2 = m * p1 78 // p2 = m * p1 78 // 79 // 79 // Transformation of vector: 80 // Transformation of vector: 80 // v2 = m * v1 81 // v2 = m * v1 81 // 82 // 82 // Transformation of normal: 83 // Transformation of normal: 83 // n2 = m * n1 84 // n2 = m * n1 84 // 85 // 85 // The following table explains how different 86 // The following table explains how different transformations affect 86 // point, vector and normal. "+" means affect, 87 // point, vector and normal. "+" means affect, "-" means do not affect, 87 // "*" meas affect but in different way than " << 88 // "*" meas affect but in different way than "+" 88 // 89 // 89 // Point Vector Normal 90 // Point Vector Normal 90 // -------------+-------+-------+------- 91 // -------------+-------+-------+------- 91 // Rotation ! + ! + ! + 92 // Rotation ! + ! + ! + 92 // Translation ! + ! - ! - 93 // Translation ! + ! - ! - 93 // Reflection ! + ! + ! * 94 // Reflection ! + ! + ! * 94 // Scaling ! + ! + ! * 95 // Scaling ! + ! + ! * 95 // -------------+-------+-------+------- 96 // -------------+-------+-------+------- 96 // 97 // 97 // Example of the usage: 98 // Example of the usage: 98 // 99 // 99 // Transform3D m1, m2, m3; 100 // Transform3D m1, m2, m3; 100 // HepVector3D v2, v1(0,0,0); 101 // HepVector3D v2, v1(0,0,0); 101 // 102 // 102 // m1 = Rotate3D(angle, Vector3D(1,1,1)); 103 // m1 = Rotate3D(angle, Vector3D(1,1,1)); 103 // m2 = Translate3D(dx,dy,dz); 104 // m2 = Translate3D(dx,dy,dz); 104 // m3 = m1.inverse(); 105 // m3 = m1.inverse(); 105 // 106 // 106 // v2 = m3*(m2*(m1*v1)); 107 // v2 = m3*(m2*(m1*v1)); 107 // 108 // 108 // History: 109 // History: 109 // 24.09.96 E.Chernyaev - initial version 110 // 24.09.96 E.Chernyaev - initial version 110 // 111 // 111 // 26.02.97 E.Chernyaev 112 // 26.02.97 E.Chernyaev 112 // - added global Identity by request of John << 113 // - added global Identity by request of John Allison 113 // (to avoid problems with compilation on HP << 114 // (to avoid problems with compilation on HP) 114 // - added getRotation and getTranslation << 115 // - added getRotation and getTranslation 115 // 116 // 116 // 29.01.01 E.Chernyaev - added subscripting 117 // 29.01.01 E.Chernyaev - added subscripting 117 // 11.06.01 E.Chernyaev - added getDecompositi 118 // 11.06.01 E.Chernyaev - added getDecomposition 118 119 119 #ifndef HEP_TRANSFROM3D_H 120 #ifndef HEP_TRANSFROM3D_H 120 #define HEP_TRANSFROM3D_H 121 #define HEP_TRANSFROM3D_H 121 122 122 #include "CLHEP/Vector/ThreeVector.h" 123 #include "CLHEP/Vector/ThreeVector.h" 123 124 124 namespace HepGeom { 125 namespace HepGeom { 125 126 126 template<class T> class Point3D; 127 template<class T> class Point3D; 127 template<class T> class Vector3D; 128 template<class T> class Vector3D; 128 template<class T> class Normal3D; 129 template<class T> class Normal3D; 129 130 130 class Translate3D; 131 class Translate3D; 131 class Rotate3D; 132 class Rotate3D; 132 class Scale3D; 133 class Scale3D; 133 134 134 /** 135 /** 135 * Class for transformation of 3D geometrica 136 * Class for transformation of 3D geometrical objects. 136 * It allows different translations, rotatio 137 * It allows different translations, rotations, scalings and reflections. 137 * Several specialized classes are derived f 138 * Several specialized classes are derived from it: 138 * 139 * 139 * TranslateX3D, TranslateY3D, TranslateZ3D, 140 * TranslateX3D, TranslateY3D, TranslateZ3D, Translate3D,<br> 140 * RotateX3D, RotateY3D, RotateZ3D, 141 * RotateX3D, RotateY3D, RotateZ3D, Rotate3D, <br> 141 * ScaleX3D, ScaleY3D, ScaleZ3D, 142 * ScaleX3D, ScaleY3D, ScaleZ3D, Scale3D, <br> 142 * ReflectX3D, ReflectY3D, ReflectZ3D, 143 * ReflectX3D, ReflectY3D, ReflectZ3D, Reflect3D. 143 * 144 * 144 * The idea behind these classes is to provi 145 * The idea behind these classes is to provide some additional constructors 145 * for Transform3D, they normally should not 146 * for Transform3D, they normally should not be used as separate classes. 146 * 147 * 147 * Example: 148 * Example: 148 * @code 149 * @code 149 * HepGeom::Transform3D m; 150 * HepGeom::Transform3D m; 150 * m = HepGeom::TranslateX3D(10.*cm); 151 * m = HepGeom::TranslateX3D(10.*cm); 151 * @endcode 152 * @endcode 152 * 153 * 153 * Remark: 154 * Remark: 154 * For the reason that the operator* is left 155 * For the reason that the operator* is left associative, the notation 155 * @code 156 * @code 156 * v2 = m3*(m2*(m1*v1)); 157 * v2 = m3*(m2*(m1*v1)); 157 * @endcode 158 * @endcode 158 * is much more effective then the notation 159 * is much more effective then the notation 159 * @code 160 * @code 160 * v2 = m3*m2*m1*v1; 161 * v2 = m3*m2*m1*v1; 161 * @endcode 162 * @endcode 162 * In the first case three operations Transf 163 * In the first case three operations Transform3D*Vector3D are executed, 163 * in the second case two operations Transfo 164 * in the second case two operations Transform3D*Transform3D and one 164 * Transform3D*Vector3D are performed. Trans 165 * Transform3D*Vector3D are performed. Transform3D*Transform3D is 165 * roughly three times slower than Transform 166 * roughly three times slower than Transform3D*Vector3D. 166 * 167 * 167 * @author <Evgueni.Tcherniaev@cern.ch> 168 * @author <Evgueni.Tcherniaev@cern.ch> 168 * @ingroup geometry 169 * @ingroup geometry 169 */ 170 */ 170 class Transform3D { 171 class Transform3D { 171 protected: 172 protected: 172 double xx_, xy_, xz_, dx_, // 4x3 Tra 173 double xx_, xy_, xz_, dx_, // 4x3 Transformation Matrix 173 yx_, yy_, yz_, dy_, 174 yx_, yy_, yz_, dy_, 174 zx_, zy_, zz_, dz_; 175 zx_, zy_, zz_, dz_; 175 176 176 // Protected constructor 177 // Protected constructor 177 Transform3D(double XX, double XY, double X 178 Transform3D(double XX, double XY, double XZ, double DX, 178 double YX, double YY, double YZ, double DY 179 double YX, double YY, double YZ, double DY, 179 double ZX, double ZY, double ZZ, double DZ 180 double ZX, double ZY, double ZZ, double DZ) 180 : xx_(XX), xy_(XY), xz_(XZ), dx_(DX), 181 : xx_(XX), xy_(XY), xz_(XZ), dx_(DX), 181 yx_(YX), yy_(YY), yz_(YZ), dy_(DY), 182 yx_(YX), yy_(YY), yz_(YZ), dy_(DY), 182 zx_(ZX), zy_(ZY), zz_(ZZ), dz_(DZ) {} 183 zx_(ZX), zy_(ZY), zz_(ZZ), dz_(DZ) {} 183 184 184 // Set transformation matrix 185 // Set transformation matrix 185 void setTransform(double XX, double XY, do 186 void setTransform(double XX, double XY, double XZ, double DX, 186 double YX, double YY, double YZ, dou 187 double YX, double YY, double YZ, double DY, 187 double ZX, double ZY, double ZZ, dou 188 double ZX, double ZY, double ZZ, double DZ) { 188 xx_ = XX; xy_ = XY; xz_ = XZ; dx_ = DX; 189 xx_ = XX; xy_ = XY; xz_ = XZ; dx_ = DX; 189 yx_ = YX; yy_ = YY; yz_ = YZ; dy_ = DY; 190 yx_ = YX; yy_ = YY; yz_ = YZ; dy_ = DY; 190 zx_ = ZX; zy_ = ZY; zz_ = ZZ; dz_ = DZ; 191 zx_ = ZX; zy_ = ZY; zz_ = ZZ; dz_ = DZ; 191 } 192 } 192 193 193 public: 194 public: 194 /** 195 /** 195 * Global identity transformation. */ 196 * Global identity transformation. */ 196 DLL_API static const Transform3D Identity; 197 DLL_API static const Transform3D Identity; 197 198 198 // Helper class for implemention of C-styl << 199 // Helper class for implemention of C-style subscripting r[i][j] 199 class Transform3D_row { 200 class Transform3D_row { 200 public: 201 public: 201 inline Transform3D_row(const Transform3D 202 inline Transform3D_row(const Transform3D &, int); 202 inline double operator [] (int) const; 203 inline double operator [] (int) const; 203 private: 204 private: 204 const Transform3D & rr; 205 const Transform3D & rr; 205 int ii; 206 int ii; 206 }; 207 }; 207 208 208 /** 209 /** 209 * Default constructor - sets the Identity 210 * Default constructor - sets the Identity transformation. */ 210 Transform3D() 211 Transform3D() 211 : xx_(1), xy_(0), xz_(0), dx_(0), 212 : xx_(1), xy_(0), xz_(0), dx_(0), 212 yx_(0), yy_(1), yz_(0), dy_(0), 213 yx_(0), yy_(1), yz_(0), dy_(0), 213 zx_(0), zy_(0), zz_(1), dz_(0) {} 214 zx_(0), zy_(0), zz_(1), dz_(0) {} 214 << 215 215 /** 216 /** 216 * Constructor: rotation and then translat 217 * Constructor: rotation and then translation. */ 217 inline Transform3D(const CLHEP::HepRotatio << 218 inline Transform3D(const CLHEP::HepRotation & m, const CLHEP::Hep3Vector & v); 218 219 219 /** 220 /** 220 * Constructor: transformation of basis (a 221 * Constructor: transformation of basis (assumed - no reflection). */ 221 Transform3D(const Point3D<double> & fr0, 222 Transform3D(const Point3D<double> & fr0, 222 const Point3D<double> & fr1, 223 const Point3D<double> & fr1, 223 const Point3D<double> & fr2, 224 const Point3D<double> & fr2, 224 const Point3D<double> & to0, 225 const Point3D<double> & to0, 225 const Point3D<double> & to1, 226 const Point3D<double> & to1, 226 const Point3D<double> & to2); 227 const Point3D<double> & to2); 227 228 228 /** 229 /** 229 * Copy constructor. */ 230 * Copy constructor. */ 230 Transform3D(const Transform3D & mt) = defa << 231 Transform3D(const Transform3D & m) 231 << 232 : xx_(m.xx_), xy_(m.xy_), xz_(m.xz_), dx_(m.dx_), 232 /** << 233 yx_(m.yx_), yy_(m.yy_), yz_(m.yz_), dy_(m.dy_), 233 * Move constructor. */ << 234 zx_(m.zx_), zy_(m.zy_), zz_(m.zz_), dz_(m.dz_) {} 234 Transform3D(Transform3D && mt) = default; << 235 << 236 /** << 237 * Destructor. */ << 238 ~Transform3D() = default; << 239 << 240 /** << 241 * Assignment. */ << 242 Transform3D & operator=(const Transform3D << 243 235 244 /** 236 /** 245 * Move assignment. */ << 237 * Destructor. 246 Transform3D & operator=(Transform3D && mt) << 238 * Virtual for now as some persistency mechanism needs that, >> 239 * in future releases this might go away again. >> 240 */ >> 241 ~Transform3D() { /* nop */ } 247 242 248 /** 243 /** 249 * Returns object of the helper class for 244 * Returns object of the helper class for C-style subscripting r[i][j] */ 250 inline const Transform3D_row operator [] ( << 245 inline const Transform3D_row operator [] (int) const; 251 246 252 /** Fortran-style subscripting: returns (i 247 /** Fortran-style subscripting: returns (i,j) element of the matrix. */ 253 double operator () (int, int) const; 248 double operator () (int, int) const; 254 249 255 /** 250 /** 256 * Gets xx-element of the transformation m 251 * Gets xx-element of the transformation matrix. */ 257 double xx() const { return xx_; } 252 double xx() const { return xx_; } 258 /** 253 /** 259 * Gets xy-element of the transformation m 254 * Gets xy-element of the transformation matrix. */ 260 double xy() const { return xy_; } 255 double xy() const { return xy_; } 261 /** 256 /** 262 * Gets xz-element of the transformation m 257 * Gets xz-element of the transformation matrix. */ 263 double xz() const { return xz_; } 258 double xz() const { return xz_; } 264 /** 259 /** 265 * Gets yx-element of the transformation m 260 * Gets yx-element of the transformation matrix. */ 266 double yx() const { return yx_; } 261 double yx() const { return yx_; } 267 /** 262 /** 268 * Gets yy-element of the transformation m 263 * Gets yy-element of the transformation matrix. */ 269 double yy() const { return yy_; } 264 double yy() const { return yy_; } 270 /** 265 /** 271 * Gets yz-element of the transformation m 266 * Gets yz-element of the transformation matrix. */ 272 double yz() const { return yz_; } 267 double yz() const { return yz_; } 273 /** << 268 /** 274 * Gets zx-element of the transformation m 269 * Gets zx-element of the transformation matrix. */ 275 double zx() const { return zx_; } 270 double zx() const { return zx_; } 276 /** 271 /** 277 * Gets zy-element of the transformation m 272 * Gets zy-element of the transformation matrix. */ 278 double zy() const { return zy_; } 273 double zy() const { return zy_; } 279 /** 274 /** 280 * Gets zz-element of the transformation m 275 * Gets zz-element of the transformation matrix. */ 281 double zz() const { return zz_; } 276 double zz() const { return zz_; } 282 /** 277 /** 283 * Gets dx-element of the transformation m 278 * Gets dx-element of the transformation matrix. */ 284 double dx() const { return dx_; } 279 double dx() const { return dx_; } 285 /** 280 /** 286 * Gets dy-element of the transformation m 281 * Gets dy-element of the transformation matrix. */ 287 double dy() const { return dy_; } 282 double dy() const { return dy_; } 288 /** 283 /** 289 * Gets dz-element of the transformation m 284 * Gets dz-element of the transformation matrix. */ 290 double dz() const { return dz_; } 285 double dz() const { return dz_; } >> 286 >> 287 /** >> 288 * Assignment. */ >> 289 Transform3D & operator=(const Transform3D &m) { >> 290 xx_= m.xx_; xy_= m.xy_; xz_= m.xz_; dx_= m.dx_; >> 291 yx_= m.yx_; yy_= m.yy_; yz_= m.yz_; dy_= m.dy_; >> 292 zx_= m.zx_; zy_= m.zy_; zz_= m.zz_; dz_= m.dz_; >> 293 return *this; >> 294 } 291 295 292 /** 296 /** 293 * Sets the Identity transformation. */ 297 * Sets the Identity transformation. */ 294 void setIdentity() { << 298 void setIdentity() { 295 xy_= xz_= dx_= yx_= yz_= dy_= zx_= zy_= 299 xy_= xz_= dx_= yx_= yz_= dy_= zx_= zy_= dz_= 0; xx_= yy_= zz_= 1; 296 } 300 } 297 << 301 298 /** 302 /** 299 * Returns the inverse transformation. */ 303 * Returns the inverse transformation. */ 300 Transform3D inverse() const; 304 Transform3D inverse() const; 301 << 305 302 /** 306 /** 303 * Transformation by another Transform3D. 307 * Transformation by another Transform3D. */ 304 Transform3D operator*(const Transform3D & 308 Transform3D operator*(const Transform3D & b) const; 305 << 309 306 /** 310 /** 307 * Decomposition of general transformation 311 * Decomposition of general transformation. 308 * This function gets decomposition of the 312 * This function gets decomposition of the transformation 309 * in three consequentive specific transfo 313 * in three consequentive specific transformations: Scale3D, 310 * then Rotate3D, then Translate3, i.e. 314 * then Rotate3D, then Translate3, i.e. 311 * @code 315 * @code 312 * Transform3D = Translate3D * Rotate3D 316 * Transform3D = Translate3D * Rotate3D * Scale3D 313 * @endcode 317 * @endcode 314 * 318 * 315 * @param scale output: scaling tran 319 * @param scale output: scaling transformation; 316 * if there was a refle 320 * if there was a reflection, then scale factor for 317 * z-component (scale(2 321 * z-component (scale(2,2)) will be negative. 318 * @param rotation output: rotation tra 322 * @param rotation output: rotation transformaion. 319 * @param translation output: translation 323 * @param translation output: translation transformaion. 320 */ 324 */ 321 void getDecomposition(Scale3D & scale, 325 void getDecomposition(Scale3D & scale, 322 Rotate3D & rotation, 326 Rotate3D & rotation, 323 Translate3D & translation) const; 327 Translate3D & translation) const; 324 328 325 /** 329 /** 326 * Returns true if the difference between 330 * Returns true if the difference between corresponding 327 * matrix elements is less than the tolera 331 * matrix elements is less than the tolerance. 328 */ 332 */ 329 bool isNear(const Transform3D & t, double 333 bool isNear(const Transform3D & t, double tolerance = 2.2E-14 ) const; 330 334 331 /** 335 /** 332 * Extracts the rotation matrix. 336 * Extracts the rotation matrix. 333 * This functions is obsolete - use getDec 337 * This functions is obsolete - use getDecomposition() instead. 334 */ 338 */ 335 inline CLHEP::HepRotation getRotation() co 339 inline CLHEP::HepRotation getRotation() const; 336 << 340 337 /** 341 /** 338 * Extracts the translation vector. 342 * Extracts the translation vector. 339 * This functions is obsolete - use getDec 343 * This functions is obsolete - use getDecomposition() instead. 340 */ 344 */ 341 inline CLHEP::Hep3Vector getTranslation() 345 inline CLHEP::Hep3Vector getTranslation() const; 342 << 346 343 /** 347 /** 344 * Test for equality. */ 348 * Test for equality. */ 345 bool operator == (const Transform3D & tran 349 bool operator == (const Transform3D & transform) const; 346 << 350 347 /** 351 /** 348 * Test for inequality. */ 352 * Test for inequality. */ 349 bool operator != (const Transform3D & tran 353 bool operator != (const Transform3D & transform) const { 350 return ! operator==(transform); 354 return ! operator==(transform); 351 } 355 } 352 }; 356 }; 353 357 354 // R O T A T I O N S 358 // R O T A T I O N S 355 359 356 /** 360 /** 357 * Constructs a rotation transformation. 361 * Constructs a rotation transformation. 358 * This class provides additional constructo 362 * This class provides additional constructors for Transform3D 359 * and should not be used as a separate clas 363 * and should not be used as a separate class. 360 * << 364 * 361 * Example of use: 365 * Example of use: 362 * @code 366 * @code 363 * Transform3D m; 367 * Transform3D m; 364 * m = Rotate3D(30.*deg, HepVector3D(1.,1. 368 * m = Rotate3D(30.*deg, HepVector3D(1.,1.,1.)); 365 * @endcode 369 * @endcode 366 * 370 * 367 * @author <Evgueni.Tcherniaev@cern.ch> 371 * @author <Evgueni.Tcherniaev@cern.ch> 368 * @ingroup geometry 372 * @ingroup geometry 369 */ 373 */ 370 class Rotate3D : public Transform3D { 374 class Rotate3D : public Transform3D { 371 public: 375 public: 372 /** 376 /** 373 * Default constructor: sets the Identity 377 * Default constructor: sets the Identity transformation. */ 374 Rotate3D() : Transform3D() {} 378 Rotate3D() : Transform3D() {} 375 << 379 376 /** 380 /** 377 * Constructor from CLHEP::HepRotation. */ 381 * Constructor from CLHEP::HepRotation. */ 378 inline Rotate3D(const CLHEP::HepRotation & << 382 inline Rotate3D(const CLHEP::HepRotation &m); 379 383 380 /** 384 /** 381 * Constructor from angle and axis given b 385 * Constructor from angle and axis given by two points. 382 * @param a angle of rotation 386 * @param a angle of rotation 383 * @param p1 begin point of the axis 387 * @param p1 begin point of the axis 384 * @param p2 end point of the axis 388 * @param p2 end point of the axis 385 */ 389 */ 386 Rotate3D(double a, 390 Rotate3D(double a, 387 const Point3D<double> & p1, 391 const Point3D<double> & p1, 388 const Point3D<double> & p2); 392 const Point3D<double> & p2); 389 << 393 390 /** 394 /** 391 * Constructor from angle and axis. 395 * Constructor from angle and axis. 392 * @param a angle of rotation 396 * @param a angle of rotation 393 * @param v axis of rotation 397 * @param v axis of rotation 394 */ 398 */ 395 inline Rotate3D(double a, const Vector3D<d 399 inline Rotate3D(double a, const Vector3D<double> & v); 396 400 397 /** 401 /** 398 * Constructor for rotation given by origi 402 * Constructor for rotation given by original and rotated position of 399 * two points. It is assumed that there is 403 * two points. It is assumed that there is no reflection. 400 * @param fr1 original position of 1st poi 404 * @param fr1 original position of 1st point 401 * @param fr2 original position of 2nd poi 405 * @param fr2 original position of 2nd point 402 * @param to1 rotated position of 1st poin 406 * @param to1 rotated position of 1st point 403 * @param to2 rotated position of 2nd poin 407 * @param to2 rotated position of 2nd point 404 */ 408 */ 405 inline Rotate3D(const Point3D<double> & fr 409 inline Rotate3D(const Point3D<double> & fr1, 406 const Point3D<double> & fr2, 410 const Point3D<double> & fr2, 407 const Point3D<double> & to1, 411 const Point3D<double> & to1, 408 const Point3D<double> & to2); 412 const Point3D<double> & to2); 409 }; 413 }; 410 414 411 /** 415 /** 412 * Constructs a rotation around x-axis. 416 * Constructs a rotation around x-axis. 413 * This class provides additional constructo 417 * This class provides additional constructors for Transform3D 414 * and should not be used as a separate clas 418 * and should not be used as a separate class. 415 * << 419 * 416 * Example of use: 420 * Example of use: 417 * @code 421 * @code 418 * Transform3D m; 422 * Transform3D m; 419 * m = RotateX3D(30.*deg); 423 * m = RotateX3D(30.*deg); 420 * @endcode 424 * @endcode 421 * 425 * 422 * @author <Evgueni.Tcherniaev@cern.ch> 426 * @author <Evgueni.Tcherniaev@cern.ch> 423 * @ingroup geometry 427 * @ingroup geometry 424 */ 428 */ 425 class RotateX3D : public Rotate3D { 429 class RotateX3D : public Rotate3D { 426 public: 430 public: 427 /** 431 /** 428 * Default constructor: sets the Identity 432 * Default constructor: sets the Identity transformation. */ 429 RotateX3D() : Rotate3D() {} 433 RotateX3D() : Rotate3D() {} 430 << 434 431 /** 435 /** 432 * Constructs a rotation around x-axis by 436 * Constructs a rotation around x-axis by angle a. */ 433 RotateX3D(double a) { 437 RotateX3D(double a) { 434 double cosa = std::cos(a), sina = std::s << 438 double cosa = std::cos(a), sina = std::sin(a); 435 setTransform(1,0,0,0, 0,cosa,-sina,0, 439 setTransform(1,0,0,0, 0,cosa,-sina,0, 0,sina,cosa,0); 436 } 440 } 437 }; 441 }; 438 442 439 /** 443 /** 440 * Constructs a rotation around y-axis. 444 * Constructs a rotation around y-axis. 441 * This class provides additional constructo 445 * This class provides additional constructors for Transform3D 442 * and should not be used as a separate clas 446 * and should not be used as a separate class. 443 * << 447 * 444 * Example of use: 448 * Example of use: 445 * @code 449 * @code 446 * Transform3D m; 450 * Transform3D m; 447 * m = RotateY3D(30.*deg); 451 * m = RotateY3D(30.*deg); 448 * @endcode 452 * @endcode 449 * 453 * 450 * @author <Evgueni.Tcherniaev@cern.ch> 454 * @author <Evgueni.Tcherniaev@cern.ch> 451 * @ingroup geometry 455 * @ingroup geometry 452 */ 456 */ 453 class RotateY3D : public Rotate3D { 457 class RotateY3D : public Rotate3D { 454 public: 458 public: 455 /** 459 /** 456 * Default constructor: sets the Identity 460 * Default constructor: sets the Identity transformation. */ 457 RotateY3D() : Rotate3D() {} 461 RotateY3D() : Rotate3D() {} 458 << 462 459 /** 463 /** 460 * Constructs a rotation around y-axis by 464 * Constructs a rotation around y-axis by angle a. */ 461 RotateY3D(double a) { 465 RotateY3D(double a) { 462 double cosa = std::cos(a), sina = std::s << 466 double cosa = std::cos(a), sina = std::sin(a); 463 setTransform(cosa,0,sina,0, 0,1,0,0, - 467 setTransform(cosa,0,sina,0, 0,1,0,0, -sina,0,cosa,0); 464 } 468 } 465 }; 469 }; 466 470 467 /** 471 /** 468 * Constructs a rotation around z-axis. 472 * Constructs a rotation around z-axis. 469 * This class provides additional constructo 473 * This class provides additional constructors for Transform3D 470 * and should not be used as a separate clas 474 * and should not be used as a separate class. 471 * << 475 * 472 * Example of use: 476 * Example of use: 473 * @code 477 * @code 474 * Transform3D m; 478 * Transform3D m; 475 * m = RotateZ3D(30.*deg); 479 * m = RotateZ3D(30.*deg); 476 * @endcode 480 * @endcode 477 * 481 * 478 * @author <Evgueni.Tcherniaev@cern.ch> 482 * @author <Evgueni.Tcherniaev@cern.ch> 479 * @ingroup geometry 483 * @ingroup geometry 480 */ 484 */ 481 class RotateZ3D : public Rotate3D { 485 class RotateZ3D : public Rotate3D { 482 public: 486 public: 483 /** 487 /** 484 * Default constructor: sets the Identity 488 * Default constructor: sets the Identity transformation. */ 485 RotateZ3D() : Rotate3D() {} 489 RotateZ3D() : Rotate3D() {} 486 << 490 487 /** 491 /** 488 * Constructs a rotation around z-axis by 492 * Constructs a rotation around z-axis by angle a. */ 489 RotateZ3D(double a) { 493 RotateZ3D(double a) { 490 double cosa = std::cos(a), sina = std::s << 494 double cosa = std::cos(a), sina = std::sin(a); 491 setTransform(cosa,-sina,0,0, sina,cosa, 495 setTransform(cosa,-sina,0,0, sina,cosa,0,0, 0,0,1,0); 492 } 496 } 493 }; 497 }; 494 498 495 // T R A N S L A T I O N S 499 // T R A N S L A T I O N S 496 << 500 497 /** 501 /** 498 * Constructs a translation transformation. 502 * Constructs a translation transformation. 499 * This class provides additional constructo 503 * This class provides additional constructors for Transform3D 500 * and should not be used as a separate clas 504 * and should not be used as a separate class. 501 * << 505 * 502 * Example of use: 506 * Example of use: 503 * @code 507 * @code 504 * Transform3D m; 508 * Transform3D m; 505 * m = Translate3D(10.,20.,30.); 509 * m = Translate3D(10.,20.,30.); 506 * @endcode 510 * @endcode 507 * 511 * 508 * @author <Evgueni.Tcherniaev@cern.ch> 512 * @author <Evgueni.Tcherniaev@cern.ch> 509 * @ingroup geometry 513 * @ingroup geometry 510 */ 514 */ 511 class Translate3D : public Transform3D { 515 class Translate3D : public Transform3D { 512 public: 516 public: 513 /** 517 /** 514 * Default constructor: sets the Identity 518 * Default constructor: sets the Identity transformation. */ 515 Translate3D() : Transform3D() {} 519 Translate3D() : Transform3D() {} 516 << 520 517 /** 521 /** 518 * Constructor from CLHEP::Hep3Vector. */ 522 * Constructor from CLHEP::Hep3Vector. */ 519 inline Translate3D(const CLHEP::Hep3Vector 523 inline Translate3D(const CLHEP::Hep3Vector &v); 520 << 524 521 /** 525 /** 522 * Constructor from three numbers. */ 526 * Constructor from three numbers. */ 523 Translate3D(double x, double y, double z) 527 Translate3D(double x, double y, double z) 524 : Transform3D(1,0,0,x, 0,1,0,y, 0,0,1,z) 528 : Transform3D(1,0,0,x, 0,1,0,y, 0,0,1,z) {} 525 }; 529 }; 526 530 527 /** 531 /** 528 * Constructs a translation along x-axis. 532 * Constructs a translation along x-axis. 529 * This class provides additional constructo 533 * This class provides additional constructors for Transform3D 530 * and should not be used as a separate clas 534 * and should not be used as a separate class. 531 * << 535 * 532 * Example of use: 536 * Example of use: 533 * @code 537 * @code 534 * Transform3D m; 538 * Transform3D m; 535 * m = TranslateX3D(10.); 539 * m = TranslateX3D(10.); 536 * @endcode 540 * @endcode 537 * 541 * 538 * @author <Evgueni.Tcherniaev@cern.ch> 542 * @author <Evgueni.Tcherniaev@cern.ch> 539 * @ingroup geometry 543 * @ingroup geometry 540 */ 544 */ 541 class TranslateX3D : public Translate3D { 545 class TranslateX3D : public Translate3D { 542 public: 546 public: 543 /** 547 /** 544 * Default constructor: sets the Identity 548 * Default constructor: sets the Identity transformation. */ 545 TranslateX3D() : Translate3D() {} 549 TranslateX3D() : Translate3D() {} 546 << 550 547 /** 551 /** 548 * Constructor from a number. */ 552 * Constructor from a number. */ 549 TranslateX3D(double x) : Translate3D(x, 0, 553 TranslateX3D(double x) : Translate3D(x, 0, 0) {} 550 }; 554 }; 551 555 552 /** 556 /** 553 * Constructs a translation along y-axis. 557 * Constructs a translation along y-axis. 554 * This class provides additional constructo 558 * This class provides additional constructors for Transform3D 555 * and should not be used as a separate clas 559 * and should not be used as a separate class. 556 * << 560 * 557 * Example of use: 561 * Example of use: 558 * @code 562 * @code 559 * Transform3D m; 563 * Transform3D m; 560 * m = TranslateY3D(10.); 564 * m = TranslateY3D(10.); 561 * @endcode 565 * @endcode 562 * 566 * 563 * @author <Evgueni.Tcherniaev@cern.ch> 567 * @author <Evgueni.Tcherniaev@cern.ch> 564 * @ingroup geometry 568 * @ingroup geometry 565 */ 569 */ 566 class TranslateY3D : public Translate3D { 570 class TranslateY3D : public Translate3D { 567 public: 571 public: 568 /** 572 /** 569 * Default constructor: sets the Identity 573 * Default constructor: sets the Identity transformation. */ 570 TranslateY3D() : Translate3D() {} 574 TranslateY3D() : Translate3D() {} 571 575 572 /** 576 /** 573 * Constructor from a number. */ 577 * Constructor from a number. */ 574 TranslateY3D(double y) : Translate3D(0, y, 578 TranslateY3D(double y) : Translate3D(0, y, 0) {} 575 }; 579 }; 576 580 577 /** 581 /** 578 * Constructs a translation along z-axis. 582 * Constructs a translation along z-axis. 579 * This class provides additional constructo 583 * This class provides additional constructors for Transform3D 580 * and should not be used as a separate clas 584 * and should not be used as a separate class. 581 * << 585 * 582 * Example of use: 586 * Example of use: 583 * @code 587 * @code 584 * Transform3D m; 588 * Transform3D m; 585 * m = TranslateZ3D(10.); 589 * m = TranslateZ3D(10.); 586 * @endcode 590 * @endcode 587 * 591 * 588 * @author <Evgueni.Tcherniaev@cern.ch> 592 * @author <Evgueni.Tcherniaev@cern.ch> 589 * @ingroup geometry 593 * @ingroup geometry 590 */ 594 */ 591 class TranslateZ3D : public Translate3D { 595 class TranslateZ3D : public Translate3D { 592 public: 596 public: 593 /** 597 /** 594 * Default constructor: sets the Identity 598 * Default constructor: sets the Identity transformation. */ 595 TranslateZ3D() : Translate3D() {} 599 TranslateZ3D() : Translate3D() {} 596 600 597 /** 601 /** 598 * Constructor from a number. */ 602 * Constructor from a number. */ 599 TranslateZ3D(double z) : Translate3D(0, 0, 603 TranslateZ3D(double z) : Translate3D(0, 0, z) {} 600 }; 604 }; 601 605 602 // R E F L E C T I O N S 606 // R E F L E C T I O N S 603 607 604 /** 608 /** 605 * Constructs a reflection transformation. 609 * Constructs a reflection transformation. 606 * This class provides additional constructo 610 * This class provides additional constructors for Transform3D 607 * and should not be used as a separate clas 611 * and should not be used as a separate class. 608 * << 612 * 609 * Example of use: 613 * Example of use: 610 * @code 614 * @code 611 * Transform3D m; 615 * Transform3D m; 612 * m = Reflect3D(1.,1.,1.,0.); 616 * m = Reflect3D(1.,1.,1.,0.); 613 * @endcode 617 * @endcode 614 * 618 * 615 * @author <Evgueni.Tcherniaev@cern.ch> 619 * @author <Evgueni.Tcherniaev@cern.ch> 616 * @ingroup geometry 620 * @ingroup geometry 617 */ 621 */ 618 class Reflect3D : public Transform3D { 622 class Reflect3D : public Transform3D { 619 protected: 623 protected: 620 Reflect3D(double XX, double XY, double XZ, 624 Reflect3D(double XX, double XY, double XZ, double DX, 621 double YX, double YY, double YZ, << 625 double YX, double YY, double YZ, double DY, 622 double ZX, double ZY, double ZZ, << 626 double ZX, double ZY, double ZZ, double DZ) 623 : Transform3D(XX,XY,XZ,DX, YX,YY,YZ,DY, 627 : Transform3D(XX,XY,XZ,DX, YX,YY,YZ,DY, ZX,ZY,ZZ,DZ) {} 624 628 625 public: 629 public: 626 /** 630 /** 627 * Default constructor: sets the Identity 631 * Default constructor: sets the Identity transformation. */ 628 Reflect3D() : Transform3D() {} 632 Reflect3D() : Transform3D() {} 629 633 630 /** 634 /** 631 * Constructor from four numbers. 635 * Constructor from four numbers. 632 * Sets reflection in a plane a*x+b*y+c*z+ 636 * Sets reflection in a plane a*x+b*y+c*z+d=0 633 */ 637 */ 634 Reflect3D(double a, double b, double c, do 638 Reflect3D(double a, double b, double c, double d); 635 639 636 /** 640 /** 637 * Constructor from a plane given by its n 641 * Constructor from a plane given by its normal and origin. */ 638 inline Reflect3D(const Normal3D<double> & 642 inline Reflect3D(const Normal3D<double> & normal, 639 const Point3D<double> & p << 643 const Point3D<double> & point); 640 }; 644 }; 641 645 642 /** 646 /** 643 * Constructs reflection in a plane x=const. 647 * Constructs reflection in a plane x=const. 644 * This class provides additional constructo 648 * This class provides additional constructors for Transform3D 645 * and should not be used as a separate clas 649 * and should not be used as a separate class. 646 * << 650 * 647 * Example of use: 651 * Example of use: 648 * @code 652 * @code 649 * Transform3D m; 653 * Transform3D m; 650 * m = ReflectX3D(1.); 654 * m = ReflectX3D(1.); 651 * @endcode 655 * @endcode 652 * 656 * 653 * @author <Evgueni.Tcherniaev@cern.ch> 657 * @author <Evgueni.Tcherniaev@cern.ch> 654 * @ingroup geometry 658 * @ingroup geometry 655 */ 659 */ 656 class ReflectX3D : public Reflect3D { 660 class ReflectX3D : public Reflect3D { 657 public: 661 public: 658 /** 662 /** 659 * Constructor from a number. */ 663 * Constructor from a number. */ 660 ReflectX3D(double x=0) : Reflect3D(-1,0,0, 664 ReflectX3D(double x=0) : Reflect3D(-1,0,0,x+x, 0,1,0,0, 0,0,1,0) {} 661 }; 665 }; 662 << 666 663 /** 667 /** 664 * Constructs reflection in a plane y=const. 668 * Constructs reflection in a plane y=const. 665 * This class provides additional constructo 669 * This class provides additional constructors for Transform3D 666 * and should not be used as a separate clas 670 * and should not be used as a separate class. 667 * << 671 * 668 * Example of use: 672 * Example of use: 669 * @code 673 * @code 670 * Transform3D m; 674 * Transform3D m; 671 * m = ReflectY3D(1.); 675 * m = ReflectY3D(1.); 672 * @endcode 676 * @endcode 673 * 677 * 674 * @author <Evgueni.Tcherniaev@cern.ch> 678 * @author <Evgueni.Tcherniaev@cern.ch> 675 * @ingroup geometry 679 * @ingroup geometry 676 */ 680 */ 677 class ReflectY3D : public Reflect3D { 681 class ReflectY3D : public Reflect3D { 678 public: 682 public: 679 /** 683 /** 680 * Constructor from a number. */ 684 * Constructor from a number. */ 681 ReflectY3D(double y=0) : Reflect3D(1,0,0,0 685 ReflectY3D(double y=0) : Reflect3D(1,0,0,0, 0,-1,0,y+y, 0,0,1,0) {} 682 }; 686 }; 683 << 687 684 /** 688 /** 685 * Constructs reflection in a plane z=const. 689 * Constructs reflection in a plane z=const. 686 * This class provides additional constructo 690 * This class provides additional constructors for Transform3D 687 * and should not be used as a separate clas 691 * and should not be used as a separate class. 688 * << 692 * 689 * Example of use: 693 * Example of use: 690 * @code 694 * @code 691 * Transform3D m; 695 * Transform3D m; 692 * m = ReflectZ3D(1.); 696 * m = ReflectZ3D(1.); 693 * @endcode 697 * @endcode 694 * 698 * 695 * @author <Evgueni.Tcherniaev@cern.ch> 699 * @author <Evgueni.Tcherniaev@cern.ch> 696 * @ingroup geometry 700 * @ingroup geometry 697 */ 701 */ 698 class ReflectZ3D : public Reflect3D { 702 class ReflectZ3D : public Reflect3D { 699 public: 703 public: 700 /** 704 /** 701 * Constructor from a number. */ 705 * Constructor from a number. */ 702 ReflectZ3D(double z=0) : Reflect3D(1,0,0,0 706 ReflectZ3D(double z=0) : Reflect3D(1,0,0,0, 0,1,0,0, 0,0,-1,z+z) {} 703 }; 707 }; 704 << 708 705 // S C A L I N G S 709 // S C A L I N G S 706 710 707 /** 711 /** 708 * Constructs a scaling transformation. 712 * Constructs a scaling transformation. 709 * This class provides additional constructo 713 * This class provides additional constructors for Transform3D 710 * and should not be used as a separate clas 714 * and should not be used as a separate class. 711 * << 715 * 712 * Example of use: 716 * Example of use: 713 * @code 717 * @code 714 * Transform3D m; 718 * Transform3D m; 715 * m = Scale3D(2.); 719 * m = Scale3D(2.); 716 * @endcode 720 * @endcode 717 * 721 * 718 * @author <Evgueni.Tcherniaev@cern.ch> 722 * @author <Evgueni.Tcherniaev@cern.ch> 719 * @ingroup geometry 723 * @ingroup geometry 720 */ 724 */ 721 class Scale3D : public Transform3D { 725 class Scale3D : public Transform3D { 722 public: 726 public: 723 /** 727 /** 724 * Default constructor: sets the Identity 728 * Default constructor: sets the Identity transformation. */ 725 Scale3D() : Transform3D() {} 729 Scale3D() : Transform3D() {} 726 730 727 /** 731 /** 728 * Constructor from three numbers - scale 732 * Constructor from three numbers - scale factors in different directions. 729 */ 733 */ 730 Scale3D(double x, double y, double z) 734 Scale3D(double x, double y, double z) 731 : Transform3D(x,0,0,0, 0,y,0,0, 0,0,z,0) 735 : Transform3D(x,0,0,0, 0,y,0,0, 0,0,z,0) {} 732 736 733 /** 737 /** 734 * Constructor from a number: sets uniform 738 * Constructor from a number: sets uniform scaling in all directions. */ 735 Scale3D(double sc) << 739 Scale3D(double s) 736 : Transform3D(sc,0,0,0, 0,sc,0,0, 0,0,sc << 740 : Transform3D(s,0,0,0, 0,s,0,0, 0,0,s,0) {} 737 }; 741 }; 738 742 739 /** 743 /** 740 * Constructs a scaling transformation in x- 744 * Constructs a scaling transformation in x-direction. 741 * This class provides additional constructo 745 * This class provides additional constructors for Transform3D 742 * and should not be used as a separate clas 746 * and should not be used as a separate class. 743 * << 747 * 744 * Example of use: 748 * Example of use: 745 * @code 749 * @code 746 * Transform3D m; 750 * Transform3D m; 747 * m = ScaleX3D(2.); 751 * m = ScaleX3D(2.); 748 * @endcode 752 * @endcode 749 * 753 * 750 * @author <Evgueni.Tcherniaev@cern.ch> 754 * @author <Evgueni.Tcherniaev@cern.ch> 751 * @ingroup geometry 755 * @ingroup geometry 752 */ 756 */ 753 class ScaleX3D : public Scale3D { 757 class ScaleX3D : public Scale3D { 754 public: 758 public: 755 /** 759 /** 756 * Default constructor: sets the Identity 760 * Default constructor: sets the Identity transformation. */ 757 ScaleX3D() : Scale3D() {} 761 ScaleX3D() : Scale3D() {} 758 762 759 /** 763 /** 760 * Constructor from a number (scale factor 764 * Constructor from a number (scale factor in x-direction). */ 761 ScaleX3D(double x) : Scale3D(x, 1, 1) {} 765 ScaleX3D(double x) : Scale3D(x, 1, 1) {} 762 }; 766 }; 763 767 764 /** 768 /** 765 * Constructs a scaling transformation in y- 769 * Constructs a scaling transformation in y-direction. 766 * This class provides additional constructo 770 * This class provides additional constructors for Transform3D 767 * and should not be used as a separate clas 771 * and should not be used as a separate class. 768 * << 772 * 769 * Example of use: 773 * Example of use: 770 * @code 774 * @code 771 * Transform3D m; 775 * Transform3D m; 772 * m = ScaleY3D(2.); 776 * m = ScaleY3D(2.); 773 * @endcode 777 * @endcode 774 * 778 * 775 * @author <Evgueni.Tcherniaev@cern.ch> 779 * @author <Evgueni.Tcherniaev@cern.ch> 776 * @ingroup geometry 780 * @ingroup geometry 777 */ 781 */ 778 class ScaleY3D : public Scale3D { 782 class ScaleY3D : public Scale3D { 779 public: 783 public: 780 /** 784 /** 781 * Default constructor: sets the Identity 785 * Default constructor: sets the Identity transformation. */ 782 ScaleY3D() : Scale3D() {} 786 ScaleY3D() : Scale3D() {} 783 787 784 /** 788 /** 785 * Constructor from a number (scale factor 789 * Constructor from a number (scale factor in y-direction). */ 786 ScaleY3D(double y) : Scale3D(1, y, 1) {} 790 ScaleY3D(double y) : Scale3D(1, y, 1) {} 787 }; 791 }; 788 792 789 /** 793 /** 790 * Constructs a scaling transformation in z- 794 * Constructs a scaling transformation in z-direction. 791 * This class provides additional constructo 795 * This class provides additional constructors for Transform3D 792 * and should not be used as a separate clas 796 * and should not be used as a separate class. 793 * 797 * 794 * Example of use: 798 * Example of use: 795 * @code 799 * @code 796 * Transform3D m; 800 * Transform3D m; 797 * m = ScaleZ3D(2.); 801 * m = ScaleZ3D(2.); 798 * @endcode 802 * @endcode 799 * 803 * 800 * @author <Evgueni.Tcherniaev@cern.ch> 804 * @author <Evgueni.Tcherniaev@cern.ch> 801 * @ingroup geometry 805 * @ingroup geometry 802 */ 806 */ 803 class ScaleZ3D : public Scale3D { 807 class ScaleZ3D : public Scale3D { 804 public: 808 public: 805 /** 809 /** 806 * Default constructor: sets the Identity 810 * Default constructor: sets the Identity transformation. */ 807 ScaleZ3D() : Scale3D() {} 811 ScaleZ3D() : Scale3D() {} 808 /** 812 /** 809 * Constructor from a number (scale factor 813 * Constructor from a number (scale factor in z-direction). */ 810 ScaleZ3D(double z) : Scale3D(1, 1, z) {} 814 ScaleZ3D(double z) : Scale3D(1, 1, z) {} 811 }; 815 }; 812 } /* namespace HepGeom */ 816 } /* namespace HepGeom */ 813 817 814 #include "CLHEP/Geometry/Transform3D.icc" 818 #include "CLHEP/Geometry/Transform3D.icc" 815 819 816 #endif /* HEP_TRANSFROM3D_H */ 820 #endif /* HEP_TRANSFROM3D_H */ 817 821