10 #ifndef _LIMBO_GEOMETRY_API_BOOSTPOLYGONAPI_H
11 #define _LIMBO_GEOMETRY_API_BOOSTPOLYGONAPI_H
27 typedef T coordinate_type;
28 typedef boost::polygon::point_data<T> point_type;
35 static coordinate_type
get(
const point_type& point,
orientation_2d const& orient)
37 if (orient == HORIZONTAL)
return point.x();
38 else if (orient == VERTICAL)
return point.y();
45 static void set(point_type& point,
orientation_2d const& orient, coordinate_type
const& value)
47 if (orient == HORIZONTAL)
return point.set(boost::polygon::HORIZONTAL, value);
48 else if (orient == VERTICAL)
return point.set(boost::polygon::VERTICAL, value);
55 static point_type
construct(coordinate_type
const& x, coordinate_type
const& y)
57 return point_type(x, y);
66 typedef T coordinate_type;
67 typedef boost::polygon::rectangle_data<T> rectangle_type;
74 static coordinate_type
get(
const rectangle_type& rect,
direction_2d const& dir)
78 case LEFT:
return boost::polygon::xl(rect);
79 case BOTTOM:
return boost::polygon::yl(rect);
80 case RIGHT:
return boost::polygon::xh(rect);
81 case TOP:
return boost::polygon::yh(rect);
89 static void set(rectangle_type& rect,
direction_2d const& dir, coordinate_type
const& value)
93 case LEFT: boost::polygon::xl(rect, value);
break;
94 case BOTTOM: boost::polygon::yl(rect, value);
break;
95 case RIGHT: boost::polygon::xh(rect, value);
break;
96 case TOP: boost::polygon::yh(rect, value);
break;
103 static rectangle_type
construct(coordinate_type
const& xl, coordinate_type
const& yl,
104 coordinate_type
const& xh, coordinate_type
const& yh)
106 return rectangle_type(xl, yl, xh, yh);
direction_2d
direction type for rectangles
Contains utilities for geometric types, such as type traits, area calculator. I'm trying to make thes...
static rectangle_type construct(coordinate_type const &xl, coordinate_type const &yl, coordinate_type const &xh, coordinate_type const &yh)
construct rectangle from coordinates
type traits for rectangle
static void set(point_type &point, orientation_2d const &orient, coordinate_type const &value)
set coordinate for point
static point_type construct(coordinate_type const &x, coordinate_type const &y)
construct point from coordinates
static void set(rectangle_type &rect, direction_2d const &dir, coordinate_type const &value)
set coordinate for rectangle
a class denoting orientation of lines