id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 10107,boost::geometry::intersection fails for triangle-triangle intersection.,Raffael Casagrande ,Barend Gehrels,"The intersection between two triangles fails. The two triangles have a considerable intersection but boost::geometry::intersects returns no intersection at all (see attached svg to get an understanding of the problem). The points of the triangles have been taken from a concrete application where the error was initially detected. Also note that if we round the nodes of the triangle a bit (by uncommenting the piece of code in the middle) intersection() will return a result, but it is unfortunately wrong. (see attached svg file) {{{ #include #include #include #include #include #include namespace bg = boost::geometry; int main() { typedef bg::model::d2::point_xy point_t; typedef bg::model::ring ring_t; ring_t ring0; bg::append(ring0, point_t(0,0)); bg::append(ring0, point_t(0.34729635524768009969, -8.0779356694631608874e-28)); bg::append(ring0, point_t(2.7755575615628913511e-17, 0.27215593674075533315)); bg::append(ring0, point_t(0,0)); ring_t ring1; bg::append(ring1, point_t(0.098648844641721203375, 0.11754520657592185118)); bg::append(ring1, point_t(0.20919064161456801809, 0.21645083936158207583)); bg::append(ring1, point_t(0.34729635524768026622, -2.8837044695958157593e-16)); bg::append(ring1, point_t(0.098648844641721203375, 0.11754520657592185118)); /* static const double roundFactor = std::pow(2., -30); for(int i=0; i<4; ++i) { ring0[i].x(std::round(ring0[i].x()/roundFactor)*roundFactor); ring0[i].y(std::round(ring0[i].y()/roundFactor)*roundFactor); ring1[i].x(std::round(ring1[i].x()/roundFactor)*roundFactor); ring1[i].y(std::round(ring1[i].y()/roundFactor)*roundFactor); }*/ std::vector result; bg::intersection(ring0, ring1, result); std::cout << result.size() << std::endl; // Output in SVG: std::ofstream stream(""debug.svg""); bg::svg_mapper mapper(stream, 400,400); mapper.add(ring0); mapper.add(ring1); mapper.map(ring0, ""fill-opacity:0.5;fill:rgb(153,204,0)""); mapper.map(ring1, ""fill-opacity:0.3;fill:rgb(51,51,153)""); if(result.size()==1) { mapper.map(result[0], ""fill:none;stroke:rgb(0,0,0);stroke-width:1""); } } }}}",Bugs,closed,Boost 1.56.0,geometry,Boost 1.55.0,Problem,fixed,,