11#include "CLHEP/Vector/defs.h"
12#include "CLHEP/Vector/Rotation.h"
13#include "CLHEP/Units/PhysicalConstants.h"
26 double sinDelta = std::sin(ddelta), cosDelta = std::cos(ddelta);
27 double oneMinusCosDelta = 1.0 - cosDelta;
35 rxx = oneMinusCosDelta * uX * uX + cosDelta;
36 rxy = oneMinusCosDelta * uX * uY - sinDelta * uZ;
37 rxz = oneMinusCosDelta * uX * uZ + sinDelta * uY;
39 ryx = oneMinusCosDelta * uY * uX + sinDelta * uZ;
40 ryy = oneMinusCosDelta * uY * uY + cosDelta;
41 ryz = oneMinusCosDelta * uY * uZ - sinDelta * uX;
43 rzx = oneMinusCosDelta * uZ * uX - sinDelta * uY;
44 rzy = oneMinusCosDelta * uZ * uY + sinDelta * uX;
45 rzz = oneMinusCosDelta * uZ * uZ + cosDelta;
65 double cosdelta = (
rxx +
ryy +
rzz - 1.0) / 2.0;
68 }
else if (cosdelta < -1.0) {
71 return std::acos( cosdelta );
78 const double eps = 1e-15;
83 if (std::abs(Ux) < eps && std::abs(Uy) < eps && std::abs(Uz) < eps) {
85 double cosdelta = (
rxx +
ryy +
rzz - 1.0) / 2.0;
88 double xxt = (
rxx + 1)/2;
89 double yyt = (
ryy + 1)/2;
90 double zzt = (
rzz + 1)/2;
91 double xyt = (
rxy +
ryx)/4;
92 double xzt = (
rxz +
rzx)/4;
93 double yzt = (
ryz +
rzy)/4;
96 if (xxt >
ryy && xxt >
rzz) {
102 }
else if (yyt > zzt) {
104 if (
rxz -
rzx < 0) y = -y;
110 if (
ryx -
rxy < 0) z = -z;
HepAxisAngle axisAngle() const
HepRotation & set(const Hep3Vector &axis, double delta)
void setDelta(double delta)
void setAxis(const Hep3Vector &axis)