Claw
1.7.3
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
coordinate_traits.hpp
Go to the documentation of this file.
1
/*
2
CLAW - a C++ Library Absolutely Wonderful
3
4
CLAW is a free library without any particular aim but being useful to
5
anyone.
6
7
Copyright (C) 2005-2011 Julien Jorge
8
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of the GNU Lesser General Public
11
License as published by the Free Software Foundation; either
12
version 2.1 of the License, or (at your option) any later version.
13
14
This library is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
Lesser General Public License for more details.
18
19
You should have received a copy of the GNU Lesser General Public
20
License along with this library; if not, write to the Free Software
21
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
contact: julien.jorge@gamned.org
23
*/
30
#ifndef __CLAW_MATH_COORDINATE_TRAITS_HPP__
31
#define __CLAW_MATH_COORDINATE_TRAITS_HPP__
32
33
#include <
claw/coordinate_2d.hpp
>
34
#include <
claw/vector_2d.hpp
>
35
36
namespace
claw
37
{
38
namespace
math
39
{
46
template
<
typename
C >
47
struct
coordinate_traits;
48
54
template
<
typename
T>
55
struct
coordinate_traits< claw::
math::coordinate_2d
<T> >
56
{
58
typedef
claw::math::coordinate_2d<T>
coordinate_type
;
59
61
typedef
typename
coordinate_type::value_type
value_type
;
62
67
static
value_type
get_x(
const
coordinate_type
& c )
68
{
69
return
c.
x
;
70
}
// get_x()
71
76
static
value_type
get_y(
const
coordinate_type
& c )
77
{
78
return
c.
y
;
79
}
// get_y()
80
87
static
coordinate_type
make_coordinate(
value_type
x,
value_type
y )
88
{
89
return
coordinate_type
(x, y);
90
}
// make_coordinate()
91
92
};
// struct coordinate_traits [claw::math::coordinate_2d]
93
99
template
<
typename
T>
100
struct
coordinate_traits< claw::
math::vector_2d
<T> >
101
{
103
typedef
claw::math::vector_2d<T>
coordinate_type
;
104
106
typedef
typename
coordinate_type::value_type
value_type
;
107
112
static
value_type
get_x(
const
coordinate_type
& c )
113
{
114
return
c.
x
;
115
}
// get_x()
116
121
static
value_type
get_y(
const
coordinate_type
& c )
122
{
123
return
c.
y
;
124
}
// get_y()
125
132
static
coordinate_type
make_coordinate(
value_type
x,
value_type
y )
133
{
134
return
coordinate_type
(x, y);
135
}
// make_coordinate()
136
137
};
// struct coordinate_traits [claw::math::vector_2d]
138
139
}
// namespace math
140
}
// namespace claw
141
142
#endif // __CLAW_MATH_COORDINATE_TRAITS_HPP__
Generated on Thu Mar 14 2013 22:09:24 for Claw by
1.8.1.2