]> granicus.if.org Git - postgis/commitdiff
Make sure to retain first point of curves on linearization (#2427)
authorSandro Santilli <strk@keybit.net>
Tue, 13 Aug 2013 22:54:21 +0000 (22:54 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 13 Aug 2013 22:54:21 +0000 (22:54 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11790 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/cunit/cu_ptarray.c
liblwgeom/lwsegmentize.c
regress/tickets.sql
regress/tickets_expected

index 369720f0ebeabb105519c86eef298699696e2e83..2a6126cb0a37285b0acb35b7f41f25e083bbf85c 100644 (file)
@@ -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,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,1.8049097 1.9807853,3 1),(3 1,4 4))");
        lwgeom_free(in);
        lwgeom_free(out);
 //     printf("%s\n", str);
index 1db038e20dfa5a0358598af96c6ab311cdda00b0..f49e0afbc0929e9eede4af2bc5e8bcc2ecc4c96d 100644 (file)
@@ -175,7 +175,8 @@ lwcircle_segmentize(POINT4D *p1, POINT4D *p2, POINT4D *p3, uint32_t perQuad)
        pa = ptarray_construct_empty(1, 1, 32);
 
        /* Sweep from a1 to a3 */
-       for ( angle = a1; clockwise ? angle > a3 : angle < a3; angle += increment ) 
+       ptarray_append_point(pa, p1, LW_FALSE);
+       for ( angle = a1 + increment; clockwise ? angle > a3 : angle < a3; angle += increment ) 
        {
                pt.x = center.x + radius * cos(angle);
                pt.y = center.y + radius * sin(angle);
index 03142a34e8c959b14363d1e76d6ce6bce9040bed..333b767bc176a8c32e80cb7ee102754e6b0d58ad 100644 (file)
@@ -841,5 +841,7 @@ SELECT '#2424', ST_AsText(ST_SnapToGrid(ST_CurveToLine(
   'MULTICURVE(COMPOUNDCURVE((0 0, 10 0),CIRCULARSTRING(10 0, 20 1, 30 10)))',
 2),1));
 
+SELECT '#2427', st_astext(st_pointn(ST_CurveToLine('CIRCULARSTRING(-1 0,0 1,0 -1)'),1));
+
 -- Clean up
 DELETE FROM spatial_ref_sys;
index 5bba2e1e15b0089dff881df28c8dd27166223439..b6ef35e88cbac3577ab4946bc39944eabf52a8f3 100644 (file)
@@ -250,3 +250,4 @@ ERROR:  invalid GML representation
 #2420|LINESTRING(0 0,10 0,10 10,0 10,0 0)
 #2423|POLYGON((-10 0,-9.2388 3.82683,-7.07107 7.07107,-3.82683 9.2388,0 10,3.82683 9.2388,7.07107 7.07107,9.2388 3.82683,10 0,-10 0))
 #2424|MULTILINESTRING((0 0,10 0,24 3,30 10))
+#2427|POINT(-1 0)