mercator
0.4.0
A terrain generation library for the Worldforge system.
Matrix.h
1
// This file may be redistributed and modified only under the terms of
2
// the GNU General Public License (See COPYING for details).
3
// Copyright (C) 2003 Alistair Riddoch
4
5
#ifndef MERCATOR_MATRIX_H
6
#define MERCATOR_MATRIX_H
7
8
namespace
Mercator {
9
13
template
<
unsigned
int
COLS,
unsigned
int
ROWS,
typename
FloatType =
float
>
14
class
Matrix
{
15
private
:
17
FloatType m_data[COLS * ROWS];
18
public
:
20
Matrix
() =
default
;
21
23
FloatType &
operator()
(
unsigned
int
col,
unsigned
int
row) {
24
return
m_data[row * COLS + col];
25
}
26
28
const
FloatType &
operator()
(
unsigned
int
col,
unsigned
int
row)
const
{
29
return
m_data[row * COLS + col];
30
}
31
33
FloatType &
operator[]
(
unsigned
int
idx) {
34
return
m_data[idx];
35
}
36
};
37
38
}
39
40
#endif // MERCATOR_MATRIX_H
Mercator::Matrix
A fixed sized array of objects.
Definition:
Matrix.h:14
Mercator::Matrix::operator()
const FloatType & operator()(unsigned int col, unsigned int row) const
Accessor for the array.
Definition:
Matrix.h:28
Mercator::Matrix::operator()
FloatType & operator()(unsigned int col, unsigned int row)
Accessor for modifying the array.
Definition:
Matrix.h:23
Mercator::Matrix::Matrix
Matrix()=default
Constructor for the Matrix.
Mercator::Matrix::operator[]
FloatType & operator[](unsigned int idx)
Accessor for accessing the array as one dimensional.
Definition:
Matrix.h:33
src
Mercator
Matrix.h
Generated by
1.8.18