My Project
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Enumerations
Pages
matrix34.h
Go to the documentation of this file.
1
/**************************************************************************/
2
/* Copyright 2009 Tim Day */
3
/* */
4
/* This file is part of Fracplanet */
5
/* */
6
/* Fracplanet 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
/* Fracplanet 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 Fracplanet. If not, see <http://www.gnu.org/licenses/>. */
18
/**************************************************************************/
19
24
#ifndef _matrix34_h_
25
#define _matrix34_h_
26
27
#include "
matrix33.h
"
28
#include "
xyz.h
"
29
31
34
class
Matrix34
35
{
36
public
:
37
39
Matrix33
rotate
;
40
42
XYZ
translate
;
44
46
Matrix34
()
47
{}
48
50
Matrix34
(
const
Matrix33
& r,
const
XYZ
& t)
51
:
rotate
(r)
52
,
translate
(t)
53
{}
54
56
Matrix34
(
const
XYZ
& rx,
const
XYZ
& ry,
const
XYZ
& rz,
const
XYZ
& tr)
57
:
rotate
(rx,ry,rz)
58
,
translate
(tr)
59
{}
60
62
~Matrix34
()
63
{}
64
65
void
assign(
const
Matrix34
& m)
66
{
67
rotate
=m.
rotate
;
68
translate
=m.
translate
;
69
}
70
};
71
72
inline
const
XYZ
operator*
(
const
Matrix34
& m,
const
XYZ
& v)
73
{
74
return
m.
rotate
*v+m.
translate
;
75
}
76
77
inline
const
Matrix34
operator*
(
const
Matrix34
& a,
const
Matrix34
& b)
78
{
79
return
Matrix34
80
(
81
a.
rotate
*b.
rotate
,
82
a.
rotate
*b.
translate
+a.
translate
83
);
84
}
85
86
class
Matrix34Identity
:
public
Matrix34
87
{
88
public
:
89
Matrix34Identity
()
90
:
Matrix34
(
Matrix33Identity
(),
XYZ
(0.0f,0.0f,0.0f))
91
{}
92
};
93
94
class
Matrix34Translate
:
public
Matrix34
95
{
96
public
:
97
Matrix34Translate
(
const
XYZ
& t)
98
:
Matrix34
(
Matrix33Identity
(),t)
99
{}
100
};
101
102
class
Matrix34RotateAboutAxisThrough
:
public
Matrix34
103
{
104
public
:
106
Matrix34RotateAboutAxisThrough
(
const
XYZ
& axis,
float
angle,
const
XYZ
& pt);
107
109
Matrix34RotateAboutAxisThrough
(
const
XYZ
& axis,
const
XYZ
& pt);
110
};
111
112
#endif
113
114
115
116
117
Generated on Sat Oct 5 2013 17:39:13 for My Project by
1.8.3.1