11 #ifndef _LIMBO_GEOMETRY_API_BLIBAPI_H
12 #define _LIMBO_GEOMETRY_API_BLIBAPI_H
28 typedef bLib::bPoint point_type;
29 typedef int coordinate_type;
36 static coordinate_type
get(
const point_type& point,
orientation_2d const& orient)
38 if (orient == HORIZONTAL)
return point.x();
39 else if (orient == VERTICAL)
return point.y();
46 static void set(point_type& point,
orientation_2d const& orient, coordinate_type
const& value)
48 if (orient == HORIZONTAL)
return point.set(value, point.y());
49 else if (orient == VERTICAL)
return point.set(point.x(), value);
56 static point_type
construct(coordinate_type
const& x, coordinate_type
const& y)
58 return point_type(x, y);
67 typedef bLib::bBox rectangle_type;
68 typedef int coordinate_type;
75 static coordinate_type
get(
const rectangle_type& rect,
direction_2d const& dir)
79 case LEFT:
return rect.x1();
80 case BOTTOM:
return rect.y1();
81 case RIGHT:
return rect.x2();
82 case TOP:
return rect.y2();
90 static void set(rectangle_type& rect,
direction_2d const& dir, coordinate_type
const& value)
94 case LEFT: rect.set(value, rect.y1(), rect.x2(), rect.y2());
break;
95 case BOTTOM: rect.set(rect.x1(), value, rect.x2(), rect.y2());
break;
96 case RIGHT: rect.set(rect.x1(), rect.y1(), value, rect.y2());
break;
97 case TOP: rect.set(rect.x1(), rect.y1(), rect.x2(), value);
break;
104 static rectangle_type
construct(coordinate_type
const& xl, coordinate_type
const& yl,
105 coordinate_type
const& xh, coordinate_type
const& yh)
107 return rectangle_type(xl, yl, xh, yh);
static rectangle_type construct(coordinate_type const &xl, coordinate_type const &yl, coordinate_type const &xh, coordinate_type const &yh)
construct rectangle from coordinates
direction_2d
direction type for rectangles
Contains utilities for geometric types, such as type traits, area calculator. I'm trying to make thes...
static void set(point_type &point, orientation_2d const &orient, coordinate_type const &value)
set coordinate for point
static void set(rectangle_type &rect, direction_2d const &dir, coordinate_type const &value)
set coordinate for rectangle
type traits for rectangle
static point_type construct(coordinate_type const &x, coordinate_type const &y)
construct point from coordinates
a class denoting orientation of lines