-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGeometryTypes.hpp
74 lines (62 loc) · 1.59 KB
/
GeometryTypes.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*****************************************************************************
* GeometryTypes.hpp
* Example_MarkerBasedAR
******************************************************************************
* by Khvedchenia Ievgen, 5th Dec 2012
* http://computer-vision-talks.com
******************************************************************************
* Ch2 of the book "Mastering OpenCV with Practical Computer Vision Projects"
* Copyright Packt Publishing 2012.
* http://www.packtpub.com/cool-projects-with-opencv/book
*****************************************************************************/
#ifndef Example_MarkerBasedAR_GeometryTypes_hpp
#define Example_MarkerBasedAR_GeometryTypes_hpp
struct Matrix44
{
union
{
float data[16];
float mat[4][4];
};
Matrix44 getTransposed() const;
Matrix44 getInvertedRT() const;
static Matrix44 identity();
};
struct Matrix33
{
union
{
float data[9];
float mat[3][3];
};
static Matrix33 identity();
Matrix33 getTransposed() const;
};
struct Vector4
{
float data[4];
};
struct Vector3
{
float data[3];
static Vector3 zero();
Vector3 operator-() const;
};
struct Transformation
{
Transformation();
Transformation(const Matrix33& r, const Vector3& t);
Matrix33& r();
Vector3& t();
int& id();
const Matrix33& r() const;
const Vector3& t() const;
const int& id() const;
Matrix44 getMat44() const;
Transformation getInverted() const;
private:
Matrix33 m_rotation;
Vector3 m_translation;
int iD;
};
#endif