Main Page
Namespaces
Classes
Files
File List
File Members
matrix1x4.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 MATRIX1X4_HPP
21
#define MATRIX1X4_HPP
22
23
#include <iostream>
24
#include <vector>
25
26
#include <
exception_cpe.hpp
>
27
28
namespace
cpe
29
{
30
31
class
matrix4x1;
32
class
matrix4;
33
35
class
matrix1x4
36
{
37
38
public
:
39
40
// ********************************************* //
41
// ********************************************* //
42
// CONSTRUCTORS
43
// ********************************************* //
44
// ********************************************* //
45
47
matrix1x4
();
49
matrix1x4
(
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
matrix1x4
operator+
(
const
matrix1x4
& m2)
const
;
82
matrix1x4
operator+
(
float
s)
const
;
83
85
matrix1x4
operator-
(
const
matrix1x4
& m2)
const
;
87
matrix1x4
operator-
(
float
s)
const
;
88
89
91
matrix1x4
operator*
(
float
s)
const
;
93
matrix1x4
operator*
(
const
matrix4
s)
const
;
95
float
operator*
(
const
matrix4x1
& m2)
const
;
97
matrix1x4
operator/
(
float
s)
const
;
98
99
101
matrix1x4
&
operator+=
(
const
matrix1x4
&
m
);
103
matrix1x4
&
operator+=
(
float
s);
105
matrix1x4
&
operator-=
(
const
matrix1x4
& m);
107
matrix1x4
&
operator-=
(
float
s);
109
matrix1x4
&
operator*=
(
float
s);
111
matrix1x4
&
operator/=
(
float
s);
112
114
matrix1x4
operator-
()
const
;
115
117
matrix1x4
product_compontentwise
(
const
matrix1x4
& m)
const
;
119
matrix1x4
&
product_compontentwise_internal
(
const
matrix1x4
& m);
120
122
matrix4x1
transposed
()
const
;
123
124
125
126
127
128
129
130
// ********************************************* //
131
// ********************************************* //
132
// Projection matrix
133
// ********************************************* //
134
// ********************************************* //
135
137
std::vector<float>
to_vector
()
const
;
138
139
private
:
140
141
// ********************************************* //
142
// ********************************************* //
143
// Internal parameters
144
// ********************************************* //
145
// ********************************************* //
146
148
float
m[4];
149
150
151
// ********************************************* //
152
// ********************************************* //
153
// Helper
154
// ********************************************* //
155
// ********************************************* //
156
158
void
assert_size
(
const
size_t
& k1,
const
size_t
& k2)
const
;
159
160
};
161
163
matrix1x4
operator+
(
float
s,
const
matrix1x4
& m);
165
matrix1x4
operator-
(
float
s,
const
matrix1x4
& m);
167
matrix1x4
operator*
(
float
s,
const
matrix1x4
& m);
168
169
// ********************************************* //
170
// ********************************************* //
171
// Output
172
// ********************************************* //
173
// ********************************************* //
174
176
std::ostream&
operator<<
(std::ostream& stream,
const
matrix1x4
& m);
177
178
179
181
class
exception_matrix1x4
:
public
exception_cpe
182
{
183
public
:
184
186
exception_matrix1x4
():
exception_cpe
(){}
188
exception_matrix1x4
(
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){}
189
};
190
191
192
193
}
194
195
#endif
lib3d
matrix1x4.hpp
Generated on Sun Apr 28 2013 11:11:29 by
1.8.3.1