Limbo
3.5.4
Toggle main menu visibility
Loading...
Searching...
No Matches
limbo
geometry
api
BoostPolygonApi.h
Go to the documentation of this file.
1
9
10
#ifndef _LIMBO_GEOMETRY_API_BOOSTPOLYGONAPI_H
11
#define _LIMBO_GEOMETRY_API_BOOSTPOLYGONAPI_H
12
13
#include <limits>
14
#include <
limbo/geometry/Geometry.h
>
15
17
namespace
limbo
18
{
20
namespace
geometry
21
{
22
24
template
<
typename
T>
25
struct
point_traits
<
boost
::polygon::point_data<T> >
26
{
28
typedef
T coordinate_type;
29
typedef
boost::polygon::point_data<T> point_type;
31
36
static
coordinate_type
get
(
const
point_type& point,
orientation_2d
const
& orient)
37
{
38
if
(orient == HORIZONTAL)
return
point.x();
39
else
if
(orient == VERTICAL)
return
point.y();
40
else
41
{
42
assert(0);
43
return
std::numeric_limits<coordinate_type>::max();
44
}
45
}
46
50
static
void
set
(point_type& point,
orientation_2d
const
& orient, coordinate_type
const
& value)
51
{
52
if
(orient == HORIZONTAL)
return
point.set(boost::polygon::HORIZONTAL, value);
53
else
if
(orient == VERTICAL)
return
point.set(boost::polygon::VERTICAL, value);
54
else
55
{
56
assert(0);
57
}
58
}
59
63
static
point_type
construct
(coordinate_type
const
& x, coordinate_type
const
& y)
64
{
65
return
point_type(x, y);
66
}
67
};
68
70
template
<
typename
T>
71
struct
rectangle_traits
<
boost
::polygon::rectangle_data<T> >
72
{
74
typedef
T coordinate_type;
75
typedef
boost::polygon::rectangle_data<T> rectangle_type;
77
82
static
coordinate_type
get
(
const
rectangle_type& rect, direction_2d
const
& dir)
83
{
84
switch
(dir)
85
{
86
case
LEFT:
return
boost::polygon::xl(rect);
87
case
BOTTOM:
return
boost::polygon::yl(rect);
88
case
RIGHT:
return
boost::polygon::xh(rect);
89
case
TOP:
return
boost::polygon::yh(rect);
90
default
: assert(0);
return
std::numeric_limits<coordinate_type>::max();
91
}
92
}
93
97
static
void
set
(rectangle_type& rect, direction_2d
const
& dir, coordinate_type
const
& value)
98
{
99
switch
(dir)
100
{
101
case
LEFT: boost::polygon::xl(rect, value);
break
;
102
case
BOTTOM: boost::polygon::yl(rect, value);
break
;
103
case
RIGHT: boost::polygon::xh(rect, value);
break
;
104
case
TOP: boost::polygon::yh(rect, value);
break
;
105
default
: assert(0);
106
}
107
}
108
111
static
rectangle_type
construct
(coordinate_type
const
& xl, coordinate_type
const
& yl,
112
coordinate_type
const
& xh, coordinate_type
const
& yh)
113
{
114
return
rectangle_type(xl, yl, xh, yh);
115
}
116
};
117
118
}
// namespace geometry
119
}
// namespace limbo
120
121
#endif
Geometry.h
Contains utilities for geometric types, such as type traits, area calculator. I'm trying to make thes...
limbo::geometry::orientation_2d
a class denoting orientation of lines
Definition
Geometry.h:93
boost
Boost.Geometry.
Definition
GdsObjects.h:740
limbo::geometry
namespace for Limbo.Geometry
Definition
Geometry.h:21
limbo
namespace for Limbo
Definition
GraphUtility.h:23
limbo::geometry::point_traits< boost::polygon::point_data< T > >::set
static void set(point_type &point, orientation_2d const &orient, coordinate_type const &value)
set coordinate for point
Definition
BoostPolygonApi.h:50
limbo::geometry::point_traits< boost::polygon::point_data< T > >::get
static coordinate_type get(const point_type &point, orientation_2d const &orient)
get coordinate from point
Definition
BoostPolygonApi.h:36
limbo::geometry::point_traits< boost::polygon::point_data< T > >::construct
static point_type construct(coordinate_type const &x, coordinate_type const &y)
construct point from coordinates
Definition
BoostPolygonApi.h:63
limbo::geometry::point_traits
type traits for point
Definition
Geometry.h:196
limbo::geometry::rectangle_traits< boost::polygon::rectangle_data< T > >::construct
static rectangle_type construct(coordinate_type const &xl, coordinate_type const &yl, coordinate_type const &xh, coordinate_type const &yh)
construct rectangle from coordinates
Definition
BoostPolygonApi.h:111
limbo::geometry::rectangle_traits< boost::polygon::rectangle_data< T > >::get
static coordinate_type get(const rectangle_type &rect, direction_2d const &dir)
get coordinate from rectangle
Definition
BoostPolygonApi.h:82
limbo::geometry::rectangle_traits< boost::polygon::rectangle_data< T > >::set
static void set(rectangle_type &rect, direction_2d const &dir, coordinate_type const &value)
set coordinate for rectangle
Definition
BoostPolygonApi.h:97
limbo::geometry::rectangle_traits
type traits for rectangle
Definition
Geometry.h:227
Generated on
for Limbo by
1.17.0