Rotation3DxAxial.cxx

Go to the documentation of this file.
00001 // @(#)root/mathcore:$Id: Rotation3DxAxial.cxx 22516 2008-03-07 15:14:26Z moneta $
00002 // Authors: W. Brown, M. Fischler, L. Moneta    2005  
00003 
00004 #include "Math/GenVector/Rotation3D.h"
00005 
00006 #include "Math/GenVector/RotationX.h"
00007 #include "Math/GenVector/RotationY.h"
00008 #include "Math/GenVector/RotationZ.h"
00009 
00010 namespace ROOT {
00011 
00012 namespace Math {
00013 
00014 Rotation3D Rotation3D::operator * (const RotationX  & rx) const {
00015    // combination of a Rotation3D with a RotationX
00016    Scalar s = rx.SinAngle();
00017    Scalar c = rx.CosAngle();
00018    return Rotation3D
00019       (
00020        fM[kXX],   fM[kXY]*c + fM[kXZ]*s,   fM[kXZ]*c - fM[kXY]*s 
00021        , fM[kYX],   fM[kYY]*c + fM[kYZ]*s,   fM[kYZ]*c - fM[kYY]*s 
00022        , fM[kZX],   fM[kZY]*c + fM[kZZ]*s,   fM[kZZ]*c - fM[kZY]*s
00023        ); 
00024 }
00025 
00026 Rotation3D Rotation3D::operator * (const RotationY  & ry) const {
00027    // combination of a Rotation3D with a RotationY
00028    Scalar s = ry.SinAngle();
00029    Scalar c = ry.CosAngle();
00030    return Rotation3D
00031       (
00032        fM[kXX]*c - fM[kXZ]*s,   fM[kXY],   fM[kXX]*s + fM[kXZ]*c
00033        , fM[kYX]*c - fM[kYZ]*s,   fM[kYY],   fM[kYX]*s + fM[kYZ]*c
00034        , fM[kZX]*c - fM[kZZ]*s,   fM[kZY],   fM[kZX]*s + fM[kZZ]*c
00035        ); 
00036 }
00037 
00038 
00039 Rotation3D Rotation3D::operator * (const RotationZ  & rz) const {
00040    // combination of a Rotation3D with a RotationZ
00041    Scalar s = rz.SinAngle();
00042    Scalar c = rz.CosAngle();
00043    return Rotation3D
00044       (
00045        fM[kXX]*c + fM[kXY]*s, fM[kXY]*c - fM[kXX]*s,   fM[kXZ] 
00046        , fM[kYX]*c + fM[kYY]*s, fM[kYY]*c - fM[kYX]*s,  fM[kYZ] 
00047        , fM[kZX]*c + fM[kZY]*s, fM[kZY]*c - fM[kZX]*s,  fM[kZZ] 
00048        ); 
00049 }
00050 
00051 Rotation3D operator* (RotationX const & r1, Rotation3D const & r2) {
00052    // combination of a RotationX with a Rotation3D 
00053    // TODO -- recode for much better efficiency!
00054    return Rotation3D(r1)*r2;
00055 }
00056 
00057 Rotation3D operator* (RotationY const & r1, Rotation3D const & r2) {
00058    // combination of a RotationY with a Rotation3D 
00059    // TODO -- recode for much better efficiency!
00060    return Rotation3D(r1)*r2;
00061 }
00062 
00063 Rotation3D operator* (RotationZ const & r1, Rotation3D const & r2) {
00064    // combination of a RotationZ with a Rotation3D 
00065    // TODO -- recode for much better efficiency!
00066    return Rotation3D(r1)*r2;
00067 }
00068 
00069 typedef Rotation3D::Scalar Scalar;
00070 
00071 // Rx * Ry
00072 Rotation3D operator* (RotationX const & rx, RotationY const & ry) {
00073    Scalar sx = rx.SinAngle();
00074    Scalar cx = rx.CosAngle();
00075    Scalar sy = ry.SinAngle();
00076    Scalar cy = ry.CosAngle();
00077    return Rotation3D
00078       (  cy     ,  0   ,    sy   , 
00079          sx*sy  , cx   , -sx*cy  ,
00080          -sy*cx  , sx   ,  cx*cy  ); 
00081 }
00082 
00083 // Rx * Rz
00084 Rotation3D operator* (RotationX const & rx, RotationZ const & rz) {
00085    Scalar sx = rx.SinAngle();
00086    Scalar cx = rx.CosAngle();
00087    Scalar sz = rz.SinAngle();
00088    Scalar cz = rz.CosAngle();
00089    return Rotation3D
00090       (  cz     ,   -sz ,     0  , 
00091          cx*sz  , cx*cz ,   -sx  ,
00092          sx*sz  , cz*sx ,    cx  ); 
00093 }
00094 
00095 // Ry * Rx
00096 Rotation3D operator* (RotationY const & ry, RotationX const & rx) {
00097    Scalar sx = rx.SinAngle();
00098    Scalar cx = rx.CosAngle();
00099    Scalar sy = ry.SinAngle();
00100    Scalar cy = ry.CosAngle();
00101    return Rotation3D
00102       (  cy     , sx*sy ,  sy*cx  , 
00103          0     ,    cx ,    -sx  ,
00104          -sy     , cy*sx ,  cx*cy  ); 
00105 }
00106 
00107 // Ry * Rz
00108 Rotation3D operator* (RotationY const & ry, RotationZ const & rz) {
00109    Scalar sy = ry.SinAngle();
00110    Scalar cy = ry.CosAngle();
00111    Scalar sz = rz.SinAngle();
00112    Scalar cz = rz.CosAngle();
00113    return Rotation3D
00114       (  cy*cz  ,-cy*sz ,    sy  , 
00115          sz  ,    cz ,     0  ,
00116          -cz*sy  , sy*sz ,    cy  ); 
00117 }
00118 
00119 // Rz * Rx
00120 Rotation3D operator* (RotationZ const & rz, RotationX const & rx) {
00121    Scalar sx = rx.SinAngle();
00122    Scalar cx = rx.CosAngle();
00123    Scalar sz = rz.SinAngle();
00124    Scalar cz = rz.CosAngle();
00125    return Rotation3D
00126       (     cz  ,-cx*sz , sx*sz  , 
00127             sz  , cx*cz ,-cz*sx  ,
00128             0  ,    sx ,    cx  ); 
00129 }
00130 
00131 // Rz * Ry
00132 Rotation3D operator* (RotationZ const & rz, RotationY const & ry) {
00133    Scalar sy = ry.SinAngle();
00134    Scalar cy = ry.CosAngle();
00135    Scalar sz = rz.SinAngle();
00136    Scalar cz = rz.CosAngle();
00137    return Rotation3D
00138       (  cy*cz  ,   -sz , cz*sy  , 
00139          cy*sz  ,    cz , sy*sz  ,
00140          -sy  ,     0 ,    cy  ); 
00141 }
00142 
00143 
00144 
00145 
00146 } //namespace Math
00147 } //namespace ROOT

Generated on Tue Jul 5 14:33:07 2011 for ROOT_528-00b_version by  doxygen 1.5.1