mirror of https://github.com/CGAL/cgal
Added a test program.
This commit is contained in:
parent
0dfa9845b8
commit
c4cc798257
|
|
@ -1189,6 +1189,18 @@ Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/tight.pstex -text svneol=unset#appli
|
|||
Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/tight.pstex_t -text svneol=unset#application/postscript
|
||||
Minkowski_sum_2/examples/Minkowski_sum_2/rooms_star.dat -text
|
||||
Minkowski_sum_2/examples/Minkowski_sum_2/spiked.dat -text
|
||||
Minkowski_sum_2/test/Minkowski_sum_2/data/comb_part1.dat -text
|
||||
Minkowski_sum_2/test/Minkowski_sum_2/data/comb_part2.dat -text
|
||||
Minkowski_sum_2/test/Minkowski_sum_2/data/fork_part1.dat -text
|
||||
Minkowski_sum_2/test/Minkowski_sum_2/data/fork_part2.dat -text
|
||||
Minkowski_sum_2/test/Minkowski_sum_2/data/knife_part1.dat -text
|
||||
Minkowski_sum_2/test/Minkowski_sum_2/data/knife_part2.dat -text
|
||||
Minkowski_sum_2/test/Minkowski_sum_2/data/mchain_part1.dat -text
|
||||
Minkowski_sum_2/test/Minkowski_sum_2/data/mchain_part2.dat -text
|
||||
Minkowski_sum_2/test/Minkowski_sum_2/data/random_part1.dat -text
|
||||
Minkowski_sum_2/test/Minkowski_sum_2/data/random_part2.dat -text
|
||||
Minkowski_sum_2/test/Minkowski_sum_2/data/wheels_part1.dat -text
|
||||
Minkowski_sum_2/test/Minkowski_sum_2/data/wheels_part2.dat -text
|
||||
Modifier/doc_tex/Modifier/idraw/modifier.eps -text svneol=unset#application/postscript
|
||||
Modifier/doc_tex/Modifier/idraw/modifier.pdf -text svneol=unset#application/pdf
|
||||
Modifier/doc_tex/Modifier/modifier.gif -text svneol=unset#image/gif
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ public:
|
|||
* \return A past-the-end iterator for the sub-polygons.
|
||||
*/
|
||||
template <class OutputIterator>
|
||||
OutputIterator operation() (const Polygon_2& pgn,
|
||||
OutputIterator oi) const
|
||||
OutputIterator operator() (const Polygon_2& pgn,
|
||||
OutputIterator oi) const
|
||||
{
|
||||
std::list<Traits_polygon_2> pgns;
|
||||
typename std::list<Traits_polygon_2>::const_iterator pgn_it;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
53
|
||||
1250/1 100/1
|
||||
1250/1 50/1
|
||||
0/1 50/1
|
||||
0/1 100/1
|
||||
25/1 250/1
|
||||
50/1 100/1
|
||||
75/1 250/1
|
||||
100/1 100/1
|
||||
125/1 250/1
|
||||
150/1 100/1
|
||||
175/1 250/1
|
||||
200/1 100/1
|
||||
225/1 250/1
|
||||
250/1 100/1
|
||||
275/1 250/1
|
||||
300/1 100/1
|
||||
325/1 250/1
|
||||
350/1 100/1
|
||||
375/1 250/1
|
||||
400/1 100/1
|
||||
425/1 250/1
|
||||
450/1 100/1
|
||||
475/1 250/1
|
||||
500/1 100/1
|
||||
525/1 250/1
|
||||
550/1 100/1
|
||||
575/1 250/1
|
||||
600/1 100/1
|
||||
625/1 250/1
|
||||
650/1 100/1
|
||||
675/1 250/1
|
||||
700/1 100/1
|
||||
725/1 250/1
|
||||
750/1 100/1
|
||||
775/1 250/1
|
||||
800/1 100/1
|
||||
825/1 250/1
|
||||
850/1 100/1
|
||||
875/1 250/1
|
||||
900/1 100/1
|
||||
925/1 250/1
|
||||
950/1 100/1
|
||||
975/1 250/1
|
||||
1000/1 100/1
|
||||
1025/1 250/1
|
||||
1050/1 100/1
|
||||
1075/1 250/1
|
||||
1100/1 100/1
|
||||
1125/1 250/1
|
||||
1150/1 100/1
|
||||
1175/1 250/1
|
||||
1200/1 100/1
|
||||
1225/1 250/1
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
22
|
||||
20/1 0/1
|
||||
-20/1 0/1
|
||||
-19/1 7/1
|
||||
-17/1 9/1
|
||||
-15/1 11/1
|
||||
-13/1 13/1
|
||||
-11/1 15/1
|
||||
-9/1 17/1
|
||||
-7/1 19/1
|
||||
-5/1 21/1
|
||||
-3/1 23/1
|
||||
-1/1 25/1
|
||||
1/1 27/1
|
||||
3/1 29/1
|
||||
5/1 31/1
|
||||
7/1 33/1
|
||||
9/1 35/1
|
||||
11/1 37/1
|
||||
13/1 39/1
|
||||
15/1 41/1
|
||||
17/1 43/1
|
||||
19/1 45/1
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
34
|
||||
-500/1 -500/1
|
||||
-500/1 100/1
|
||||
0/1 102/1
|
||||
-500/1 104/1
|
||||
-500/1 200/1
|
||||
0/1 202/1
|
||||
-500/1 204/1
|
||||
-500/1 300/1
|
||||
0/1 302/1
|
||||
-500/1 304/1
|
||||
-500/1 400/1
|
||||
0/1 402/1
|
||||
-500/1 404/1
|
||||
-500/1 500/1
|
||||
0/1 502/1
|
||||
-500/1 504/1
|
||||
-510/1 500/1
|
||||
-510/1 -510/1
|
||||
500/1 -510/1
|
||||
504/1 -500/1
|
||||
502/1 0/1
|
||||
500/1 -500/1
|
||||
404/1 -500/1
|
||||
402/1 0/1
|
||||
400/1 -500/1
|
||||
304/1 -500/1
|
||||
302/1 0/1
|
||||
300/1 -500/1
|
||||
204/1 -500/1
|
||||
202/1 0/1
|
||||
200/1 -500/1
|
||||
104/1 -500/1
|
||||
102/1 0/1
|
||||
100/1 -500/1
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
31
|
||||
0/1 0/1
|
||||
0/1 100/1
|
||||
2/1 600/1
|
||||
4/1 100/1
|
||||
20/1 100/1
|
||||
22/1 600/1
|
||||
24/1 100/1
|
||||
40/1 100/1
|
||||
42/1 600/1
|
||||
44/1 100/1
|
||||
60/1 100/1
|
||||
62/1 600/1
|
||||
64/1 100/1
|
||||
80/1 100/1
|
||||
82/1 600/1
|
||||
84/1 100/1
|
||||
100/1 80/1
|
||||
600/1 78/1
|
||||
100/1 76/1
|
||||
100/1 60/1
|
||||
600/1 58/1
|
||||
100/1 56/1
|
||||
100/1 40/1
|
||||
600/1 38/1
|
||||
100/1 36/1
|
||||
100/1 20/1
|
||||
600/1 18/1
|
||||
100/1 16/1
|
||||
100/1 0/1
|
||||
600/1 -2/1
|
||||
100/1 -4/1
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
64
|
||||
100/1 -10/1
|
||||
100/1 500/1
|
||||
500/1 498/1
|
||||
110/1 495/1
|
||||
110/1 450/1
|
||||
500/1 448/1
|
||||
110/1 445/1
|
||||
110/1 400/1
|
||||
500/1 398/1
|
||||
110/1 395/1
|
||||
110/1 350/1
|
||||
500/1 348/1
|
||||
110/1 345/1
|
||||
110/1 300/1
|
||||
500/1 298/1
|
||||
110/1 295/1
|
||||
110/1 250/1
|
||||
500/1 248/1
|
||||
110/1 245/1
|
||||
110/1 200/1
|
||||
500/1 198/1
|
||||
110/1 195/1
|
||||
110/1 150/1
|
||||
500/1 148/1
|
||||
110/1 145/1
|
||||
110/1 100/1
|
||||
500/1 98/1
|
||||
110/1 95/1
|
||||
110/1 50/1
|
||||
500/1 48/1
|
||||
110/1 45/1
|
||||
110/1 0/1
|
||||
600/1 0/1
|
||||
602/1 500/1
|
||||
605/1 0/1
|
||||
610/1 0/1
|
||||
612/1 500/1
|
||||
615/1 0/1
|
||||
620/1 0/1
|
||||
622/1 500/1
|
||||
625/1 0/1
|
||||
630/1 0/1
|
||||
632/1 500/1
|
||||
635/1 0/1
|
||||
640/1 0/1
|
||||
642/1 500/1
|
||||
645/1 0/1
|
||||
650/1 0/1
|
||||
652/1 500/1
|
||||
655/1 0/1
|
||||
660/1 0/1
|
||||
662/1 500/1
|
||||
665/1 0/1
|
||||
670/1 0/1
|
||||
672/1 500/1
|
||||
675/1 0/1
|
||||
680/1 0/1
|
||||
682/1 500/1
|
||||
685/1 0/1
|
||||
690/1 0/1
|
||||
692/1 500/1
|
||||
695/1 0/1
|
||||
700/1 0/1
|
||||
700/1 -10/1
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
12
|
||||
0/1 0/1
|
||||
10/1 2/1
|
||||
0/1 5/1
|
||||
10/1 7/1
|
||||
0/1 10/1
|
||||
10/1 12/1
|
||||
0/1 15/1
|
||||
10/1 17/1
|
||||
0/1 20/1
|
||||
10/1 22/1
|
||||
0/1 25/1
|
||||
420/1 12/1
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
82
|
||||
1150840/1 3269680/1
|
||||
2009089/1 622385/1
|
||||
3563659/1 -1685869/1
|
||||
5694160/1 -3476329/1
|
||||
8235589/1 -4610310/1
|
||||
10991099/1 -5000000/1
|
||||
13747300/1 -4615210/1
|
||||
16290799/1 -3485749/1
|
||||
18424400/1 -1699079/1
|
||||
19983099/1 606407/1
|
||||
21100000/1 1000000/1
|
||||
22000000/1 -1000000/1
|
||||
23100000/1 1000000/1
|
||||
24000000/1 -1000000/1
|
||||
25100000/1 1000000/1
|
||||
26000000/1 -1000000/1
|
||||
27100000/1 1000000/1
|
||||
28000000/1 -1000000/1
|
||||
29100000/1 1000000/1
|
||||
30000000/1 -1000000/1
|
||||
31100000/1 1000000/1
|
||||
32000000/1 -1000000/1
|
||||
33100000/1 1000000/1
|
||||
34000000/1 -1000000/1
|
||||
35100000/1 1000000/1
|
||||
36000000/1 -1000000/1
|
||||
37100000/1 1000000/1
|
||||
38000000/1 -1000000/1
|
||||
39100000/1 1000000/1
|
||||
40000000/1 -1000000/1
|
||||
42014300/1 4388269/1
|
||||
43571599/1 6694679/1
|
||||
45704200/1 8482609/1
|
||||
48246999/1 9613579/1
|
||||
51003000/1 10000000/1
|
||||
53758699/1 9611950/1
|
||||
56300799/1 8479470/1
|
||||
58432399/1 6690280/1
|
||||
59988299/1 4382939/1
|
||||
60848100/1 1736160/1
|
||||
61150799/1 3269680/1
|
||||
62009099/1 622385/1
|
||||
63563699/1 -1685869/1
|
||||
65694200/1 -3476329/1
|
||||
68235600/1 -4610310/1
|
||||
70991099/1 -5000000/1
|
||||
73747299/1 -4615210/1
|
||||
76290799/1 -3485749/1
|
||||
78424399/1 -1699079/1
|
||||
79983100/1 606407/1
|
||||
81100000/1 1000000/1
|
||||
82000000/1 -1000000/1
|
||||
83100000/1 1000000/1
|
||||
84000000/1 -1000000/1
|
||||
85100000/1 1000000/1
|
||||
86000000/1 -1000000/1
|
||||
87100000/1 1000000/1
|
||||
88000000/1 -1000000/1
|
||||
89100000/1 1000000/1
|
||||
90000000/1 -1000000/1
|
||||
91100000/1 1000000/1
|
||||
92000000/1 -1000000/1
|
||||
93100000/1 1000000/1
|
||||
94000000/1 -1000000/1
|
||||
95100000/1 1000000/1
|
||||
96000000/1 -1000000/1
|
||||
97100000/1 1000000/1
|
||||
98000000/1 -1000000/1
|
||||
99100000/1 1000000/1
|
||||
100000000/1 -1000000/1
|
||||
102013999/1 4388269/1
|
||||
103572000/1 6694679/1
|
||||
105703999/1 8482609/1
|
||||
108247000/1 9613579/1
|
||||
111002999/1 10000000/1
|
||||
113758999/1 9611950/1
|
||||
116301000/1 8479470/1
|
||||
118432000/1 6690280/1
|
||||
119987999/1 4382939/1
|
||||
120847999/1 1736160/1
|
||||
121100000/1 -30000000/1
|
||||
0/1 -30000000/1
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
30
|
||||
3000000/1 5000000/1
|
||||
2934470/1 5623619/1
|
||||
2740729/1 6219990/1
|
||||
2427259/1 6763070/1
|
||||
1606200/1 6783289/1
|
||||
1500509/1 7597780/1
|
||||
927727/1 7852949/1
|
||||
314410/1 7983479/1
|
||||
-312641/1 7983659/1
|
||||
-740828/1 7282799/1
|
||||
-1498969/1 7598669/1
|
||||
-2006419/1 7230309/1
|
||||
-2426210/1 6764510/1
|
||||
-2740009/1 6221620/1
|
||||
-2347280/1 5500289/1
|
||||
-3000000/1 5001779/1
|
||||
-2934839/1 4378120/1
|
||||
-2741460/1 3781630/1
|
||||
-2428300/1 3238369/1
|
||||
-1607249/1 3217660/1
|
||||
-1502050/1 2403110/1
|
||||
-929418/1 2147599/1
|
||||
-316178/1 2016709/1
|
||||
310873/1 2016150/1
|
||||
739475/1 2716759/1
|
||||
1497429/1 2400440/1
|
||||
2005099/1 2768500/1
|
||||
2425169/1 3234060/1
|
||||
2739279/1 3776759/1
|
||||
2346980/1 4498319/1
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
40
|
||||
579/1 768/1
|
||||
307/1 750/1
|
||||
700/1 726/1
|
||||
420/1 604/1
|
||||
448/1 640/1
|
||||
218/1 753/1
|
||||
213/1 657/1
|
||||
366/1 615/1
|
||||
370/1 450/1
|
||||
516/1 410/1
|
||||
565/1 554/1
|
||||
730/1 547/1
|
||||
829/1 669/1
|
||||
879/1 542/1
|
||||
707/1 287/1
|
||||
754/1 502/1
|
||||
710/1 521/1
|
||||
536/1 362/1
|
||||
419/1 299/1
|
||||
376/1 326/1
|
||||
319/1 399/1
|
||||
259/1 536/1
|
||||
352/1 446/1
|
||||
348/1 504/1
|
||||
233/1 608/1
|
||||
350/1 113/1
|
||||
201/1 520/1
|
||||
313/1 108/1
|
||||
465/1 71/1
|
||||
740/1 2/1
|
||||
347/1 290/1
|
||||
504/1 227/1
|
||||
704/1 131/1
|
||||
962/1 42/1
|
||||
966/1 418/1
|
||||
976/1 481/1
|
||||
922/1 609/1
|
||||
940/1 435/1
|
||||
883/1 389/1
|
||||
950/1 790/1
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
20
|
||||
-67/1 -56/1
|
||||
-43/1 15/1
|
||||
6/1 -79/1
|
||||
82/1 47/1
|
||||
9/1 -40/1
|
||||
-9/1 -14/1
|
||||
24/1 78/1
|
||||
-45/1 45/1
|
||||
-71/1 -21/1
|
||||
-76/1 -1/1
|
||||
-72/1 58/1
|
||||
18/1 96/1
|
||||
84/1 56/1
|
||||
92/1 -54/1
|
||||
95/1 -89/1
|
||||
85/1 -5/1
|
||||
58/1 -44/1
|
||||
-2/1 -88/1
|
||||
-31/1 -74/1
|
||||
-78/1 -85/1
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
40
|
||||
90000000/1 0/1
|
||||
99384600/1 7820260/1
|
||||
97553700/1 15447999/1
|
||||
85641899/1 18156499/1
|
||||
90454300/1 29384500/1
|
||||
85360599/1 35350099/1
|
||||
73517200/1 32356499/1
|
||||
72708799/1 44545600/1
|
||||
65462099/1 47549200/1
|
||||
56267899/1 39505900/1
|
||||
50014800/1 50000000/1
|
||||
42194400/1 49387000/1
|
||||
37652800/1 38046699/1
|
||||
27317599/1 44559100/1
|
||||
20627500/1 40462999/1
|
||||
21728299/1 28296800/1
|
||||
9563089/1 29408400/1
|
||||
5461110/1 22721999/1
|
||||
11964300/1 12381000/1
|
||||
619995/1 7849530/1
|
||||
8/1 29632/1
|
||||
10488599/1 -6232789/1
|
||||
2437109/1 -15419800/1
|
||||
5434210/1 -22669200/1
|
||||
17622599/1 -23488399/1
|
||||
14618500/1 -35329099/1
|
||||
20579599/1 -40428199/1
|
||||
31811900/1 -35625700/1
|
||||
34509699/1 -47539999/1
|
||||
42135800/1 -49377699/1
|
||||
49964400/1 -40000000/1
|
||||
57776400/1 -49391599/1
|
||||
65405799/1 -47567500/1
|
||||
68124800/1 -35657999/1
|
||||
79348500/1 -40480399/1
|
||||
85318700/1 -35392000/1
|
||||
82335599/1 -23545900/1
|
||||
94525400/1 -22748400/1
|
||||
97535400/1 -15504400/1
|
||||
89500300/1 -6303029/1
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
40
|
||||
40000000/1 50000000/1
|
||||
49384600/1 57820299/1
|
||||
47553699/1 65448000/1
|
||||
35641899/1 68156500/1
|
||||
40454300/1 79384500/1
|
||||
35360599/1 85350099/1
|
||||
23517199/1 82356500/1
|
||||
22708799/1 94545600/1
|
||||
15462100/1 97549199/1
|
||||
6267909/1 89505899/1
|
||||
14816/1 100000000/1
|
||||
-7805629/1 99387000/1
|
||||
-12347199/1 88046699/1
|
||||
-22682400/1 94559100/1
|
||||
-29372500/1 90462999/1
|
||||
-28271699/1 78296799/1
|
||||
-40436900/1 79408399/1
|
||||
-44538900/1 72722000/1
|
||||
-38035700/1 62380999/1
|
||||
-49380000/1 57849500/1
|
||||
-50000000/1 50029599/1
|
||||
-39511399/1 43767200/1
|
||||
-47562900/1 34580200/1
|
||||
-44565800/1 27330799/1
|
||||
-32377400/1 26511599/1
|
||||
-35381499/1 14670900/1
|
||||
-29420400/1 9571810/1
|
||||
-18188100/1 14374299/1
|
||||
-15490299/1 2460010/1
|
||||
-7864159/1 622323/1
|
||||
-35559/1 10000000/1
|
||||
7776349/1 608419/1
|
||||
15405799/1 2432539/1
|
||||
18124799/1 14341999/1
|
||||
29348500/1 9519559/1
|
||||
35318700/1 14608000/1
|
||||
32335599/1 26454099/1
|
||||
44525400/1 27251600/1
|
||||
47535399/1 34495600/1
|
||||
39500299/1 43697000/1
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
#include <CGAL/basic.h>
|
||||
|
||||
#ifdef CGAL_USE_GMP
|
||||
// GMP is installed. Use the GMP rational number-type.
|
||||
#include <CGAL/Gmpq.h>
|
||||
typedef CGAL::Gmpq Rational;
|
||||
#else
|
||||
// GMP is not installed. Use CGAL's exact rational number-type.
|
||||
#include <CGAL/MP_Float.h>
|
||||
#include <CGAL/Quotient.h>
|
||||
typedef CGAL::Quotient<CGAL::MP_Float> Rational;
|
||||
#endif
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/minkowski_sum_2.h>
|
||||
#include <CGAL/Small_side_angle_bisector_decomposition_2.h>
|
||||
#include <CGAL/Polygon_convex_decomposition_2.h>
|
||||
#include <CGAL/Boolean_set_operations_2.h>
|
||||
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
typedef CGAL::Cartesian<Rational> Kernel;
|
||||
typedef Kernel::Point_2 Point_2;
|
||||
typedef Kernel::Segment_2 Segment_2;
|
||||
typedef CGAL::Polygon_2<Kernel> Polygon_2;
|
||||
typedef CGAL::Polygon_with_holes_2<Kernel> Polygon_with_holes_2;
|
||||
|
||||
/*!
|
||||
* Read a polygons from an input file.
|
||||
* \param filename The name of the input file.
|
||||
* \param pgn Output: The polygon.
|
||||
* \return Whether the polygon was successfuly read.
|
||||
*/
|
||||
bool read_polygon (const char *filename, Polygon_2& pgn)
|
||||
{
|
||||
// Open the input file.
|
||||
std::ifstream ifile (filename);
|
||||
|
||||
if (! ifile.is_open())
|
||||
{
|
||||
std::cerr << "Failed to open <" << filename << ">." << std::endl;
|
||||
return (false);
|
||||
}
|
||||
|
||||
// Read the polygon.
|
||||
int n_vertices;
|
||||
Rational x, y;
|
||||
std::list<Point_2> vertices;
|
||||
int k;
|
||||
|
||||
// Read the number of polygon vertices.
|
||||
ifile >> n_vertices;
|
||||
|
||||
// Read the vertices.
|
||||
for (k = 0; k < n_vertices; k++)
|
||||
{
|
||||
ifile >> x >> y;
|
||||
|
||||
vertices.push_back (Point_2 (x, y));
|
||||
}
|
||||
ifile.close();
|
||||
|
||||
pgn = Polygon_2 (vertices.begin(), vertices.end());
|
||||
|
||||
// Make sure the polygon is simple.
|
||||
if (! pgn.is_simple())
|
||||
{
|
||||
std::cerr << "Error - the polygon is not simple." << std::endl;
|
||||
return (false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
/*! Check if two polygons with holes are the same. */
|
||||
bool are_equal (const Polygon_with_holes_2& ph1,
|
||||
const Polygon_with_holes_2& ph2)
|
||||
{
|
||||
std::list<Polygon_with_holes_2> sym_diff;
|
||||
|
||||
CGAL::symmetric_difference (ph1, ph2,
|
||||
std::back_inserter(sym_diff));
|
||||
|
||||
return (sym_diff.empty());
|
||||
}
|
||||
|
||||
/*! The main program. */
|
||||
int main (int argc, char **argv )
|
||||
{
|
||||
// Read the input file.
|
||||
if (argc < 3)
|
||||
{
|
||||
std::cerr << "Usage: " << argv[0]
|
||||
<< " <polygon#1> <polygon#2> ."
|
||||
<< std::endl;
|
||||
return (1);
|
||||
}
|
||||
|
||||
// Read the polygons from the input files.
|
||||
Polygon_2 pgn1, pgn2;
|
||||
|
||||
if (! read_polygon (argv[1], pgn1))
|
||||
{
|
||||
std::cerr << "Failed to read: <" << argv[1] << ">." << std::endl;
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (! read_polygon (argv[2], pgn2))
|
||||
{
|
||||
std::cerr << "Failed to read: <" << argv[2] << ">." << std::endl;
|
||||
return (1);
|
||||
}
|
||||
|
||||
// Compute the Minkowski sum using the convolution method.
|
||||
Polygon_with_holes_2 sum_conv;
|
||||
|
||||
std::cout << "Using the convolution method ... ";
|
||||
sum_conv = minkowski_sum_2 (pgn1, pgn2);
|
||||
std::cout << "Done." << std::endl;
|
||||
|
||||
// Define auxiliary polygon-decomposition objects.
|
||||
CGAL::Small_side_angle_bisector_decomposition_2<Kernel> ssab_decomp;
|
||||
CGAL::Optimal_convex_decomposition_2<Kernel> opt_decomp;
|
||||
CGAL::Hertel_Mehlhorn_convex_decomposition_2<Kernel> hm_approx_decomp;
|
||||
CGAL::Greene_convex_decomposition_2<Kernel> greene_decomp;
|
||||
Polygon_with_holes_2 sum_decomp;
|
||||
|
||||
std::cout << "Using the small-side angle-bisector decomposition ... ";
|
||||
sum_decomp = minkowski_sum_2 (pgn1, pgn2, ssab_decomp);
|
||||
if (are_equal (sum_conv, sum_decomp))
|
||||
{
|
||||
std::cout << "OK." << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "ERROR (different result)." << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "Using the optimal convex decomposition ... ";
|
||||
sum_decomp = minkowski_sum_2 (pgn1, pgn2, opt_decomp);
|
||||
if (are_equal (sum_conv, sum_decomp))
|
||||
{
|
||||
std::cout << "OK." << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "ERROR (different result)." << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "Using the Hertel--Mehlhorn decomposition ... ";
|
||||
sum_decomp = minkowski_sum_2 (pgn1, pgn2, hm_approx_decomp);
|
||||
if (are_equal (sum_conv, sum_decomp))
|
||||
{
|
||||
std::cout << "OK." << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "ERROR (different result)." << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "Using the Greene decomposition ... ";
|
||||
sum_decomp = minkowski_sum_2 (pgn1, pgn2, greene_decomp);
|
||||
if (are_equal (sum_conv, sum_decomp))
|
||||
{
|
||||
std::cout << "OK." << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "ERROR (different result)." << std::endl;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
Loading…
Reference in New Issue