12#include "CLHEP/Vector/defs.h"
13#include "CLHEP/Vector/Rotation.h"
14#include "CLHEP/Vector/ZMxpv.h"
23bool HepRotation::setCols
24 (
const Hep3Vector & u1,
const Hep3Vector & u2,
const Hep3Vector & u3,
26 Hep3Vector & v1, Hep3Vector & v2, Hep3Vector & v3 )
const {
30 "All three cols supplied for a Rotation are parallel --"
31 "\n an arbitrary rotation will be returned"));
32 setArbitrarily (u1, v1, v2, v3);
37 v2 = Hep3Vector(u2 - u1u2 * u1).unit();
39 if ( v3.dot(u3) >= 0 ) {
47void HepRotation::setArbitrarily (
const Hep3Vector & ccolX,
48 Hep3Vector & v1, Hep3Vector & v2, Hep3Vector & v3)
const {
54 v2 = v1.cross(Hep3Vector(0,0,1));
58 v2 = Hep3Vector(1,0,0);
79 double u1u2 = ucolX.
dot(ucolY);
80 double f12 = std::fabs(u1u2);
83 "col's X and Y supplied for Rotation are not close to orthogonal"));
85 double u1u3 = ucolX.
dot(ucolZ);
86 double f13 = std::fabs(u1u3);
89 "col's X and Z supplied for Rotation are not close to orthogonal"));
91 double u2u3 = ucolY.
dot(ucolZ);
92 double f23 = std::fabs(u2u3);
95 "col's Y and Z supplied for Rotation are not close to orthogonal"));
100 if ( (f12 <= f13) && (f12 <= f23) ) {
101 isRotation = setCols ( ucolX, ucolY, ucolZ, u1u2, v1, v2, v3 );
104 "col's X Y and Z supplied form closer to a reflection than a Rotation "
105 "\n col Z is set to col X cross col Y"));
107 }
else if ( f13 <= f23 ) {
108 isRotation = setCols ( ucolZ, ucolX, ucolY, u1u3, v3, v1, v2 );
111 "col's X Y and Z supplied form closer to a reflection than a Rotation "
112 "\n col Y is set to col Z cross col X"));
115 isRotation = setCols ( ucolY, ucolZ, ucolX, u2u3, v2, v3, v1 );
118 "col's X Y and Z supplied form closer to a reflection than a Rotation "
119 "\n col X is set to col Y cross col Z"));
135 set (ccolX, ccolY, ccolZ);
141 set (rrowX, rrowY, rrowZ);
168 "Attempt to rectify a Rotation with determinant <= 0\n"));
171 double di = 1.0 / det;
196 double del =
delta();
double dot(const Hep3Vector &) const
HepRotation & setRows(const Hep3Vector &rowX, const Hep3Vector &rowY, const Hep3Vector &rowZ)
HepRotation & set(const Hep3Vector &axis, double delta)