OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
AffineTransformation.h
Go to the documentation of this file.
1#ifndef MSLANG_AFFINETRANSFORMATION_H
2#define MSLANG_AFFINETRANSFORMATION_H
3
4#include "Algorithms/Matrix.h"
5#include "VectorMath.h"
6
7namespace mslang {
10
12 : data_() {
13 data_(0, 0) = row0[0];
14 data_(0, 1) = row0[1];
15 data_(0, 2) = row0[2];
16 data_(1, 0) = row1[0];
17 data_(1, 1) = row1[1];
18 data_(1, 2) = row1[2];
19 data_(2, 0) = 0.0;
20 data_(2, 1) = 0.0;
21 data_(2, 2) = 1.0;
22 }
23
25 // Default constructor already initializes to identity
26 }
27
28 // Access operators for compatibility
29 double& operator()(int i, int j) { return data_(i, j); }
30
31 double operator()(int i, int j) const { return data_(i, j); }
32
35 double det = (*this)(0, 0) * (*this)(1, 1) - (*this)(1, 0) * (*this)(0, 1);
36
37 Ret(0, 0) = (*this)(1, 1) / det;
38 Ret(1, 0) = -(*this)(1, 0) / det;
39 Ret(0, 1) = -(*this)(0, 1) / det;
40 Ret(1, 1) = (*this)(0, 0) / det;
41
42 Ret(0, 2) = -Ret(0, 0) * (*this)(0, 2) - Ret(0, 1) * (*this)(1, 2);
43 Ret(1, 2) = -Ret(1, 0) * (*this)(0, 2) - Ret(1, 1) * (*this)(1, 2);
44 Ret(2, 2) = 1.0;
45
46 return Ret;
47 }
48
50 return Vector_t<double, 3>(-(*this)(0, 2), -(*this)(1, 2), 0.0);
51 }
52
53 double getAngle() const { return atan2((*this)(1, 0), (*this)(0, 0)); }
54
56 vector_t<3> b(0.0); // Create a 3D vector
57 b[0] = v(0);
58 b[1] = v(1);
59 b[2] = 1.0;
61 return Vector_t<double, 3>(w[0], w[1], 0.0);
62 }
63
68
71 Ret.data_ = prod(data_, B.data_);
72 return Ret;
73 }
74 };
75} // namespace mslang
76
77#endif
ippl::Vector< T, Dim > Vector_t
KOKKOS_INLINE_FUNCTION ippl::Vector< double, static_cast< unsigned >(Rows)> prod_matrix_vector(const matrix_t< Rows, Cols > &m, const ippl::Vector< double, static_cast< unsigned >(Cols)> &v)
Definition Matrix.h:169
ippl::Vector< double, Size > vector_t
Definition Matrix.h:102
KOKKOS_INLINE_FUNCTION matrix_t< Rows1, Cols2 > prod(const matrix_t< Rows1, Cols1 > &a, const matrix_t< Rows2, Cols2 > &b)
Definition Matrix.h:151
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
double & operator()(int i, int j)
AffineTransformation(const Vector_t< double, 3 > &row0, const Vector_t< double, 3 > &row1)
AffineTransformation getInverse() const
double operator()(int i, int j) const
AffineTransformation mult(const AffineTransformation &B)