34 value_type
const&
x()
const {
return m_x;}
39 value_type
const&
y()
const {
return m_y;}
43 void x(value_type v) {m_x = v;}
47 void y(value_type v) {m_y = v;}
52 namespace limbo {
namespace geometry {
75 if (orient == HORIZONTAL)
return point.x();
76 else if (orient == VERTICAL)
return point.y();
87 if (orient == HORIZONTAL)
return point.
x(value);
88 else if (orient == VERTICAL)
return point.
y(value);
97 static point_type
construct(coordinate_type x, coordinate_type y)
128 value_type
const&
xl()
const {
return m_xl;}
133 value_type
const&
yl()
const {
return m_yl;}
138 value_type
const&
xh()
const {
return m_xh;}
143 value_type
const&
yh()
const {
return m_yh;}
148 void xl(value_type v) {m_xl = v;}
153 void yl(value_type v) {m_yl = v;}
158 void xh(value_type v) {m_xh = v;}
163 void yh(value_type v) {m_yh = v;}
166 namespace limbo {
namespace geometry {
185 static coordinate_type
get(
const rectangle_type& rect,
direction_2d dir)
189 case LEFT:
return rect.xl();
190 case BOTTOM:
return rect.yl();
191 case RIGHT:
return rect.xh();
192 case TOP:
return rect.yh();
206 case LEFT: rect.
xl(value);
break;
207 case BOTTOM: rect.
yl(value);
break;
208 case RIGHT: rect.
xh(value);
break;
209 case TOP: rect.
yh(value);
break;
218 static rectangle_type
construct(coordinate_type xl, coordinate_type yl, coordinate_type xh, coordinate_type yh)
221 rect.
xl(xl); rect.
yl(yl);
222 rect.
xh(xh); rect.
yh(yh);
235 vector<Rectangle> vRect;
237 assert(p2r.
read(filename));
239 p2r.
print(
"p2r1.gp");
248 vector<Rectangle> vRect;
250 assert(p2r.
read(filename));
252 p2r.
print(
"p2r2.gp");
261 vector<Rectangle> vRect;
263 assert(p2r.
read(filename));
265 p2r.
print(
"p2r3.gp");
274 int main(
int argc,
char** argv)
282 else cout <<
"at least 1 argument is required" << endl;
static void set(point_type &point, orientation_2d orient, coordinate_type value)
set coordinates
Rectangle rectangle_type
rectangle type
int value_type
coordinate type
Point point_type
point type
int coordinate_type
coordinate type
direction_2d
direction type for rectangles
value_type m_x
x coordinate
void test1(string const &filename)
test polygon-to-rectangle for std::vector
value_type m_y
y coordinate
bool read(string const &filename)
read polygon from file try to be compatible to gnuplot format
a class implement conversion from manhattan polygon to rectangle
value_type const & xl() const
access left coordinate
static point_type construct(coordinate_type x, coordinate_type y)
construct a point object
value_type const & x() const
access x coordinate
void x(value_type v)
set x coordinate
void yl(value_type v)
set bottom coordinate
type traits for rectangle
value_type const & yl() const
access bottom coordinate
void test2(string const &filename)
test polygon-to-rectangle for std::list
value_type const & yh() const
access top coordinate
void test3(string const &filename)
test polygon-to-rectangle for std::set
void print(string const &filename) const
print polygon to file in gnuplot format
static void set(rectangle_type &rect, direction_2d dir, coordinate_type value)
set coordinates
void xl(value_type v)
set left coordinate
int main(int argc, char **argv)
main function requires an input benchmark in gnuplot format
value_type const & xh() const
access right coordinate
void y(value_type v)
set y coordinate
a generic implementation of polygon-to-rectangle conversion
namespace for Limbo.Geometry
horizontal/vertical slicing and choose rectangle with larger area every time
int coordinate_type
coordinate type
int value_type
coordinate type
static rectangle_type construct(coordinate_type xl, coordinate_type yl, coordinate_type xh, coordinate_type yh)
construct rectangle
value_type const & y() const
access y coordinate
a class denoting orientation of lines
void xh(value_type v)
set right coordinate
void yh(value_type v)
set top coordinate