]> granicus.if.org Git - postgis/commitdiff
Fix segmentize of collinear curve (#2410)
authorSandro Santilli <strk@keybit.net>
Thu, 8 Aug 2013 06:07:50 +0000 (06:07 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 8 Aug 2013 06:07:50 +0000 (06:07 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11745 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwsegmentize.c
regress/sql-mm-circularstring.sql
regress/sql-mm-circularstring_expected

index bc350fad169ab0bed8cc97d24106c1151cc5c13a..b0144af64ca795dd5ae2c6ec89ac753b745c5d20 100644 (file)
@@ -220,7 +220,7 @@ lwcircstring_segmentize(const LWCIRCSTRING *icurve, uint32_t perQuad)
                {
                        LWDEBUG(3, "lwcircstring_segmentize: points are colinear, returning curve points as line");
 
-                       for (j = i - 1 ; j <= i ; j++)
+                       for (j = i - 2 ; j < i ; j++)
                        {
                                getPoint4d_p(icurve->points, j, &p4);
                                ptarray_append_point(ptarray, &p4, LW_TRUE);
index 28fcd6eea0297def3fbab8612da2e2a07bb29952..67a88677f9f111c6c0d1fde247fe665ce9859f11 100644 (file)
@@ -279,3 +279,7 @@ SELECT DropGeometryColumn('public', 'circularstring', 'the_geom_2d');
 DROP TABLE public.circularstring;
 SELECT ST_AsText(st_snaptogrid(box2d('CIRCULARSTRING(220268.439465645 150415.359530563,220227.333322076 150505.561285879,220227.353105332 150406.434743975)'::geometry),0.0001));
 SELECT 'npoints_is_five',ST_NumPoints(ST_GeomFromEWKT('CIRCULARSTRING(0 0,2 0, 2 1, 2 3, 4 3)'));
+
+-- See http://trac.osgeo.org/postgis/ticket/2410
+SELECT 'straight_curve',ST_AsText(ST_CurveToLine(ST_GeomFromEWKT('CIRCULARSTRING(0 0,1 0,2 0,3 0,4 0)')));
+
index 66b3c81561d6f11001d5ebd403496799581a1181..16907353a015635cc144b9f04e35df4e71530b27 100644 (file)
@@ -106,3 +106,4 @@ public.circularstring.the_geom_3dm effectively removed.
 public.circularstring.the_geom_2d effectively removed.
 POLYGON((220187.3821 150406.4347,220187.3821 150506.7171,220288.8159 150506.7171,220288.8159 150406.4347,220187.3821 150406.4347))
 npoints_is_five|5
+straight_curve|LINESTRING(0 0,1 0,2 0,3 0,4 0)