#include "Math/GenVector/AxisAngle.h"
#include <cmath>
#include <algorithm>
#include "Math/GenVector/Cartesian3D.h"
#include "Math/GenVector/DisplacementVector3D.h"
#include "Math/GenVector/Rotation3D.h"
namespace ROOT {
namespace Math {
void AxisAngle::RectifyAngle() {
   
   
   
   
   if ( fAngle <= Pi() && fAngle > -Pi() ) return;
   
   if ( fAngle > 0 ) {
      int n = static_cast<int>( (fAngle+Pi())/(2*Pi()) );
      fAngle -= 2*Pi()*n;
   } else {
      int n = static_cast<int>( -(fAngle-Pi())/(2*Pi()) );
      fAngle += 2*Pi()*n;  
   }
} 
void AxisAngle::Rectify()
{
   
   
   
   Scalar r2 = fAxis.Mag2();
   if ( r2 == 0 ) {
      fAxis.SetCoordinates(0,0,1);
      fAngle = 0;
      return;
   }
   fAxis *= (1.0/r2);
   RectifyAngle();  
} 
enum ERotation3DMatrixIndex {
   kXX = 0, kXY = 1, kXZ = 2
   , kYX = 3, kYY = 4, kYZ = 5
   , kZX = 6, kZY = 7, kZZ = 8
};
DisplacementVector3D< Cartesian3D<double> >
AxisAngle::
operator() (const DisplacementVector3D< Cartesian3D<double> > & v) const
{
   Scalar c = std::cos(fAngle);
   Scalar s = std::sin(fAngle);
   Scalar p = fAxis.Dot(v) * ( 1 - c );
   return  DisplacementVector3D< Cartesian3D<double> >  
      (
       c*v.X() + p*fAxis.X() + s * (fAxis.Y()*v.Z() - fAxis.Z()*v.Y())
       , c*v.Y() + p*fAxis.Y() + s * (fAxis.Z()*v.X() - fAxis.X()*v.Z())
       , c*v.Z() + p*fAxis.Z() + s * (fAxis.X()*v.Y() - fAxis.Y()*v.X())
       );
}
std::ostream & operator<< (std::ostream & os, const AxisAngle & a) {
   
   
   os << "\n" << a.Axis() << "  " << a.Angle() << "\n"; 
   return os;
}
} 
} 
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.