14 #include "CLHEP/Vector/AxisAngle.h"
22 double sinDelta = std::sin( aa.delta() );
23 double cosDelta = std::cos( aa.delta() );
24 double oneMinusCosDelta = 1.0 - cosDelta;
26 double uX = aa.getAxis().getX();
27 double uY = aa.getAxis().getY();
28 double uZ = aa.getAxis().getZ();
30 array[0] = oneMinusCosDelta * uX * uX + cosDelta;
31 array[1] = oneMinusCosDelta * uX * uY - sinDelta * uZ;
32 array[2] = oneMinusCosDelta * uX * uZ + sinDelta * uY;
34 array[3] = oneMinusCosDelta * uY * uX + sinDelta * uZ;
35 array[4] = oneMinusCosDelta * uY * uY + cosDelta;
36 array[5] = oneMinusCosDelta * uY * uZ - sinDelta * uX;
38 array[6] = oneMinusCosDelta * uZ * uX - sinDelta * uY;
39 array[7] = oneMinusCosDelta * uZ * uY + sinDelta * uX;
40 array[8] = oneMinusCosDelta * uZ * uZ + cosDelta;
45 double HepAxisAngle::distance(
const AA & aa )
const {
54 for (
int i = 0; i < 9; i++ ) {
55 sum += thisRep[i] * aaRep[i];
59 return (d >= 0) ? d : 0;
64 bool HepAxisAngle::isNear(
const AA & aa, Scalar epsilon )
const {
66 return distance( aa ) <= epsilon * epsilon;
71 double HepAxisAngle::howNear(
const AA & aa )
const {
73 return std::sqrt( distance( aa ) );
85 std::ostream &
operator<<(std::ostream & os,
const HepAxisAngle & aa) {
86 os <<
'(' << aa.axis() <<
", " << aa.delta() <<
')';
92 double & x,
double & y,
double &
z,
95 std::istream &
operator>>(std::istream & is, HepAxisAngle & aa) {
101 aa.set ( axis, delta );
static void ZMpvAxisAngleRep(const HepAxisAngle &aa, double array[])
void ZMinputAxisAngle(std::istream &is, double &x, double &y, double &z, double &delta)
static const G4double tolerance
std::istream & operator>>(std::istream &is, HepAxisAngle &aa)
std::ostream & operator<<(std::ostream &os, const HepAxisAngle &aa)