Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends
CLHEP::HepRotation Class Reference

#include <Rotation.h>

Inheritance diagram for CLHEP::HepRotation:
G3toG4RotationMatrix

Data Structures

class  HepRotation_row
 

Public Member Functions

 HepRotation ()
 
 HepRotation (const HepRotation &m)
 
 HepRotation (const HepRotationX &m)
 
 HepRotation (const HepRotationY &m)
 
 HepRotation (const HepRotationZ &m)
 
HepRotationset (const Hep3Vector &axis, double delta)
 
 HepRotation (const Hep3Vector &axis, double delta)
 
HepRotationset (const HepAxisAngle &ax)
 
 HepRotation (const HepAxisAngle &ax)
 
HepRotationset (double phi, double theta, double psi)
 
 HepRotation (double phi, double theta, double psi)
 
HepRotationset (const HepEulerAngles &e)
 
 HepRotation (const HepEulerAngles &e)
 
 HepRotation (const Hep3Vector &colX, const Hep3Vector &colY, const Hep3Vector &colZ)
 
HepRotationset (const Hep3Vector &colX, const Hep3Vector &colY, const Hep3Vector &colZ)
 
HepRotationsetRows (const Hep3Vector &rowX, const Hep3Vector &rowY, const Hep3Vector &rowZ)
 
HepRotationset (const HepRotationX &r)
 
HepRotationset (const HepRotationY &r)
 
HepRotationset (const HepRotationZ &r)
 
HepRotationoperator= (const HepRotation &r)
 
HepRotationoperator= (const HepRotationX &r)
 
HepRotationoperator= (const HepRotationY &r)
 
HepRotationoperator= (const HepRotationZ &r)
 
HepRotationset (const HepRep3x3 &m)
 
 HepRotation (const HepRep3x3 &m)
 
 ~HepRotation ()
 
Hep3Vector colX () const
 
Hep3Vector colY () const
 
Hep3Vector colZ () const
 
Hep3Vector rowX () const
 
Hep3Vector rowY () const
 
Hep3Vector rowZ () const
 
double xx () const
 
double xy () const
 
double xz () const
 
double yx () const
 
double yy () const
 
double yz () const
 
double zx () const
 
double zy () const
 
double zz () const
 
HepRep3x3 rep3x3 () const
 
const HepRotation_row operator[] (int) const
 
double operator() (int, int) const
 
double getPhi () const
 
double getTheta () const
 
double getPsi () const
 
double phi () const
 
double theta () const
 
double psi () const
 
HepEulerAngles eulerAngles () const
 
double getDelta () const
 
Hep3Vector getAxis () const
 
double delta () const
 
Hep3Vector axis () const
 
HepAxisAngle axisAngle () const
 
void getAngleAxis (double &delta, Hep3Vector &axis) const
 
double phiX () const
 
double phiY () const
 
double phiZ () const
 
double thetaX () const
 
double thetaY () const
 
double thetaZ () const
 
HepLorentzVector col1 () const
 
HepLorentzVector col2 () const
 
HepLorentzVector col3 () const
 
HepLorentzVector col4 () const
 
HepLorentzVector row1 () const
 
HepLorentzVector row2 () const
 
HepLorentzVector row3 () const
 
HepLorentzVector row4 () const
 
double xt () const
 
double yt () const
 
double zt () const
 
double tx () const
 
double ty () const
 
double tz () const
 
double tt () const
 
HepRep4x4 rep4x4 () const
 
void setPhi (double phi)
 
void setTheta (double theta)
 
void setPsi (double psi)
 
void setAxis (const Hep3Vector &axis)
 
void setDelta (double delta)
 
void decompose (HepAxisAngle &rotation, Hep3Vector &boost) const
 
void decompose (Hep3Vector &boost, HepAxisAngle &rotation) const
 
bool isIdentity () const
 
int compare (const HepRotation &r) const
 
bool operator== (const HepRotation &r) const
 
bool operator!= (const HepRotation &r) const
 
bool operator< (const HepRotation &r) const
 
bool operator> (const HepRotation &r) const
 
bool operator<= (const HepRotation &r) const
 
bool operator>= (const HepRotation &r) const
 
double distance2 (const HepRotation &r) const
 
double howNear (const HepRotation &r) const
 
bool isNear (const HepRotation &r, double epsilon=Hep4RotationInterface::tolerance) const
 
double distance2 (const HepBoost &lt) const
 
double distance2 (const HepLorentzRotation &lt) const
 
double howNear (const HepBoost &lt) const
 
double howNear (const HepLorentzRotation &lt) const
 
bool isNear (const HepBoost &lt, double epsilon=Hep4RotationInterface::tolerance) const
 
bool isNear (const HepLorentzRotation &lt, double epsilon=Hep4RotationInterface::tolerance) const
 
double norm2 () const
 
void rectify ()
 
Hep3Vector operator() (const Hep3Vector &p) const
 
Hep3Vector operator* (const Hep3Vector &p) const
 
HepLorentzVector operator() (const HepLorentzVector &w) const
 
HepLorentzVector operator* (const HepLorentzVector &w) const
 
HepRotation operator* (const HepRotation &r) const
 
HepRotation operator* (const HepRotationX &rx) const
 
HepRotation operator* (const HepRotationY &ry) const
 
HepRotation operator* (const HepRotationZ &rz) const
 
HepRotationoperator*= (const HepRotation &r)
 
HepRotationtransform (const HepRotation &r)
 
HepRotationoperator*= (const HepRotationX &r)
 
HepRotationoperator*= (const HepRotationY &r)
 
HepRotationoperator*= (const HepRotationZ &r)
 
HepRotationtransform (const HepRotationX &r)
 
HepRotationtransform (const HepRotationY &r)
 
HepRotationtransform (const HepRotationZ &r)
 
HepRotationrotateX (double delta)
 
HepRotationrotateY (double delta)
 
HepRotationrotateZ (double delta)
 
HepRotationrotate (double delta, const Hep3Vector &axis)
 
HepRotationrotate (double delta, const Hep3Vector *axis)
 
HepRotationrotateAxes (const Hep3Vector &newX, const Hep3Vector &newY, const Hep3Vector &newZ)
 
HepRotation inverse () const
 
HepRotationinvert ()
 
std::ostream & print (std::ostream &os) const
 

Static Public Member Functions

static double getTolerance ()
 
static double setTolerance (double tol)
 

Static Public Attributes

static DLL_API const HepRotation IDENTITY
 

Protected Member Functions

 HepRotation (double mxx, double mxy, double mxz, double myx, double myy, double myz, double mzx, double mzy, double mzz)
 

Protected Attributes

double rxx
 
double rxy
 
double rxz
 
double ryx
 
double ryy
 
double ryz
 
double rzx
 
double rzy
 
double rzz
 

Friends

HepRotation operator* (const HepRotationX &rx, const HepRotation &r)
 
HepRotation operator* (const HepRotationY &ry, const HepRotation &r)
 
HepRotation operator* (const HepRotationZ &rz, const HepRotation &r)
 

Detailed Description

Author

Definition at line 47 of file Rotation.h.

Constructor & Destructor Documentation

CLHEP::HepRotation::HepRotation ( )
inline

Referenced by rotateAxes().

CLHEP::HepRotation::HepRotation ( const HepRotation m)
inline
CLHEP::HepRotation::HepRotation ( const HepRotationX m)
inline
CLHEP::HepRotation::HepRotation ( const HepRotationY m)
inline
CLHEP::HepRotation::HepRotation ( const HepRotationZ m)
inline
CLHEP::HepRotation::HepRotation ( const Hep3Vector axis,
double  delta 
)

Definition at line 54 of file RotationA.cc.

References set().

55 {
56  set( aaxis, ddelta );
57 }
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
CLHEP::HepRotation::HepRotation ( const HepAxisAngle ax)

Definition at line 61 of file RotationA.cc.

References CLHEP::HepAxisAngle::axis(), CLHEP::HepAxisAngle::delta(), and set().

62 {
63  set ( ax.axis(), ax.delta() );
64 }
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
CLHEP::HepRotation::HepRotation ( double  phi,
double  theta,
double  psi 
)

Definition at line 57 of file RotationE.cc.

References set().

58 {
59  set (phi1, theta1, psi1);
60 }
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
CLHEP::HepRotation::HepRotation ( const HepEulerAngles e)

Definition at line 64 of file RotationE.cc.

References CLHEP::HepEulerAngles::phi(), CLHEP::HepEulerAngles::psi(), set(), and CLHEP::HepEulerAngles::theta().

65 {
66  set(e.phi(), e.theta(), e.psi());
67 }
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
CLHEP::HepRotation::HepRotation ( const Hep3Vector colX,
const Hep3Vector colY,
const Hep3Vector colZ 
)

Definition at line 135 of file RotationC.cc.

References set().

138 {
139  set (ccolX, ccolY, ccolZ);
140 }
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
CLHEP::HepRotation::HepRotation ( const HepRep3x3 m)
inline
CLHEP::HepRotation::~HepRotation ( )
inline
CLHEP::HepRotation::HepRotation ( double  mxx,
double  mxy,
double  mxz,
double  myx,
double  myy,
double  myz,
double  mzx,
double  mzy,
double  mzz 
)
inlineprotected

Member Function Documentation

Hep3Vector CLHEP::HepRotation::axis ( ) const

Definition at line 79 of file RotationA.cc.

References rxy, rxz, ryx, ryy, ryz, rzx, rzy, rzz, and CLHEP::Hep3Vector::unit().

Referenced by axisAngle(), rectify(), and setDelta().

79  {
80 
81  // Determine 2*std::sin(delta) times the u components (I call this uX, uY, Uz)
82  // Normalization is not needed; it will be done when returning the 3-Vector
83 
84  double Uz = ryx - rxy;
85  double Uy = rxz - rzx;
86  double Ux = rzy - ryz;
87 
88  if ( (Uz==0) && (Uy==0) && (Ux==0) ) {
89  if ( rzz>0 ) {
90  return Hep3Vector(0,0,1);
91  } else if ( ryy>0 ) {
92  return Hep3Vector(0,1,0);
93  } else {
94  return Hep3Vector(1,0,0);
95  }
96  } else {
97  return Hep3Vector( Ux, Uy, Uz ).unit();
98  }
99 
100 } // axis()
HepAxisAngle CLHEP::HepRotation::axisAngle ( ) const

Definition at line 102 of file RotationA.cc.

References axis(), and delta().

Referenced by CLHEP::HepLorentzRotation::decompose(), and decompose().

102  {
103 
104  return HepAxisAngle (axis(), delta());
105 
106 } // axisAngle()
Hep3Vector axis() const
Definition: RotationA.cc:79
double delta() const
Definition: RotationA.cc:66
HepLorentzVector CLHEP::HepRotation::col1 ( ) const
inline
HepLorentzVector CLHEP::HepRotation::col2 ( ) const
inline
HepLorentzVector CLHEP::HepRotation::col3 ( ) const
inline
HepLorentzVector CLHEP::HepRotation::col4 ( ) const
inline
Hep3Vector CLHEP::HepRotation::colX ( ) const
inline
Hep3Vector CLHEP::HepRotation::colY ( ) const
inline
Hep3Vector CLHEP::HepRotation::colZ ( ) const
inline
int CLHEP::HepRotation::compare ( const HepRotation r) const

Definition at line 178 of file Rotation.cc.

References rxx, rxy, rxz, ryx, ryy, ryz, rzx, rzy, and rzz.

178  {
179  if (rzz<r.rzz) return -1; else if (rzz>r.rzz) return 1;
180  else if (rzy<r.rzy) return -1; else if (rzy>r.rzy) return 1;
181  else if (rzx<r.rzx) return -1; else if (rzx>r.rzx) return 1;
182  else if (ryz<r.ryz) return -1; else if (ryz>r.ryz) return 1;
183  else if (ryy<r.ryy) return -1; else if (ryy>r.ryy) return 1;
184  else if (ryx<r.ryx) return -1; else if (ryx>r.ryx) return 1;
185  else if (rxz<r.rxz) return -1; else if (rxz>r.rxz) return 1;
186  else if (rxy<r.rxy) return -1; else if (rxy>r.rxy) return 1;
187  else if (rxx<r.rxx) return -1; else if (rxx>r.rxx) return 1;
188  else return 0;
189 }
void CLHEP::HepRotation::decompose ( HepAxisAngle rotation,
Hep3Vector boost 
) const

Definition at line 23 of file RotationP.cc.

References axisAngle(), and CLHEP::Hep3Vector::set().

23  {
24  boost.set(0,0,0);
25  rotation = axisAngle();
26 }
HepAxisAngle axisAngle() const
Definition: RotationA.cc:102
void CLHEP::HepRotation::decompose ( Hep3Vector boost,
HepAxisAngle rotation 
) const

Definition at line 28 of file RotationP.cc.

References axisAngle(), and CLHEP::Hep3Vector::set().

28  {
29  boost.set(0,0,0);
30  rotation = axisAngle();
31 }
HepAxisAngle axisAngle() const
Definition: RotationA.cc:102
double CLHEP::HepRotation::delta ( ) const

Definition at line 66 of file RotationA.cc.

References rxx, ryy, and rzz.

Referenced by axisAngle(), rectify(), and setAxis().

66  {
67 
68  double cosdelta = (rxx + ryy + rzz - 1.0) / 2.0;
69  if (cosdelta > 1.0) {
70  return 0;
71  } else if (cosdelta < -1.0) {
72  return CLHEP::pi;
73  } else {
74  return std::acos( cosdelta ); // Already safe due to the cosdelta > 1 check
75  }
76 
77 } // delta()
double CLHEP::HepRotation::distance2 ( const HepRotation r) const

Definition at line 33 of file RotationP.cc.

References rxx, rxy, rxz, ryx, ryy, ryz, rzx, rzy, and rzz.

Referenced by CLHEP::HepLorentzRotation::distance2(), distance2(), howNear(), CLHEP::HepLorentzRotation::isNear(), and isNear().

33  {
34  double sum = rxx * r.rxx + rxy * r.rxy + rxz * r.rxz
35  + ryx * r.ryx + ryy * r.ryy + ryz * r.ryz
36  + rzx * r.rzx + rzy * r.rzy + rzz * r.rzz;
37  double answer = 3.0 - sum;
38  return (answer >= 0 ) ? answer : 0;
39 }
double CLHEP::HepRotation::distance2 ( const HepBoost lt) const

Definition at line 39 of file RotationL.cc.

References distance2().

39  {
40  return distance2( HepLorentzRotation(lt));
41 }
double distance2(const HepRotation &r) const
Definition: RotationP.cc:33
double CLHEP::HepRotation::distance2 ( const HepLorentzRotation lt) const

Definition at line 29 of file RotationL.cc.

References test::a, test::b, CLHEP::Hep3Vector::beta(), CLHEP::HepLorentzRotation::decompose(), and distance2().

29  {
30  HepAxisAngle a;
31  Hep3Vector b;
32  lt.decompose(b, a);
33  double bet = b.beta();
34  double bet2 = bet*bet;
35  HepRotation r(a);
36  return bet2/(1-bet2) + distance2(r);
37 }
double distance2(const HepRotation &r) const
Definition: RotationP.cc:33
HepEulerAngles CLHEP::HepRotation::eulerAngles ( ) const

Definition at line 201 of file RotationE.cc.

References plottest35::c1, rxx, rxy, ryx, ryy, and rzz.

Referenced by phi(), and psi().

201  {
202 
203  // Please see the mathematical justification in eulerAngleComputations.ps
204 
205  double phi1, theta1, psi1;
206  double psiPlusPhi, psiMinusPhi;
207 
208  theta1 = safe_acos( rzz );
209 
210 // if (rzz > 1 || rzz < -1) {
211 // std::cerr << "HepRotation::eulerAngles() - "
212 // << "HepRotation::eulerAngles() finds | rzz | > 1 " << std::endl;
213 // }
214 
215  double cosTheta = rzz;
216  if (cosTheta > 1) cosTheta = 1;
217  if (cosTheta < -1) cosTheta = -1;
218 
219  if (cosTheta == 1) {
220  psiPlusPhi = std::atan2 ( rxy - ryx, rxx + ryy );
221  psiMinusPhi = 0;
222 
223  } else if (cosTheta >= 0) {
224 
225  // In this realm, the atan2 expression for psi + phi is numerically stable
226  psiPlusPhi = std::atan2 ( rxy - ryx, rxx + ryy );
227 
228  // psi - phi is potentially more subtle, but when unstable it is moot
229  double s1 = -rxy - ryx; // sin (psi-phi) * (1 - cos theta)
230  double c1 = rxx - ryy; // cos (psi-phi) * (1 - cos theta)
231  psiMinusPhi = std::atan2 ( s1, c1 );
232 
233  } else if (cosTheta > -1) {
234 
235  // In this realm, the atan2 expression for psi - phi is numerically stable
236  psiMinusPhi = std::atan2 ( -rxy - ryx, rxx - ryy );
237 
238  // psi + phi is potentially more subtle, but when unstable it is moot
239  double s1 = rxy - ryx; // sin (psi+phi) * (1 + cos theta)
240  double c1 = rxx + ryy; // cos (psi+phi) * (1 + cos theta)
241  psiPlusPhi = std::atan2 ( s1, c1 );
242 
243  } else { // cosTheta == -1
244 
245  psiMinusPhi = std::atan2 ( -rxy - ryx, rxx - ryy );
246  psiPlusPhi = 0;
247 
248  }
249 
250  psi1 = .5 * (psiPlusPhi + psiMinusPhi);
251  phi1 = .5 * (psiPlusPhi - psiMinusPhi);
252 
253  // Now correct by pi if we have managed to get a value of psiPlusPhi
254  // or psiMinusPhi that was off by 2 pi:
255  correctPsiPhi ( rxz, rzx, ryz, rzy, psi1, phi1 );
256 
257  return HepEulerAngles( phi1, theta1, psi1 );
258 
259 } // eulerAngles()
tuple c1
Definition: plottest35.py:14
void CLHEP::HepRotation::getAngleAxis ( double &  delta,
Hep3Vector axis 
) const

Definition at line 153 of file Rotation.cc.

References test::x, xx(), xy(), xz(), yx(), yy(), yz(), z, zx(), zy(), and zz().

153  {
154  double cosa = 0.5*(xx()+yy()+zz()-1);
155  double cosa1 = 1-cosa;
156  if (cosa1 <= 0) {
157  angle = 0;
158  aaxis = Hep3Vector(0,0,1);
159  }else{
160  double x=0, y=0, z=0;
161  if (xx() > cosa) x = std::sqrt((xx()-cosa)/cosa1);
162  if (yy() > cosa) y = std::sqrt((yy()-cosa)/cosa1);
163  if (zz() > cosa) z = std::sqrt((zz()-cosa)/cosa1);
164  if (zy() < yz()) x = -x;
165  if (xz() < zx()) y = -y;
166  if (yx() < xy()) z = -z;
167  angle = (cosa < -1.) ? std::acos(-1.) : std::acos(cosa);
168  aaxis = Hep3Vector(x,y,z);
169  }
170 }
double xx() const
G4double z
Definition: TRTMaterials.hh:39
double yy() const
double xz() const
double zx() const
double yz() const
double zy() const
double yx() const
double zz() const
double xy() const
Hep3Vector CLHEP::HepRotation::getAxis ( ) const
inline
double CLHEP::HepRotation::getDelta ( ) const
inline
double CLHEP::HepRotation::getPhi ( ) const
inline
double CLHEP::HepRotation::getPsi ( ) const
inline
double CLHEP::HepRotation::getTheta ( ) const
inline
static double CLHEP::HepRotation::getTolerance ( )
inlinestatic
double CLHEP::HepRotation::howNear ( const HepRotation r) const

Definition at line 41 of file RotationP.cc.

References distance2().

41  {
42  return std::sqrt( distance2( r ) );
43 }
double distance2(const HepRotation &r) const
Definition: RotationP.cc:33
double CLHEP::HepRotation::howNear ( const HepBoost lt) const

Definition at line 47 of file RotationL.cc.

References distance2().

47  {
48  return std::sqrt( distance2( lt ) );
49 }
double distance2(const HepRotation &r) const
Definition: RotationP.cc:33
double CLHEP::HepRotation::howNear ( const HepLorentzRotation lt) const

Definition at line 43 of file RotationL.cc.

References distance2().

43  {
44  return std::sqrt( distance2( lt ) );
45 }
double distance2(const HepRotation &r) const
Definition: RotationP.cc:33
HepRotation CLHEP::HepRotation::inverse ( ) const
inline
HepRotation& CLHEP::HepRotation::invert ( )
inline
bool CLHEP::HepRotation::isIdentity ( ) const

Definition at line 172 of file Rotation.cc.

References rxx, rxy, rxz, ryx, ryy, ryz, rzx, rzy, and rzz.

Referenced by G4GMocrenFileSceneHandler::AddSolid().

172  {
173  return (rxx == 1.0 && rxy == 0.0 && rxz == 0.0 &&
174  ryx == 0.0 && ryy == 1.0 && ryz == 0.0 &&
175  rzx == 0.0 && rzy == 0.0 && rzz == 1.0) ? true : false;
176 }
bool CLHEP::HepRotation::isNear ( const HepRotation r,
double  epsilon = Hep4RotationInterface::tolerance 
) const

Definition at line 45 of file RotationP.cc.

References distance2().

46  {
47  return distance2( r ) <= epsilon*epsilon;
48 }
double distance2(const HepRotation &r) const
Definition: RotationP.cc:33
bool CLHEP::HepRotation::isNear ( const HepBoost lt,
double  epsilon = Hep4RotationInterface::tolerance 
) const

Definition at line 56 of file RotationL.cc.

References distance2().

57  {
58  return distance2( lt ) <= epsilon*epsilon;
59 }
double distance2(const HepRotation &r) const
Definition: RotationP.cc:33
bool CLHEP::HepRotation::isNear ( const HepLorentzRotation lt,
double  epsilon = Hep4RotationInterface::tolerance 
) const

Definition at line 51 of file RotationL.cc.

References distance2().

52  {
53  return distance2( lt ) <= epsilon*epsilon;
54 }
double distance2(const HepRotation &r) const
Definition: RotationP.cc:33
double CLHEP::HepRotation::norm2 ( ) const
bool CLHEP::HepRotation::operator!= ( const HepRotation r) const
inline
double CLHEP::HepRotation::operator() ( int  i,
int  j 
) const

Definition at line 28 of file Rotation.cc.

References xx(), xy(), xz(), yx(), yy(), yz(), zx(), zy(), and zz().

28  {
29  if (i == 0) {
30  if (j == 0) { return xx(); }
31  if (j == 1) { return xy(); }
32  if (j == 2) { return xz(); }
33  } else if (i == 1) {
34  if (j == 0) { return yx(); }
35  if (j == 1) { return yy(); }
36  if (j == 2) { return yz(); }
37  } else if (i == 2) {
38  if (j == 0) { return zx(); }
39  if (j == 1) { return zy(); }
40  if (j == 2) { return zz(); }
41  }
42  std::cerr << "HepRotation subscripting: bad indices "
43  << "(" << i << "," << j << ")" << std::endl;
44  return 0.0;
45 }
double xx() const
double yy() const
double xz() const
double zx() const
double yz() const
double zy() const
double yx() const
double zz() const
double xy() const
Hep3Vector CLHEP::HepRotation::operator() ( const Hep3Vector p) const
inline
HepLorentzVector CLHEP::HepRotation::operator() ( const HepLorentzVector w) const
inline
Hep3Vector CLHEP::HepRotation::operator* ( const Hep3Vector p) const
inline
HepLorentzVector CLHEP::HepRotation::operator* ( const HepLorentzVector w) const
inline
HepRotation CLHEP::HepRotation::operator* ( const HepRotation r) const
inline
HepRotation CLHEP::HepRotation::operator* ( const HepRotationX rx) const
inline
HepRotation CLHEP::HepRotation::operator* ( const HepRotationY ry) const
inline
HepRotation CLHEP::HepRotation::operator* ( const HepRotationZ rz) const
inline
HepRotation& CLHEP::HepRotation::operator*= ( const HepRotation r)
inline
HepRotation& CLHEP::HepRotation::operator*= ( const HepRotationX r)
inline
HepRotation& CLHEP::HepRotation::operator*= ( const HepRotationY r)
inline
HepRotation& CLHEP::HepRotation::operator*= ( const HepRotationZ r)
inline
bool CLHEP::HepRotation::operator< ( const HepRotation r) const
inline
bool CLHEP::HepRotation::operator<= ( const HepRotation r) const
inline
HepRotation& CLHEP::HepRotation::operator= ( const HepRotation r)
inline
HepRotation& CLHEP::HepRotation::operator= ( const HepRotationX r)
inline
HepRotation& CLHEP::HepRotation::operator= ( const HepRotationY r)
inline
HepRotation& CLHEP::HepRotation::operator= ( const HepRotationZ r)
inline
bool CLHEP::HepRotation::operator== ( const HepRotation r) const
inline
bool CLHEP::HepRotation::operator> ( const HepRotation r) const
inline
bool CLHEP::HepRotation::operator>= ( const HepRotation r) const
inline
const HepRotation_row CLHEP::HepRotation::operator[] ( int  ) const
inline
double CLHEP::HepRotation::phi ( ) const

Definition at line 70 of file RotationE.cc.

References eulerAngles(), CLHEP::HepEulerAngles::phi(), rzx, rzy, and rzz.

Referenced by setPsi(), and setTheta().

70  {
71 
72  double s2 = 1.0 - rzz*rzz;
73  if (s2 < 0) {
74  std::cerr << "HepRotation::phi() - "
75  << "HepRotation::phi() finds | rzz | > 1 " << std::endl;
76  s2 = 0;
77  }
78  const double sinTheta = std::sqrt( s2 );
79 
80  if (sinTheta < .01) { // For theta close to 0 or PI, use the more stable
81  // algorithm to get all three Euler angles
82  HepEulerAngles ea = eulerAngles();
83  return ea.phi();
84  }
85 
86  const double cscTheta = 1/sinTheta;
87  double cosabsphi = - rzy * cscTheta;
88  if ( std::fabs(cosabsphi) > 1 ) { // NaN-proofing
89  std::cerr << "HepRotation::phi() - "
90  << "HepRotation::phi() finds | cos phi | > 1 " << std::endl;
91  cosabsphi = 1;
92  }
93  const double absPhi = std::acos ( cosabsphi );
94  if (rzx > 0) {
95  return absPhi;
96  } else if (rzx < 0) {
97  return -absPhi;
98  } else {
99  return (rzy < 0) ? 0 : CLHEP::pi;
100  }
101 
102 } // phi()
HepEulerAngles eulerAngles() const
Definition: RotationE.cc:201
double CLHEP::HepRotation::phiX ( ) const

Definition at line 129 of file Rotation.cc.

References xx(), and yx().

Referenced by G4HepRepFileSceneHandler::AddSolid(), G4tgbGeometryDumper::DumpRotationMatrix(), and operator<<().

129  {
130  return (yx() == 0.0 && xx() == 0.0) ? 0.0 : std::atan2(yx(),xx());
131 }
double xx() const
double yx() const
double CLHEP::HepRotation::phiY ( ) const

Definition at line 133 of file Rotation.cc.

References xy(), and yy().

Referenced by G4HepRepFileSceneHandler::AddSolid(), G4tgbGeometryDumper::DumpRotationMatrix(), and operator<<().

133  {
134  return (yy() == 0.0 && xy() == 0.0) ? 0.0 : std::atan2(yy(),xy());
135 }
double yy() const
double xy() const
double CLHEP::HepRotation::phiZ ( ) const

Definition at line 137 of file Rotation.cc.

References xz(), and yz().

Referenced by G4HepRepFileSceneHandler::AddSolid(), G4tgbGeometryDumper::DumpRotationMatrix(), and operator<<().

137  {
138  return (yz() == 0.0 && xz() == 0.0) ? 0.0 : std::atan2(yz(),xz());
139 }
double xz() const
double yz() const
std::ostream & CLHEP::HepRotation::print ( std::ostream &  os) const

Definition at line 21 of file RotationIO.cc.

References xx(), xy(), xz(), yx(), yy(), yz(), zx(), zy(), and zz().

Referenced by G4ReflectedSolid::StreamInfo(), and G4DisplacedSolid::StreamInfo().

21  {
22  os << "\n [ ( " <<
23  std::setw(11) << std::setprecision(6) << xx() << " " <<
24  std::setw(11) << std::setprecision(6) << xy() << " " <<
25  std::setw(11) << std::setprecision(6) << xz() << ")\n"
26  << " ( " <<
27  std::setw(11) << std::setprecision(6) << yx() << " " <<
28  std::setw(11) << std::setprecision(6) << yy() << " " <<
29  std::setw(11) << std::setprecision(6) << yz() << ")\n"
30  << " ( " <<
31  std::setw(11) << std::setprecision(6) << zx() << " " <<
32  std::setw(11) << std::setprecision(6) << zy() << " " <<
33  std::setw(11) << std::setprecision(6) << zz() << ") ]\n";
34  return os;
35 }
double xx() const
double yy() const
double xz() const
double zx() const
double yz() const
double zy() const
double yx() const
double zz() const
double xy() const
double CLHEP::HepRotation::psi ( ) const

Definition at line 110 of file RotationE.cc.

References eulerAngles(), CLHEP::HepEulerAngles::psi(), rxz, ryz, and rzz.

Referenced by setPhi(), and setTheta().

110  {
111 
112  double sinTheta;
113  if ( std::fabs(rzz) > 1 ) { // NaN-proofing
114  std::cerr << "HepRotation::psi() - "
115  << "HepRotation::psi() finds | rzz | > 1" << std::endl;
116  sinTheta = 0;
117  } else {
118  sinTheta = std::sqrt( 1.0 - rzz*rzz );
119  }
120 
121  if (sinTheta < .01) { // For theta close to 0 or PI, use the more stable
122  // algorithm to get all three Euler angles
123  HepEulerAngles ea = eulerAngles();
124  return ea.psi();
125  }
126 
127  const double cscTheta = 1/sinTheta;
128  double cosabspsi = ryz * cscTheta;
129  if ( std::fabs(cosabspsi) > 1 ) { // NaN-proofing
130  std::cerr << "HepRotation::psi() - "
131  << "HepRotation::psi() finds | cos psi | > 1" << std::endl;
132  cosabspsi = 1;
133  }
134  const double absPsi = std::acos ( cosabspsi );
135  if (rxz > 0) {
136  return absPsi;
137  } else if (rxz < 0) {
138  return -absPsi;
139  } else {
140  return (ryz > 0) ? 0 : CLHEP::pi;
141  }
142 
143 } // psi()
HepEulerAngles eulerAngles() const
Definition: RotationE.cc:201
void CLHEP::HepRotation::rectify ( )

Definition at line 152 of file RotationC.cc.

References axis(), delta(), rxx, rxy, rxz, ryx, ryy, ryz, rzx, rzy, rzz, set(), and CLHEP::Hep3Vector::unit().

Referenced by CLHEP::HepLorentzRotation::decompose().

152  {
153  // Assuming the representation of this is close to a true Rotation,
154  // but may have drifted due to round-off error from many operations,
155  // this forms an "exact" orthonormal matrix for the rotation again.
156 
157  // The first step is to average with the transposed inverse. This
158  // will correct for small errors such as those occuring when decomposing
159  // a LorentzTransformation. Then we take the bull by the horns and
160  // formally extract the axis and delta (assuming the Rotation were true)
161  // and re-setting the rotation according to those.
162 
163  double det = rxx * ryy * rzz +
164  rxy * ryz * rzx +
165  rxz * ryx * rzy -
166  rxx * ryz * rzy -
167  rxy * ryx * rzz -
168  rxz * ryy * rzx ;
169  if (det <= 0) {
170  std::cerr << "HepRotation::rectify() - "
171  << "Attempt to rectify a Rotation with determinant <= 0" << std::endl;
172  return;
173  }
174  double di = 1.0 / det;
175 
176  // xx, xy, ... are components of inverse matrix:
177  double xx1 = (ryy * rzz - ryz * rzy) * di;
178  double xy1 = (rzy * rxz - rzz * rxy) * di;
179  double xz1 = (rxy * ryz - rxz * ryy) * di;
180  double yx1 = (ryz * rzx - ryx * rzz) * di;
181  double yy1 = (rzz * rxx - rzx * rxz) * di;
182  double yz1 = (rxz * ryx - rxx * ryz) * di;
183  double zx1 = (ryx * rzy - ryy * rzx) * di;
184  double zy1 = (rzx * rxy - rzy * rxx) * di;
185  double zz1 = (rxx * ryy - rxy * ryx) * di;
186 
187  // Now average with the TRANSPOSE of that:
188  rxx = .5*(rxx + xx1);
189  rxy = .5*(rxy + yx1);
190  rxz = .5*(rxz + zx1);
191  ryx = .5*(ryx + xy1);
192  ryy = .5*(ryy + yy1);
193  ryz = .5*(ryz + zy1);
194  rzx = .5*(rzx + xz1);
195  rzy = .5*(rzy + yz1);
196  rzz = .5*(rzz + zz1);
197 
198  // Now force feed this improved rotation
199  double del = delta();
200  Hep3Vector u = axis();
201  u = u.unit(); // Because if the rotation is inexact, then the
202  // axis() returned will not have length 1!
203  set(u, del);
204 
205 } // rectify()
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
Hep3Vector axis() const
Definition: RotationA.cc:79
double delta() const
Definition: RotationA.cc:66
HepRep3x3 CLHEP::HepRotation::rep3x3 ( ) const
inline
HepRep4x4 CLHEP::HepRotation::rep4x4 ( ) const
inline
HepRotation & CLHEP::HepRotation::rotate ( double  delta,
const Hep3Vector axis 
)

Definition at line 47 of file Rotation.cc.

References CLHEP::Hep3Vector::mag(), transform(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by G4tgbPlaceParamCircle::ComputeTransformation(), and CLHEP::Hep3Vector::rotate().

47  {
48  if (a != 0.0) {
49  double ll = aaxis.mag();
50  if (ll == 0.0) {
51  std::cerr << "HepRotation::rotate() - "
52  << "HepRotation: zero axis" << std::endl;
53  }else{
54  double sa = std::sin(a), ca = std::cos(a);
55  double dx = aaxis.x()/ll, dy = aaxis.y()/ll, dz = aaxis.z()/ll;
56  HepRotation m1(
57  ca+(1-ca)*dx*dx, (1-ca)*dx*dy-sa*dz, (1-ca)*dx*dz+sa*dy,
58  (1-ca)*dy*dx+sa*dz, ca+(1-ca)*dy*dy, (1-ca)*dy*dz-sa*dx,
59  (1-ca)*dz*dx-sa*dy, (1-ca)*dz*dy+sa*dx, ca+(1-ca)*dz*dz );
60  transform(m1);
61  }
62  }
63  return *this;
64 }
HepRotation & transform(const HepRotation &r)
HepRotation& CLHEP::HepRotation::rotate ( double  delta,
const Hep3Vector axis 
)
inline
HepRotation & CLHEP::HepRotation::rotateAxes ( const Hep3Vector newX,
const Hep3Vector newY,
const Hep3Vector newZ 
)

Definition at line 105 of file Rotation.cc.

References CLHEP::Hep3Vector::cross(), CLHEP::Hep3Vector::dot(), HepRotation(), CLHEP::Hep3Vector::mag2(), transform(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by CCalRotationMatrixFactory::AddMatrix().

107  {
108  double del = 0.001;
109  Hep3Vector w = newX.cross(newY);
110 
111  if (std::abs(newZ.x()-w.x()) > del ||
112  std::abs(newZ.y()-w.y()) > del ||
113  std::abs(newZ.z()-w.z()) > del ||
114  std::abs(newX.mag2()-1.) > del ||
115  std::abs(newY.mag2()-1.) > del ||
116  std::abs(newZ.mag2()-1.) > del ||
117  std::abs(newX.dot(newY)) > del ||
118  std::abs(newY.dot(newZ)) > del ||
119  std::abs(newZ.dot(newX)) > del) {
120  std::cerr << "HepRotation::rotateAxes: bad axis vectors" << std::endl;
121  return *this;
122  }else{
123  return transform(HepRotation(newX.x(), newY.x(), newZ.x(),
124  newX.y(), newY.y(), newZ.y(),
125  newX.z(), newY.z(), newZ.z()));
126  }
127 }
HepRotation & transform(const HepRotation &r)
HepRotation & CLHEP::HepRotation::rotateX ( double  delta)

Definition at line 66 of file Rotation.cc.

References plottest35::c1, ryx, ryy, ryz, rzx, rzy, and rzz.

Referenced by G4tgbRotationMatrix::BuildG4RotMatrixFrom3(), G4MIRDLiver::Construct(), G4MIRDLeftLeg::Construct(), G4MIRDRightLeg::Construct(), G4MIRDSmallIntestine::Construct(), G4MIRDUterus::Construct(), G4MIRDLeftBreast::Construct(), G4MIRDRightBreast::Construct(), G4MIRDTrunk::Construct(), G4MIRDHead::Construct(), G4MIRDRightArmBone::Construct(), G4MIRDLeftArmBone::Construct(), B5DetectorConstruction::Construct(), FCALTestbeamSetup::Construct(), G4tgrUtils::GetRotationFromDirection(), G4GDMLReadDefine::GetRotationMatrix(), LXeMainVolume::LXeMainVolume(), G4GDMLReadParamvol::ParametersRead(), CML2AcceleratorConstruction::rotateAccelerator(), G4VScoringMesh::RotateX(), DicomIntersectVolume::SetNewValue(), XrayFluoPlaneDetectorConstruction::UpdateGeometry(), XrayFluoMercuryDetectorConstruction::UpdateGeometry(), and XrayFluoDetectorConstruction::UpdateGeometry().

66  {
67  double c1 = std::cos(a);
68  double s1 = std::sin(a);
69  double x1 = ryx, y1 = ryy, z1 = ryz;
70  ryx = c1*x1 - s1*rzx;
71  ryy = c1*y1 - s1*rzy;
72  ryz = c1*z1 - s1*rzz;
73  rzx = s1*x1 + c1*rzx;
74  rzy = s1*y1 + c1*rzy;
75  rzz = s1*z1 + c1*rzz;
76  return *this;
77 }
tuple c1
Definition: plottest35.py:14
HepRotation & CLHEP::HepRotation::rotateY ( double  delta)

Definition at line 79 of file Rotation.cc.

References plottest35::c1, rxx, rxy, rxz, rzx, rzy, and rzz.

Referenced by G4INCLXXInterface::ApplyYourself(), B5DetectorConstruction::B5DetectorConstruction(), G4tgbRotationMatrix::BuildG4RotMatrixFrom3(), G4MIRDLeftLeg::Construct(), G4MIRDRightLeg::Construct(), G4MIRDSmallIntestine::Construct(), G4MIRDHeart::Construct(), G4MIRDLeftBreast::Construct(), G4MIRDPancreas::Construct(), G4MIRDRightBreast::Construct(), G4MIRDTrunk::Construct(), G4MIRDHead::Construct(), B3DetectorConstruction::Construct(), IORTDetectorConstruction::ConstructDisc(), G4NeutronBetaDecayChannel::DecayIt(), G4tgrUtils::GetRotationFromDirection(), G4GDMLReadDefine::GetRotationMatrix(), PassiveProtonBeamLine::HadrontherapyBeamCollimators(), PassiveCarbonBeamLine::HadrontherapyBeamFinalCollimator(), PassiveProtonBeamLine::HadrontherapyBeamFinalCollimator(), PassiveCarbonBeamLine::HadrontherapyBeamNozzle(), PassiveProtonBeamLine::HadrontherapyBeamNozzle(), PassiveProtonBeamLine::HadrontherapyBeamScatteringFoils(), Collimator80BeamLine::IortBeamLineBlocks(), Collimator50BeamLine::IortBeamLineBlocks(), Collimator40BeamLine::IortBeamLineBlocks(), Collimator60BeamLine::IortBeamLineBlocks(), Collimator100BeamLine::IortBeamLineBlocks(), Collimator70BeamLine::IortBeamLineBlocks(), Collimator70BeamLine::IortBeamLineFinalCollimator(), Collimator100BeamLine::IortBeamLineFinalCollimator(), Collimator80BeamLine::IortBeamLineFinalCollimator(), Collimator50BeamLine::IortBeamLineFinalCollimator(), Collimator40BeamLine::IortBeamLineFinalCollimator(), Collimator60BeamLine::IortBeamLineFinalCollimator(), Collimator100BeamLine::IortBeamLineJunctions(), Collimator80BeamLine::IortBeamLineJunctions(), Collimator50BeamLine::IortBeamLineJunctions(), Collimator40BeamLine::IortBeamLineJunctions(), Collimator70BeamLine::IortBeamLineJunctions(), Collimator60BeamLine::IortBeamLineJunctions(), Collimator80BeamLine::IortBeamLineMonitorChambers(), Collimator50BeamLine::IortBeamLineMonitorChambers(), Collimator40BeamLine::IortBeamLineMonitorChambers(), Collimator60BeamLine::IortBeamLineMonitorChambers(), Collimator100BeamLine::IortBeamLineMonitorChambers(), Collimator70BeamLine::IortBeamLineMonitorChambers(), Collimator70BeamLine::IortBeamLineTitaniumWindows(), Collimator60BeamLine::IortBeamLineTitaniumWindows(), Collimator50BeamLine::IortBeamLineTitaniumWindows(), Collimator80BeamLine::IortBeamLineTitaniumWindows(), Collimator100BeamLine::IortBeamLineTitaniumWindows(), Collimator40BeamLine::IortBeamLineTitaniumWindows(), Collimator100BeamLine::IortBeamLineVacuumSource(), Collimator60BeamLine::IortBeamLineVacuumSource(), Collimator40BeamLine::IortBeamLineVacuumSource(), Collimator70BeamLine::IortBeamLineVacuumSource(), Collimator80BeamLine::IortBeamLineVacuumSource(), Collimator50BeamLine::IortBeamLineVacuumSource(), LXeMainVolume::LXeMainVolume(), LXeWLSSlab::LXeWLSSlab(), G4GDMLReadParamvol::ParametersRead(), CML2AcceleratorConstruction::rotateAccelerator(), G4VScoringMesh::RotateY(), PassiveCarbonBeamLine::ScatteringSystem(), B5DetectorConstruction::SetArmAngle(), and DicomIntersectVolume::SetNewValue().

79  {
80  double c1 = std::cos(a);
81  double s1 = std::sin(a);
82  double x1 = rzx, y1 = rzy, z1 = rzz;
83  rzx = c1*x1 - s1*rxx;
84  rzy = c1*y1 - s1*rxy;
85  rzz = c1*z1 - s1*rxz;
86  rxx = s1*x1 + c1*rxx;
87  rxy = s1*y1 + c1*rxy;
88  rxz = s1*z1 + c1*rxz;
89  return *this;
90 }
tuple c1
Definition: plottest35.py:14
HepRotation & CLHEP::HepRotation::rotateZ ( double  delta)

Definition at line 92 of file Rotation.cc.

References plottest35::c1, rxx, rxy, rxz, ryx, ryy, and ryz.

Referenced by G4VTwistSurface::AmIOnLeftSide(), G4INCLXXInterface::ApplyYourself(), G4tgbRotationMatrix::BuildG4RotMatrixFrom3(), HadrontherapyModulator::BuildModulator(), G4VDivisionParameterisation::ChangeRotMatrix(), H02DetectorConstruction::Construct(), ExN04DetectorConstruction::Construct(), G4MIRDThyroid::Construct(), G4MIRDLeftBreast::Construct(), G4MIRDRightBreast::Construct(), G4MIRDRightLung::Construct(), RE05DetectorConstruction::Construct(), B3DetectorConstruction::Construct(), FCALEMModule::Construct(), FCALHadModule::Construct(), FCALCryostatVolumes::Construct(), G4NeutronBetaDecayChannel::DecayIt(), G4TwistBoxSide::G4TwistBoxSide(), G4TwistTrapAlphaSide::G4TwistTrapAlphaSide(), G4TwistTrapFlatSide::G4TwistTrapFlatSide(), G4TwistTrapParallelSide::G4TwistTrapParallelSide(), G4TwistTubsFlatSide::G4TwistTubsFlatSide(), G4TwistTubsSide::G4TwistTubsSide(), G4GDMLReadDefine::GetRotationMatrix(), G4GDMLReadParamvol::ParametersRead(), G4VScoringMesh::RotateZ(), and G4PhysicalVolumeModel::VisitGeometryAndGetVisReps().

92  {
93  double c1 = std::cos(a);
94  double s1 = std::sin(a);
95  double x1 = rxx, y1 = rxy, z1 = rxz;
96  rxx = c1*x1 - s1*ryx;
97  rxy = c1*y1 - s1*ryy;
98  rxz = c1*z1 - s1*ryz;
99  ryx = s1*x1 + c1*ryx;
100  ryy = s1*y1 + c1*ryy;
101  ryz = s1*z1 + c1*ryz;
102  return *this;
103 }
tuple c1
Definition: plottest35.py:14
HepLorentzVector CLHEP::HepRotation::row1 ( ) const
inline
HepLorentzVector CLHEP::HepRotation::row2 ( ) const
inline
HepLorentzVector CLHEP::HepRotation::row3 ( ) const
inline
HepLorentzVector CLHEP::HepRotation::row4 ( ) const
inline
Hep3Vector CLHEP::HepRotation::rowX ( ) const
inline
Hep3Vector CLHEP::HepRotation::rowY ( ) const
inline
Hep3Vector CLHEP::HepRotation::rowZ ( ) const
inline
HepRotation & CLHEP::HepRotation::set ( const Hep3Vector axis,
double  delta 
)

Definition at line 27 of file RotationA.cc.

References CLHEP::Hep3Vector::getX(), CLHEP::Hep3Vector::getY(), CLHEP::Hep3Vector::getZ(), rxx, rxy, rxz, ryx, ryy, ryz, rzx, rzy, rzz, and CLHEP::Hep3Vector::unit().

Referenced by G4MuonDecayChannel::DecayIt(), CLHEP::HepLorentzRotation::decompose(), HepRotation(), rectify(), set(), setAxis(), setDelta(), setPhi(), setPsi(), setRows(), and setTheta().

27  {
28 
29  register double sinDelta = std::sin(ddelta), cosDelta = std::cos(ddelta);
30  register double oneMinusCosDelta = 1.0 - cosDelta;
31 
32  Hep3Vector u = aaxis.unit();
33 
34  register double uX = u.getX();
35  register double uY = u.getY();
36  register double uZ = u.getZ();
37 
38  rxx = oneMinusCosDelta * uX * uX + cosDelta;
39  rxy = oneMinusCosDelta * uX * uY - sinDelta * uZ;
40  rxz = oneMinusCosDelta * uX * uZ + sinDelta * uY;
41 
42  ryx = oneMinusCosDelta * uY * uX + sinDelta * uZ;
43  ryy = oneMinusCosDelta * uY * uY + cosDelta;
44  ryz = oneMinusCosDelta * uY * uZ - sinDelta * uX;
45 
46  rzx = oneMinusCosDelta * uZ * uX - sinDelta * uY;
47  rzy = oneMinusCosDelta * uZ * uY + sinDelta * uX;
48  rzz = oneMinusCosDelta * uZ * uZ + cosDelta;
49 
50  return *this;
51 
52 } // HepRotation::set(axis, delta)
HepRotation & CLHEP::HepRotation::set ( const HepAxisAngle ax)

Definition at line 58 of file RotationA.cc.

References CLHEP::HepAxisAngle::axis(), CLHEP::HepAxisAngle::delta(), and set().

58  {
59  return set ( ax.axis(), ax.delta() );
60 }
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
HepRotation & CLHEP::HepRotation::set ( double  phi,
double  theta,
double  psi 
)

Definition at line 35 of file RotationE.cc.

References rxx, rxy, rxz, ryx, ryy, ryz, rzx, rzy, and rzz.

35  {
36 
37  register double sinPhi = std::sin( phi1 ), cosPhi = std::cos( phi1 );
38  register double sinTheta = std::sin( theta1 ), cosTheta = std::cos( theta1 );
39  register double sinPsi = std::sin( psi1 ), cosPsi = std::cos( psi1 );
40 
41  rxx = cosPsi * cosPhi - cosTheta * sinPhi * sinPsi;
42  rxy = cosPsi * sinPhi + cosTheta * cosPhi * sinPsi;
43  rxz = sinPsi * sinTheta;
44 
45  ryx = - sinPsi * cosPhi - cosTheta * sinPhi * cosPsi;
46  ryy = - sinPsi * sinPhi + cosTheta * cosPhi * cosPsi;
47  ryz = cosPsi * sinTheta;
48 
49  rzx = sinTheta * sinPhi;
50  rzy = - sinTheta * cosPhi;
51  rzz = cosTheta;
52 
53  return *this;
54 
55 } // Rotation::set(phi, theta, psi)
HepRotation & CLHEP::HepRotation::set ( const HepEulerAngles e)

Definition at line 61 of file RotationE.cc.

References CLHEP::HepEulerAngles::phi(), CLHEP::HepEulerAngles::psi(), set(), and CLHEP::HepEulerAngles::theta().

61  {
62  return set(e.phi(), e.theta(), e.psi());
63 }
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
HepRotation & CLHEP::HepRotation::set ( const Hep3Vector colX,
const Hep3Vector colY,
const Hep3Vector colZ 
)

Definition at line 73 of file RotationC.cc.

References CLHEP::Hep3Vector::dot(), rxx, rxy, rxz, ryx, ryy, ryz, rzx, rzy, rzz, CLHEP::Hep4RotationInterface::tolerance, CLHEP::Hep3Vector::unit(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

75  {
76  Hep3Vector ucolX = ccolX.unit();
77  Hep3Vector ucolY = ccolY.unit();
78  Hep3Vector ucolZ = ccolZ.unit();
79 
80  double u1u2 = ucolX.dot(ucolY);
81  double f12 = std::fabs(u1u2);
83  std::cerr << "HepRotation::set() - "
84  << "col's X and Y supplied for Rotation are not close to orthogonal"
85  << std::endl;
86  }
87  double u1u3 = ucolX.dot(ucolZ);
88  double f13 = std::fabs(u1u3);
90  std::cerr << "HepRotation::set() - "
91  << "col's X and Z supplied for Rotation are not close to orthogonal"
92  << std::endl;
93  }
94  double u2u3 = ucolY.dot(ucolZ);
95  double f23 = std::fabs(u2u3);
97  std::cerr << "HepRotation::set() - "
98  << "col's Y and Z supplied for Rotation are not close to orthogonal"
99  << std::endl;
100  }
101 
102  Hep3Vector v1, v2, v3;
103  bool isRotation;
104  if ( (f12 <= f13) && (f12 <= f23) ) {
105  isRotation = setCols ( ucolX, ucolY, ucolZ, u1u2, v1, v2, v3 );
106  if ( !isRotation ) {
107  std::cerr << "HepRotation::set() - "
108  << "col's X Y and Z supplied form closer to a reflection than a Rotation "
109  << "\n col Z is set to col X cross col Y" << std::endl;
110  }
111  } else if ( f13 <= f23 ) {
112  isRotation = setCols ( ucolZ, ucolX, ucolY, u1u3, v3, v1, v2 );
113  if ( !isRotation ) {
114  std::cerr << "HepRotation::set() - "
115  << "col's X Y and Z supplied form closer to a reflection than a Rotation "
116  << "\n col Y is set to col Z cross col X" << std::endl;
117  }
118  } else {
119  isRotation = setCols ( ucolY, ucolZ, ucolX, u2u3, v2, v3, v1 );
120  if ( !isRotation ) {
121  std::cerr << "HepRotation::set() - "
122  << "col's X Y and Z supplied form closer to a reflection than a Rotation "
123  << "\n col X is set to col Y cross col Z" << std::endl;
124  }
125  }
126 
127  rxx = v1.x(); ryx = v1.y(); rzx = v1.z();
128  rxy = v2.x(); ryy = v2.y(); rzy = v2.z();
129  rxz = v3.x(); ryz = v3.y(); rzz = v3.z();
130 
131  return *this;
132 
133 } // HepRotation::set(colX, colY, colZ)
static DLL_API double tolerance
HepRotation& CLHEP::HepRotation::set ( const HepRotationX r)
inline
HepRotation& CLHEP::HepRotation::set ( const HepRotationY r)
inline
HepRotation& CLHEP::HepRotation::set ( const HepRotationZ r)
inline
HepRotation& CLHEP::HepRotation::set ( const HepRep3x3 m)
inline
void CLHEP::HepRotation::setAxis ( const Hep3Vector axis)

Definition at line 109 of file RotationA.cc.

References delta(), and set().

109  {
110  set ( aaxis, delta() );
111 }
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
double delta() const
Definition: RotationA.cc:66
void CLHEP::HepRotation::setDelta ( double  delta)

Definition at line 113 of file RotationA.cc.

References axis(), and set().

113  {
114  set ( axis(), ddelta );
115 }
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
Hep3Vector axis() const
Definition: RotationA.cc:79
void CLHEP::HepRotation::setPhi ( double  phi)

Definition at line 262 of file RotationE.cc.

References psi(), set(), and theta().

Referenced by G4GMocrenTouchable::GetRotation().

262  {
263  set ( phi1, theta(), psi() );
264 }
double theta() const
Definition: RotationE.cc:104
double psi() const
Definition: RotationE.cc:110
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
void CLHEP::HepRotation::setPsi ( double  psi)

Definition at line 270 of file RotationE.cc.

References phi(), set(), and theta().

270  {
271  set ( phi(), theta(), psi1 );
272 }
double theta() const
Definition: RotationE.cc:104
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
double phi() const
Definition: RotationE.cc:70
HepRotation & CLHEP::HepRotation::setRows ( const Hep3Vector rowX,
const Hep3Vector rowY,
const Hep3Vector rowZ 
)

Definition at line 142 of file RotationC.cc.

References invert(), and set().

144  {
145  set (rrowX, rrowY, rrowZ);
146  invert();
147  return *this;
148 }
HepRotation & invert()
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
void CLHEP::HepRotation::setTheta ( double  theta)

Definition at line 266 of file RotationE.cc.

References phi(), psi(), and set().

266  {
267  set ( phi(), theta1, psi() );
268 }
double psi() const
Definition: RotationE.cc:110
HepRotation & set(const Hep3Vector &axis, double delta)
Definition: RotationA.cc:27
double phi() const
Definition: RotationE.cc:70
static double CLHEP::HepRotation::setTolerance ( double  tol)
inlinestatic
double CLHEP::HepRotation::theta ( ) const

Definition at line 104 of file RotationE.cc.

References rzz.

Referenced by setPhi(), and setPsi().

104  {
105 
106  return safe_acos( rzz );
107 
108 } // theta()
double CLHEP::HepRotation::thetaX ( ) const

Definition at line 141 of file Rotation.cc.

References zx().

Referenced by G4tgbGeometryDumper::DumpRotationMatrix(), and operator<<().

141  {
142  return safe_acos(zx());
143 }
double zx() const
double CLHEP::HepRotation::thetaY ( ) const

Definition at line 145 of file Rotation.cc.

References zy().

Referenced by G4tgbGeometryDumper::DumpRotationMatrix(), and operator<<().

145  {
146  return safe_acos(zy());
147 }
double zy() const
double CLHEP::HepRotation::thetaZ ( ) const

Definition at line 149 of file Rotation.cc.

References zz().

Referenced by G4tgbGeometryDumper::DumpRotationMatrix(), and operator<<().

149  {
150  return safe_acos(zz());
151 }
double zz() const
HepRotation& CLHEP::HepRotation::transform ( const HepRotation r)
inline

Referenced by rotate(), and rotateAxes().

HepRotation& CLHEP::HepRotation::transform ( const HepRotationX r)
inline
HepRotation& CLHEP::HepRotation::transform ( const HepRotationY r)
inline
HepRotation& CLHEP::HepRotation::transform ( const HepRotationZ r)
inline
double CLHEP::HepRotation::tt ( ) const
inline

Referenced by CLHEP::operator*().

double CLHEP::HepRotation::tx ( ) const
inline

Referenced by CLHEP::operator*().

double CLHEP::HepRotation::ty ( ) const
inline

Referenced by CLHEP::operator*().

double CLHEP::HepRotation::tz ( ) const
inline

Referenced by CLHEP::operator*().

double CLHEP::HepRotation::xt ( ) const
inline

Referenced by CLHEP::operator*().

double CLHEP::HepRotation::xx ( ) const
inline
double CLHEP::HepRotation::xy ( ) const
inline
double CLHEP::HepRotation::xz ( ) const
inline
double CLHEP::HepRotation::yt ( ) const
inline

Referenced by CLHEP::operator*().

double CLHEP::HepRotation::yx ( ) const
inline
double CLHEP::HepRotation::yy ( ) const
inline
double CLHEP::HepRotation::yz ( ) const
inline
double CLHEP::HepRotation::zt ( ) const
inline

Referenced by CLHEP::operator*().

double CLHEP::HepRotation::zx ( ) const
inline
double CLHEP::HepRotation::zy ( ) const
inline
double CLHEP::HepRotation::zz ( ) const
inline

Friends And Related Function Documentation

HepRotation operator* ( const HepRotationX rx,
const HepRotation r 
)
friend
HepRotation operator* ( const HepRotationY ry,
const HepRotation r 
)
friend
HepRotation operator* ( const HepRotationZ rz,
const HepRotation r 
)
friend

Field Documentation

const HepRotation CLHEP::HepRotation::IDENTITY
static
double CLHEP::HepRotation::rxx
protected
double CLHEP::HepRotation::rxy
protected
double CLHEP::HepRotation::rxz
protected
double CLHEP::HepRotation::ryx
protected
double CLHEP::HepRotation::ryy
protected
double CLHEP::HepRotation::ryz
protected
double CLHEP::HepRotation::rzx
protected
double CLHEP::HepRotation::rzy
protected
double CLHEP::HepRotation::rzz
protected

The documentation for this class was generated from the following files: