Limbo
3.5.4
Toggle main menu visibility
Loading...
Searching...
No Matches
test
geometry
test_blibapi.cpp
Go to the documentation of this file.
1
6
7
#include <iostream>
8
#include <string>
9
#include <vector>
10
#include <list>
11
#include <set>
12
#include "bLibPoint.h"
13
#include "bLibShape.h"
14
#include <
limbo/geometry/Polygon2Rectangle.h
>
15
#include <
limbo/geometry/api/bLibApi.h
>
16
using
std::cout;
17
using
std::endl;
18
using
std::string;
19
using
std::vector;
20
using
std::list;
21
using
std::set;
22
23
namespace
lg
=
limbo::geometry
;
24
30
34
void
test1
(
string
const
& filename)
35
{
36
std::vector<bLib::bBox> vRect;
37
lg::Polygon2Rectangle<vector<bLib::bPoint>
, vector<bLib::bBox> > p2r (vRect,
lg::HOR_VER_SLICING
);
38
assert(p2r.
read
(filename));
39
assert(p2r());
40
p2r.
print
(
"p2r1.gp"
);
41
}
42
46
void
test2
(
string
const
& filename)
47
{
48
std::vector<bLib::bBox> vRect;
49
lg::Polygon2Rectangle<list<bLib::bPoint>
, vector<bLib::bBox> > p2r (vRect,
lg::HOR_VER_SLICING
);
50
assert(p2r.
read
(filename));
51
assert(p2r());
52
p2r.
print
(
"p2r2.gp"
);
53
}
54
58
void
test3
(
string
const
& filename)
59
{
60
std::vector<bLib::bBox> vRect;
61
lg::Polygon2Rectangle<set<bLib::bPoint, lg::point_compare_type>
, vector<bLib::bBox> > p2r (vRect,
lg::HOR_VER_SLICING
);
62
assert(p2r.
read
(filename));
63
assert(p2r());
64
p2r.
print
(
"p2r3.gp"
);
65
}
66
73
int
main
(
int
argc,
char
** argv)
74
{
75
if
(argc > 1)
76
{
77
test1
(argv[1]);
78
test2
(argv[1]);
79
test3
(argv[1]);
80
}
81
else
cout <<
"at least 1 argument is required"
<< endl;
82
83
return
0;
84
}
Polygon2Rectangle.h
a generic implementation of polygon-to-rectangle conversion
bLibApi.h
Geometry traits for bLib, include this file when bLib is used if your point class setting is differen...
limbo::geometry::Polygon2Rectangle
a class implement conversion from manhattan polygon to rectangle
Definition
Polygon2Rectangle.h:91
limbo::geometry::Polygon2Rectangle::read
bool read(string const &filename)
read polygon from file try to be compatible to gnuplot format
Definition
Polygon2Rectangle.h:380
limbo::geometry::Polygon2Rectangle::print
void print(string const &filename) const
print polygon to file in gnuplot format
Definition
Polygon2Rectangle.h:441
limbo::geometry
namespace for Limbo.Geometry
Definition
Geometry.h:21
limbo::geometry::HOR_VER_SLICING
@ HOR_VER_SLICING
horizontal/vertical slicing and choose rectangle with larger area every time
Definition
Geometry.h:43
main
int main()
Definition
test_ChromaticNumber.cpp:78
test2
void test2(string const &filename)
test std::list
Definition
test_blibapi.cpp:46
test3
void test3(string const &filename)
test std::set
Definition
test_blibapi.cpp:58
test1
void test1()
test function API
Definition
test_solvers.cpp:11
Generated on
for Limbo by
1.17.0