1 #ifndef __JROTATION3D__
2 #define __JROTATION3D__
19 namespace JGEOMETRY3D {}
20 namespace JPP {
using namespace JGEOMETRY3D; }
22 namespace JGEOMETRY3D {
113 public JMath<JRotation3D>
140 const double ct = cos(dir.
getTheta());
141 const double st = sin(dir.
getTheta());
142 const double cp = cos(dir.
getPhi());
143 const double sp = sin(dir.
getPhi());
162 const double ct = dir.
getDZ();
163 const double st = sqrt((1.0 + ct)*(1.0 - ct));
164 const double phi = atan2(dir.
getDY(), dir.
getDX());
165 const double cp = cos(phi);
166 const double sp = sin(phi);
185 const double ct = dir.
getDZ();
186 const double st = sqrt((1.0 + ct)*(1.0 - ct));
187 const double phi = atan2(dir.
getDY(), dir.
getDX());
188 const double cp = cos(phi);
189 const double sp = sin(phi);
247 const double a2 = Q.
getA()*Q.
getA();
248 const double b2 = Q.
getB()*Q.
getB();
249 const double c2 = Q.
getC()*Q.
getC();
250 const double d2 = Q.
getD()*Q.
getD();
252 const double ab = Q.
getA()*Q.
getB();
253 const double ac = Q.
getA()*Q.
getC();
254 const double ad = Q.
getA()*Q.
getD();
256 const double bc = Q.
getB()*Q.
getC();
257 const double bd = Q.
getB()*Q.
getD();
259 const double cd = Q.
getC()*Q.
getD();
261 a00 = a2 + b2 - c2 - d2;
a01 = 2.0*bc - 2.0*ad;
a02 = 2.0*bd + 2.0*ac;
262 a10 = 2.0*bc + 2.0*ad;
a11 = a2 - b2 + c2 - d2;
a12 = 2.0*cd - 2.0*ab;
263 a20 = 2.0*bd - 2.0*ac;
a21 = 2.0*cd + 2.0*ab;
a22 = a2 - b2 - c2 + d2;
285 const double q2 = 0.25 * (1.0 +
a00 +
a11 +
a22);
289 const double a = sqrt(q2);
290 const double w = 0.25 /
a;
291 const double b = (
a21 -
a12) * w;
292 const double c = (
a02 -
a20) * w;
293 const double d = (
a10 -
a01) * w;
336 void rotate(
double& __x,
double& __y,
double& __z)
const
338 const double x =
a00 * __x +
a01 * __y +
a02 * __z;
339 const double y =
a10 * __x +
a11 * __y +
a12 * __z;
340 const double z =
a20 * __x +
a21 * __y +
a22 * __z;
357 const double x =
a00 * __x +
a10 * __y +
a20 * __z;
358 const double y =
a01 * __x +
a11 * __y +
a21 * __z;
359 const double z =
a02 * __x +
a12 * __y +
a22 * __z;
Data structure for angles in three dimensions.
JRotation3D & transpose()
Transpose.
JRotation3D(const JVersor3Z &dir)
Constructor.
double getB() const
Get b value.
Auxiliary base class for aritmetic operations of derived class types.
double getPhi() const
Get phi angle.
JRotation3D(const JRotation3Y &R)
Constructor.
JRotation3Y(const double phi)
Constructor.
void rotate(double &__x, double &__y, double &__z) const
Rotate.
JRotation3D(const JQuaternion3D &Q)
Constructor.
void rotate_back(double &__x, double &__y, double &__z) const
Rotate back.
JRotation3Y()
Default constructor (= identity matrix).
JMatrix3D & mul(const double factor)
Scale matrix.
JMatrix3D & transpose()
Transpose.
JRotation3Z()
Default constructor (= identity matrix).
double getTheta() const
Get theta angle.
double getDY() const
Get y direction.
JRotation3D()
Default constructor (= identity matrix).
JRotation3X()
Default constructor (= identity matrix).
JRotation3D(const JVersor3D &dir)
Constructor.
double getDY() const
Get y direction.
double getDX() const
Get x direction.
then usage $script[distance] fi case set_variable R
JRotation3D(const JAngle3D &dir)
Constructor.
const JRotation3D & getRotation() const
Get rotation.
double getD() const
Get d value.
Data structure for unit quaternion in three dimensions.
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
JRotation3X(const double phi)
Constructor.
double getDX() const
Get x direction.
double getC() const
Get c value.
JRotation3Z(const double phi)
Constructor.
Base class for data structures with artithmetic capabilities.
double getA() const
Get a value.
JQuaternion3D & normalise()
Normalise quaternion.
double getDZ() const
Get z direction.
JRotation3D(const JRotation3Z &R)
Constructor.
JMatrix3D & setIdentity()
Set to identity matrix.
Data structure for normalised vector in three dimensions.
JRotation3D & mul(const JRotation3D &A, const JRotation3D &B)
Matrix multiplication.
Data structure for normalised vector in positive z-direction.
JRotation3D(const JRotation3X &R)
Constructor.
double getDZ() const
Get z direction.
source $JPP_DIR setenv csh $JPP_DIR eval JShellParser o a A