Boost C++ Libraries: Ticket #9909: boost::geometry::intersection on two polygons returns incorrect result in one case https://svn.boost.org/trac10/ticket/9909 <p> Hi, </p> <p> There is problem with intersection of 2 <a class="missing wiki">BoostMultiPolygons</a>. Result consisted of only one poly, but should contain 2. Our boost version is 1.55. We use MS VS 2005. </p> <p> Regards, Roman. </p> <p> Source: </p> <pre class="wiki">typedef boost::geometry::model::d2::point_xy&lt;double&gt; BoostPoint; typedef boost::geometry::model::ring&lt;BoostPoint, true&gt; BoostRing; typedef boost::geometry::model::polygon&lt;BoostPoint, true&gt; BoostPolygon; typedef boost::geometry::model::multi_polygon&lt;BoostPolygon&gt; BoostMultiPolygon; std::ifstream in("input.txt"); BoostMultiPolygon mpSrc1, mpSrc2, mpRes; int polyCount; in&gt;&gt;polyCount; for (int i=0;i&lt;polyCount;i++) { int pointCount; in&gt;&gt;pointCount; BoostPolygon curPolygon; BoostRing curRing; for(int j=0;j&lt;pointCount;j++) { double x,y; in&gt;&gt;x&gt;&gt;y; curRing.push_back(BoostPoint(x,y)); } curPolygon.outer() = curRing; mpSrc1.push_back(curPolygon); } in&gt;&gt;polyCount; for (int i=0;i&lt;polyCount;i++) { int pointCount; in&gt;&gt;pointCount; BoostPolygon curPolygon; BoostRing curRing; for(int j=0;j&lt;pointCount;j++) { double x,y; in&gt;&gt;x&gt;&gt;y; curRing.push_back(BoostPoint(x,y)); } curPolygon.outer() = curRing; mpSrc2.push_back(curPolygon); } boost::geometry::intersection(mpSrc1, mpSrc1, mpRes); // mpRes contain only 1 poly. </pre><p> Contaiment of input.txt : </p> <pre class="wiki">2 27 1.7795412086922593 -0.6928106373008438 1.7891900856407261 -0.73346701678889104 1.8205003053203772 -0.93531819320144416 1.8121292936644648 -1.1807879269729795 1.7394808987253128 -1.4154103358489794 1.6076723780308959 -1.6226589254855832 1.4259881506704424 -1.7879353774152118 1.2072258150073207 -1.8995978354269698 0.96679470265783485 -1.9497809426285055 0.72163046540975617 -1.934949866855677 0.60267613336191828 -1.8966346198312143 0.41731164084513261 -1.7901953365848997 0.27656953156479103 -1.6293196865339519 0.19571165090939757 -1.4314527634772853 0.18350609592762368 -1.2180509346857271 0.24127641714720549 -1.0122551473377328 0.36470663256680463 -0.8348324228970293 0.67786452669735997 -0.60942974505933833 0.76516102039389844 -0.55513726961522536 0.81184032592082556 -0.52936777403881374 0.9456140934360856 -0.46301076844880257 1.0715439430748541 -0.41043054738175999 1.2051029188121665 -0.39184926061543224 1.3438936378781083 -0.42743758887205224 1.4793480212800743 -0.49201773445646352 1.6124976944936933 -0.5720053785043937 1.7795412086922593 -0.6928106373008438 21 1.1615462164308124 1.9754373027139951 1.5360149764505899 1.886934666316108 1.7087948729537776 1.8041724959027103 1.8362554271519613 1.661147055471015 1.8986519852214538 1.4800141235445734 1.8863188239381428 1.2888326322334416 1.8011664480979825 1.1172181154349941 1.6563856381255915 0.99175502703475193 1.4722208702867912 0.93196155014586246 1.3307251338101709 0.96302852254101112 1.1889015041869535 1.0063804359754345 1.0851554485208663 1.0419536723519502 0.9303284683690195 1.1007328938955687 0.86940784993802189 1.126033284720011 0.73031572956801372 1.2427081650372707 0.64785873725084664 1.4044502129533221 0.63514254042735985 1.5855522394036576 0.69418824418515901 1.7572299913513629 0.81561115796600125 1.8921971045865578 0.98011239294323005 1.9690019829279639 1.1615462164308124 1.9754373027139951 2 27 0.4022007544928915 -0.79320935498558631 0.67786021968757104 -0.59223694917595526 0.72926567327554304 -0.56003487788773432 0.83396700970889248 -0.50259243802045006 0.94559413155101379 -0.44613850745202116 1.0715439430748541 -0.39325208386734267 1.2051029188121665 -0.36717869475972431 1.2079466156233769 -0.36787014029848375 1.383100956224427 -0.42804360792267371 1.5711416115100447 -0.55533336824076429 1.5817841916061597 -0.56708324300601975 1.712343915281392 -0.71850008854626279 1.8205003053203772 -0.93531819320144416 1.812129293664464 -1.1807879269729791 1.7394808987253114 -1.4154103358489782 1.6076723780308948 -1.6226589254855814 1.4259881506704415 -1.7879353774152098 1.2072258150073203 -1.899597835426968 0.96679470265783507 -1.9497809426285047 0.72163046540975617 -1.934949866855677 0.53668372332048819 -1.8329698805024297 0.38798986558594484 -1.6829853756425535 0.28761203927878709 -1.4971642062029744 0.24369363713914372 -1.2905815617733336 0.25979764523973214 -1.0799969565688248 0.33461758716561152 -0.88249457350408611 0.4022007544928915 -0.79320935498558631 24 0.69106840510193146 1.7283118331970613 0.80491403567959896 1.8636891961105639 0.97252446578255225 1.9537292239908663 1.1615462164308124 1.9754373027139951 1.445329131723774 1.9083675258739219 1.6295697181486921 1.8205585564967293 1.778913808591188 1.6814494215012656 1.87956003859109 1.503895640420464 1.9222073685313958 1.304305525338967 1.908582733892098 1.1608175914897563 1.9058154916000392 1.1489111215390388 1.8042808050307477 0.99216149052586733 1.6864779577548399 0.90268670286901209 1.5974991741674556 0.89671357054168577 1.4640547165764142 0.9042573086441501 1.3308383768494927 0.94117823976176729 1.1908244144294404 0.99088339761011279 1.0620930550951979 1.0410213286408192 0.93028741744520127 1.0862837299344523 0.9007363188137486 1.0981042670180636 0.7529401342681733 1.21045558001871 0.66108738214900509 1.3717924996227908 0.6399134449656606 1.5562327178056883 0.69106840510193146 1.7283118331970613 </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9909 Trac 1.4.3 anonymous Tue, 15 Apr 2014 14:04:59 GMT summary changed https://svn.boost.org/trac10/ticket/9909#comment:1 https://svn.boost.org/trac10/ticket/9909#comment:1 <ul> <li><strong>summary</strong> <span class="trac-field-old">boost::geometry::intersection on two polygons returns incorrect empty intersection</span> → <span class="trac-field-new">boost::geometry::intersection on two polygons returns incorrect result in one case</span> </li> </ul> Ticket