|
Geometry : |
Subject: [ggl] Multipolygon self intersection with of coincident edges
From: V D (zedxz2)
Date: 2011-10-25 03:44:50
Hi,
I'm looking at self-intersection problems when dealing with integer multi-polygons.
For example, the following 2 polygons as a multipolygon:
They have a coincident edge, and therefore doing bg::intersects(this_multipolygon) will return true. Of course, bg::intersects() on each polygon individually is perfectly fine.
Is there any way I could tweak this algorithm so that coincident edges are not considered as self intersection? (can't use algorithms on this kind of multipolygons right now because of that)
Would this possibly break algorithms ? Should I simply deal with this kind of geometries as a vector of polygons and do algorithms 1 polygon at a time rather than the multipolygon concept ?
Thank you for sharing opinions.
-V
(code below for this example)
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <iostream>
int main()
{
typedef boost::geometry::model::d2::point_xy<int> ipoint_xy;
typedef boost::geometry::model::polygon<ipoint_xy > ipolygon;
typedef boost::geometry::model::multi_polygon<ipolygon > imulti_polygon;
imulti_polygon adjacents;
boost::geometry::read_wkt("MULTIPOLYGON(((0 0, 0 10, 10 10, 10 0, 0 0)), ((10 5, 10 15, 20 15, 20 5, 10 5)))", adjacents);
std::cout << boost::geometry::intersects(adjacents) << std::endl;
return 0;
}
-------------- next part --------------
Skipped content of type multipart/related
Geometry list run by mateusz at loskot.net