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

Sandro Santilli strk at keybit.net
Mon Sep 15 06:16:16 PDT 2014


On Fri, Sep 12, 2014 at 08:04:10PM +0300, Mika Heiskanen wrote:
> On 09/12/2014 07:31 PM, Sandro Santilli wrote:
> >But distinguishing between which boundary lines will need to be
> >added to the result and which not is still not done explicitly.
> 
> I believe I can help with that. First I'll have to check your changes
> to the algorithm to catch up.

I ended up completing this part myself. During subsequent tests
I found a case included in your set which was failing. On a closer
look the hole was not obeying to the right-hand-rule, so as you said
it would be expected:

  // Surround the rectangle, hole outside rectangle but shares edge
  {
    "POLYGON ((-15 -15,-15 15,15 15,15 -15,-15 -15),(0 5,-1 5,-1 6,0 6,0 5))",
    "POLYGON ((0 0,0 10,10 10,10 0,0 0))"
  }

With the new code the shared edge is considered as needed in the output
as it goes upside-down (thus counter-clockwise on the rect edge).

I wonder if the RectangleIntersection class should check winding order
and reverse rings if needed...

--strk;

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


More information about the geos-devel mailing list