Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CLHEP
CLHEP
Commits
f8ad330a
Commit
f8ad330a
authored
Mar 21, 2017
by
Lynn Garren
Browse files
fix for
CLHEP-141
supplied by Evgueni Tcherniaev
parent
e6b26b25
Changes
3
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
f8ad330a
2017-03-21 Lynn Garren <garren@fnal.gov>
* Vector/src/RotationA.cc:
fix for CLHEP-141 supplied by Evgueni Tcherniaev
* Vector/test/testRotationAxis.cc:
test for CLHEP-141 supplied by Evgueni Tcherniaev
==============================
30.11.16 Release CLHEP-2.3.4.3
==============================
...
...
Vector/ChangeLog
View file @
f8ad330a
2017-03-21 Lynn Garren <garren@fnal.gov>
* src/RotationA.cc:
fix for CLHEP-141 supplied by Evgueni Tcherniaev
* test/testRotationAxis.cc:
test for CLHEP-141 supplied by Evgueni Tcherniaev
==============================
30.11.16 Release CLHEP-2.3.4.3
==============================
...
...
Vector/src/RotationA.cc
View file @
f8ad330a
...
...
@@ -64,8 +64,6 @@ HepRotation::HepRotation ( const HepAxisAngle & ax )
set
(
ax
.
axis
(),
ax
.
delta
()
);
}
double
HepRotation
::
delta
()
const
{
double
cosdelta
=
(
rxx
+
ryy
+
rzz
-
1.0
)
/
2.0
;
...
...
@@ -81,20 +79,42 @@ double HepRotation::delta() const {
Hep3Vector
HepRotation
::
axis
()
const
{
// Determine 2*std::sin(delta) times the u components (I call this uX, uY, Uz)
// Normalization is not needed; it will be done when returning the 3-Vector
double
Uz
=
ryx
-
rxy
;
double
Uy
=
rxz
-
rzx
;
double
Ux
=
rzy
-
ryz
;
if
(
(
Uz
==
0
)
&&
(
Uy
==
0
)
&&
(
Ux
==
0
)
)
{
if
(
rzz
>
0
)
{
return
Hep3Vector
(
0
,
0
,
1
);
}
else
if
(
ryy
>
0
)
{
return
Hep3Vector
(
0
,
1
,
0
);
const
double
eps
=
1e-15
;
double
Ux
=
rzy
-
ryz
;
double
Uy
=
rxz
-
rzx
;
double
Uz
=
ryx
-
rxy
;
if
(
std
::
abs
(
Ux
)
<
eps
&&
std
::
abs
(
Uy
)
<
eps
&&
std
::
abs
(
Uz
)
<
eps
)
{
double
cosdelta
=
(
rxx
+
ryy
+
rzz
-
1.0
)
/
2.0
;
if
(
cosdelta
>
0.0
)
return
Hep3Vector
(
0
,
0
,
1
);
// angle = 0, any axis is good
double
xx
=
(
rxx
+
1
)
/
2
;
double
yy
=
(
ryy
+
1
)
/
2
;
double
zz
=
(
rzz
+
1
)
/
2
;
double
xy
=
(
rxy
+
ryx
)
/
4
;
double
xz
=
(
rxz
+
rzx
)
/
4
;
double
yz
=
(
ryz
+
rzy
)
/
4
;
double
x
,
y
,
z
;
if
(
xx
>
ryy
&&
xx
>
rzz
)
{
x
=
std
::
sqrt
(
xx
);
if
(
rzy
-
ryz
<
0
)
x
=
-
x
;
y
=
xy
/
x
;
z
=
xz
/
x
;
return
Hep3Vector
(
x
,
y
,
z
).
unit
();
}
else
if
(
yy
>
zz
)
{
y
=
std
::
sqrt
(
yy
);
if
(
rxz
-
rzx
<
0
)
y
=
-
y
;
x
=
xy
/
y
;
z
=
yz
/
y
;
return
Hep3Vector
(
x
,
y
,
z
).
unit
();
}
else
{
return
Hep3Vector
(
1
,
0
,
0
);
z
=
std
::
sqrt
(
zz
);
if
(
ryx
-
rxy
<
0
)
z
=
-
z
;
x
=
xz
/
z
;
y
=
yz
/
z
;
return
Hep3Vector
(
x
,
y
,
z
).
unit
();
}
}
else
{
return
Hep3Vector
(
Ux
,
Uy
,
Uz
).
unit
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment