[postgis-devel] OffsetCurve tests

Martin Davis mtnclimb at gmail.com
Wed Jan 5 10:29:23 PST 2022


Yes, the new OffsetCurve code does not return "inner loops".  That was a
deliberate design decision, base on the idea that the offset curve of a
single line should itself be a single line.  (Otherwise, how is the client
code supposed to know what to do with the multiple lines it gets back?)

There's also the new behaviour that for a self-intersecting line the result
offset curve stops at the self-intersection (and so is perhaps shorter than
might be expected/desired).  This is more a result of me not being able to
figure out a workable algorithm to do the alternate thing that was stable
and robust against all input situations.  (You can imagine that
self-intersecting lines can get infinitely complex...). However, I'll
revisit this - perhaps there's a way to change the behaviour in some more
tractable cases.

The underlying issue here is that AFAIK there is no standard definition of
what an offset curve should look like.  So there's no basis for
disagreement about how the algorithms work - they are just different.


On Wed, Jan 5, 2022 at 6:53 AM Sandro Santilli <strk at kbt.io> wrote:

> Hi Paul, I was reading this commit of yours:
>
> > commit 9b0c432beea50f2b5071a50f6a4e11647c092229
> > Author: Paul Ramsey <pramsey at cleverelephant.ca>
> > Date:   Tue Jan 4 14:20:01 2022 -0800
> >
> >     Revise regression tests so that both pre- and post-GEOS 3.11
> >     updates to OffsetCurve will pass.
>
> [...]
>
> > +-- SELECT 't14', ST_AsEWKT(ST_Normalize(ST_OffsetCurve(
> > +--  'LINESTRING(0 0,0 20, 10 20, 10 10, 0 10)', -2,
> > +--  ''
> > +-- )));
> > +-- SELECT 't15', ST_AsEWKT(ST_Normalize(ST_OffsetCurve(
> > +--  'GEOMETRYCOLLECTION(LINESTRING(0 0,0 20, 10 20, 10 10, 0
> 10),MULTILINESTRING((2 0,2 20, 12 20, 12 10, 2 10),(3 0,3 20, 13 20, 13 10,
> 3 10)))', -2,
> > +--  ''
> > +-- )));
>
> With GEOS 3.11.0dev (unknown hash) from t14 I get the result
> which was expected:
>
>   MULTILINESTRING((2 12,8 12,8 18,2 18,2 12),(2 8,2 0))
>
> The new GEOS gives:
>
>   LINESTRING(2 0,2 8)
>
> Shouldn't the new GEOS result be considered bogus instead ?
>
> In the ASCII drawing below, you see the input (with arrow
> signs showing the direction) and the previous result of the
> offset:
>
>     .--->----.
>     | .----, |
>     ^ |    | v
>     | '----' |
>     |---<----'
>     |
>     ^ |
>     | |
>     | |
>
> The new result is basically ONLY returning the vertical open
> line on the bottom and completely missing the inner rectangle
> on top.
>
> --strk;
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20220105/307a5d9d/attachment.html>


More information about the postgis-devel mailing list