Claw  1.7.3
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 >
48 
54  template<typename T>
56  {
59 
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 
88  {
89  return coordinate_type(x, y);
90  } // make_coordinate()
91 
92  }; // struct coordinate_traits [claw::math::coordinate_2d]
93 
99  template<typename T>
101  {
104 
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 
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__
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_2d::y
value_type y
Y-coordinate.
Definition: coordinate_2d.hpp:85
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::vector_2d::value_type
T value_type
The type of the values we store.
Definition: vector_2d.hpp:49
claw
This is the main namespace.
Definition: algorithm.hpp:33
vector_2d.hpp
Two dimensional vector.
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::vector_2d
Two dimensional vector.
Definition: vector_2d.hpp:44
claw::math::coordinate_2d
Coordinates in a two dimensional space.
Definition: coordinate_2d.hpp:42
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
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
coordinate_2d.hpp
Coordinates in a two dimensional space.
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::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< 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::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_2d::x
value_type x
X-coordinate.
Definition: coordinate_2d.hpp:82
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::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_2d::value_type
T value_type
The type of the values we store.
Definition: coordinate_2d.hpp:46