coordinate_traits.hpp
Go to the documentation of this file.
/*
CLAW - a C++ Library Absolutely Wonderful
CLAW is a free library without any particular aim but being useful to
anyone.
Copyright (C) 2005-2011 Julien Jorge
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
contact: julien.jorge@gamned.org
*/
#ifndef __CLAW_MATH_COORDINATE_TRAITS_HPP__
#define __CLAW_MATH_COORDINATE_TRAITS_HPP__
#include <claw/coordinate_2d.hpp>
#include <claw/vector_2d.hpp>
namespace claw
{
namespace math
{
template< typename C >
struct coordinate_traits;
template<typename T>
struct coordinate_traits< claw::math::coordinate_2d<T> >
{
typedef claw::math::coordinate_2d<T> coordinate_type;
typedef typename coordinate_type::value_type value_type;
static value_type get_x( const coordinate_type& c )
{
return c.x;
} // get_x()
static value_type get_y( const coordinate_type& c )
{
return c.y;
} // get_y()
static coordinate_type make_coordinate( value_type x, value_type y )
{
return coordinate_type(x, y);
} // make_coordinate()
}; // struct coordinate_traits [claw::math::coordinate_2d]
template<typename T>
struct coordinate_traits< claw::math::vector_2d<T> >
{
typedef claw::math::vector_2d<T> coordinate_type;
typedef typename coordinate_type::value_type value_type;
static value_type get_x( const coordinate_type& c )
{
return c.x;
} // get_x()
static value_type get_y( const coordinate_type& c )
{
return c.y;
} // get_y()
static coordinate_type make_coordinate( value_type x, value_type y )
{
return coordinate_type(x, y);
} // make_coordinate()
}; // struct coordinate_traits [claw::math::vector_2d]
} // namespace math
} // namespace claw
#endif // __CLAW_MATH_COORDINATE_TRAITS_HPP__
claw::math::coordinate_2d::value_type
T value_type
The type of the values we store.
Definition: coordinate_2d.hpp:46
coordinate_2d.hpp
Coordinates in a two dimensional space.
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::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 > >::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_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::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::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< 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 > >::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
The coordinate traits provide an access to the members of the structures representing a coordinate in...
Definition: coordinate_traits.hpp:47
claw::math::vector_2d::value_type
T value_type
The type of the values we store.
Definition: vector_2d.hpp:49
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_2d::y
value_type y
Y-coordinate.
Definition: coordinate_2d.hpp:85
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
This is the main namespace.
Definition: algorithm.hpp:33
vector_2d.hpp
Two dimensional vector.
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