QuaternionXaxial.cxx

Go to the documentation of this file.
00001 // @(#)root/mathcore:$Id: QuaternionXaxial.cxx 22516 2008-03-07 15:14:26Z moneta $
00002 // Authors: W. Brown, M. Fischler, L. Moneta    2005  
00003 
00004  /**********************************************************************
00005   *                                                                    *
00006   * Copyright (c) 2005 , LCG ROOT FNAL MathLib Team                    *
00007   *                                                                    *
00008   *                                                                    *
00009   **********************************************************************/
00010 
00011 // Implementation file for quaternion times other non-axial rotations.
00012 // Decoupled from main Quaternion implementations.
00013 //
00014 // Created by: Mark Fischler Tues July 19,  2005
00015 //
00016 // Last update: $Id: QuaternionXaxial.cxx 22516 2008-03-07 15:14:26Z moneta $
00017 //
00018 #include "Math/GenVector/Quaternion.h"
00019 
00020 namespace ROOT {
00021 
00022 namespace Math {
00023 
00024 
00025 // Although the same technique would work with axial rotations,
00026 // we know that two of the four quaternion components will be zero,
00027 // and we exploit that knowledge:
00028 
00029 Quaternion Quaternion::operator * (const RotationX  & rx) const {
00030    // combination with a RotationX
00031    Quaternion q(rx);
00032    return Quaternion (
00033                       U()*q.U() - I()*q.I()
00034                       , I()*q.U() + U()*q.I()
00035                       , J()*q.U() + K()*q.I()
00036                       , K()*q.U() - J()*q.I()
00037                       );
00038 }
00039 
00040 Quaternion Quaternion::operator * (const RotationY  & ry) const {
00041    // combination with a RotationY
00042    Quaternion q(ry);
00043    return Quaternion (
00044                       U()*q.U() - J()*q.J()
00045                       , I()*q.U() - K()*q.J()
00046                       , J()*q.U() + U()*q.J()
00047                       , K()*q.U() + I()*q.J()
00048                       );
00049 }
00050 
00051 Quaternion Quaternion::operator * (const RotationZ  & rz) const {
00052    // combination with a RotationZ
00053    Quaternion q(rz);
00054    return Quaternion (
00055                       U()*q.U() - K()*q.K()
00056                       , I()*q.U() + J()*q.K()
00057                       , J()*q.U() - I()*q.K()
00058                       , K()*q.U() + U()*q.K()
00059                       );
00060 }
00061 
00062 Quaternion
00063 operator * ( RotationX const & r, Quaternion const & q ) {
00064    return Quaternion(r) * q;  // TODO: improve performance
00065 }
00066 
00067 Quaternion
00068 operator * ( RotationY const & r, Quaternion const & q ) {
00069    return Quaternion(r) * q;  // TODO: improve performance
00070 }
00071 
00072 Quaternion
00073 operator * ( RotationZ const & r, Quaternion const & q ) {
00074    return Quaternion(r) * q;  // TODO: improve performance
00075 }
00076 
00077 
00078 } //namespace Math
00079 } //namespace ROOT

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