50 RotationZYX RotationZYX::operator * (
const Rotation3D & r)
const {
52 return RotationZYX ( Rotation3D(*
this) * r );
55 RotationZYX RotationZYX::operator * (
const AxisAngle & a)
const {
57 return RotationZYX ( Quaternion(*
this) * Quaternion(a) );
60 RotationZYX RotationZYX::operator * (
const EulerAngles & e)
const {
62 return RotationZYX ( Quaternion(*
this) * Quaternion(e) );
65 RotationZYX RotationZYX::operator * (
const RotationZYX & e)
const {
68 return RotationZYX ( Rotation3D(*
this) * Rotation3D(e) );
70 RotationZYX RotationZYX::operator * (
const Quaternion & q)
const {
72 return RotationZYX ( Quaternion(*
this) * q );
75 RotationZYX RotationZYX::operator * (
const RotationX & r)
const {
77 return RotationZYX ( Quaternion(*
this) * r );
80 RotationZYX RotationZYX::operator * (
const RotationY & r)
const {
82 return RotationZYX ( Quaternion(*
this) * r );
85 RotationZYX RotationZYX::operator * (
const RotationZ & r)
const {
89 Scalar newPhi = fPhi + r.Angle();
90 if ( newPhi <= -Pi()|| newPhi > Pi() ) {
91 newPhi = newPhi - std::floor( newPhi/(2*Pi()) +.5 ) * 2*Pi();
93 return RotationZYX ( newPhi, fTheta, fPsi );
96 RotationZYX operator * ( RotationX
const & r, RotationZYX
const & e ) {
97 return RotationZYX(r) * e;
100 RotationZYX operator * ( RotationY
const & r, RotationZYX
const & e ) {
101 return RotationZYX(r) * e;
105 operator * ( RotationZ
const & r, RotationZYX
const & e ) {
106 return RotationZYX(r) * e;
109 void RotationZYX::Rectify()
115 Scalar theta2 = fTheta + M_PI_2;
116 if ( theta2 < 0 || theta2 > Pi() ) {
117 Scalar t = theta2 - std::floor( theta2/(2*Pi() ) ) * 2*Pi();
126 fTheta = theta2 - M_PI_2;
129 if ( fPhi <= -Pi()|| fPhi > Pi() ) {
130 fPhi = fPhi - std::floor( fPhi/(2*Pi()) +.5 ) * 2*Pi();
133 if ( fPsi <= -Pi()|| fPsi > Pi() ) {
134 fPsi = fPsi - std::floor( fPsi/(2*Pi()) +.5 ) * 2*Pi();
139 void RotationZYX::Invert()
151 std::ostream & operator<< (std::ostream & os,
const RotationZYX & e) {
154 os <<
"\n{phi(Z angle): " << e.Phi() <<
" theta(Y angle): " << e.Theta()
155 <<
" psi(X angle): " << e.Psi() <<
"}\n";