Boost C++ Libraries: Ticket #11576: boost::geometry::intersection wrong results https://svn.boost.org/trac10/ticket/11576 <p> Here is a code of intersection of two 2d triangles. boost::geometry::intersection (inside get_poly_intersection_area_S_2d function) gives empty result. It was ok in boost 1.55.0 version. </p> <pre class="wiki">// boost_geom.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include &lt;time.h&gt; #include &lt;deque&gt; #include &lt;boost/geometry.hpp&gt; #include &lt;boost/geometry/geometries/point_xy.hpp&gt; #include &lt;boost/geometry/geometries/polygon.hpp&gt; #include &lt;boost/foreach.hpp&gt; bool get_poly_intersection_area_S_2d( const double *poly_x_1, const int poly_n_1, const double *poly_x_2, const int poly_n_2, double *S) { // intersects two 2d polygons using boost::geometry library // polygons are in 3d format [(x0, y0, 0.0) (x1, y1, 0.0) .... (xn, yn, 0.0) ] // S is resulting area of intersection // returns true if intersection exists (area &gt; DBL_EPSILON) and false otherwise typedef boost::geometry::model::d2::point_xy&lt;double&gt; bg_point; typedef boost::geometry::model::polygon&lt; bg_point, false, false &gt; bg_polygon; *S = 0.0; bg_polygon bg_poly_1, bg_poly_2; // init boost 2d polygons by our double 3D polygons for(int i=0; i&lt;poly_n_1; i++) bg_poly_1.outer().push_back(bg_point(poly_x_1[i*3], poly_x_1[i*3+1])); for(int i=0; i&lt;poly_n_2; i++) bg_poly_2.outer().push_back(bg_point(poly_x_2[i*3], poly_x_2[i*3+1])); // correct polygons boost::geometry::correct(bg_poly_1); boost::geometry::correct(bg_poly_2); // call intersection std::deque&lt;bg_polygon&gt; output; bool res = boost::geometry::intersection(bg_poly_1, bg_poly_2, output); if(!res) return false; // for each polygon of intersection we add area BOOST_FOREACH(bg_polygon const&amp; p, output) { double s = boost::geometry::area(p); *S += s; } // no intersection if(fabs(*S) &lt;= DBL_EPSILON) return false; // intersection &gt; DBL_EPSILON return true; } int _tmain(int argc, _TCHAR* argv[]) { /*double p1[3 * 3] = {0.00000000000000000, -0.00000000000000000, 0.00000000000000000, 0.0025482760575599476, 0.00000000000000000, 0.00000000000000000, 0.00053468140165232941, 0.0010376086029810613, 0.00000000000000000}; double p2[4 * 3] = {0.0030662413355881501, 0.0010051691098038377, 0.00000000000000000, 0.0019811507896907981, -0.0011005695262458440, 0.00000000000000000, -3.2443866216813556e-005, -6.2960923264770714e-005, 0.00000000000000000, 0.0010526466796805442, 0.0020427777127849226, 0.00000000000000000};*/ double p1[3 * 3]={ -0.00000000000000000 , 0.00000000000000000 , 0.00000000000000000 , 0.0030892383152813277, 0.00000000000000000 , 0.00000000000000000 , 0.0017033357506405240, 0.0015364430953530355, 0.00000000000000000 }; double p2[3 * 3] = { 0.0023117731015916947, 0.00082400923980274917, 0.00000000000000000, 0.00079878052059454633, 0.00072051609032968962, 0.00000000000000000, 0.0016845031281539609, 0.0015194556912103366, 0.00000000000000000 }; double s = 0; get_poly_intersection_area_S_2d(p1, 3, p2, 3, &amp;s); return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11576 Trac 1.4.3 Barend Gehrels Wed, 23 Mar 2016 15:45:23 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/11576#comment:1 https://svn.boost.org/trac10/ticket/11576#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.61.0</span> </li> </ul> <p> Fixed in 1.61, thanks for the report </p> Ticket alex-x@… Thu, 02 Jun 2016 21:00:20 GMT status, version changed; resolution deleted https://svn.boost.org/trac10/ticket/11576#comment:2 https://svn.boost.org/trac10/ticket/11576#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.59.0</span> → <span class="trac-field-new">Boost 1.61.0</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> Not fixed in 1.61.0. Still empty result of intersection. </p> Ticket