Geant4-11
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Private Member Functions
G3toG4RotationMatrix Class Reference

#include <G3toG4RotationMatrix.hh>

Inheritance diagram for G3toG4RotationMatrix:
CLHEP::HepRotation

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

static DLL_API const HepRotation IDENTITY
 

Protected Attributes

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

Private Member Functions

void setArbitrarily (const Hep3Vector &colX, Hep3Vector &v1, Hep3Vector &v2, Hep3Vector &v3) const
 
bool setCols (const Hep3Vector &u1, const Hep3Vector &u2, const Hep3Vector &u3, double u1u2, Hep3Vector &v1, Hep3Vector &v2, Hep3Vector &v3) const
 

Detailed Description

Definition at line 46 of file G3toG4RotationMatrix.hh.

Constructor & Destructor Documentation

◆ G3toG4RotationMatrix()

G3toG4RotationMatrix::G3toG4RotationMatrix ( )

◆ ~G3toG4RotationMatrix()

G3toG4RotationMatrix::~G3toG4RotationMatrix ( )

Definition at line 43 of file G3toG4RotationMatrix.cc.

44{
45 ;
46}

Member Function Documentation

◆ axis()

Hep3Vector CLHEP::HepRotation::axis ( ) const
inherited

Definition at line 75 of file RotationA.cc.

75 {
76
77 const double eps = 1e-15;
78
79 double Ux = rzy - ryz;
80 double Uy = rxz - rzx;
81 double Uz = ryx - rxy;
82 if (std::abs(Ux) < eps && std::abs(Uy) < eps && std::abs(Uz) < eps) {
83
84 double cosdelta = (rxx + ryy + rzz - 1.0) / 2.0;
85 if (cosdelta > 0.0) return Hep3Vector(0,0,1); // angle = 0, any axis is good
86
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;
93 double x, y, z;
94
95 if (mxx > ryy && mxx > rzz) {
96 x = std::sqrt(mxx);
97 if (rzy - ryz < 0) x = -x;
98 y = mxy/x;
99 z = mxz/x;
100 return Hep3Vector( x, y, z ).unit();
101 } else if (myy > mzz) {
102 y = std::sqrt(myy);
103 if (rxz - rzx < 0) y = -y;
104 x = mxy/y;
105 z = myz/y;
106 return Hep3Vector( x, y, z ).unit();
107 } else {
108 z = std::sqrt(mzz);
109 if (ryx - rxy < 0) z = -z;
110 x = mxz/z;
111 y = myz/z;
112 return Hep3Vector( x, y, z ).unit();
113 }
114 } else {
115 return Hep3Vector( Ux, Uy, Uz ).unit();
116 }
117
118} // axis()
static const G4double eps

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

Referenced by CLHEP::HepRotation::axisAngle(), export_G4RotationMatrix(), CLHEP::HepRotation::rectify(), and CLHEP::HepRotation::setDelta().

◆ axisAngle()

HepAxisAngle CLHEP::HepRotation::axisAngle ( ) const
inherited

Definition at line 120 of file RotationA.cc.

120 {
121
122 return HepAxisAngle (axis(), delta());
123
124} // axisAngle()
Hep3Vector axis() const
Definition: RotationA.cc:75
double delta() const
Definition: RotationA.cc:62

References CLHEP::HepRotation::axis(), and CLHEP::HepRotation::delta().

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

◆ col1()

HepLorentzVector CLHEP::HepRotation::col1 ( ) const
inlineinherited

◆ col2()

HepLorentzVector CLHEP::HepRotation::col2 ( ) const
inlineinherited

◆ col3()

HepLorentzVector CLHEP::HepRotation::col3 ( ) const
inlineinherited

◆ col4()

HepLorentzVector CLHEP::HepRotation::col4 ( ) const
inlineinherited

◆ colX()

Hep3Vector CLHEP::HepRotation::colX ( ) const
inlineinherited

◆ colY()

Hep3Vector CLHEP::HepRotation::colY ( ) const
inlineinherited

◆ colZ()

Hep3Vector CLHEP::HepRotation::colZ ( ) const
inlineinherited

◆ compare()

int CLHEP::HepRotation::compare ( const HepRotation r) const
inherited

Definition at line 173 of file Rotation.cc.

173 {
174 if (rzz<r.rzz) return -1; else if (rzz>r.rzz) return 1;
175 else if (rzy<r.rzy) return -1; else if (rzy>r.rzy) return 1;
176 else if (rzx<r.rzx) return -1; else if (rzx>r.rzx) return 1;
177 else if (ryz<r.ryz) return -1; else if (ryz>r.ryz) return 1;
178 else if (ryy<r.ryy) return -1; else if (ryy>r.ryy) return 1;
179 else if (ryx<r.ryx) return -1; else if (ryx>r.ryx) return 1;
180 else if (rxz<r.rxz) return -1; else if (rxz>r.rxz) return 1;
181 else if (rxy<r.rxy) return -1; else if (rxy>r.rxy) return 1;
182 else if (rxx<r.rxx) return -1; else if (rxx>r.rxx) return 1;
183 else return 0;
184}

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

Referenced by export_G4ThreeVector().

◆ decompose() [1/2]

void CLHEP::HepRotation::decompose ( Hep3Vector boost,
HepAxisAngle rotation 
) const
inherited

Definition at line 24 of file RotationP.cc.

24 {
25 boost.set(0,0,0);
26 rotation = axisAngle();
27}
HepAxisAngle axisAngle() const
Definition: RotationA.cc:120

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

◆ decompose() [2/2]

void CLHEP::HepRotation::decompose ( HepAxisAngle rotation,
Hep3Vector boost 
) const
inherited

Definition at line 19 of file RotationP.cc.

19 {
20 boost.set(0,0,0);
21 rotation = axisAngle();
22}

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

◆ delta()

double CLHEP::HepRotation::delta ( ) const
inherited

Definition at line 62 of file RotationA.cc.

62 {
63
64 double cosdelta = (rxx + ryy + rzz - 1.0) / 2.0;
65 if (cosdelta > 1.0) {
66 return 0;
67 } else if (cosdelta < -1.0) {
68 return CLHEP::pi;
69 } else {
70 return std::acos( cosdelta ); // Already safe due to the cosdelta > 1 check
71 }
72
73} // delta()
static constexpr double pi
Definition: SystemOfUnits.h:55

References CLHEP::pi, CLHEP::HepRotation::rxx, CLHEP::HepRotation::ryy, and CLHEP::HepRotation::rzz.

Referenced by CLHEP::HepRotation::axisAngle(), export_G4RotationMatrix(), CLHEP::HepRotation::rectify(), and CLHEP::HepRotation::setAxis().

◆ distance2() [1/3]

double CLHEP::HepRotation::distance2 ( const HepBoost lt) const
inherited

Definition at line 35 of file RotationL.cc.

35 {
36 return distance2( HepLorentzRotation(lt));
37}
double distance2(const HepRotation &r) const
Definition: RotationP.cc:29

References CLHEP::HepRotation::distance2().

◆ distance2() [2/3]

double CLHEP::HepRotation::distance2 ( const HepLorentzRotation lt) const
inherited

Definition at line 25 of file RotationL.cc.

25 {
26 HepAxisAngle a;
27 Hep3Vector b;
28 lt.decompose(b, a);
29 double bet = b.beta();
30 double bet2 = bet*bet;
31 HepRotation r(a);
32 return bet2/(1-bet2) + distance2(r);
33}

References CLHEP::Hep3Vector::beta(), CLHEP::HepLorentzRotation::decompose(), and CLHEP::HepRotation::distance2().

◆ distance2() [3/3]

double CLHEP::HepRotation::distance2 ( const HepRotation r) const
inherited

Definition at line 29 of file RotationP.cc.

29 {
30 double sum = rxx * r.rxx + rxy * r.rxy + rxz * r.rxz
31 + ryx * r.ryx + ryy * r.ryy + ryz * r.ryz
32 + rzx * r.rzx + rzy * r.rzy + rzz * r.rzz;
33 double answer = 3.0 - sum;
34 return (answer >= 0 ) ? answer : 0;
35}

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

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

◆ eulerAngles()

HepEulerAngles CLHEP::HepRotation::eulerAngles ( ) const
inherited

Definition at line 198 of file RotationE.cc.

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

References CLHEP::correctPsiPhi(), CLHEP::HepRotation::rxx, CLHEP::HepRotation::rxy, CLHEP::HepRotation::rxz, CLHEP::HepRotation::ryx, CLHEP::HepRotation::ryy, CLHEP::HepRotation::ryz, CLHEP::HepRotation::rzx, CLHEP::HepRotation::rzy, CLHEP::HepRotation::rzz, and CLHEP::safe_acos().

Referenced by CLHEP::HepRotation::phi(), and CLHEP::HepRotation::psi().

◆ getAngleAxis()

void CLHEP::HepRotation::getAngleAxis ( double &  delta,
Hep3Vector axis 
) const
inherited

Definition at line 148 of file Rotation.cc.

148 {
149 double cosa = 0.5*(xx()+yy()+zz()-1);
150 double cosa1 = 1-cosa;
151 if (cosa1 <= 0) {
152 angle = 0;
153 aaxis = Hep3Vector(0,0,1);
154 }else{
155 double x=0, y=0, z=0;
156 if (xx() > cosa) x = std::sqrt((xx()-cosa)/cosa1);
157 if (yy() > cosa) y = std::sqrt((yy()-cosa)/cosa1);
158 if (zz() > cosa) z = std::sqrt((zz()-cosa)/cosa1);
159 if (zy() < yz()) x = -x;
160 if (xz() < zx()) y = -y;
161 if (yx() < xy()) z = -z;
162 angle = (cosa < -1.) ? std::acos(-1.) : std::acos(cosa);
163 aaxis = Hep3Vector(x,y,z);
164 }
165}
static const G4double angle[DIMMOTT]
double zz() const
double yz() const
double zx() const
double yx() const
double zy() const
double xx() const
double yy() const
double xz() const
double xy() const

References angle, CLHEP::HepRotation::xx(), CLHEP::HepRotation::xy(), CLHEP::HepRotation::xz(), CLHEP::HepRotation::yx(), CLHEP::HepRotation::yy(), CLHEP::HepRotation::yz(), CLHEP::HepRotation::zx(), CLHEP::HepRotation::zy(), and CLHEP::HepRotation::zz().

◆ getAxis()

Hep3Vector CLHEP::HepRotation::getAxis ( ) const
inlineinherited

Referenced by export_G4RotationMatrix().

◆ getDelta()

double CLHEP::HepRotation::getDelta ( ) const
inlineinherited

Referenced by export_G4RotationMatrix().

◆ getPhi()

double CLHEP::HepRotation::getPhi ( ) const
inlineinherited

◆ getPsi()

double CLHEP::HepRotation::getPsi ( ) const
inlineinherited

Referenced by export_G4RotationMatrix().

◆ getTheta()

double CLHEP::HepRotation::getTheta ( ) const
inlineinherited

◆ getTolerance()

static double CLHEP::HepRotation::getTolerance ( )
inlinestaticinherited

Referenced by export_G4ThreeVector().

◆ howNear() [1/3]

double CLHEP::HepRotation::howNear ( const HepBoost lt) const
inherited

Definition at line 43 of file RotationL.cc.

43 {
44 return std::sqrt( distance2( lt ) );
45}

References CLHEP::HepRotation::distance2().

◆ howNear() [2/3]

double CLHEP::HepRotation::howNear ( const HepLorentzRotation lt) const
inherited

Definition at line 39 of file RotationL.cc.

39 {
40 return std::sqrt( distance2( lt ) );
41}

References CLHEP::HepRotation::distance2().

◆ howNear() [3/3]

double CLHEP::HepRotation::howNear ( const HepRotation r) const
inherited

Definition at line 37 of file RotationP.cc.

37 {
38 return std::sqrt( distance2( r ) );
39}

References CLHEP::HepRotation::distance2().

Referenced by export_G4ThreeVector(), and export_G4TwoVector().

◆ inverse()

HepRotation CLHEP::HepRotation::inverse ( ) const
inlineinherited

◆ invert()

HepRotation & CLHEP::HepRotation::invert ( )
inlineinherited

◆ isIdentity()

bool CLHEP::HepRotation::isIdentity ( ) const
inherited

Definition at line 167 of file Rotation.cc.

167 {
168 return (rxx == 1.0 && rxy == 0.0 && rxz == 0.0 &&
169 ryx == 0.0 && ryy == 1.0 && ryz == 0.0 &&
170 rzx == 0.0 && rzy == 0.0 && rzz == 1.0) ? true : false;
171}

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

Referenced by G4GMocrenFileSceneHandler::AddSolid(), export_G4RotationMatrix(), and G4PVPlacement::NewPtrRotMatrix().

◆ isNear() [1/3]

bool CLHEP::HepRotation::isNear ( const HepBoost lt,
double  epsilon = Hep4RotationInterface::tolerance 
) const
inherited

Definition at line 52 of file RotationL.cc.

53 {
54 return distance2( lt ) <= epsilon*epsilon;
55}
G4double epsilon(G4double density, G4double temperature)

References CLHEP::HepRotation::distance2(), and epsilon().

◆ isNear() [2/3]

bool CLHEP::HepRotation::isNear ( const HepLorentzRotation lt,
double  epsilon = Hep4RotationInterface::tolerance 
) const
inherited

Definition at line 47 of file RotationL.cc.

48 {
49 return distance2( lt ) <= epsilon*epsilon;
50}

References CLHEP::HepRotation::distance2(), and epsilon().

◆ isNear() [3/3]

bool CLHEP::HepRotation::isNear ( const HepRotation r,
double  epsilon = Hep4RotationInterface::tolerance 
) const
inherited

Definition at line 41 of file RotationP.cc.

42 {
43 return distance2( r ) <= epsilon*epsilon;
44}

References CLHEP::HepRotation::distance2(), and epsilon().

Referenced by export_G4ThreeVector(), and export_G4TwoVector().

◆ norm2()

double CLHEP::HepRotation::norm2 ( ) const
inherited

◆ operator!=()

bool CLHEP::HepRotation::operator!= ( const HepRotation r) const
inlineinherited

◆ operator()() [1/3]

Hep3Vector CLHEP::HepRotation::operator() ( const Hep3Vector p) const
inlineinherited

◆ operator()() [2/3]

HepLorentzVector CLHEP::HepRotation::operator() ( const HepLorentzVector w) const
inlineinherited

◆ operator()() [3/3]

double CLHEP::HepRotation::operator() ( int  i,
int  j 
) const
inherited

Definition at line 23 of file Rotation.cc.

23 {
24 if (i == 0) {
25 if (j == 0) { return xx(); }
26 if (j == 1) { return xy(); }
27 if (j == 2) { return xz(); }
28 } else if (i == 1) {
29 if (j == 0) { return yx(); }
30 if (j == 1) { return yy(); }
31 if (j == 2) { return yz(); }
32 } else if (i == 2) {
33 if (j == 0) { return zx(); }
34 if (j == 1) { return zy(); }
35 if (j == 2) { return zz(); }
36 }
37 std::cerr << "HepRotation subscripting: bad indices "
38 << "(" << i << "," << j << ")" << std::endl;
39 return 0.0;
40}

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

◆ operator*() [1/6]

Hep3Vector CLHEP::HepRotation::operator* ( const Hep3Vector p) const
inlineinherited

◆ operator*() [2/6]

HepLorentzVector CLHEP::HepRotation::operator* ( const HepLorentzVector w) const
inlineinherited

◆ operator*() [3/6]

HepRotation CLHEP::HepRotation::operator* ( const HepRotation r) const
inlineinherited

◆ operator*() [4/6]

HepRotation CLHEP::HepRotation::operator* ( const HepRotationX rx) const
inlineinherited

◆ operator*() [5/6]

HepRotation CLHEP::HepRotation::operator* ( const HepRotationY ry) const
inlineinherited

◆ operator*() [6/6]

HepRotation CLHEP::HepRotation::operator* ( const HepRotationZ rz) const
inlineinherited

◆ operator*=() [1/4]

HepRotation & CLHEP::HepRotation::operator*= ( const HepRotation r)
inlineinherited

◆ operator*=() [2/4]

HepRotation & CLHEP::HepRotation::operator*= ( const HepRotationX r)
inlineinherited

◆ operator*=() [3/4]

HepRotation & CLHEP::HepRotation::operator*= ( const HepRotationY r)
inlineinherited

◆ operator*=() [4/4]

HepRotation & CLHEP::HepRotation::operator*= ( const HepRotationZ r)
inlineinherited

◆ operator<()

bool CLHEP::HepRotation::operator< ( const HepRotation r) const
inlineinherited

◆ operator<=()

bool CLHEP::HepRotation::operator<= ( const HepRotation r) const
inlineinherited

◆ operator==()

bool CLHEP::HepRotation::operator== ( const HepRotation r) const
inlineinherited

◆ operator>()

bool CLHEP::HepRotation::operator> ( const HepRotation r) const
inlineinherited

◆ operator>=()

bool CLHEP::HepRotation::operator>= ( const HepRotation r) const
inlineinherited

◆ operator[]()

const HepRotation_row CLHEP::HepRotation::operator[] ( int  ) const
inlineinherited

◆ phi()

double CLHEP::HepRotation::phi ( ) const
inherited

Definition at line 67 of file RotationE.cc.

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

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

Referenced by export_G4RotationMatrix(), export_G4ThreeVector(), export_G4TwoVector(), CLHEP::HepRotation::setPsi(), and CLHEP::HepRotation::setTheta().

◆ phiX()

double CLHEP::HepRotation::phiX ( ) const
inherited

Definition at line 124 of file Rotation.cc.

124 {
125 return (yx() == 0.0 && xx() == 0.0) ? 0.0 : std::atan2(yx(),xx());
126}

References CLHEP::HepRotation::xx(), and CLHEP::HepRotation::yx().

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

◆ phiY()

double CLHEP::HepRotation::phiY ( ) const
inherited

Definition at line 128 of file Rotation.cc.

128 {
129 return (yy() == 0.0 && xy() == 0.0) ? 0.0 : std::atan2(yy(),xy());
130}

References CLHEP::HepRotation::xy(), and CLHEP::HepRotation::yy().

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

◆ phiZ()

double CLHEP::HepRotation::phiZ ( ) const
inherited

Definition at line 132 of file Rotation.cc.

132 {
133 return (yz() == 0.0 && xz() == 0.0) ? 0.0 : std::atan2(yz(),xz());
134}

References CLHEP::HepRotation::xz(), and CLHEP::HepRotation::yz().

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

◆ print()

std::ostream & CLHEP::HepRotation::print ( std::ostream &  os) const
inherited

Definition at line 17 of file RotationIO.cc.

17 {
18 os << "\n [ ( " <<
19 std::setw(11) << std::setprecision(6) << xx() << " " <<
20 std::setw(11) << std::setprecision(6) << xy() << " " <<
21 std::setw(11) << std::setprecision(6) << xz() << ")\n"
22 << " ( " <<
23 std::setw(11) << std::setprecision(6) << yx() << " " <<
24 std::setw(11) << std::setprecision(6) << yy() << " " <<
25 std::setw(11) << std::setprecision(6) << yz() << ")\n"
26 << " ( " <<
27 std::setw(11) << std::setprecision(6) << zx() << " " <<
28 std::setw(11) << std::setprecision(6) << zy() << " " <<
29 std::setw(11) << std::setprecision(6) << zz() << ") ]\n";
30 return os;
31}

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

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

◆ psi()

double CLHEP::HepRotation::psi ( ) const
inherited

Definition at line 107 of file RotationE.cc.

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

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

Referenced by export_G4RotationMatrix(), CLHEP::HepRotation::setPhi(), and CLHEP::HepRotation::setTheta().

◆ rectify()

void CLHEP::HepRotation::rectify ( )
inherited

Definition at line 149 of file RotationC.cc.

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

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

Referenced by CLHEP::HepLorentzRotation::decompose(), G4GDMLWriteDefine::GetAngles(), G4GDMLReadDefine::GetRotationMatrix(), and CLHEP::HepLorentzRotation::rectify().

◆ rep3x3()

HepRep3x3 CLHEP::HepRotation::rep3x3 ( ) const
inlineinherited

◆ rep4x4()

HepRep4x4 CLHEP::HepRotation::rep4x4 ( ) const
inlineinherited

◆ rotate() [1/2]

HepRotation & CLHEP::HepRotation::rotate ( double  delta,
const Hep3Vector axis 
)
inherited

Definition at line 42 of file Rotation.cc.

42 {
43 if (a != 0.0) {
44 double ll = aaxis.mag();
45 if (ll == 0.0) {
46 std::cerr << "HepRotation::rotate() - "
47 << "HepRotation: zero axis" << std::endl;
48 }else{
49 double sa = std::sin(a), ca = std::cos(a);
50 double dx = aaxis.x()/ll, dy = aaxis.y()/ll, dz = aaxis.z()/ll;
51 HepRotation m1(
52 ca+(1-ca)*dx*dx, (1-ca)*dx*dy-sa*dz, (1-ca)*dx*dz+sa*dy,
53 (1-ca)*dy*dx+sa*dz, ca+(1-ca)*dy*dy, (1-ca)*dy*dz-sa*dx,
54 (1-ca)*dz*dx-sa*dy, (1-ca)*dz*dy+sa*dx, ca+(1-ca)*dz*dz );
55 transform(m1);
56 }
57 }
58 return *this;
59}
HepRotation & transform(const HepRotation &r)

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

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

◆ rotate() [2/2]

HepRotation & CLHEP::HepRotation::rotate ( double  delta,
const Hep3Vector axis 
)
inlineinherited

◆ rotateAxes()

HepRotation & CLHEP::HepRotation::rotateAxes ( const Hep3Vector newX,
const Hep3Vector newY,
const Hep3Vector newZ 
)
inherited

Definition at line 100 of file Rotation.cc.

102 {
103 double del = 0.001;
104 Hep3Vector w = newX.cross(newY);
105
106 if (std::abs(newZ.x()-w.x()) > del ||
107 std::abs(newZ.y()-w.y()) > del ||
108 std::abs(newZ.z()-w.z()) > del ||
109 std::abs(newX.mag2()-1.) > del ||
110 std::abs(newY.mag2()-1.) > del ||
111 std::abs(newZ.mag2()-1.) > del ||
112 std::abs(newX.dot(newY)) > del ||
113 std::abs(newY.dot(newZ)) > del ||
114 std::abs(newZ.dot(newX)) > del) {
115 std::cerr << "HepRotation::rotateAxes: bad axis vectors" << std::endl;
116 return *this;
117 }else{
118 return transform(HepRotation(newX.x(), newY.x(), newZ.x(),
119 newX.y(), newY.y(), newZ.y(),
120 newX.z(), newY.z(), newZ.z()));
121 }
122}

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

Referenced by export_G4RotationMatrix().

◆ rotateX()

HepRotation & CLHEP::HepRotation::rotateX ( double  delta)
inherited

Definition at line 61 of file Rotation.cc.

61 {
62 double c1 = std::cos(a);
63 double s1 = std::sin(a);
64 double x1 = ryx, y1 = ryy, z1 = ryz;
65 ryx = c1*x1 - s1*rzx;
66 ryy = c1*y1 - s1*rzy;
67 ryz = c1*z1 - s1*rzz;
68 rzx = s1*x1 + c1*rzx;
69 rzy = s1*y1 + c1*rzy;
70 rzz = s1*z1 + c1*rzz;
71 return *this;
72}

References CLHEP::HepRotation::ryx, CLHEP::HepRotation::ryy, CLHEP::HepRotation::ryz, CLHEP::HepRotation::rzx, CLHEP::HepRotation::rzy, and CLHEP::HepRotation::rzz.

Referenced by G4tgbRotationMatrix::BuildG4RotMatrixFrom3(), export_G4RotationMatrix(), export_G4ThreeVector(), G4tgrUtils::GetRotationFromDirection(), G4GDMLReadDefine::GetRotationMatrix(), G4GDMLReadParamvol::ParametersRead(), and G4VScoringMesh::RotateX().

◆ rotateY()

HepRotation & CLHEP::HepRotation::rotateY ( double  delta)
inherited

◆ rotateZ()

HepRotation & CLHEP::HepRotation::rotateZ ( double  delta)
inherited

◆ row1()

HepLorentzVector CLHEP::HepRotation::row1 ( ) const
inlineinherited

◆ row2()

HepLorentzVector CLHEP::HepRotation::row2 ( ) const
inlineinherited

◆ row3()

HepLorentzVector CLHEP::HepRotation::row3 ( ) const
inlineinherited

◆ row4()

HepLorentzVector CLHEP::HepRotation::row4 ( ) const
inlineinherited

◆ rowX()

Hep3Vector CLHEP::HepRotation::rowX ( ) const
inlineinherited

◆ rowY()

Hep3Vector CLHEP::HepRotation::rowY ( ) const
inlineinherited

◆ rowZ()

Hep3Vector CLHEP::HepRotation::rowZ ( ) const
inlineinherited

◆ set() [1/9]

HepRotation & CLHEP::HepRotation::set ( const Hep3Vector axis,
double  delta 
)
inherited

Definition at line 23 of file RotationA.cc.

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

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

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

◆ set() [2/9]

HepRotation & CLHEP::HepRotation::set ( const Hep3Vector colX,
const Hep3Vector colY,
const Hep3Vector colZ 
)
inherited

Definition at line 70 of file RotationC.cc.

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

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

◆ set() [3/9]

HepRotation & CLHEP::HepRotation::set ( const HepAxisAngle ax)
inherited

Definition at line 54 of file RotationA.cc.

54 {
55 return set ( ax.axis(), ax.delta() );
56}

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

◆ set() [4/9]

HepRotation & CLHEP::HepRotation::set ( const HepEulerAngles e)
inherited

Definition at line 58 of file RotationE.cc.

58 {
59 return set(e.phi(), e.theta(), e.psi());
60}

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

◆ set() [5/9]

HepRotation & CLHEP::HepRotation::set ( const HepRep3x3 m)
inlineinherited

◆ set() [6/9]

HepRotation & CLHEP::HepRotation::set ( const HepRotationX r)
inlineinherited

◆ set() [7/9]

HepRotation & CLHEP::HepRotation::set ( const HepRotationY r)
inlineinherited

◆ set() [8/9]

HepRotation & CLHEP::HepRotation::set ( const HepRotationZ r)
inlineinherited

◆ set() [9/9]

HepRotation & CLHEP::HepRotation::set ( double  phi,
double  theta,
double  psi 
)
inherited

Definition at line 32 of file RotationE.cc.

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

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

◆ setArbitrarily()

void CLHEP::HepRotation::setArbitrarily ( const Hep3Vector colX,
Hep3Vector v1,
Hep3Vector v2,
Hep3Vector v3 
) const
privateinherited

Definition at line 45 of file RotationC.cc.

46 {
47
48 // We have all three col's parallel. Warnings already been given;
49 // this just supplies a result which is a valid rotation.
50
51 v1 = ccolX.unit();
52 v2 = v1.cross(Hep3Vector(0,0,1));
53 if (v2.mag2() != 0) {
54 v2 = v2.unit();
55 } else {
56 v2 = Hep3Vector(1,0,0);
57 }
58 v3 = v1.cross(v2);
59
60 return;
61
62} // HepRotation::setArbitrarily

References CLHEP::Hep3Vector::cross(), CLHEP::Hep3Vector::mag2(), and CLHEP::Hep3Vector::unit().

Referenced by CLHEP::HepRotation::setCols().

◆ setAxis()

void CLHEP::HepRotation::setAxis ( const Hep3Vector axis)
inherited

Definition at line 127 of file RotationA.cc.

127 {
128 set ( aaxis, delta() );
129}

References CLHEP::HepRotation::delta(), and CLHEP::HepRotation::set().

Referenced by export_G4RotationMatrix().

◆ setCols()

bool CLHEP::HepRotation::setCols ( const Hep3Vector u1,
const Hep3Vector u2,
const Hep3Vector u3,
double  u1u2,
Hep3Vector v1,
Hep3Vector v2,
Hep3Vector v3 
) const
privateinherited

Definition at line 21 of file RotationC.cc.

24 {
25
26 if ( (1-std::fabs(u1u2)) <= Hep4RotationInterface::tolerance ) {
27 std::cerr << "HepRotation::setCols() - "
28 << "All three cols supplied for a Rotation are parallel --"
29 << "\n an arbitrary rotation will be returned" << std::endl;
30 setArbitrarily (u1, v1, v2, v3);
31 return true;
32 }
33
34 v1 = u1;
35 v2 = Hep3Vector(u2 - u1u2 * u1).unit();
36 v3 = v1.cross(v2);
37 if ( v3.dot(u3) >= 0 ) {
38 return true;
39 } else {
40 return false; // looks more like a reflection in this case!
41 }
42
43} // HepRotation::setCols
void setArbitrarily(const Hep3Vector &colX, Hep3Vector &v1, Hep3Vector &v2, Hep3Vector &v3) const
Definition: RotationC.cc:45

References CLHEP::Hep3Vector::cross(), CLHEP::Hep3Vector::dot(), CLHEP::HepRotation::setArbitrarily(), CLHEP::Hep4RotationInterface::tolerance, and CLHEP::Hep3Vector::unit().

Referenced by CLHEP::HepRotation::set().

◆ setDelta()

void CLHEP::HepRotation::setDelta ( double  delta)
inherited

Definition at line 131 of file RotationA.cc.

131 {
132 set ( axis(), ddelta );
133}

References CLHEP::HepRotation::axis(), and CLHEP::HepRotation::set().

Referenced by export_G4RotationMatrix().

◆ setPhi()

void CLHEP::HepRotation::setPhi ( double  phi)
inherited

◆ setPsi()

void CLHEP::HepRotation::setPsi ( double  psi)
inherited

Definition at line 267 of file RotationE.cc.

267 {
268 set ( phi(), theta(), psi1 );
269}
double phi() const
Definition: RotationE.cc:67

References CLHEP::HepRotation::phi(), CLHEP::HepRotation::set(), and CLHEP::HepRotation::theta().

Referenced by export_G4RotationMatrix().

◆ SetRotationMatrixByCol()

void G3toG4RotationMatrix::SetRotationMatrixByCol ( const G4ThreeVector Col1,
const G4ThreeVector Col2,
const G4ThreeVector Col3 
)

Definition at line 49 of file G3toG4RotationMatrix.cc.

52{
53 rxx = cl1.x();
54 ryx = cl1.y();
55 rzx = cl1.z();
56
57 rxy = cl2.x();
58 ryy = cl2.y();
59 rzy = cl2.z();
60
61 rxz = cl3.x();
62 ryz = cl3.y();
63 rzz = cl3.z();
64
65}

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

◆ SetRotationMatrixByRow()

void G3toG4RotationMatrix::SetRotationMatrixByRow ( const G4ThreeVector Row1,
const G4ThreeVector Row2,
const G4ThreeVector Row3 
)

Definition at line 68 of file G3toG4RotationMatrix.cc.

71{
72 rxx = rw1.x();
73 rxy = rw1.y();
74 rxz = rw1.z();
75
76 ryx = rw2.x();
77 ryy = rw2.y();
78 ryz = rw2.z();
79
80 rzx = rw3.x();
81 rzy = rw3.y();
82 rzz = rw3.z();
83
84}

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

Referenced by G4gsrotm().

◆ setRows()

HepRotation & CLHEP::HepRotation::setRows ( const Hep3Vector rowX,
const Hep3Vector rowY,
const Hep3Vector rowZ 
)
inherited

Definition at line 139 of file RotationC.cc.

141 {
142 set (rrowX, rrowY, rrowZ);
143 invert();
144 return *this;
145}
HepRotation & invert()

References CLHEP::HepRotation::invert(), and CLHEP::HepRotation::set().

◆ setTheta()

void CLHEP::HepRotation::setTheta ( double  theta)
inherited

Definition at line 263 of file RotationE.cc.

263 {
264 set ( phi(), theta1, psi() );
265}

References CLHEP::HepRotation::phi(), CLHEP::HepRotation::psi(), and CLHEP::HepRotation::set().

Referenced by export_G4RotationMatrix(), and export_G4ThreeVector().

◆ setTolerance()

static double CLHEP::HepRotation::setTolerance ( double  tol)
inlinestaticinherited

Referenced by export_G4ThreeVector().

◆ theta()

double CLHEP::HepRotation::theta ( ) const
inherited

Definition at line 101 of file RotationE.cc.

101 {
102
103 return safe_acos( rzz );
104
105} // theta()

References CLHEP::HepRotation::rzz, and CLHEP::safe_acos().

Referenced by export_G4RotationMatrix(), CLHEP::HepRotation::setPhi(), and CLHEP::HepRotation::setPsi().

◆ thetaX()

double CLHEP::HepRotation::thetaX ( ) const
inherited

Definition at line 136 of file Rotation.cc.

136 {
137 return safe_acos(zx());
138}

References CLHEP::safe_acos(), and CLHEP::HepRotation::zx().

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

◆ thetaY()

double CLHEP::HepRotation::thetaY ( ) const
inherited

Definition at line 140 of file Rotation.cc.

140 {
141 return safe_acos(zy());
142}

References CLHEP::safe_acos(), and CLHEP::HepRotation::zy().

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

◆ thetaZ()

double CLHEP::HepRotation::thetaZ ( ) const
inherited

Definition at line 144 of file Rotation.cc.

144 {
145 return safe_acos(zz());
146}

References CLHEP::safe_acos(), and CLHEP::HepRotation::zz().

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

◆ transform() [1/4]

HepRotation & CLHEP::HepRotation::transform ( const HepRotation r)
inlineinherited

◆ transform() [2/4]

HepRotation & CLHEP::HepRotation::transform ( const HepRotationX r)
inlineinherited

◆ transform() [3/4]

HepRotation & CLHEP::HepRotation::transform ( const HepRotationY r)
inlineinherited

◆ transform() [4/4]

HepRotation & CLHEP::HepRotation::transform ( const HepRotationZ r)
inlineinherited

◆ tt()

double CLHEP::HepRotation::tt ( ) const
inlineinherited

Referenced by CLHEP::operator*().

◆ tx()

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

Referenced by CLHEP::operator*().

◆ ty()

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

Referenced by CLHEP::operator*().

◆ tz()

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

Referenced by CLHEP::operator*().

◆ xt()

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

Referenced by CLHEP::operator*().

◆ xx()

double CLHEP::HepRotation::xx ( ) const
inlineinherited

◆ xy()

double CLHEP::HepRotation::xy ( ) const
inlineinherited

◆ xz()

double CLHEP::HepRotation::xz ( ) const
inlineinherited

◆ yt()

double CLHEP::HepRotation::yt ( ) const
inlineinherited

Referenced by CLHEP::operator*().

◆ yx()

double CLHEP::HepRotation::yx ( ) const
inlineinherited

◆ yy()

double CLHEP::HepRotation::yy ( ) const
inlineinherited

◆ yz()

double CLHEP::HepRotation::yz ( ) const
inlineinherited

◆ zt()

double CLHEP::HepRotation::zt ( ) const
inlineinherited

Referenced by CLHEP::operator*().

◆ zx()

double CLHEP::HepRotation::zx ( ) const
inlineinherited

◆ zy()

double CLHEP::HepRotation::zy ( ) const
inlineinherited

◆ zz()

double CLHEP::HepRotation::zz ( ) const
inlineinherited

Field Documentation

◆ IDENTITY

const HepRotation CLHEP::HepRotation::IDENTITY
staticinherited

◆ rxx

double CLHEP::HepRotation::rxx
protectedinherited

◆ rxy

double CLHEP::HepRotation::rxy
protectedinherited

◆ rxz

double CLHEP::HepRotation::rxz
protectedinherited

◆ ryx

double CLHEP::HepRotation::ryx
protectedinherited

◆ ryy

double CLHEP::HepRotation::ryy
protectedinherited

◆ ryz

double CLHEP::HepRotation::ryz
protectedinherited

◆ rzx

double CLHEP::HepRotation::rzx
protectedinherited

◆ rzy

double CLHEP::HepRotation::rzy
protectedinherited

◆ rzz

double CLHEP::HepRotation::rzz
protectedinherited

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