Rotation matrix.
More...
#include <JRotation3D.hh>
Rotation matrix.
Definition at line 111 of file JRotation3D.hh.
◆ JRotation3D() [1/8]
JGEOMETRY3D::JRotation3D::JRotation3D |
( |
| ) |
|
|
inline |
Default constructor (= identity matrix).
Definition at line 122 of file JRotation3D.hh.
◆ JRotation3D() [2/8]
JGEOMETRY3D::JRotation3D::JRotation3D |
( |
const JAngle3D & |
dir | ) |
|
|
inline |
Constructor.
The matrix is defined such that the rotation of a vector in the given direction ends up along the z-axis and the back rotation of a vector parallel to the z-axis ends up in the given direction.
- Parameters
-
Definition at line 137 of file JRotation3D.hh.
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());
◆ JRotation3D() [3/8]
JGEOMETRY3D::JRotation3D::JRotation3D |
( |
const JVersor3D & |
dir | ) |
|
|
inline |
Constructor.
The matrix is defined such that the rotation of a vector in the given direction ends up along the z-axis and the back rotation of a vector parallel to the z-axis ends up in the given direction.
- Parameters
-
Definition at line 159 of file JRotation3D.hh.
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);
◆ JRotation3D() [4/8]
JGEOMETRY3D::JRotation3D::JRotation3D |
( |
const JVersor3Z & |
dir | ) |
|
|
inline |
Constructor.
The matrix is defined such that the rotation of a vector in the given direction ends up along the z-axis and the back rotation of a vector parallel to the z-axis ends up in the given direction.
- Parameters
-
Definition at line 182 of file JRotation3D.hh.
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);
◆ JRotation3D() [5/8]
JGEOMETRY3D::JRotation3D::JRotation3D |
( |
const JRotation3X & |
R | ) |
|
|
inline |
Constructor.
- Parameters
-
R | 2D rotation matrix around X-axis |
Definition at line 202 of file JRotation3D.hh.
◆ JRotation3D() [6/8]
JGEOMETRY3D::JRotation3D::JRotation3D |
( |
const JRotation3Y & |
R | ) |
|
|
inline |
Constructor.
- Parameters
-
R | 2D rotation matrix around Y-axis |
Definition at line 216 of file JRotation3D.hh.
◆ JRotation3D() [7/8]
JGEOMETRY3D::JRotation3D::JRotation3D |
( |
const JRotation3Z & |
R | ) |
|
|
inline |
Constructor.
- Parameters
-
R | 2D rotation matrix around Z-axis |
Definition at line 230 of file JRotation3D.hh.
◆ JRotation3D() [8/8]
Constructor.
- Parameters
-
Definition at line 244 of file JRotation3D.hh.
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;
◆ getRotation()
const JRotation3D& JGEOMETRY3D::JRotation3D::getRotation |
( |
| ) |
const |
|
inline |
Get rotation.
- Returns
- rotation
Definition at line 272 of file JRotation3D.hh.
274 return static_cast<const JRotation3D&>(*
this);
◆ operator JQuaternion3D()
Type conversion operator.
- Returns
- quaternion
Definition at line 283 of file JRotation3D.hh.
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;
◆ transpose()
Transpose.
Definition at line 305 of file JRotation3D.hh.
307 static_cast<JMatrix3D&>(*this).transpose();
◆ mul() [1/5]
Matrix multiplication.
- Parameters
-
- Returns
- this matrix
Definition at line 320 of file JRotation3D.hh.
323 static_cast<JMatrix3D&>(*this).mul(A, B);
◆ rotate()
void JGEOMETRY3D::JRotation3D::rotate |
( |
double & |
__x, |
|
|
double & |
__y, |
|
|
double & |
__z |
|
) |
| const |
|
inline |
Rotate.
- Parameters
-
__x | x value |
__y | y value |
__z | z value |
Definition at line 336 of file JRotation3D.hh.
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;
◆ rotate_back()
void JGEOMETRY3D::JRotation3D::rotate_back |
( |
double & |
__x, |
|
|
double & |
__y, |
|
|
double & |
__z |
|
) |
| const |
|
inline |
Rotate back.
- Parameters
-
__x | x value |
__y | y value |
__z | z value |
Definition at line 355 of file JRotation3D.hh.
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;
◆ getInstance()
static const JMatrix3D& JMATH::JMatrix3D::getInstance |
( |
| ) |
|
|
inlinestaticinherited |
Get reference to unique instance of this class object.
- Returns
- zero matrix
Definition at line 78 of file JMath/JMatrix3D.hh.
◆ setIdentity()
◆ getIdentity()
static const JMatrix3D& JMATH::JMatrix3D::getIdentity |
( |
| ) |
|
|
inlinestaticinherited |
Get reference to unique instance of this class object.
- Returns
- identity matrix
Definition at line 106 of file JMath/JMatrix3D.hh.
◆ set()
void JMATH::JMatrix3D::set |
( |
const JMatrix3D & |
A | ) |
|
|
inlineinherited |
Set matrix.
- Parameters
-
Definition at line 119 of file JMath/JMatrix3D.hh.
121 static_cast<JMatrix3D&>(*
this) = A;
◆ reset()
◆ negate()
◆ add()
◆ sub()
◆ mul() [2/5]
JMatrix3D& JMATH::JMatrix3D::mul |
( |
const double |
factor | ) |
|
|
inlineinherited |
Scale matrix.
- Parameters
-
- Returns
- this matrix * factor
Definition at line 208 of file JMath/JMatrix3D.hh.
210 a00 *= factor;
a01 *= factor;
a02 *= factor;
211 a10 *= factor;
a11 *= factor;
a12 *= factor;
212 a20 *= factor;
a21 *= factor;
a22 *= factor;
◆ mul() [3/5]
◆ mul() [4/5]
Multiply with object.
- Parameters
-
- Returns
- result object
Definition at line 273 of file JMath.hh.
◆ div()
JMatrix3D& JMATH::JMatrix3D::div |
( |
const double |
factor | ) |
|
|
inlineinherited |
Scale matrix.
- Parameters
-
- Returns
- this matrix / factor
Definition at line 224 of file JMath/JMatrix3D.hh.
226 a00 /= factor;
a01 /= factor;
a02 /= factor;
227 a10 /= factor;
a11 /= factor;
a12 /= factor;
228 a20 /= factor;
a21 /= factor;
a22 /= factor;
◆ equals()
bool JMATH::JMatrix3D::equals |
( |
const JMatrix3D & |
A, |
|
|
const double |
eps = std::numeric_limits<double>::min() |
|
) |
| const |
|
inlineinherited |
Equality.
- Parameters
-
A | matrix |
eps | numerical precision |
- Returns
- true if matrices identical; else false
Definition at line 267 of file JMath/JMatrix3D.hh.
270 return (fabs(
a00 - A.
a00) <= eps &&
271 fabs(
a01 - A.
a01) <= eps &&
272 fabs(
a02 - A.
a02) <= eps &&
273 fabs(
a10 - A.
a10) <= eps &&
274 fabs(
a11 - A.
a11) <= eps &&
275 fabs(
a12 - A.
a12) <= eps &&
276 fabs(
a20 - A.
a20) <= eps &&
277 fabs(
a21 - A.
a21) <= eps &&
278 fabs(
a22 - A.
a22) <= eps);
◆ isIdentity()
bool JMATH::JMatrix3D::isIdentity |
( |
const double |
eps = std::numeric_limits<double>::min() | ) |
const |
|
inlineinherited |
Test identity.
- Parameters
-
- Returns
- true if identity matrix; else false
Definition at line 288 of file JMath/JMatrix3D.hh.
◆ getDeterminant()
double JMATH::JMatrix3D::getDeterminant |
( |
| ) |
const |
|
inlineinherited |
Get determinant of matrix.
- Returns
- determinant of matrix
Definition at line 299 of file JMath/JMatrix3D.hh.
◆ transform()
void JMATH::JMatrix3D::transform |
( |
double & |
__x, |
|
|
double & |
__y, |
|
|
double & |
__z |
|
) |
| const |
|
inlineinherited |
Transform.
- Parameters
-
__x | x value |
__y | y value |
__z | z value |
Definition at line 318 of file JMath/JMatrix3D.hh.
320 const double x =
a00 * __x +
a01 * __y +
a02 * __z;
321 const double y =
a10 * __x +
a11 * __y +
a12 * __z;
322 const double z =
a20 * __x +
a21 * __y +
a22 * __z;
◆ mul() [5/5]
template<class JFirst_t, class JSecond_t>
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul |
( |
const JSecond_t & |
object | ) |
|
|
inlineinherited |
Multiply with object.
- Parameters
-
- Returns
- result object
Definition at line 273 of file JMath.hh.
◆ a00
double JMATH::JMatrix3D::a00 |
|
inherited |
◆ a01
double JMATH::JMatrix3D::a01 |
|
inherited |
◆ a02
double JMATH::JMatrix3D::a02 |
|
inherited |
◆ a10
double JMATH::JMatrix3D::a10 |
|
inherited |
◆ a11
double JMATH::JMatrix3D::a11 |
|
inherited |
◆ a12
double JMATH::JMatrix3D::a12 |
|
inherited |
◆ a20
double JMATH::JMatrix3D::a20 |
|
inherited |
◆ a21
double JMATH::JMatrix3D::a21 |
|
inherited |
◆ a22
double JMATH::JMatrix3D::a22 |
|
inherited |
The documentation for this class was generated from the following file: