Re: [Boost-bugs] [Boost C++ Libraries] #13522: Invalid empty result using boost::geometry::difference

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #13522: Invalid empty result using boost::geometry::difference
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-05-16 06:07:54


#13522: Invalid empty result using boost::geometry::difference
-------------------------------+---------------------------------
  Reporter: lehnert@… | Owner: Barend Gehrels
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: geometry
   Version: Boost 1.66.0 | Severity: Problem
Resolution: | Keywords: geometry difference
-------------------------------+---------------------------------

Comment (by henrik@…):

 I have probably encountered the same problem, it might have to do with a
 problem in the boost::geometry::intersection function. In my testcase the
 result of the intersection between green and blue is (erroneously) equal
 to green.

 Available on wandbox.org under permlink/ThHHAW13DOdHbgEx

 // This file is a "Hello, world!" in C++ language by GCC for wandbox.
 #include <iostream>
 #include <cstdlib>
 #include <boost/tuple/tuple.hpp>
 #include <boost/geometry.hpp>
 #include <boost/geometry/geometries/polygon.hpp>
 #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
 #include <boost/foreach.hpp>

 #include <boost/geometry.hpp>
 #include <boost/geometry/algorithms/assign.hpp>
 #include <boost/geometry/algorithms/union.hpp>
 #include <boost/geometry/geometries/point_xy.hpp>
 #include <boost/geometry/geometries/polygon.hpp>
 #include <boost/geometry/geometries/multi_polygon.hpp>
 #include <boost/geometry/algorithms/buffer.hpp>
 #include <boost/geometry/geometries/box.hpp>
 #include <boost/foreach.hpp>

 using BoostPointT =
 boost::geometry::model::d2::point_xy<double>;
 using BoostCCWPolygonT = boost::geometry::model::polygon<
 BoostPointT, false>;
 using BoostMultiPolygonT = boost::geometry::model::multi_polygon<
 BoostCCWPolygonT>;
 using BoostBoxT = boost::geometry::model::box<BoostPointT>;
 using BoostLineStringT =
 boost::geometry::model::linestring<BoostPointT>;
 using BoostClosedRingT = boost::geometry::model::ring<BoostPointT,
 false, true>;
 using BoostSegmentT =
 boost::geometry::model::segment<BoostPointT>;
 using BoostReferringSegmentT =
 boost::geometry::model::referring_segment<BoostPointT>;

 void test_boost_difference() {
     BoostMultiPolygonT green, blue;
     boost::geometry::read_wkt("MULTIPOLYGON(((109.9985073
 0.001497676134,109.9995457 0.0612420731,110.000004 0.08749948829,110
 0.8867007527,110 1.886700753,110 2.886700753,110 3.886700753,110
 4.886700753,110 5.886700753,110 6.886700753,110 7.886700753,110
 8.886700753,110 9.886700753,110 10.88670075,110 11.88670075,110
 12.88670075,110 13.88670075,110 14.88670075,110 15.88670075,110
 16.88670075,110 17.88670075,110 18.88670075,110 19.88670075,110
 20.88670075,110 21.88670075,110 22.88670075,110 23.88670075,110
 24.88670075,110 25.88670075,110 26.88670075,110 27.88670075,110
 28.88670075,110 29.88670075,110 30.88670075,110 31.88670075,110
 32.88670075,110 33.88670075,110 34.88670075,110 35.88670075,110
 36.88670075,110 37.88670075,110 38.88670075,110 39.88670075,110
 40.88670075,110 41.88670075,110 42.88670075,110 43.88670075,110
 44.88670075,110 45.88670075,110 46.88670075,110 47.88670075,110
 48.88670075,110 49.88670075,110 50.88670075,110 51.88670075,110
 52.88670075,110 53.88670075,110 54.88670075,110 55.88670075,110
 56.88670075,110 57.88670075,110 58.88670075,110 59.88670075,110
 60.88670075,110 61.88670075,110 62.88670075,110 63.88670075,110
 64.88670075,110 65.88670075,110 66.88670075,110 67.88670075,110
 68.88670075,110 69.88670075,110 70.88670075,110 71.88670075,110
 72.88670075,110 73.88670075,110 74.88670075,110 75.88670075,110
 76.88670075,110 77.88670075,110 78.88670075,110 79.88670075,110
 80.88670075,110 81.88670075,110 82.88670075,110 83.88670075,110
 84.88670075,110 85.88670075,110 86.88670075,110 87.88670075,110
 88.88670075,110 89.88670075,110 90.88670075,110 91.88670075,110
 92.88670075,110 93.88670075,110 94.88670075,110 95.88670075,110
 96.88670075,110 97.88670075,110 98.88670075,110 99.88670075,110
 100.8867008,110 101.8867008,110 102.8867008,110 103.8867008,110
 104.8867008,110 105.8867008,110 106.8867008,110 107.8867008,110
 108.8867008,110 109.8867008,110 110.8867008,110 111.8867008,110
 112.8867008,110 113.8867008,110 114.5954041,110 114.8867008,110
 115.5954041,110 115.8867008,110 116.5954041,110 116.8867008,110
 117.5954041,110 117.8867008,110 118.5954041,110 118.8867008,110
 119.5954041,109.9999967 119.9129178,109.9984991 119.9985007,109.9372206
 119.9995725,109.9130371 119.9999947,109.1117617 120,108.820465
 120,108.1117617 120,107.820465 120,107.1117617 120,106.820465
 120,106.1117617 120,105.820465 120,105.1117617 120,104.820465
 120,104.1117617 120,103.820465 120,102.820465 120,101.820465
 120,100.820465 120,99.82046504 120,98.82046504 120,97.82046504
 120,96.82046504 120,95.82046504 120,94.82046504 120,93.82046504
 120,92.82046504 120,91.82046504 120,90.82046504 120,89.82046504
 120,88.82046504 120,87.82046504 120,86.82046504 120,85.82046504
 120,84.82046504 120,83.82046504 120,82.82046504 120,81.82046504
 120,80.82046504 120,79.82046504 120,78.82046504 120,77.82046504
 120,76.82046504 120,75.82046504 120,74.82046504 120,73.82046504
 120,72.82046504 120,71.82046504 120,70.82046504 120,69.82046504
 120,68.82046504 120,67.82046504 120,66.82046504 120,65.82046504
 120,64.82046504 120,63.82046504 120,62.82046504 120,61.82046504
 120,60.82046504 120,59.82046504 120,58.82046504 120,57.82046504
 120,56.82046504 120,55.82046504 120,54.82046504 120,53.82046504
 120,52.82046504 120,51.82046504 120,50.82046504 120,49.82046504
 120,48.82046504 120,47.82046504 120,46.82046504 120,45.82046504
 120,44.82046504 120,43.82046504 120,42.82046504 120,41.82046504
 120,40.82046504 120,39.82046504 120,38.82046504 120,37.82046504
 120,36.82046504 120,35.82046504 120,34.82046504 120,33.82046504
 120,32.82046504 120,31.82046504 120,30.82046504 120,29.82046504
 120,28.82046504 120,27.82046504 120,26.82046504 120,25.82046504
 120,24.82046504 120,23.82046504 120,22.82046504 120,21.82046504
 120,20.82046504 120,19.82046504 120,18.82046504 120,17.82046504
 120,16.82046504 120,15.82046504 120,14.82046504 120,13.82046504
 120,12.82046504 120,11.82046504 120,10.82046504 120,9.820465041
 120,8.820465041 120,7.820465041 120,6.820465041 120,5.820465041
 120,5.392080345 120,4.820465041 120,4.392080345 120,3.820465041
 120,3.392080345 120,2.820465041 120,2.392080345 120,1.820465041
 120,1.392080345 120,0.8204650409 120,0.3920803446 120,0.08685786452
 119.9999928,0.001504965242 119.9984995,0.0002090355037
 119.924707,0.0001763579247 119.9228349,4.457256991e-06 119.9127306,0
 119.5276308,0 119.0992461,0 118.5276308,1.776356839e-15 118.0992461,0
 117.5276308,0 117.0992461,0 116.5276308,0 116.0992461,0 115.5276308,0
 115.0992461,0 114.5276308,0 114.0992461,0 113.5276308,-1.776356839e-15
 112.5276308,1.776356839e-15 111.5276308,0 110.5276308,-1.776356839e-15
 109.5276308,0 108.5276308,1.776356839e-15 107.5276308,0
 106.5276308,-1.776356839e-15 105.5276308,0 104.5276308,0 103.5276308,0
 102.5276308,0 101.5276308,0 100.5276308,0 99.52763083,0 98.52763083,0
 97.52763083,0 96.52763083,0 95.52763083,0 94.52763083,0 93.52763083,0
 92.52763083,0 91.52763083,0 90.52763083,0 89.52763083,0 88.52763083,0
 87.52763083,0 86.52763083,0 85.52763083,0 84.52763083,0 83.52763083,0
 82.52763083,0 81.52763083,0 80.52763083,0 79.52763083,0 78.52763083,0
 77.52763083,0 76.52763083,0 75.52763083,0 74.52763083,0 73.52763083,0
 72.52763083,0 71.52763083,0 70.52763083,0 69.52763083,0 68.52763083,0
 67.52763083,0 66.52763083,0 65.52763083,0 64.52763083,0 63.52763083,0
 62.52763083,0 61.52763083,0 60.52763083,0 59.52763083,0 58.52763083,0
 57.52763083,0 56.52763083,0 55.52763083,0 54.52763083,0 53.52763083,0
 52.52763083,0 51.52763083,0 50.52763083,0 49.52763083,0 48.52763083,0
 47.52763083,0 46.52763083,0 45.52763083,0 44.52763083,0 43.52763083,0
 42.52763083,0 41.52763083,0 40.52763083,0 39.52763083,0 38.52763083,0
 37.52763083,0 36.52763083,0 35.52763083,0 34.52763083,0 33.52763083,0
 32.52763083,0 31.52763083,0 30.52763083,0 29.52763083,0 28.52763083,0
 27.52763083,0 26.52763083,0 25.52763083,0 24.52763083,0 23.52763083,0
 22.52763083,0 21.52763083,0 20.52763083,0 19.52763083,0 18.52763083,0
 17.52763083,0 16.52763083,0 15.52763083,0 14.52763083,0 13.52763083,0
 12.52763083,0 11.52763083,0 10.52763083,0 9.527630834,0 8.527630834,0
 7.527630834,0 6.527630834,0 5.527630834,0 5.404203613,0 4.527630834,0
 4.404203613,0 3.527630834,0 3.404203613,0 2.527630834,0 2.404203613,0
 1.527630834,0 1.404203613,0 0.5276308344,0 0.4042036128,-1.15983827e-07
 0.08727532262,0.0003899881774 0.06492358486,0.001497273744
 0.001498135305,0.0631716201 0.0004206157086,0.0873786732
 -1.91997499e-06,0.765203372 1.776356839e-15,0.8886305936 0,1.765203372
 0,1.888630594 8.67361738e-19,2.765203372 0,2.888630594 0,3.765203372
 0,3.888630594 8.67361738e-19,4.765203372 0,4.888630594 0,5.765203372
 0,5.888630594 0,6.765203372 0,7.765203372 0,8.765203372 0,9.765203372
 0,10.76520337 0,11.76520337 0,12.76520337 0,13.76520337 0,14.76520337
 0,15.76520337 0,16.76520337 0,17.76520337 0,18.76520337 0,19.76520337
 0,20.76520337 0,21.76520337 0,22.76520337 0,23.76520337 0,24.76520337
 0,25.76520337 0,26.76520337 0,27.76520337 0,28.76520337 0,29.76520337
 0,29.91272302 0,29.99963042 0.001516926166,30.04657968
 0.02544289189,30.16401313 0.0827216774,30.28045153
 0.1407905759,30.32050195 0.1590475463,30.36030206 0.1784555204,30.47979629
 0.2316618183,30.59805702 0.2855709281,30.63880797 0.3024554023,30.6791734
 0.3204261845,30.79963124 0.3690898352,30.92052179 0.4191788123,30.96204927
 0.4347101383,31.00280519 0.451181915,31.12581738 0.4959595975,31.24745297
 0.5414514479,32.19006035 0.8753546188,32.23628347 0.8908166285,32.28276053
 0.9076808739,32.40230405 0.946392289,32.52105963 0.9861430355,32.56818065
 1.000106154,32.61483151 1.015214409,33.57142486 1.306640465,33.5830268
 1.309956905,33.59439998 1.313609702,33.75108694 1.357965553,33.90704642
 1.402519383,33.91857621 1.405381976,33.93025077 1.408682555,34.89704833
 1.664226021,35.05186672 1.702269654,35.21183269 1.741992298,36.18640689
 1.966057327,36.31588428 1.993455574,36.4465021 2.022223428,37.4266929
 2.220278937,37.54202241 2.24149429,37.65756418 2.264111409,38.64213823
 2.43907979,38.74442851 2.455421593,38.84679485 2.473262894,39.83478721
 2.627765613,39.92448659 2.640193213,40.01382616 2.654106469,41.00445261
 2.790705294,41.07995822 2.799777074,41.15540881 2.810351198,42.14799985
 2.931854403,42.21523398 2.93889592,42.28254023 2.947399526,43.27668579
 3.055448692,43.3367521 3.060918189,43.3965302 3.06774407,44.39190529
 3.163808795,44.44518838 3.168014059,44.49859701 3.17352918,45.49494413
 3.258924733,45.54232728 3.262153971,45.58986786 3.266605378,46.58698305
 3.342508559,46.62925666 3.344985364,46.67140315 3.348575637,47.66912505
 3.416036808,47.70658859 3.417913769,47.74418517 3.420828519,48.74238624
 3.480783677,48.77544906 3.482190947,48.80911498 3.484567864,49.80769447
 3.537850149,49.83613717 3.538870377,49.86486918 3.540736784,50.86373733
 3.588301598,50.88914432 3.589067329,50.91409978 3.590572573,51.91319503
 3.633101142,51.93579544 3.633668262,51.95824771 3.634917159,52.95752457
 3.672940459,52.97749465 3.673351485,52.99782824 3.674392663,53.99725031
 3.708385597,54.01493707 3.708678272,54.03330137 3.709546698,55.03283956
 3.739934525,55.0490305 3.740144035,55.06508734 3.740862855,56.06471835
 3.768025905,56.07934556 3.768167985,56.09355688 3.76876791,57.0932621
 3.793047107,57.10639542 3.793136786,57.11905011 3.793640125,58.11881463
 3.81534052,58.13027164 3.815389199,58.14187368 3.815814425,59.14168559
 3.835208915,59.15231386 3.83522956,59.16230049 3.835587546,60.16215026
 3.852920546,60.17145755 3.852919435,60.1805827 3.853223089,61.18046272
 3.868712846,61.18859739 3.868696878,61.19694156 3.868954547,62.19684576
 3.88279642,62.20388623 3.882770997,62.21157635 3.882989486,63.21149985
 3.8953583,63.2182169 3.895324149,63.22466865 3.895512522,64.22460757
 3.906564457,64.23051065 3.90652667,64.23637604 3.906687603,65.23632728
 3.916562691,65.24167567 3.916522159,65.24684884 3.916661061,66.24680992
 3.925483993,66.25181833 3.925440768,66.25621288 3.925562536,67.25618181
 3.933445172,67.26022312 3.933406493,67.26458538 3.933507885,68.26456058
 3.940550164,68.26818874 3.94051239,68.27207264 3.940600245,69.27205285
 3.946891318,69.27537951 3.946854184,69.27876478 3.946931292,70.27874899
 3.952551172,70.28188669 3.95251404,70.2847482 3.952583087,71.2847356
 3.957603046,71.28736587 3.957570342,71.29009501 3.957628515,71.98653479
 3.960751394,72.09587083 3.959328879,72.20589904 3.959328879,72.27072424
 3.957065461,72.33555356 3.956224626,72.44530022 3.950966394,72.55473453
 3.947147275,72.6193267 3.94263055,72.68420174 3.939520035,72.79342613
 3.930456332,72.9029324 3.922798908,72.96757847 3.916004332,73.03205455
 3.910657974,73.14084724 3.89779305,73.25006841 3.886313444,73.31424523
 3.877293979,73.37868819 3.869673607,73.48722857 3.852982756,73.59571962
 3.837735333,73.65950436 3.826488362,73.72368033 3.816616868,73.83158146
 3.796146528,73.93946492 3.777123762,74.00284835 3.763651198,74.06661066
 3.751552397,74.17386665 3.727296454,74.28088551 3.704552575,74.34341305
 3.688953532,74.40706137 3.674559465,74.51393929 3.646445744,74.61956542
 3.62011019,74.68147168 3.602358856,74.74461767 3.585731877,74.85007092
 3.554007935,74.95509202 3.523899487,75.01670759 3.503879374,75.0788683
 3.485177856,75.1829176 3.449874469,75.28705652 3.416037683,75.34778194
 3.393935437,75.40940603 3.37301991,75.51237542 3.33402831,75.61505447
 3.296656192,75.67502714 3.272425659,75.73582815 3.249394688,75.8369358
 3.207011082,75.93868626 3.165900462,75.99800663 3.139489331,76.05773697
 3.114452807,76.15747979 3.068487306,76.25755759 3.023929797,76.31571049
 2.995563142,76.37474028 2.968358674,76.47295212 2.918874863,76.57127997
 2.870917169,76.62841795 2.840536363,76.68645187 2.811290281,76.7825962
 2.758558336,76.87947117 2.707048998,76.93566844 2.67460349,76.99249197
 2.643438992,77.08677465 2.587362281,77.18175572 2.532524934,77.23680974
 2.498123361,77.29248771 2.465009308,77.38452318 2.40582176,77.47776532
 2.347557607,77.53161974 2.31123234,77.58607359 2.276218618,77.67621382
 2.213702237,77.76713933 2.15237237,77.81956391 2.114282366,77.87289193
 2.077296935,77.96103449 2.011499295,78.0495252 1.947207028,78.10039655
 1.907461978,78.15259329 1.868486614,78.23849361 1.79956873,78.32457888
 1.732311542,78.3740406 1.690808234,78.42483688 1.650042059,78.50826353
 1.578174601,78.59196526 1.507947729,78.64005001 1.464652028,78.68929102
 1.422229409,78.76975576 1.347864443,78.85135857 1.274388943,78.89818456
 1.229169613,78.94563351 1.18532622,79.02344622 1.108205835,79.10244278
 1.031919739,79.14738859 0.9853724338,79.19355205 0.9396211227,79.26895976
 0.8594797492,79.34491199 0.7808355277,79.38819616 0.7327635805,79.43274458
 0.6854134697,79.50511551 0.6029114913,79.57847077 0.521442217,79.62017704
 0.4717386193,79.66291968 0.4230129743,79.7323008 0.3381147312,79.80283459
 0.2540558376,79.84280662 0.2028965825,79.88379691 0.1527393311,79.95001481
 0.06568019037,79.98416448 0.02196734815,80.00073415
 0.001506569541,80.08722867 -1.258761169e-06,80.77766443 0,81.77766443
 0,82.77766443 0,83.77766443 0,84.77766443 -1.776356839e-15,85.77766443
 0,86.77766443 0,87.77766443 0,88.77766443 0,89.77766443 0,90.77766443
 0,91.77766443 0,92.77766443 0,93.77766443 0,94.77766443 0,95.77766443
 0,96.77766443 0,97.77766443 0,98.77766443 0,99.77766443 0,100.7776644
 0,101.7776644 0,102.7776644 0,103.7776644 0,104.5938665 0,104.7776644
 0,105.5938665 0,105.7776644 0,106.5938665 8.67361738e-19,106.7776644
 0,107.5938665 0,107.7776644 0,108.5938665 8.67361738e-19,108.7776644
 0,109.5938665 0,109.7776644 0,109.9127247 -1.15983827e-07,109.9985073
 0.001497676134)))", green);
     boost::geometry::read_wkt("MULTIPOLYGON(((109.9954313
 -0.1744709027,109.9954313 -0.5235190314,110.0076129
 -0.8723545295,110.0319613 -1.220552395,110.0684468
 -1.567688401,110.1170249 -1.913339617,110.1776364 -2.257084921,110.2502076
 -2.59850551,110.33465 -2.937185418,110.4308607 -3.272712014,110.5387225
 -3.604676512,110.658104 -3.932674462,110.7888597 -4.256306252,110.9308304
 -4.575177584,111.083843 -4.888899964,111.2477112 -5.197091169,111.4222353
 -5.499375716,111.6072026 -5.795385317,111.8023878 -6.084759331,112.0075532
 -6.367145199,112.2224487 -6.642198878,112.4468125 -6.909585257,112.6803713
 -7.168978568,112.9228405 -7.420062779,113.1739247 -7.662531983,113.433318
 -7.896090769,113.7007044 -8.120454582,113.975758 -8.335350067,114.2581439
 -8.54051541,114.5475179 -8.735700646,114.8435275 -8.920667974,115.1458121
 -9.095192038,115.4540033 -9.259060209,115.7677257 -9.412072837,116.086597
 -9.554043502,116.4102288 -9.684799232,116.7382267 -9.804180723,117.0701912
 -9.912042527,117.4057178 -10.00825323,117.7443977 -10.09269561,118.0858183
 -10.1652668,118.4295636 -10.22587837,118.7752148 -10.27445648,119.1223508
 -10.31094195,119.4705487 -10.33529031,119.8193842 -10.34747192,120.1684323
 -10.34747192,120.5172678 -10.33529031,120.8654657 -10.31094195,121.2126017
 -10.27445648,121.5582529 -10.22587837,121.9019982 -10.1652668,122.2434188
 -10.09269561,122.5820987 -10.00825323,122.9176253 -9.912042527,123.2495898
 -9.804180723,123.5775878 -9.684799232,123.9012196 -9.554043502,124.2200909
 -9.412072837,124.5338133 -9.259060209,124.8420045 -9.095192038,125.144289
 -8.920667974,125.4402986 -8.735700646,125.7296726 -8.54051541,126.0120585
 -8.335350067,126.2871122 -8.120454582,126.5544986 -7.896090769,126.8138919
 -7.662531983,127.0649761 -7.420062779,127.3074453 -7.168978568,127.5410041
 -6.909585257,127.7653679 -6.642198878,127.9802634 -6.367145199,128.1854287
 -6.084759331,128.3806139 -5.795385317,128.5655813 -5.499375716,128.7401053
 -5.197091169,128.9039735 -4.888899964,129.0569861 -4.575177584,129.1989568
 -4.256306252,129.3297125 -3.932674462,129.449094 -3.604676512,129.5569558
 -3.272712014,129.6531665 -2.937185418,129.7376089 -2.59850551,129.8101801
 -2.257084921,129.8707917 -1.913339617,129.9193698 -1.567688401,129.9558553
 -1.220552395,129.9802036 -0.8723545295,129.9923852
 -0.5235190314,129.998477 -0.1745240644,129.998477 -0.1745240644,129.998477
 0.1745240644,129.9862953 0.5233595624,129.961947 0.8715574275,129.9254615
 1.218693434,129.8768834 1.56434465,129.8162718 1.908089954,129.7437006
 2.249510543,129.6592583 2.588190451,129.5630476 2.923717047,129.4551858
 3.255681545,129.3358043 3.583679495,129.2050485 3.907311285,129.0630779
 4.226182617,128.9100652 4.539904997,128.7461971 4.848096202,128.571673
 5.150380749,128.3867057 5.44639035,128.1915204 5.735764364,127.9863551
 6.018150232,127.7714596 6.29320391,127.5470958 6.56059029,127.313537
 6.819983601,127.0710678 7.071067812,126.8199836 7.313537016,126.5605903
 7.547095802,126.2932039 7.771459615,126.0181502 7.9863551,125.7357644
 8.191520443,125.4463904 8.386705679,125.1503807 8.571673007,124.8480962
 8.746197071,124.539905 8.910065242,124.2261826 9.06307787,123.9073113
 9.205048535,123.5836795 9.335804265,123.2556815 9.455185756,122.923717
 9.56304756,122.5881905 9.659258263,122.2495105 9.743700648,121.90809
 9.816271834,121.5643447 9.876883406,121.2186934 9.925461516,120.8715574
 9.961946981,120.5233596 9.986295348,120.1745241 9.998476952,119.8254759
 9.998476952,119.4766404 9.986295348,119.1284426 9.961946981,118.7813066
 9.925461516,118.4356553 9.876883406,118.09191 9.816271834,117.7504895
 9.743700648,117.4118095 9.659258263,117.076283 9.56304756,116.7443185
 9.455185756,116.4163205 9.335804265,116.0926887 9.205048535,115.7738174
 9.06307787,115.460095 8.910065242,115.1519038 8.746197071,114.8496193
 8.571673007,114.5536096 8.386705679,114.2642356 8.191520443,113.9818498
 7.9863551,113.7067961 7.771459615,113.4394097 7.547095802,113.1800164
 7.313537016,112.9289322 7.071067812,112.686463 6.819983601,112.4529042
 6.56059029,112.2285404 6.29320391,112.0136449 6.018150232,111.8084796
 5.735764364,111.6132943 5.44639035,111.428327 5.150380749,111.2538029
 4.848096202,111.0899348 4.539904997,110.9369221 4.226182617,110.7949515
 3.907311285,110.6641957 3.583679495,110.5448142 3.255681545,110.4369524
 2.923717047,110.3407417 2.588190451,110.2562994 2.249510543,110.1837282
 1.908089954,110.1231166 1.56434465,110.0745385 1.218693434,110.038053
 0.8715574275,110.0137047 0.5233595624,110.001523 0.1745240644,109.9954313
 -0.1744709027)))", blue);
     boost::geometry::correct(green);
     boost::geometry::correct(blue);

     // Test intersection between green and blue
     BoostMultiPolygonT output_intersection;
     boost::geometry::intersection(green,blue, output_intersection);
     std::cout << " area of intersection " <<
 boost::geometry::area(output_intersection) << std::endl;
     std::cout << " Polygons of intersection : ..." << std::endl;
     BOOST_FOREACH(BoostCCWPolygonT const& p, output_intersection)
     {
         std::cout << boost::geometry::dsv(p) << std::endl;
     }
     // Does intersection output equal green?
     std::cout << "Intersection output does" <<
 (boost::geometry::equals(output_intersection, green) ? "(!)" : " not") <<
 " equal green" << std::endl;

     // Test difference between green and blue
     BoostMultiPolygonT output_difference;
     boost::geometry::difference(green, blue, output_difference);
     std::cout << " area of difference " <<
 boost::geometry::area(output_difference) << std::endl;
     std::cout << " Polygons of difference : ..." << std::endl;
     BOOST_FOREACH(BoostCCWPolygonT const& p, output_difference)
     {
         std::cout << boost::geometry::dsv(p) << std::endl;
     }

 }

 int main()
 {
     test_boost_difference();
 }

-- 
Ticket URL: <https://svn.boost.org/trac10/ticket/13522#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2018-05-16 06:13:20 UTC