Limbo
3.5.4
Toggle main menu visibility
Loading...
Searching...
No Matches
limbo
geometry
api
bLibApi.h
Go to the documentation of this file.
1
10
11
#ifndef _LIMBO_GEOMETRY_API_BLIBAPI_H
12
#define _LIMBO_GEOMETRY_API_BLIBAPI_H
13
14
#include <
limbo/geometry/Geometry.h
>
15
17
namespace
limbo
18
{
20
namespace
geometry
21
{
22
24
template
<>
25
struct
point_traits
<bLib::bPoint>
26
{
28
typedef
bLib::bPoint point_type;
29
typedef
int
coordinate_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
assert(0);
41
}
42
46
static
void
set
(point_type& point,
orientation_2d
const
& orient, coordinate_type
const
& value)
47
{
48
if
(orient == HORIZONTAL)
return
point.set(value, point.y());
49
else
if
(orient == VERTICAL)
return
point.set(point.x(), value);
50
else
assert(0);
51
}
52
56
static
point_type
construct
(coordinate_type
const
& x, coordinate_type
const
& y)
57
{
58
return
point_type(x, y);
59
}
60
};
61
63
template
<>
64
struct
rectangle_traits
<bLib::bBox>
65
{
67
typedef
bLib::bBox rectangle_type;
68
typedef
int
coordinate_type;
70
75
static
coordinate_type
get
(
const
rectangle_type& rect, direction_2d
const
& dir)
76
{
77
switch
(dir)
78
{
79
case
LEFT:
return
rect.x1();
80
case
BOTTOM:
return
rect.y1();
81
case
RIGHT:
return
rect.x2();
82
case
TOP:
return
rect.y2();
83
default
: assert(0);
84
}
85
}
86
90
static
void
set
(rectangle_type& rect, direction_2d
const
& dir, coordinate_type
const
& value)
91
{
92
switch
(dir)
93
{
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
;
98
default
: assert(0);
99
}
100
}
101
104
static
rectangle_type
construct
(coordinate_type
const
& xl, coordinate_type
const
& yl,
105
coordinate_type
const
& xh, coordinate_type
const
& yh)
106
{
107
return
rectangle_type(xl, yl, xh, yh);
108
}
109
};
110
111
}}
// namespace limbo // namespace geometry
112
113
#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
limbo::geometry
namespace for Limbo.Geometry
Definition
Geometry.h:21
limbo
namespace for Limbo
Definition
GraphUtility.h:23
limbo::geometry::point_traits< bLib::bPoint >::get
static coordinate_type get(const point_type &point, orientation_2d const &orient)
get coordinate from point
Definition
bLibApi.h:36
limbo::geometry::point_traits< bLib::bPoint >::construct
static point_type construct(coordinate_type const &x, coordinate_type const &y)
construct point from coordinates
Definition
bLibApi.h:56
limbo::geometry::point_traits< bLib::bPoint >::set
static void set(point_type &point, orientation_2d const &orient, coordinate_type const &value)
set coordinate for point
Definition
bLibApi.h:46
limbo::geometry::point_traits
type traits for point
Definition
Geometry.h:196
limbo::geometry::rectangle_traits< bLib::bBox >::set
static void set(rectangle_type &rect, direction_2d const &dir, coordinate_type const &value)
set coordinate for rectangle
Definition
bLibApi.h:90
limbo::geometry::rectangle_traits< bLib::bBox >::get
static coordinate_type get(const rectangle_type &rect, direction_2d const &dir)
get coordinate from rectangle
Definition
bLibApi.h:75
limbo::geometry::rectangle_traits< bLib::bBox >::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
bLibApi.h:104
limbo::geometry::rectangle_traits
type traits for rectangle
Definition
Geometry.h:227
Generated on
for Limbo by
1.17.0