affine_matrix.hh
Go to the documentation of this file.
1 /* -*- mia-c++ -*-
2  *
3  * This file is part of MIA - a toolbox for medical image analysis
4  * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
5  *
6  * MIA is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with MIA; if not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef mia_3d_affine_matrix_hh
22 #define mia_3d_affine_matrix_hh
23 
24 #include <mia/3d/quaternion.hh>
25 
27 
28 
36 
37 public:
40 
44  CAffinTransformMatrix(float a11, float a12, float a13, float a14,
45  float a21, float a22, float a23, float a24,
46  float a31, float a32, float a33, float a34);
47 
53  void rotate_x(float angle, const C3DFVector& center = C3DFVector::_0);
54 
60  void rotate_y(float angle, const C3DFVector& center = C3DFVector::_0);
61 
67  void rotate_z(float angle, const C3DFVector& center = C3DFVector::_0);
68 
75  void rotate(const Quaternion& q, const C3DFVector& center = C3DFVector::_0);
76 
83  void transform_centered(const C3DFMatrix& m, const C3DFVector& center = C3DFVector::_0);
84 
91  void scale(const C3DFVector& scale, const C3DFVector& center = C3DFVector::_0);
92 
93 
100  void shear(const C3DFVector& shear, const C3DFVector& center = C3DFVector::_0);
101 
106  void translate(const C3DFVector& shift);
107 
111  void identity();
112 
118  CAffinTransformMatrix& operator *= (const CAffinTransformMatrix& rhs);
119 
123  const CAffinTransformMatrix inverse() const;
124 
132  C3DFVector operator * (const C3DFVector& x) const;
133 
142  C3DFVector rotate(const C3DFVector& x) const;
143 
147  const std::vector<float>& data() const;
148 private:
149  std::vector<float> m_matrix;
150 
151 };
152 
153 
158 
159 
160 
161 
163 #endif
a class to implement a quaternion
Definition: quaternion.hh:43
EXPORT_3D CAffinTransformMatrix operator*(const CAffinTransformMatrix &lhs, const CAffinTransformMatrix &rhs)
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
#define EXPORT_3D
Definition: defines3d.hh:44
static T3DVector< float > _0
declare the vector (0,0,0)
Definition: 3d/vector.hh:280
float EXPORT_2D angle(const C2DFVector &ray_a, const C2DFVector &ray_b)
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36