Boost logo

Geometry :

Subject: Re: [geometry] duplicate points in polygon
From: Barend Gehrels (barend_at_[hidden])
Date: 2013-07-14 07:23:50


On 5-7-2013 18:15, Volker Schöch wrote:
>
> Hi Barend,
>
> Thank you very much for your detailed reply.
>
> > In the output duplicate points are skipped too. Even if the input does not contain duplicate points, the raw
> output might in some configurations contain duplicate points, and they
> are explicitly skipped (however, this is not checked). This is done in
> a later phase of the library, at first they were just included.
>
> Not sure what exactly that means. So, when I call, e.g.,
> boost::geometry::difference(poly1, poly2, polyOut) -- can any
> assumptions be made about the presence of duplicate points in polyOut?
>

Yes, the output should not contain duplicate points.

> > You can use boost::geometry::unique(polygon). But this is not
> required, the algorithms we provide should handle them correctly.
> However it is always possible that you at one time need to get rid of
> them yourself.
>
> Follow-up question: In case of an open (implicitly closed)
> representation, does boost::geometry::unique(polygon) remove the last
> point if it is equal to the first? Why (not)?
>

Good point. Yes, in my opinion that is a duplicate too. A polygon-border
is a continuous cyclic geometry without a start and an end. The first
point is just arbitrary. So yes, for an open polygon unique should
remove the last point if duplicate. However, that is currently not
done... So that is an action...

Besides this: boost::geometry::correct does explicitly remove the point
if necessary (or add it for closed polygons).

Regards, Barend



Geometry list run by mateusz at loskot.net