Main Page
Namespaces
Classes
Files
File List
File Members
matrix4x1.hpp
Go to the documentation of this file.
1
/*
2
** TP CPE Lyon
3
** Copyright (C) 2013 Damien Rohmer
4
**
5
** This program is free software: you can redistribute it and/or modify
6
** it under the terms of the GNU General Public License as published by
7
** the Free Software Foundation, either version 3 of the License, or
8
** (at your option) any later version.
9
**
10
** This program is distributed in the hope that it will be useful,
11
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
** GNU General Public License for more details.
14
**
15
** You should have received a copy of the GNU General Public License
16
** along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
20
#ifndef matrix4x1_HPP
21
#define matrix4x1_HPP
22
23
#include <iostream>
24
#include <vector>
25
26
#include <
exception_cpe.hpp
>
27
28
namespace
cpe
29
{
30
31
class
matrix1x4;
32
class
matrix4;
33
35
class
matrix4x1
36
{
37
38
public
:
39
40
// ********************************************* //
41
// ********************************************* //
42
// CONSTRUCTORS
43
// ********************************************* //
44
// ********************************************* //
45
47
matrix4x1
();
49
matrix4x1
(
float
x00,
float
x01,
float
x02,
float
x03);
50
51
52
53
// ********************************************* //
54
// ********************************************* //
55
// Element access
56
// ********************************************* //
57
// ********************************************* //
58
60
float
operator()
(
const
size_t
& k1,
const
size_t
& k2)
const
;
62
float
&
operator()
(
const
size_t
& k1,
const
size_t
& k2);
63
66
const
float
*
pointer
()
const
;
69
float
*
pointer_unprotected
();
70
71
72
73
// ********************************************* //
74
// ********************************************* //
75
// Math operator
76
// ********************************************* //
77
// ********************************************* //
78
80
matrix4x1
operator+
(
const
matrix4x1
& m2)
const
;
82
matrix4x1
operator+
(
float
s)
const
;
83
85
matrix4x1
operator-
(
const
matrix4x1
& m2)
const
;
87
matrix4x1
operator-
(
float
s)
const
;
88
89
91
matrix4x1
operator*
(
float
s)
const
;
93
float
operator*
(
const
matrix1x4
& m2)
const
;
95
matrix4x1
operator/
(
float
s)
const
;
96
97
99
matrix4x1
&
operator+=
(
const
matrix4x1
&
m
);
101
matrix4x1
&
operator+=
(
float
s);
103
matrix4x1
&
operator-=
(
const
matrix4x1
& m);
105
matrix4x1
&
operator-=
(
float
s);
107
matrix4x1
&
operator*=
(
float
s);
109
matrix4x1
&
operator/=
(
float
s);
110
112
matrix4x1
operator-
()
const
;
113
115
matrix4x1
product_compontentwise
(
const
matrix4x1
& m)
const
;
117
matrix4x1
&
product_compontentwise_internal
(
const
matrix4x1
& m);
118
120
matrix4x1
transposed
()
const
;
121
122
123
124
125
126
127
128
// ********************************************* //
129
// ********************************************* //
130
// Projection matrix
131
// ********************************************* //
132
// ********************************************* //
133
135
std::vector<float>
to_vector
()
const
;
136
137
private
:
138
139
// ********************************************* //
140
// ********************************************* //
141
// Internal parameters
142
// ********************************************* //
143
// ********************************************* //
144
146
float
m[4];
147
148
149
// ********************************************* //
150
// ********************************************* //
151
// Helper
152
// ********************************************* //
153
// ********************************************* //
154
156
void
assert_size
(
const
size_t
& k1,
const
size_t
& k2)
const
;
157
158
};
159
161
matrix4x1
operator+
(
float
s,
const
matrix4x1
& m);
163
matrix4x1
operator-
(
float
s,
const
matrix4x1
& m);
165
matrix4x1
operator*
(
float
s,
const
matrix4x1
& m);
167
matrix4x1
operator*
(
const
matrix4
& m1,
const
matrix4x1
& m2);
168
169
170
// ********************************************* //
171
// ********************************************* //
172
// Output
173
// ********************************************* //
174
// ********************************************* //
175
177
std::ostream&
operator<<
(std::ostream& stream,
const
matrix4x1
& m);
178
179
180
182
class
exception_matrix4x1
:
public
exception_cpe
183
{
184
public
:
185
187
exception_matrix4x1
():
exception_cpe
(){}
189
exception_matrix4x1
(
const
std::string& msg_param,
const
std::string& file_param,
const
std::string& caller_param,
const
int
& line_param):
exception_cpe
(msg_param,file_param,caller_param,line_param){}
190
};
191
192
193
194
}
195
196
#endif
lib3d
matrix4x1.hpp
Generated on Sun Apr 28 2013 11:11:29 by
1.8.3.1