diff --git a/.gitattributes b/.gitattributes index 8934bf9f7fa..52516f3c531 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2577,6 +2577,14 @@ Min_sphere_of_spheres_d/test_extensive/stability/maple/balls-on-boundary-3.mws - Min_sphere_of_spheres_d/web/figs/heuristic/excess.xfig -text svneol=unset#application/octet-stream Min_sphere_of_spheres_d/web/figs/mbex/mbex.xfig -text svneol=unset#application/octet-stream Min_sphere_of_spheres_d/web/figs/pivot/cex.xfig -text svneol=unset#application/octet-stream +Minkowski_sum_2/benchmark/data/chain.dat -text +Minkowski_sum_2/benchmark/data/comb.dat -text +Minkowski_sum_2/benchmark/data/fork.dat -text +Minkowski_sum_2/benchmark/data/knife.dat -text +Minkowski_sum_2/benchmark/data/random.dat -text +Minkowski_sum_2/benchmark/data/random2.dat -text +Minkowski_sum_2/benchmark/data/star.dat -text +Minkowski_sum_2/benchmark/sum_by_decomposition.cpp -text Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/Minkowski_sum_2.png -text Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/approx_offset.fig -text svneol=unset#application/octet-stream Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/approx_offset.gif -text svneol=unset#image/gif diff --git a/Minkowski_sum_2/benchmark/data/chain.dat b/Minkowski_sum_2/benchmark/data/chain.dat new file mode 100644 index 00000000000..bbd30b4b01f --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/chain.dat @@ -0,0 +1,114 @@ +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 +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 diff --git a/Minkowski_sum_2/benchmark/data/comb.dat b/Minkowski_sum_2/benchmark/data/comb.dat new file mode 100644 index 00000000000..fd7a9cde92d --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/comb.dat @@ -0,0 +1,77 @@ +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 +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 diff --git a/Minkowski_sum_2/benchmark/data/fork.dat b/Minkowski_sum_2/benchmark/data/fork.dat new file mode 100644 index 00000000000..243ed16b268 --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/fork.dat @@ -0,0 +1,67 @@ +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 +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 diff --git a/Minkowski_sum_2/benchmark/data/knife.dat b/Minkowski_sum_2/benchmark/data/knife.dat new file mode 100644 index 00000000000..36fb830be37 --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/knife.dat @@ -0,0 +1,78 @@ +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 +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 diff --git a/Minkowski_sum_2/benchmark/data/random.dat b/Minkowski_sum_2/benchmark/data/random.dat new file mode 100644 index 00000000000..4b5ddd0cc2e --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/random.dat @@ -0,0 +1,62 @@ +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 +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 diff --git a/Minkowski_sum_2/benchmark/data/random2.dat b/Minkowski_sum_2/benchmark/data/random2.dat new file mode 100644 index 00000000000..0c4de884e82 --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/random2.dat @@ -0,0 +1,148 @@ +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 +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 diff --git a/Minkowski_sum_2/benchmark/data/star.dat b/Minkowski_sum_2/benchmark/data/star.dat new file mode 100644 index 00000000000..8ef429efb99 --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/star.dat @@ -0,0 +1,82 @@ +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 +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 diff --git a/Minkowski_sum_2/benchmark/sum_by_decomposition.cpp b/Minkowski_sum_2/benchmark/sum_by_decomposition.cpp new file mode 100644 index 00000000000..feda0bb46ac --- /dev/null +++ b/Minkowski_sum_2/benchmark/sum_by_decomposition.cpp @@ -0,0 +1,70 @@ +//! \file examples/Minkowski_sum_2/sum_by_decomposition.cpp +// Computing the Minkowski sum of two non-convex polygons read from a file +// using the small-side angle-bisector decomposition strategy. + +#include +#include +#include +#include +#include + +#include + +#if !defined(CGAL_MINKOWSKI_SUM_2_SERIAL) && defined(_OPENMP) +#include +#endif + +#include "print_utils.h" + +struct Kernel : public CGAL::Exact_predicates_exact_constructions_kernel {}; + +typedef Kernel::Point_2 Point_2; +typedef CGAL::Polygon_2 Polygon_2; +typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; + +int main () +{ + // Open the input file. + std::ifstream in_file ("random2.dat"); + + if (! in_file.is_open()) + { + std::cerr << "Failed to open the input file." << std::endl; + return (1); + } + + // Read the two polygons from the file and compute their Minkowski sum. + Polygon_2 P, Q; + + in_file >> P >> Q; + in_file.close(); + + // Compute the Minkowski sum using the decomposition approach. + CGAL::Small_side_angle_bisector_decomposition_2 ssab_decomp; + + time_t s,e; + s = time(NULL); + + #if !defined(CGAL_MINKOWSKI_SUM_2_SERIAL) && defined(_OPENMP) + double start,end; + start = omp_get_wtime(); + #endif + + Polygon_with_holes_2 sum = minkowski_sum_2 (P, Q, ssab_decomp); + + #if !defined(CGAL_MINKOWSKI_SUM_2_SERIAL) && defined(_OPENMP) + end = omp_get_wtime(); + #endif + + e = time(NULL); + + #if !defined(CGAL_MINKOWSKI_SUM_2_SERIAL) && defined(_OPENMP) + std::cout << "Done! time using omp_get_wtime() (" << end-start << " seconds)." << std::endl; + #endif + + std::cout << "Done! time using time() (" << difftime(e,s) << " seconds)." << std::endl; + + std::cout << "P (+) Q = "; print_polygon_with_holes (sum); + + return (0); +}