#include "Math/GenVector/Quaternion.h"
#include <cmath>
#include "Math/GenVector/Cartesian3D.h"
#include "Math/GenVector/DisplacementVector3D.h"
#include "Math/GenVector/Quaternion.h"
#include "Math/GenVector/Rotation3Dfwd.h"
#include "Math/GenVector/AxisAnglefwd.h"
#include "Math/GenVector/EulerAnglesfwd.h"
namespace ROOT {
namespace Math {
void Quaternion::Rectify()
{
if ( fU < 0 ) {
fU = - fU; fI = - fI; fJ = - fJ; fK = - fK;
}
Scalar a = 1.0 / std::sqrt(fU*fU + fI*fI + fJ*fJ + fK*fK);
fU *= a;
fI *= a;
fJ *= a;
fK *= a;
}
Quaternion Quaternion::operator * (const Rotation3D & r) const {
return operator* ( Quaternion(r) );
}
Quaternion Quaternion::operator * (const AxisAngle & a) const {
return operator* ( Quaternion(a) );
}
Quaternion Quaternion::operator * (const EulerAngles & e) const {
return operator* ( Quaternion(e) );
}
Quaternion Quaternion::operator * (const RotationZYX & r) const {
return operator* ( Quaternion(r) );
}
Quaternion::Scalar Quaternion::Distance(const Quaternion & q) const {
Scalar chordLength = std::fabs(fU*q.fU + fI*q.fI + fJ*q.fJ + fK*q.fK);
if (chordLength > 1) chordLength = 1;
return acos(chordLength);
}
std::ostream & operator<< (std::ostream & os, const Quaternion & q) {
os << "\n{" << q.U() << " " << q.I()
<< " " << q.J() << " " << q.K() << "}\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.