Boost C++ Libraries: Ticket #13078: boost::geometry::intersection between a polygon and a box produces incorrect results https://svn.boost.org/trac10/ticket/13078 <p> I am intersecting a polygon with a box and with a polygon of the same points as the box. The result from box intersection is incorrect - it is a large as the original polygon. </p> <p> Here is the code: </p> <pre class="wiki">#include &lt;iostream&gt;` #include &lt;boost/geometry.hpp&gt; #include &lt;boost/geometry/geometries/point_xy.hpp&gt; namespace bg = boost::geometry; namespace bgm = bg::model; typedef double base_type; typedef bgm::d2::point_xy&lt;base_type&gt; point_type; typedef bgm::polygon&lt;point_type&gt; polygon_type; typedef bgm::multi_polygon&lt;polygon_type&gt; multipolygon_type; int main() { std::vector&lt;point_type&gt; points { {7.99922500000000127329e+02, 1.04990090625000011642e+04}, {7.99922500000000013642e+02, 9.99905624999999963620e+03}, {3.99961250000000006821e+02, 9.99905624999999963620e+03}, {3.99961250000000006821e+02, 1.04990090625000011642e+04}, {7.99922500000000127329e+02, 1.04990090625000011642e+04}, }; polygon_type poly; bg::assign_points(poly, points); bgm::box&lt;point_type&gt; box( {5.99941874999999981810e+02, 1.02490326562500013097e+04}, {7.99922500000000013642e+02, 1.04990090625000011642e+04} ); std::vector&lt;point_type&gt; box_points { {5.99941874999999981810e+02, 1.02490326562500013097e+04}, {5.99941874999999981810e+02, 1.04990090625000011642e+04}, {7.99922500000000013642e+02, 1.04990090625000011642e+04}, {7.99922500000000013642e+02, 1.02490326562500013097e+04}, {5.99941874999999981810e+02, 1.02490326562500013097e+04}, }; polygon_type box2; bg::assign_points(box2, box_points); multipolygon_type out; bg::intersection(poly, box, out); std::cout &lt;&lt; bg::area(out) &lt;&lt; " " &lt;&lt; bg::wkt(out) &lt;&lt; std::endl; multipolygon_type out2; bg::intersection(poly, box2, out2); std::cout &lt;&lt; bg::area(out2) &lt;&lt; " " &lt;&lt; bg::wkt(out2) &lt;&lt; std::endl; return 0; } </pre><p> And this is the output: </p> <pre class="wiki">199962 MULTIPOLYGON(((599.942 10499,799.923 10499,799.923 9999.06,399.961 9999.06,399.961 10499,599.942 10499))) 49990.4 MULTIPOLYGON(((799.923 10249,599.942 10249,599.942 10499,799.923 10499,799.923 10249))) </pre><p> Is this expected? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13078 Trac 1.4.3 John Maddock Sun, 30 Jul 2017 18:22:40 GMT component changed; owner set https://svn.boost.org/trac10/ticket/13078#comment:1 https://svn.boost.org/trac10/ticket/13078#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Barend Gehrels</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">geometry</span> </li> </ul> Ticket