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

Sandro Santilli strk at keybit.net
Tue Sep 9 08:53:00 PDT 2014


On Tue, Sep 09, 2014 at 06:44:49PM +0300, Mika Heiskanen wrote:
> On 09/09/2014 06:27 PM, Sandro Santilli wrote:
> >>I'd like to see a reference where all such special cases
> >>are defined explicitly. (No, I never looked for one, as explained
> >>before.) In your previous example a linestring was split in half
> >>because a vertex is on the rectangle edge. This is kind of consistent
> >>with the interpretation that the vertex is considered to be out.
> >>However, the example presented here is consistent with the
> >>interpretation that the vertex should be considered to be in.
> >
> >Indeed the results are formally confusing.
> >I hope Martin Davis can chime in, being the author of the currently
> >used algorithm.
> 
> Our algorithm discards all points on the rectangle edges unless they
> are required to represent the resulting geometry. This means
> intermediate vertices might be skipped when the edges are travelling
> along the rectangle edge.
> 
> I do see however that someone might wish original vertices on the edges
> to be preserved during polygon clipping, for example if the geometry is
> to be projected afterwards.

Yep. Best would be if all these options could be available as parameters
of the RectangleIntersection class.

Beside, re-thinking about the consistency of the split, I think the reason
why the linestring was split was not because the boundary of the rectangle
was not considered part of the result, but rather just a subproduct of
the geomgraph building algorithm. I'm saying this because in the case of
a linestring laying on a single edge of the rectangle, that line also
becomes a multiline, for no apparent reason. 

So my guess is that boundary intersections are always included in
the result as either points, lines or polygons depending on the
dimension of the intersection.

--strk; 

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


More information about the geos-devel mailing list