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

Sandro Santilli strk at keybit.net
Thu Sep 11 08:17:02 PDT 2014


On Thu, Sep 11, 2014 at 03:58:32PM +0200, Sandro Santilli wrote:
> On Thu, Sep 11, 2014 at 03:52:21PM +0200, Sandro Santilli wrote:

> > Actually one result I'm looking at is perplexing.
> > One operand is the usual rectangle, the other is a polygon which
> > is cut by the right-edge of the rectangle and has a rectangular
> > hole whose right edge is covered by the rectangle edge:
> > 
> >  POLYGON(
> >   (5 2,5 8,15 8,15 2,5 2),
> >   (8 4, 8 6, 10 6, 10 4, 8 4)
> >  )
> > 
> > 10 +-----------+
> >    |           |
> >  8 |    +------+----+
> >    |    |      :    |   h: hole
> >  6 |    |  +---+    |   s: shell
> >    |    |  | h |    |   
> >  4 |    |  +---+    |
> >    |    |      :    |
> >    |    |   s  :  s |
> >  2 |    +------+----+
> >    |           |
> >  0 +-----------+
> >    0    5  8  10   15
> > 
> > GEOS intersection result is:
> 
>  GEOMETRYCOLLECTION (
>   LINESTRING (10 6, 10 4),
>   POLYGON ((5 2, 5 8, 10 8, 10 6, 8 6, 8 4, 10 4, 10 2, 5 2))
>  )
> 
> That is, the polygon I'd expect plus a dangling line I would
> not expect to see in output.  Visually: 
> 
>  10 . . . . . . .
>     .           .
>   8 .    +------+
>     .    |      |
>   6 .    |  +---+
>     .    |  |   |<-- spurious line
>   4 .    |  +---+
>     .    |      |
>     .    |    s | <-- s: shell
>   2 .    +------+
>     .           .
>   0 . . . . . . .
>     0    5  8  10 
> 
> Is the dangling line expected to be in output ? If so, why ?
> Does JTS also include it ?

I've just tried with JTS and it indeed gives the same result.
Is including that right line correct ?
Being a Boundary-Boundary intersection of the two operands it
would indeed seem correct to include it.

I dunno how the RectangleIntersection could handle such case...

--strk; 

 ()  ASCII ribbon campaign  --  Keep it simple !
 /\  http://strk.keybit.net/rants/ascii_mails.txt  


More information about the geos-devel mailing list