[geos-devel] Fwd: Geometry/Rectangle Intersection: line touching rectangle

Mika Heiskanen mika.heiskanen at fmi.fi
Fri Sep 12 02:32:32 PDT 2014


On 09/12/2014 11:28 AM, Sandro Santilli wrote:
> On Thu, Sep 11, 2014 at 07:30:45PM +0300, Mika Heiskanen wrote:
>> On 09/11/2014 06:57 PM, Sandro Santilli wrote:
>>> Did you take a look at the algorithm ?
>>> It sounds like by the end of operations the class is left with a bunch
>>> of lines to work with, not much to build a result w/out going back
>>> to look at which sides of those lines are internal or external of the
>>> originals.
>>
>> At the time of insertion into the builder it is known for all
>> linestrings whether they are part of a hole or the exterior of
>> a polygon. This information can be inserted into the builder
>> along with the linestring, and used in the rebuild phase.
>
> Not only whether the linestring was part of an hole or a shell, but
> in case it was part of the hole, we must also pass along which side
> of boundary segments had the area. Look here:
>
> Clipping rectangle       Expected result
> and input                ( a poligon + a line )
>
>   +-------+               . . . . .
>   |rect   |               .       .
>   |  +----:-----+         .  +----+
>   |  |    :     |         .  |    |
>   |  | +--+     |         .  | +--+
>   |  | |h |     |         .  | |  | <-- dangling line
>   |  | +--+ s   |         .  | +--+
>   |  |    :     |         .  |    |
>   |  |    +--+  |         .  |    |
>   |  |    |h |  |         .  |    | <-- dissolved
>   |  |    +--+  |         .  |    |
>   |  |    :     |         .  |    |
>   |  +----:-----+         .  +----+
>   |       :               .       .
>   +-------+               . . . . .

I do not think the extra information is necessary, since if the input
is a valid geometry, the hole is counter-clockwise. The direction of the 
shared partial edge should  dictate the position of the hole with 
respect to the rectangle. In the above example the upper edge is
counter-clockwise in the rectangle while the lower edge is clockwise.

Regards,

Mika Heiskanen / Finnish Meteorological Institute


More information about the geos-devel mailing list