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