Boost logo

Geometry :

Subject: Re: [geometry] Why closure?
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2013-06-20 10:32:04


On 20 June 2013 15:18, TONGARI <tongari95_at_[hidden]> wrote:
> 2013/6/20 Mateusz Loskot <mateusz_at_[hidden]>
>> On 20 June 2013 10:26, TONGARI <tongari95_at_[hidden]> wrote:
>> >
>> > I'm not quite understand why we need traits::closure for Ring & Polygon,
>> > aren't these always closed?
>>
>> You can define open polygon or ring, means
>>
>> typedef bg::model::polygon<point, false, false> polygon; // open polygon
>> typedef bg::model::ring<point, false, false> ring; // open ring
>>
>> where the following condition does not hold
>>
>> last point == first point
>>
>> It is specification of the fact if first point is assumed as repeated or
>> not
>> at last position.
>>
>> > What should I expect if the closure is open?
>>
>> Algorithms won't expect physical presence of the repeated first point.
>>
>> > Should I see Ring as Linestring
>>
>> Ring is also known as linear ring, in case you know OGC geometry model.
>> IOW, (linear) ring is a specialisation of the linestring kind.
>
>
> So "closure is open" means auto-close for Ring & Polygon, and the closure
> doesn't change the meaning of Ring & Polygon as we should always see them as
> closed.
>
> Am I right?

Yes, correct.

It is also visible from the minimum_ring_size metafunction in closure.hpp,
which translates to the following requirement, for non-empty ring:

- an open ring shall have at least three points (triangle)
- a closed ring shall have at least four points (triangle with first
point repeated)

Best regards,

--
Mateusz Loskot, http://mateusz.loskot.net

Geometry list run by mateusz at loskot.net