claw 1.9.0
 
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
34#include <claw/vector_2d.hpp>
35
36namespace claw
37{
38 namespace math
39 {
46 template <typename C>
48
54 template <typename T>
56 {
59
62
68 {
69 return c.x;
70 }
71
77 {
78 return c.y;
79 }
80
88 {
89 return coordinate_type(x, y);
90 }
91
92 }; // struct coordinate_traits [claw::math::coordinate_2d]
93
99 template <typename T>
101 {
104
107
113 {
114 return c.x;
115 }
116
122 {
123 return c.y;
124 }
125
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__
Coordinates in a two dimensional space.
T value_type
The type of the values we store.
value_type x
X-coordinate.
value_type y
Y-coordinate.
Two dimensional vector.
Definition vector_2d.hpp:45
T value_type
The type of the values we store.
Definition vector_2d.hpp:48
Coordinates in a two dimensional space.
Manipulation of mathematic, geometric, etc. items.
Definition box_2d.hpp:38
This is the main namespace.
claw::math::coordinate_2d< T > coordinate_type
The type of the 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.
static value_type get_y(const coordinate_type &c)
Get the component of a coordinate on the y-axis.
static value_type get_x(const coordinate_type &c)
Get the component of a coordinate on the x-axis.
coordinate_type::value_type value_type
The type of the components of the coordinate.
coordinate_type::value_type value_type
The type of the components of the 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.
static value_type get_x(const coordinate_type &c)
Get the component of a coordinate on the x-axis.
claw::math::vector_2d< T > coordinate_type
The type of the coordinate.
static value_type get_y(const coordinate_type &c)
Get the component of a coordinate on the y-axis.
The coordinate traits provide an access to the members of the structures representing a coordinate in...
Two dimensional vector.