claw
1.9.0
Toggle main menu visibility
Loading...
Searching...
No Matches
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@stuff-o-matic.com
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
}
71
76
static
value_type
get_y
(
const
coordinate_type
& c)
77
{
78
return
c.
y
;
79
}
80
87
static
coordinate_type
make_coordinate
(
value_type
x,
value_type
y)
88
{
89
return
coordinate_type
(x, y);
90
}
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
}
116
121
static
value_type
get_y
(
const
coordinate_type
& c)
122
{
123
return
c.
y
;
124
}
125
132
static
coordinate_type
make_coordinate
(
value_type
x,
value_type
y)
133
{
134
return
coordinate_type
(x, y);
135
}
136
137
};
// struct coordinate_traits [claw::math::vector_2d]
138
139
}
140
}
141
142
#endif
// __CLAW_MATH_COORDINATE_TRAITS_HPP__
claw::math::coordinate_2d
Coordinates in a two dimensional space.
Definition
coordinate_2d.hpp:43
claw::math::coordinate_2d::value_type
T value_type
The type of the values we store.
Definition
coordinate_2d.hpp:46
claw::math::coordinate_2d::x
value_type x
X-coordinate.
Definition
coordinate_2d.hpp:82
claw::math::coordinate_2d::y
value_type y
Y-coordinate.
Definition
coordinate_2d.hpp:85
claw::math::vector_2d
Two dimensional vector.
Definition
vector_2d.hpp:45
claw::math::vector_2d::value_type
T value_type
The type of the values we store.
Definition
vector_2d.hpp:48
coordinate_2d.hpp
Coordinates in a two dimensional space.
claw::math
Manipulation of mathematic, geometric, etc. items.
Definition
box_2d.hpp:38
claw
This is the main namespace.
Definition
application.hpp:50
claw::math::coordinate_traits< claw::math::coordinate_2d< T > >::coordinate_type
claw::math::coordinate_2d< T > coordinate_type
The type of the coordinate.
Definition
coordinate_traits.hpp:58
claw::math::coordinate_traits< claw::math::coordinate_2d< T > >::make_coordinate
static coordinate_type make_coordinate(value_type x, value_type y)
Create a new coordinate from with the components sets to the provided values.
Definition
coordinate_traits.hpp:87
claw::math::coordinate_traits< claw::math::coordinate_2d< T > >::get_y
static value_type get_y(const coordinate_type &c)
Get the component of a coordinate on the y-axis.
Definition
coordinate_traits.hpp:76
claw::math::coordinate_traits< claw::math::coordinate_2d< T > >::get_x
static value_type get_x(const coordinate_type &c)
Get the component of a coordinate on the x-axis.
Definition
coordinate_traits.hpp:67
claw::math::coordinate_traits< claw::math::coordinate_2d< T > >::value_type
coordinate_type::value_type value_type
The type of the components of the coordinate.
Definition
coordinate_traits.hpp:61
claw::math::coordinate_traits< claw::math::vector_2d< T > >::value_type
coordinate_type::value_type value_type
The type of the components of the coordinate.
Definition
coordinate_traits.hpp:106
claw::math::coordinate_traits< claw::math::vector_2d< T > >::make_coordinate
static coordinate_type make_coordinate(value_type x, value_type y)
Create a new coordinate from with the components sets to the provided values.
Definition
coordinate_traits.hpp:132
claw::math::coordinate_traits< claw::math::vector_2d< T > >::get_x
static value_type get_x(const coordinate_type &c)
Get the component of a coordinate on the x-axis.
Definition
coordinate_traits.hpp:112
claw::math::coordinate_traits< claw::math::vector_2d< T > >::coordinate_type
claw::math::vector_2d< T > coordinate_type
The type of the coordinate.
Definition
coordinate_traits.hpp:103
claw::math::coordinate_traits< claw::math::vector_2d< T > >::get_y
static value_type get_y(const coordinate_type &c)
Get the component of a coordinate on the y-axis.
Definition
coordinate_traits.hpp:121
claw::math::coordinate_traits
The coordinate traits provide an access to the members of the structures representing a coordinate in...
Definition
coordinate_traits.hpp:47
vector_2d.hpp
Two dimensional vector.
lib
core
include
claw
coordinate_traits.hpp
Generated by
1.17.0