OPALX (Object Oriented Parallel Accelerator Library for Exascale)
MINIorX
OPALX
CoordinateSystemTrafo.cpp
Go to the documentation of this file.
1
#include "
Algorithms/CoordinateSystemTrafo.h
"
2
3
CoordinateSystemTrafo::CoordinateSystemTrafo
()
4
: origin_m(0.0), orientation_m(1.0, 0.0, 0.0, 0.0), rotationMatrix_m(3, 3) {
5
rotationMatrix_m
(0, 0) = 1.0;
6
rotationMatrix_m
(0, 1) = 0.0;
7
rotationMatrix_m
(0, 2) = 0.0;
8
rotationMatrix_m
(1, 0) = 0.0;
9
rotationMatrix_m
(1, 1) = 1.0;
10
rotationMatrix_m
(1, 2) = 0.0;
11
rotationMatrix_m
(2, 0) = 0.0;
12
rotationMatrix_m
(2, 1) = 0.0;
13
rotationMatrix_m
(2, 2) = 1.0;
14
}
15
16
CoordinateSystemTrafo::CoordinateSystemTrafo
(
const
CoordinateSystemTrafo
& right)
17
: origin_m(right.origin_m),
18
orientation_m(right.orientation_m),
19
rotationMatrix_m(right.rotationMatrix_m) {
20
}
21
22
CoordinateSystemTrafo::CoordinateSystemTrafo
(
23
const
ippl::Vector<double, 3>
& origin,
const
Quaternion
& orientation)
24
: origin_m(origin),
25
orientation_m(orientation),
26
rotationMatrix_m(orientation_m.getRotationMatrix()) {
27
}
28
29
void
CoordinateSystemTrafo::invert
() {
30
origin_m
= -
orientation_m
.
rotate
(
origin_m
);
31
orientation_m
=
orientation_m
.
conjugate
();
32
rotationMatrix_m
= boost::numeric::ublas::trans(
rotationMatrix_m
);
33
}
34
35
CoordinateSystemTrafo
CoordinateSystemTrafo::operator*
(
const
CoordinateSystemTrafo
& right)
const
{
36
CoordinateSystemTrafo
result(*
this
);
37
38
result *= right;
39
return
result;
40
}
41
42
void
CoordinateSystemTrafo::operator*=
(
const
CoordinateSystemTrafo
& right) {
43
origin_m
= right.
orientation_m
.
conjugate
().
rotate
(
origin_m
) + right.
origin_m
;
44
orientation_m
*= right.
orientation_m
;
45
orientation_m
.
normalize
();
46
rotationMatrix_m
=
orientation_m
.
getRotationMatrix
();
47
}
CoordinateSystemTrafo.h
CoordinateSystemTrafo
Definition:
CoordinateSystemTrafo.h:6
CoordinateSystemTrafo::CoordinateSystemTrafo
CoordinateSystemTrafo()
Definition:
CoordinateSystemTrafo.cpp:3
CoordinateSystemTrafo::operator*=
void operator*=(const CoordinateSystemTrafo &right)
Definition:
CoordinateSystemTrafo.cpp:42
CoordinateSystemTrafo::rotationMatrix_m
matrix_t rotationMatrix_m
Definition:
CoordinateSystemTrafo.h:37
CoordinateSystemTrafo::origin_m
ippl::Vector< double, 3 > origin_m
Definition:
CoordinateSystemTrafo.h:35
CoordinateSystemTrafo::operator*
CoordinateSystemTrafo operator*(const CoordinateSystemTrafo &right) const
Definition:
CoordinateSystemTrafo.cpp:35
CoordinateSystemTrafo::orientation_m
Quaternion orientation_m
Definition:
CoordinateSystemTrafo.h:36
CoordinateSystemTrafo::invert
void invert()
Definition:
CoordinateSystemTrafo.cpp:29
Quaternion
Definition:
Quaternion.hpp:6
Quaternion::normalize
Quaternion & normalize()
Definition:
Quaternion.cpp:104
Quaternion::conjugate
Quaternion conjugate() const
Definition:
Quaternion.hpp:88
Quaternion::rotate
ippl::Vector< double, 3 > rotate(const ippl::Vector< double, 3 > &) const
Definition:
Quaternion.cpp:122
Quaternion::getRotationMatrix
matrix_t getRotationMatrix() const
Definition:
Quaternion.cpp:135
ippl::Vector< double, 3 >
src
Algorithms
CoordinateSystemTrafo.cpp
Generated on Fri Jan 23 2026 14:40:00 for OPALX (Object Oriented Parallel Accelerator Library for Exascale) by
1.9.3