Boost logo

Geometry :

Subject: Re: [geometry] Why closure?
From: Barend Gehrels (barend_at_[hidden])
Date: 2013-06-20 17:53:40


Hi,

On 20-6-2013 18:30, TONGARI wrote:
> 2013/6/21 Barend Gehrels <barend_at_[hidden] <mailto:barend_at_[hidden]>>
>
> Hi,
>
>
> On 20-6-2013 11:26, TONGARI wrote:
>
>
> I'm not quite understand why we need traits::closure for Ring
> & Polygon, aren't these always closed?
> What should I expect if the closure is open? Should I see Ring
> as Linestring then?
>
>
> No (about the last question).
>
> Apparently the doc about closure should be updated. However, this
> page explains it clearly:
>
> http://www.boost.org/doc/libs/1_53_0/libs/geometry/doc/html/geometry/reference/enumerations/closure_selector.html
>
>
> Yah, I somewhat missed that page, seems it does contain the info I needed.
> Since I'm writing my 2d graphics lib, I always think the lib should
> close it anyway for drawing, but I don't know how it matters in the
> context of geometry operations...
>

Sure, basically every algorithm needs polygons to be closed. Therefore
we have the closeable_view which closes them automatically. Likewise we
have the reversible_view which walks through the points in opposite
direction, if the rings are counter clockwise. So basically (in a system
where x is going up) we consider, internally, with help of these two
views, all polygons as closed and clockwise.

Regards, Barend



Geometry list run by mateusz at loskot.net