12 #include <boost/polygon/polygon.hpp>
36 void test1(
string const& filename)
38 std::vector<gtl::rectangle_data<int> > vRect;
40 assert(p2r.
read(filename));
49 void test2(
string const& filename)
51 std::vector<gtl::rectangle_data<int> > vRect;
53 assert(p2r.
read(filename));
62 void test3(
string const& filename)
64 std::vector<gtl::rectangle_data<int> > vRect;
66 assert(p2r.
read(filename));
76 vector<gtl::point_data<int> > vPoint (8);
77 vPoint[0] = gtl::construct<gtl::point_data<int> >(0, 0);
78 vPoint[1] = gtl::construct<gtl::point_data<int> >(0, 10);
79 vPoint[2] = gtl::construct<gtl::point_data<int> >(10, 10);
80 vPoint[3] = gtl::construct<gtl::point_data<int> >(10, 20);
81 vPoint[4] = gtl::construct<gtl::point_data<int> >(20, 20);
82 vPoint[5] = gtl::construct<gtl::point_data<int> >(20, 10);
83 vPoint[6] = gtl::construct<gtl::point_data<int> >(30, 10);
84 vPoint[7] = gtl::construct<gtl::point_data<int> >(30, 0);
86 vector<gtl::rectangle_data<int> > vRectangle;
88 for (std::size_t i = 0; i != vRectangle.size(); ++i)
90 gtl::rectangle_data<int>
const& rect = vRectangle[i];
91 cout <<
"(" << gtl::xl(rect) <<
", " << gtl::yl(rect) <<
", " << gtl::xh(rect) <<
", " << gtl::yh(rect) <<
")\n";
93 cout <<
"test 4 passed\n";
102 int main(
int argc,
char** argv)
111 else cout <<
"at least 1 argument is required" << endl;
void test2(string const &filename)
test polygon-to-rectangle for std::list
sort helper if orient == HORIZONTAL, sort by left lower if orient == VERTICAL, sort by lower left ...
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
void test4()
test polygon-to-rectangle for array of points
int main(int argc, char **argv)
main function requires an input benchmark in gnuplot format
void test3(string const &filename)
test polygon-to-rectangle for std::set
void test1(string const &filename)
test Boost.Polygon API
void print(string const &filename) const
print polygon to file in gnuplot format
Geometry traits for Boost.Polygon, include this file when you use Boost.Polygon geometric types...
a generic implementation of polygon-to-rectangle conversion
this file extracts polygon-to-rectangle conversion for Boost.Polygon API.
namespace for Limbo.Geometry
bool polygon2RectangleBoost(std::vector< gtl::point_data< int > > const &vPoint, std::vector< gtl::rectangle_data< int > > &vRectangle)
this function takes a set of points describing a rectilinear polygon and decomposes it into rectangle...
horizontal/vertical slicing and choose rectangle with larger area every time