From: Sandro Santilli Date: Tue, 13 Aug 2013 23:47:54 +0000 (+0000) Subject: Pick curve control point farther than in the middle X-Git-Tag: 2.2.0rc1~1404 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2cc422bb2092d24f74a5bf1c23936982412b08b2;p=postgis Pick curve control point farther than in the middle Seems to get a good point when doing manual tests... git-svn-id: http://svn.osgeo.org/postgis/trunk@11793 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/cunit/cu_ptarray.c b/liblwgeom/cunit/cu_ptarray.c index 2a6126cb0..933aa062e 100644 --- a/liblwgeom/cunit/cu_ptarray.c +++ b/liblwgeom/cunit/cu_ptarray.c @@ -399,7 +399,7 @@ static void test_ptarray_desegmentize() in = out; out = lwgeom_desegmentize(in); str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL); - CU_ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE((0 0,1 1),CIRCULARSTRING(1 1,1.8049097 1.9807853,3 1),(3 1,4 4))"); + CU_ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE((0 0,1 1),CIRCULARSTRING(1 1,2 2,3 1),(3 1,4 4))"); lwgeom_free(in); lwgeom_free(out); // printf("%s\n", str); diff --git a/liblwgeom/lwsegmentize.c b/liblwgeom/lwsegmentize.c index f49e0afbc..2fd5d063e 100644 --- a/liblwgeom/lwsegmentize.c +++ b/liblwgeom/lwsegmentize.c @@ -565,7 +565,7 @@ circstring_from_pa(const POINTARRAY *pa, int srid, int start, int end) LWDEBUGF(4, "srid=%d, start=%d, end=%d", srid, start, end); getPoint4d_p(pa, start, &p0); ptarray_set_point4d(pao, 0, &p0); - getPoint4d_p(pa, (start+end)/2, &p1); + getPoint4d_p(pa, (start+end+1)/2, &p1); ptarray_set_point4d(pao, 1, &p1); getPoint4d_p(pa, end+1, &p2); ptarray_set_point4d(pao, 2, &p2); diff --git a/regress/tickets_expected b/regress/tickets_expected index b6ef35e88..6dd393717 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -40,7 +40,7 @@ NOTICE: No points or linestrings in input array #179a| NOTICE: No points or linestrings in input array #179b| -#183|COMPOUNDCURVE(CIRCULARSTRING(0 0,0.4653039147 1.2062550401,1 0),(1 0,0 1)) +#183|COMPOUNDCURVE(CIRCULARSTRING(0 0,0.5 1.2071067812,1 0),(1 0,0 1)) #210a| NOTICE: No points or linestrings in input array #210b| @@ -95,7 +95,7 @@ NOTICE: IllegalArgumentException: Invalid number of points in LinearRing found #835.11|MULTILINESTRING EMPTY #835.12|MULTIPOLYGON EMPTY #650|MULTIPOINT(0 0,1 1,2 2) -#667|SRID=4326;CURVEPOLYGON(CIRCULARSTRING(30 40,-49.2314112161292 32.1963871193548,30 40)) +#667|SRID=4326;CURVEPOLYGON(CIRCULARSTRING(30 40,-50 39.9999999999999,30 40)) #677|1121395 #680|01d107000000000000000024c000000000000049400000000000000040 #681a|