11 #pragma implementation
23 if (
std::abs(x) <= 1.0)
return std::acos(x);
29 if (j == 0) {
return xx(); }
30 if (j == 1) {
return xy(); }
31 if (j == 2) {
return xz(); }
33 if (j == 0) {
return yx(); }
34 if (j == 1) {
return yy(); }
35 if (j == 2) {
return yz(); }
37 if (j == 0) {
return zx(); }
38 if (j == 1) {
return zy(); }
39 if (j == 2) {
return zz(); }
41 std::cerr <<
"HepRotation subscripting: bad indices "
42 <<
"(" << i <<
"," << j <<
")" << std::endl;
48 double ll = aaxis.
mag();
50 std::cerr <<
"HepRotation::rotate() - "
51 <<
"HepRotation: zero axis" << std::endl;
53 double sa = std::sin(a), ca = std::cos(a);
54 double dx = aaxis.
x()/ll,
dy = aaxis.
y()/ll,
dz = aaxis.
z()/ll;
56 ca+(1-ca)*dx*dx, (1-ca)*dx*dy-sa*dz, (1-ca)*dx*dz+sa*dy,
57 (1-ca)*dy*dx+sa*dz, ca+(1-ca)*dy*dy, (1-ca)*dy*dz-sa*dx,
58 (1-ca)*dz*dx-sa*dy, (1-ca)*dz*dy+sa*dx, ca+(1-ca)*dz*dz );
66 double c1 = std::cos(a);
67 double s1 = std::sin(a);
79 double c1 = std::cos(a);
80 double s1 = std::sin(a);
92 double c1 = std::cos(a);
93 double s1 = std::sin(a);
100 ryz = s1*z1 + c1*
ryz;
119 std::cerr <<
"HepRotation::rotateAxes: bad axis vectors" << std::endl;
123 newX.
y(), newY.
y(), newZ.
y(),
124 newX.
z(), newY.
z(), newZ.
z()));
129 return (
yx() == 0.0 &&
xx() == 0.0) ? 0.0 : std::atan2(
yx(),
xx());
133 return (
yy() == 0.0 &&
xy() == 0.0) ? 0.0 : std::atan2(
yy(),
xy());
137 return (
yz() == 0.0 &&
xz() == 0.0) ? 0.0 : std::atan2(
yz(),
xz());
153 double cosa = 0.5*(
xx()+
yy()+
zz()-1);
154 double cosa1 = 1-cosa;
159 double x=0,
y=0,
z=0;
160 if (
xx() > cosa) x = std::sqrt((
xx()-cosa)/cosa1);
161 if (
yy() > cosa)
y = std::sqrt((
yy()-cosa)/cosa1);
162 if (
zz() > cosa)
z = std::sqrt((
zz()-cosa)/cosa1);
163 if (
zy() <
yz()) x = -
x;
166 angle = (cosa < -1.) ? std::acos(-1.) : std::acos(cosa);
172 return (
rxx == 1.0 &&
rxy == 0.0 &&
rxz == 0.0 &&
173 ryx == 0.0 &&
ryy == 1.0 &&
ryz == 0.0 &&
174 rzx == 0.0 &&
rzy == 0.0 &&
rzz == 1.0) ?
true :
false;
179 else if (
rzy<r.
rzy)
return -1;
else if (
rzy>r.
rzy)
return 1;
180 else if (
rzx<r.
rzx)
return -1;
else if (
rzx>r.
rzx)
return 1;
181 else if (
ryz<r.
ryz)
return -1;
else if (
ryz>r.
ryz)
return 1;
182 else if (
ryy<r.
ryy)
return -1;
else if (
ryy>r.
ryy)
return 1;
183 else if (
ryx<r.
ryx)
return -1;
else if (
ryx>r.
ryx)
return 1;
184 else if (
rxz<r.
rxz)
return -1;
else if (
rxz>r.
rxz)
return 1;
185 else if (
rxy<r.
rxy)
return -1;
else if (
rxy>r.
rxy)
return 1;
186 else if (
rxx<r.
rxx)
return -1;
else if (
rxx>r.
rxx)
return 1;