rot.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_rot_hh
22 #define mia_3d_rot_hh
23 
24 #include <mia/core/attributes.hh>
25 #include <mia/3d/quaternion.hh>
26 #include <mia/3d/matrix.hh>
27 
29 
31 public:
32  C3DRotation();
33  ~C3DRotation();
34 
35  C3DRotation(const C3DRotation& other);
36  C3DRotation& operator = (const C3DRotation& other);
37 
38  C3DRotation(const C3DDMatrix& m);
39  C3DRotation(const Quaternion& q);
40  C3DRotation(const std::string& s);
41 
42  C3DDMatrix as_matrix_3x3() const;
43  Quaternion as_quaternion() const;
44  std::string as_string() const;
45 
46  static const C3DRotation _1;
47 
48 private:
49  class C3DRotationImpl *impl;
50 };
51 
52 
53 
54 
55 template <>
57  static const int value = 0x4000;
58 };
59 
60 template <>
61 struct dispatch_attr_string<C3DRotation> {
62  static std::string val2string(const C3DRotation& value) {
63  return value.as_string();
64  }
65  static C3DRotation string2val(const std::string& str) {
66  return C3DRotation(str);
67  }
68 };
69 
70 
71 EXPORT_3D bool operator == (const C3DRotation& lhs, const C3DRotation& rhs);
72 EXPORT_3D bool operator < (const C3DRotation& lhs, const C3DRotation& rhs);
73 
76 
78 #endif
a class to implement a quaternion
Definition: quaternion.hh:43
TTranslator< C3DRotation > C3DRotationAttributeTranslate
Definition: rot.hh:75
Generic string vs. attribute translator singleton.
Definition: attributes.hh:509
static const C3DRotation _1
Definition: rot.hh:46
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
#define EXPORT_3D
Definition: defines3d.hh:44
static C3DRotation string2val(const std::string &str)
Definition: rot.hh:65
EXPORT_3D bool operator<(const C3DRotation &lhs, const C3DRotation &rhs)
EXPORT_3D bool operator==(const C3DRotation &lhs, const C3DRotation &rhs)
a simple 3x3 matrix
Definition: 3d/matrix.hh:45
static std::string val2string(const C3DRotation &value)
Definition: rot.hh:62
std::string as_string() const
Class of an attribute that holds data of type T.
Definition: attributes.hh:116
TAttribute< C3DRotation > C3DRotationAttribute
Definition: rot.hh:74
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36