Subject: [Boost-bugs] [Boost C++ Libraries] #6958: boost::geometry::intersection on two triangles creates self-intersecting polygon
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-05-31 19:48:29
#6958: boost::geometry::intersection on two triangles creates self-intersecting
polygon
-------------------------------------+--------------------------------------
Reporter: anonymous | Owner: barendgehrels
Type: Bugs | Status: new
Milestone: To Be Determined | Component: geometry
Version: Boost Development Trunk | Severity: Problem
Keywords: |
-------------------------------------+--------------------------------------
This program intersects two non-self-intersecting polygons and receives a
self-intersecting polygon as output. The expected result was a polygon
that does not intersect itself. I tested this on SVN revision 78784, and
it failed with:
A
B
terminate called after throwing an instance of
'boost::geometry::overlay_invalid_input_exception'
what(): Boost.Geometry Overlay invalid input exception
Aborted
Thanks!
Craig
{{{
#include <cstdio>
#include <vector>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/geometries/register/ring.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
typedef boost::geometry::model::d2::point_xy<double> pt;
typedef boost::geometry::model::polygon<pt> polygon;
typedef boost::geometry::model::multi_polygon<polygon> multi_polygon;
int main()
{
polygon green, blue;
multi_polygon output;
boost::geometry::read_wkt(
"POLYGON((0.63872330997599124913 0.25963790394761232516 ,"
" 0.51901482278481125832 0.36860892060212790966 ,"
" 0.24443514109589159489 0.62663296470418572426 ,"
" 0.41175117865081167778 0.47178476291601745274 ,"
" 0.63872330997599124913 0.25963790394761232516))", green);
boost::geometry::read_wkt(
"POLYGON((0.52364358028948876367 0.36823021165656988352 ,"
" 0.7762673462275415659 0.13443113025277850237 ,"
" 0.59446187055393329146 0.29992923303868185281 ,"
" 0.52364358028948876367 0.36823021165656988352))",blue);
boost::geometry::correct(green);
boost::geometry::correct(blue);
boost::geometry::detail::overlay::has_self_intersections(green);
boost::geometry::detail::overlay::has_self_intersections(blue);
printf("A\n");
boost::geometry::intersection(green,blue,output);
printf("B\n");
boost::geometry::detail::overlay::has_self_intersections(output);
printf("C\n");
return 0;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6958> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC