Boost logo

Geometry :

Subject: [ggl] Re: Problems with the difference between two polygons
From: Barend Gehrels (barend)
Date: 2011-08-08 10:33:35


On 7-8-2011 14:38, Angus Johnson wrote:
> On 7/08/2011 8:05 PM, Barend Gehrels wrote:
>> Why should you do that? Round them and then consider them as
>> duplicate? If they would be duplicate (before rounding), they would
>> not be included (since this is solved).
>
> Actually, if I properly understand geometry of the intersection of the
> inner black trapezoid with the hexagon here (
> http://boost-geometry.203548.n3.nabble.com/attachment/3232092/0/Example.svg
> ), then there really should only be 4 vertices in the solution.

See also:
<http://boost-geometry.203548.n3.nabble.com/Problems-with-the-difference-between-two-polygons-td3175027.html>

The coordinates (which I got that time and played with later) really
show very small segments, near the corners of the hexagons, which cause
the extra intersection. I think you will get them using Boost.Geometry
with ttmath as well. I don't know how you cope with such small distances
in integer scaled algorithms, but I think they should be included.

Anyway, the plan was to implement Boost.Rational as a coordinate type
for Boost.Geometry as well. That is not yet ready but it came a little
bit further today, and will be not a real problem. If that is done this
is actually an exact alternative, and even better (and probably much
faster) alternative to using ttmath. Anyway, still have to test that.
Besides that it cannot be used for anything doing non-rational
operations (such as distance (square root) or trigonometry (used in
spherical coordinate systems). But overlay is possible, tried that
today. It is even a little bit faster again, in some circumstances, by
avoiding the sqrt at one place.

Besides that, the enhanced self-intersections are committed today to
Trunk as well.

Regards, Barend


Geometry list run by mateusz at loskot.net