Boost logo

Geometry :

Subject: Re: [geometry] Incorrect results from bg::equals (problem with closure and collect_vectors?)
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2017-04-09 00:05:15


Ch'gans Via Geometry wrote:
> Hi there,
> My custom ring type is defined with an 'open' closure.
> When i try to compare 2 geometrically equivalent ring and box,
> bg::equals return false.
> While investigating using the debugger, i discovered that the call to
> geometry::collect_vectors() returns 4 points for a box, but only 3
> points for a ring, so my 2 geometries can never be equal.
> In my case, collect_vectors is dispatched to range_collect_vectors,
> and by the look of it range_collect_vectors doesn't care about the
> geometry object (and it's closure), since it sees only point
> (iterator) range.
> I found a similar thread back from 2014, but it actually deals with a
> different problem, see

Right, it was something different:

> And there is this bug report that seems to be equivalent to my use-case:

Thanks for the heads up. The component of this bug is set wrongly to
'polygon' so we missed it.

> Am i missing something in my custom geometry trait adaptation? is it a
> bug in BG, or a known limitation?

It is a bug. I pushed a fix to develop:
I'll try to release it with Boost 1.64.

> Could someone shed some light on this? Any point-out to example,
> documentation or archives would be welcome too.
> If this is the same bug as #11899, could the fix be as simple as
> making range_collect_vectors aware of the closure of the ring, or
> maybe simply add a specialisation for rings?

Yes it probably is. You could check the bugfix mentioned above.
As a workaround probably relate() could be used but there probably would
be some difference in performance.


Geometry list run by mateusz at