12 #pragma implementation
29 double sinDelta = std::sin(ddelta), cosDelta = std::cos(ddelta);
30 double oneMinusCosDelta = 1.0 - cosDelta;
38 rxx = oneMinusCosDelta * uX * uX + cosDelta;
39 rxy = oneMinusCosDelta * uX * uY - sinDelta * uZ;
40 rxz = oneMinusCosDelta * uX * uZ + sinDelta * uY;
42 ryx = oneMinusCosDelta * uY * uX + sinDelta * uZ;
43 ryy = oneMinusCosDelta * uY * uY + cosDelta;
44 ryz = oneMinusCosDelta * uY * uZ - sinDelta * uX;
46 rzx = oneMinusCosDelta * uZ * uX - sinDelta * uY;
47 rzy = oneMinusCosDelta * uZ * uY + sinDelta * uX;
48 rzz = oneMinusCosDelta * uZ * uZ + cosDelta;
68 double cosdelta = (
rxx +
ryy +
rzz - 1.0) / 2.0;
71 }
else if (cosdelta < -1.0) {
74 return std::acos( cosdelta );
81 const double eps = 1
e-15;
86 if (std::abs(Ux) < eps && std::abs(Uy) < eps && std::abs(Uz) < eps) {
88 double cosdelta = (
rxx +
ryy +
rzz - 1.0) / 2.0;
91 double mxx = (
rxx + 1)/2;
92 double myy = (
ryy + 1)/2;
93 double mzz = (
rzz + 1)/2;
94 double mxy = (rxy +
ryx)/4;
95 double mxz = (
rxz +
rzx)/4;
96 double myz = (ryz +
rzy)/4;
99 if (mxx >
ryy && mxx >
rzz) {
101 if (
rzy - ryz < 0) x = -
x;
105 }
else if (myy > mzz) {
107 if (
rxz - rzx < 0) y = -
y;
113 if (
ryx - rxy < 0) z = -
z;
HepAxisAngle axisAngle() const
void setDelta(double delta)
HepRotation & set(const Hep3Vector &axis, double delta)
void setAxis(const Hep3Vector &axis)
static const G4double eps
static constexpr double pi