RotationP.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // ---------------------------------------------------------------------------
00003 //
00004 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
00005 //
00006 // This is the implementation of methods of the HepRotation class which
00007 // were introduced when ZOOM PhysicsVectors was merged in, other than those
00008 // involving Euler or axis/angle representations, lengthy corrections of
00009 // the rotation matrix, or I/O.
00010 //
00011 
00012 #ifdef GNUPRAGMA
00013 #pragma implementation
00014 #endif
00015 
00016 #include "CLHEP/Vector/Rotation.h"
00017 
00018 #include <cmath>
00019 
00020 
00021 namespace CLHEP  {
00022 
00023 void HepRotation::decompose(HepAxisAngle & rotation, Hep3Vector & boost)const {
00024   boost.set(0,0,0);
00025   rotation = axisAngle();
00026 }
00027 
00028 void HepRotation::decompose(Hep3Vector & boost, HepAxisAngle & rotation)const {
00029   boost.set(0,0,0);
00030   rotation = axisAngle();
00031 }
00032 
00033 double HepRotation::distance2( const HepRotation & r  ) const {
00034   double sum = rxx * r.rxx + rxy * r.rxy + rxz * r.rxz
00035                 + ryx * r.ryx + ryy * r.ryy + ryz * r.ryz
00036                 + rzx * r.rzx + rzy * r.rzy + rzz * r.rzz;
00037   double answer = 3.0 - sum;
00038   return (answer >= 0 ) ? answer : 0;
00039 }
00040 
00041 double HepRotation::howNear(   const HepRotation & r  ) const {
00042   return  std::sqrt( distance2( r ) );
00043 }
00044 
00045 bool HepRotation::isNear(   const HepRotation & r,
00046                                      double epsilon) const {
00047  return  distance2( r ) <= epsilon*epsilon;
00048 }
00049 
00050 double HepRotation::norm2() const {
00051   double answer = 3.0 - rxx - ryy - rzz;
00052   return (answer >= 0 ) ? answer : 0;
00053 }
00054 
00055 }  // namespace CLHEP

Generated on Mon May 27 17:50:34 2013 for Geant4 by  doxygen 1.4.7