id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 11576,boost::geometry::intersection wrong results,alex-x@…,Barend Gehrels,"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. {{{ // boost_geom.cpp : Defines the entry point for the console application. // #include ""stdafx.h"" #include #include #include #include #include #include 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 > DBL_EPSILON) and false otherwise typedef boost::geometry::model::d2::point_xy bg_point; typedef boost::geometry::model::polygon< bg_point, false, false > 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 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& p, output) { double s = boost::geometry::area(p); *S += s; } // no intersection if(fabs(*S) <= DBL_EPSILON) return false; // intersection > 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, &s); return 0; } }}} ",Bugs,reopened,Boost 1.61.0,geometry,Boost 1.61.0,Problem,,intersection,