wfmath
1.0.3
A math library for the Worldforge system.
wrapped_array.h
1
2
3
// Copright (C) 1999
4
// $Revision$
5
// $Date$
6
//
7
// This program is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
11
//
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
16
//
17
// You should have received a copy of the GNU General Public License
18
// along with this program; if not, write to the Free Software
19
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA,
20
// or download the License terms from prep.ai.mit.edu/pub/gnu/COPYING-2.0.
21
//
22
// Contact:
23
// --------
24
// Bernd Gaertner
25
// Institut f. Informatik
26
// ETH Zuerich
27
// ETH-Zentrum
28
// CH-8092 Zuerich, Switzerland
29
// http://www.inf.ethz.ch/personal/gaertner
30
//
31
32
#ifndef WFMATH_WRAPPED_ARRAY_H
33
#define WFMATH_WRAPPED_ARRAY_H
34
35
namespace
WFMath
{
namespace
_miniball {
36
37
template
<
int
d>
38
class
Wrapped_array
{
39
private
:
40
double
coord [d];
41
42
public
:
43
// default
44
Wrapped_array
()
45
{}
46
47
// copy from Wrapped_array
48
Wrapped_array
(
const
Wrapped_array
& p)
49
{
50
for
(
int
i=0; i<d; ++i)
51
coord[i] = p.coord[i];
52
}
53
54
// copy from double*
55
Wrapped_array
(
const
double
* p)
56
{
57
for
(
int
i=0; i<d; ++i)
58
coord[i] = p[i];
59
}
60
61
// assignment
62
Wrapped_array
& operator = (
const
Wrapped_array
& p)
63
{
64
for
(
int
i=0; i<d; ++i)
65
coord[i] = p.coord[i];
66
return
*
this
;
67
}
68
69
// coordinate access
70
double
& operator [] (
int
i)
71
{
72
return
coord[i];
73
}
74
const
double
& operator [] (
int
i)
const
75
{
76
return
coord[i];
77
}
78
const
double
* begin()
const
79
{
80
return
coord;
81
}
82
const
double
* end()
const
83
{
84
return
coord+d;
85
}
86
};
87
88
}}
// namespace WFMath::_miniball
89
90
#endif // WFMATH_WRAPPED_ARRAY_H
WFMath::_miniball::Wrapped_array
Definition:
wrapped_array.h:38
WFMath
Generic library namespace.
Definition:
shape.h:41
src
wfmath
wrapped_array.h
Generated by
1.8.16