Free Electron
OrthonormalBasis.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __math_OrthonormalBasis_h__
8 #define __math_OrthonormalBasis_h__
9 
10 namespace fe
11 {
12 
13 /**************************************************************************//**
14  \brief OrthonormalBasis for 3D transformations
15 
16  @ingroup math
17 
18  HACK Currently assumes Z-forward Y-up
19 
20  TODO care about specified direction and up
21 *//***************************************************************************/
22 template <typename T>
23 class OrthonormalBasis: public Matrix<3,4,T>
24 {
25  public:
26  OrthonormalBasis<T>(Axis a_direction,Axis a_up)
27  {
28  setIdentity(*this);
29  }
30 
31  template <typename U>
32  void adapt(const Matrix<3,4,U>& a_rMatrix);
33 
34  private:
35  Axis m_direction;
36  Axis m_up;
37 
38 };
39 
40 template <typename T>
41 template <typename U>
42 inline void OrthonormalBasis<T>::adapt(const Matrix<3,4,U>& a_rMatrix)
43 {
46  a_rMatrix.left()[1],
47  a_rMatrix.left()[2],
48  a_rMatrix.left()[0]);
49 
52  a_rMatrix.direction()[1],
53  a_rMatrix.direction()[2],
54  a_rMatrix.direction()[0]);
55 
58  a_rMatrix.up()[1],
59  a_rMatrix.up()[2],
60  a_rMatrix.up()[0]);
61 
62  setTranslation((Matrix<3,4,T>&)*this,
64  a_rMatrix.translation()[1],
65  a_rMatrix.translation()[2],
66  a_rMatrix.translation()[0]));
67 }
68 
72 
73 } /* namespace */
74 
75 #endif /* __math_OrthonormalBasis_h__ */
76 
Matrix for 3D transformations.
Definition: Matrix3x4.h:47
kernel
Definition: namespace.dox:3
General template for fixed size numeric matrices.
Definition: Matrix.h:42
OrthonormalBasis for 3D transformations.
Definition: OrthonormalBasis.h:23