13 #pragma implementation
16 #include "CLHEP/Vector/defs.h"
17 #include "CLHEP/Vector/Rotation.h"
18 #include "CLHEP/Vector/ZMxpv.h"
26 bool HepRotation::setCols
33 "All three cols supplied for a Rotation are parallel --"
34 "\n an arbitrary rotation will be returned"));
35 setArbitrarily (u1, v1, v2, v3);
42 if ( v3.dot(u3) >= 0 ) {
50 void HepRotation::setArbitrarily (
const Hep3Vector & ccolX,
82 double u1u2 = ucolX.
dot(ucolY);
83 double f12 = std::fabs(u1u2);
86 "col's X and Y supplied for Rotation are not close to orthogonal"));
88 double u1u3 = ucolX.
dot(ucolZ);
89 double f13 = std::fabs(u1u3);
92 "col's X and Z supplied for Rotation are not close to orthogonal"));
94 double u2u3 = ucolY.
dot(ucolZ);
95 double f23 = std::fabs(u2u3);
98 "col's Y and Z supplied for Rotation are not close to orthogonal"));
103 if ( (f12 <= f13) && (f12 <= f23) ) {
104 isRotation = setCols ( ucolX, ucolY, ucolZ, u1u2, v1, v2, v3 );
107 "col's X Y and Z supplied form closer to a reflection than a Rotation "
108 "\n col Z is set to col X cross col Y"));
110 }
else if ( f13 <= f23 ) {
111 isRotation = setCols ( ucolZ, ucolX, ucolY, u1u3, v3, v1, v2 );
114 "col's X Y and Z supplied form closer to a reflection than a Rotation "
115 "\n col Y is set to col Z cross col X"));
118 isRotation = setCols ( ucolY, ucolZ, ucolX, u2u3, v2, v3, v1 );
121 "col's X Y and Z supplied form closer to a reflection than a Rotation "
122 "\n col X is set to col Y cross col Z"));
138 set (ccolX, ccolY, ccolZ);
144 set (rrowX, rrowY, rrowZ);
171 "Attempt to rectify a Rotation with determinant <= 0\n"));
174 double di = 1.0 / det;
199 double del =
delta();