25 double sinDelta = std::sin(ddelta), cosDelta = std::cos(ddelta);
26 double oneMinusCosDelta = 1.0 - cosDelta;
34 rxx = oneMinusCosDelta * uX * uX + cosDelta;
35 rxy = oneMinusCosDelta * uX * uY - sinDelta * uZ;
36 rxz = oneMinusCosDelta * uX * uZ + sinDelta * uY;
38 ryx = oneMinusCosDelta * uY * uX + sinDelta * uZ;
39 ryy = oneMinusCosDelta * uY * uY + cosDelta;
40 ryz = oneMinusCosDelta * uY * uZ - sinDelta * uX;
42 rzx = oneMinusCosDelta * uZ * uX - sinDelta * uY;
43 rzy = oneMinusCosDelta * uZ * uY + sinDelta * uX;
44 rzz = oneMinusCosDelta * uZ * uZ + cosDelta;
64 double cosdelta = (
rxx +
ryy +
rzz - 1.0) / 2.0;
67 }
else if (cosdelta < -1.0) {
70 return std::acos( cosdelta );
77 const double eps = 1e-15;
82 if (std::abs(Ux) < eps && std::abs(Uy) < eps && std::abs(Uz) < eps) {
84 double cosdelta = (
rxx +
ryy +
rzz - 1.0) / 2.0;
87 double mxx = (
rxx + 1)/2;
88 double myy = (
ryy + 1)/2;
89 double mzz = (
rzz + 1)/2;
90 double mxy = (
rxy +
ryx)/4;
91 double mxz = (
rxz +
rzx)/4;
92 double myz = (
ryz +
rzy)/4;
95 if (mxx >
ryy && mxx >
rzz) {
101 }
else if (myy > mzz) {
103 if (
rxz -
rzx < 0) y = -y;
109 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)