OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
AffineTransformation.h
Go to the documentation of this file.
1#ifndef MSLANG_AFFINETRANSFORMATION_H
2#define MSLANG_AFFINETRANSFORMATION_H
3
5
6
7#include <iostream>
8#include <fstream>
9
10namespace mslang {
13 const Vector_t<double, 3>& row1):
14 matrix_t(3,3){
15 (*this)(0, 0) = row0[0];
16 (*this)(0, 1) = row0[1];
17 (*this)(0, 2) = row0[2];
18 (*this)(1, 0) = row1[0];
19 (*this)(1, 1) = row1[1];
20 (*this)(1, 2) = row1[2];
21 (*this)(2, 0) = 0.0;
22 (*this)(2, 1) = 0.0;
23 (*this)(2, 2) = 1.0;
24 }
25
27 matrix_t(3,3){
28 (*this)(0, 0) = 1.0;
29 (*this)(0, 1) = 0.0;
30 (*this)(0, 2) = 0.0;
31 (*this)(1, 0) = 0.0;
32 (*this)(1, 1) = 1.0;
33 (*this)(1, 2) = 0.0;
34 (*this)(2, 0) = 0.0;
35 (*this)(2, 1) = 0.0;
36 (*this)(2, 2) = 1.0;
37 }
38
41 double det = (*this)(0, 0) * (*this)(1, 1) - (*this)(1, 0) * (*this)(0, 1);
42
43 Ret(0, 0) = (*this)(1, 1) / det;
44 Ret(1, 0) = -(*this)(1, 0) / det;
45 Ret(0, 1) = -(*this)(0, 1) / det;
46 Ret(1, 1) = (*this)(0, 0) / det;
47
48 Ret(0, 2) = - Ret(0, 0) * (*this)(0, 2) - Ret(0, 1) * (*this)(1, 2);
49 Ret(1, 2) = - Ret(1, 0) * (*this)(0, 2) - Ret(1, 1) * (*this)(1, 2);
50 Ret(2, 2) = 1.0;
51
52 return Ret;
53 }
54
56 return Vector_t<double, 3>(-(*this)(0, 2), -(*this)(1, 2), 0.0);
57 }
58
59 double getAngle() const {
60 return atan2((*this)(1, 0), (*this)(0, 0));
61 }
62
64 matrix_t b = matrix_t(3, 1); // Create a 3x1 matrix for b
65 b(0, 0) = v(0);
66 b(1, 0) = v(1);
67 b(2, 0) = 1.0;
68 matrix_t w = boost::numeric::ublas::prod(*this, b);
69 return Vector_t<double, 3>(w(0, 0), w(1, 0), 0.0);
70 }
71
76
79 matrix_t &A = *this;
80 const matrix_t &BTenz = B;
81 matrix_t &C = Ret;
82 C = boost::numeric::ublas::prod(A, BTenz);
83 return Ret;
84 }
85 };
86}
87
88#endif
boost::numeric::ublas::matrix< double > matrix_t
Definition BoostMatrix.h:23
ippl::Vector< T, Dim > Vector_t
Vector_t< double, 3 > transformFrom(const Vector_t< double, 3 > &v) const
Vector_t< double, 3 > getOrigin() const
Vector_t< double, 3 > transformTo(const Vector_t< double, 3 > &v) const
AffineTransformation(const Vector_t< double, 3 > &row0, const Vector_t< double, 3 > &row1)
AffineTransformation getInverse() const
AffineTransformation mult(const AffineTransformation &B)