Subject: Re: [geometry] Polygon intersection along coincident edges.
From: Barend Gehrels (barend_at_[hidden])
Date: 2012-07-11 16:38:13
I was just answering your other mail. Thanks for the report.
On 11-7-2012 22:33, Paul J. Caritj wrote:
> Hello again everyone,
> I have solved my problem and am reporting back for posterity (and
> perhaps for the benefit of other desperate Googlers). Bg::intersection
> is a lost cause
I was writing: you mean that intersection (with point output) outputs
only one point? That is indeed surprising. It should return two points
(for point output) or a segment (n.y.i.) or zero polygons. But it might
be that this is a border-case too, I'll have a look.
> , but I was able to get the results I needed another way: I now
> iterate over the points defining my test polygon and check for each's
> presence within the target polygon. But this sounds easier than it is
> because bg::within does not actually return 'true' for points along
> the border of the target polygon. The reference documents at boost.org
> <http://boost.org> suggested that this might depend on my search
> strategy, but after having tried winding, franklin, and crossings
> multiply, it seems that, at least in my case, the strategy made no
> difference. Fortunately, there is an easier way: if you pull the boost
> source from repository you'll be happy to discover that there is a
> new boost::geometry::covered_by(Geometry1 const & geometry1, Geometry2
> const & geometry2) that returns 'true' for border cases. See:
> I'm sure most subscribers to this list already knew all this, but
> hopefully this will be helpful to some other newcomer someday.
Indeed covered_by is what you need here. The strategies differ in the
sense that they sometimes include points on borders, sometimes none, but
indeed there is (until now) no one which garantees "true" if it is on
Geometry list run by mateusz at loskot.net