1 #ifndef __JROTATION3D__
2 #define __JROTATION3D__
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;
Base class for data structures with artithmetic capabilities.
Data structure for angles in three dimensions.
double getTheta() const
Get theta angle.
double getPhi() const
Get phi angle.
Data structure for unit quaternion in three dimensions.
double getB() const
Get b value.
JQuaternion3D & normalise()
Normalise quaternion.
double getD() const
Get d value.
double getC() const
Get c value.
double getA() const
Get a value.
JRotation3D(const JRotation3Y &R)
Constructor.
JRotation3D & transpose()
Transpose.
JRotation3D(const JRotation3Z &R)
Constructor.
void rotate_back(double &__x, double &__y, double &__z) const
Rotate back.
JRotation3D(const JRotation3X &R)
Constructor.
JRotation3D(const JVersor3D &dir)
Constructor.
JRotation3D(const JQuaternion3D &Q)
Constructor.
JRotation3D()
Default constructor (= identity matrix).
const JRotation3D & getRotation() const
Get rotation.
JRotation3D(const JAngle3D &dir)
Constructor.
void rotate(double &__x, double &__y, double &__z) const
Rotate.
JRotation3D(const JVersor3Z &dir)
Constructor.
JRotation3D & mul(const JRotation3D &A, const JRotation3D &B)
Matrix multiplication.
JRotation3X(const double phi)
Constructor.
JRotation3X()
Default constructor (= identity matrix).
JRotation3Y()
Default constructor (= identity matrix).
JRotation3Y(const double phi)
Constructor.
JRotation3Z()
Default constructor (= identity matrix).
JRotation3Z(const double phi)
Constructor.
Data structure for normalised vector in three dimensions.
double getDY() const
Get y direction.
double getDX() const
Get x direction.
double getDZ() const
Get z direction.
Data structure for normalised vector in positive z-direction.
double getDZ() const
Get z direction.
double getDY() const
Get y direction.
double getDX() const
Get x direction.
JMatrix3D & setIdentity()
Set to identity matrix.
JMatrix3D & transpose()
Transpose.
JMatrix3D & mul(const double factor)
Scale matrix.
Auxiliary classes and methods for 3D geometrical objects and operations.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary base class for aritmetic operations of derived class types.