Auxiliary class to get rotation matrix between two optical modules.
More...
#include <JDetectorToolkit.hh>
|
const JRotation3D & | operator() (const JModule &first, const JModule &second) |
| Get rotation matrix to go from first to second module. More...
|
|
const JRotation3D & | getRotation () const |
| Get rotation. More...
|
|
| operator JQuaternion3D () const |
| Type conversion operator. More...
|
|
JRotation3D & | transpose () |
| Transpose. More...
|
|
JRotation3D & | mul (const JRotation3D &A, const JRotation3D &B) |
| Matrix multiplication. More...
|
|
JMatrix3D & | mul (const double factor) |
| Scale matrix. More...
|
|
JMatrix3D & | mul (const JMatrix3D &A, const JMatrix3D &B) |
| Matrix multiplication. More...
|
|
JMatrix3D & | mul (const JSecond_t &object) |
| Multiply with object. More...
|
|
JFirst_t & | mul (const JSecond_t &object) |
| Multiply with object. More...
|
|
void | rotate (double &__x, double &__y, double &__z) const |
| Rotate. More...
|
|
void | rotate_back (double &__x, double &__y, double &__z) const |
| Rotate back. More...
|
|
JMatrix3D & | setIdentity () |
| Set to identity matrix. More...
|
|
void | set (const JMatrix3D &A) |
| Set matrix. More...
|
|
JMatrix3D & | reset () |
| Set matrix to the null matrix. More...
|
|
JMatrix3D & | negate () |
| Negate matrix. More...
|
|
JMatrix3D & | add (const JMatrix3D &A) |
| Matrix addition. More...
|
|
JMatrix3D & | sub (const JMatrix3D &A) |
| Matrix subtraction. More...
|
|
JMatrix3D & | div (const double factor) |
| Scale matrix. More...
|
|
bool | equals (const JMatrix3D &A, const double eps=std::numeric_limits< double >::min()) const |
| Equality. More...
|
|
bool | isIdentity (const double eps=std::numeric_limits< double >::min()) const |
| Test identity. More...
|
|
double | getDeterminant () const |
| Get determinant of matrix. More...
|
|
void | transform (double &__x, double &__y, double &__z) const |
| Transform. More...
|
|
|
bool | orthonormalise (const size_t index, const double precision=std::numeric_limits< double >::epsilon()) |
| Put normalised primary direction at specified index and orthoganilise following directions. More...
|
|
Auxiliary class to get rotation matrix between two optical modules.
Definition at line 644 of file JDetectorToolkit.hh.
◆ operator()()
Get rotation matrix to go from first to second module.
- Parameters
-
first | first module |
second | second module |
- Returns
- rotation matrix
Definition at line 658 of file JDetectorToolkit.hh.
662 if (first.size() == second.size()) {
664 const size_t N = first.size();
671 for (
size_t i = 0; i != N; ++i) {
682 this->
a00 =
out[0].getX() *
in[0].getX() +
out[1].getX() *
in[1].getX() +
out[2].getX() *
in[2].getX();
683 this->
a01 =
out[0].getX() *
in[0].getY() +
out[1].getX() *
in[1].getY() +
out[2].getX() *
in[2].getY();
684 this->
a02 =
out[0].getX() *
in[0].getZ() +
out[1].getX() *
in[1].getZ() +
out[2].getX() *
in[2].getZ();
686 this->
a10 =
out[0].getY() *
in[0].getX() +
out[1].getY() *
in[1].getX() +
out[2].getY() *
in[2].getX();
687 this->
a11 =
out[0].getY() *
in[0].getY() +
out[1].getY() *
in[1].getY() +
out[2].getY() *
in[2].getY();
688 this->
a12 =
out[0].getY() *
in[0].getZ() +
out[1].getY() *
in[1].getZ() +
out[2].getY() *
in[2].getZ();
690 this->
a20 =
out[0].getZ() *
in[0].getX() +
out[1].getZ() *
in[1].getX() +
out[2].getZ() *
in[2].getX();
691 this->
a21 =
out[0].getZ() *
in[0].getY() +
out[1].getZ() *
in[1].getY() +
out[2].getZ() *
in[2].getY();
692 this->
a22 =
out[0].getZ() *
in[0].getZ() +
out[1].getZ() *
in[1].getZ() +
out[2].getZ() *
in[2].getZ();
701 THROW(
JException,
"Module " << first.
getID() <<
" size " << first.size() <<
" != " << second.size());
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
const JPMT & getPMT(const int index) const
Get PMT.
const JDirection3D & getDirection() const
Get direction.
int getID() const
Get identifier.
JMatrix3D & setIdentity()
Set to identity matrix.
std::vector< JVector3D > out
std::vector< JVector3D > in
bool orthonormalise(const size_t index, const double precision=std::numeric_limits< double >::epsilon())
Put normalised primary direction at specified index and orthoganilise following directions.
static const size_t NUMBER_OF_DIMENSIONS
Number of dimensions.
◆ orthonormalise()
bool JDETECTOR::JRotation::orthonormalise |
( |
const size_t |
index, |
|
|
const double |
precision = std::numeric_limits<double>::epsilon() |
|
) |
| |
|
inlineprivate |
Put normalised primary direction at specified index and orthoganilise following directions.
This procedure follows Gram-Schmidt process.
- Parameters
-
index | index |
precision | precision |
- Returns
- true if primary direction exists; else false
Definition at line 716 of file JDetectorToolkit.hh.
722 for (
size_t i = index + 1; i !=
in.size(); ++i) {
723 if (
in[i].getLengthSquared() >
in[pos].getLengthSquared()) {
728 const double u =
in[pos].getLength();
736 swap(
in [pos],
in [index]);
737 swap(
out[pos],
out[index]);
740 for (
size_t i = index + 1; i !=
in.size(); ++i) {
742 const double dot =
in[index].getDot(
in[i]);
744 in [i] -= dot *
in [index];
745 out[i] -= dot *
out[index];
◆ getRotation()
const JRotation3D& JGEOMETRY3D::JRotation3D::getRotation |
( |
| ) |
const |
|
inlineinherited |
◆ 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;
Data structure for unit quaternion in three dimensions.
JQuaternion3D & normalise()
Normalise quaternion.
◆ transpose()
Transpose.
Definition at line 305 of file JRotation3D.hh.
307 static_cast<JMatrix3D&
>(*this).transpose();
JMatrix3D()
Default constructor.
◆ 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);
◆ 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 354 of file JMath.hh.
356 return static_cast<JFirst_t&
>(*this) = JFirst_t().mul(
static_cast<const JFirst_t&
>(*
this),
object);
◆ 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 354 of file JMath.hh.
356 return static_cast<JFirst_t&
>(*this) = JFirst_t().mul(
static_cast<const JFirst_t&
>(*
this),
object);
◆ rotate()
void JGEOMETRY3D::JRotation3D::rotate |
( |
double & |
__x, |
|
|
double & |
__y, |
|
|
double & |
__z |
|
) |
| const |
|
inlineinherited |
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 |
|
inlineinherited |
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 |
◆ reset()
◆ negate()
◆ add()
◆ sub()
◆ 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.
static const JMatrix3D & getIdentity()
Get reference to unique instance of this class object.
bool equals(const JMatrix3D &A, const double eps=std::numeric_limits< double >::min()) const
Equality.
◆ 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;
◆ NUMBER_OF_DIMENSIONS
const size_t JDETECTOR::JRotation::NUMBER_OF_DIMENSIONS = 3 |
|
static |
◆ in
◆ out
◆ 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 struct was generated from the following file: