[postgis-tickets] r17186 - Avoid final point duplicates for circle stroking

Paul Ramsey pramsey at cleverelephant.ca
Fri Jan 18 12:43:47 PST 2019


Author: pramsey
Date: 2019-01-18 12:43:47 -0800 (Fri, 18 Jan 2019)
New Revision: 17186

Modified:
   branches/2.5/NEWS
   branches/2.5/liblwgeom/lwstroke.c
Log:
Avoid final point duplicates for circle stroking
References #4283




Modified: branches/2.5/NEWS
===================================================================
--- branches/2.5/NEWS	2019-01-18 20:41:13 UTC (rev 17185)
+++ branches/2.5/NEWS	2019-01-18 20:43:47 UTC (rev 17186)
@@ -42,6 +42,12 @@
 
   - #4296, Use `server_version_num` instead of parsing `version()` (Raúl Marín)
 
+  - #4290, More robust geography distance (Paul Ramsey)
+
+  - #4283, Avoid final point duplicates for circle stroking
+
+
+
 PostGIS 2.5.1
 2018/11/18
 

Modified: branches/2.5/liblwgeom/lwstroke.c
===================================================================
--- branches/2.5/liblwgeom/lwstroke.c	2019-01-18 20:41:13 UTC (rev 17185)
+++ branches/2.5/liblwgeom/lwstroke.c	2019-01-18 20:43:47 UTC (rev 17186)
@@ -345,9 +345,9 @@
 	/* Override angles for circle case */
 	if( is_circle )
 	{
+		increment = fabs(increment);
 		a3 = a1 + 2.0 * M_PI;
 		a2 = a1 + M_PI;
-		increment = fabs(increment);
 		clockwise = LW_FALSE;
 	}
 
@@ -380,7 +380,15 @@
 		angle_shift = 0;
 	}
 
-	if ( reverse ) {{
+	/* Ensure the final point is EXACTLY the same as the first for the circular case */
+	if ( is_circle )
+	{
+		ptarray_remove_point(pa, pa->npoints - 1);
+		ptarray_append_point(pa, p1, LW_FALSE);
+	}
+
+	if ( reverse )
+	{
 		int i;
 		ptarray_append_point(to, p3, LW_FALSE);
 		for ( i=pa->npoints; i>0; i-- ) {
@@ -388,7 +396,7 @@
 			ptarray_append_point(to, &pt, LW_FALSE);
 		}
 		ptarray_free(pa);
-	}}
+	}
 
 	return points_added;
 }
@@ -447,7 +455,7 @@
 		}
 	}
 	getPoint4d_p(icurve->points, icurve->points->npoints-1, &p1);
-	ptarray_append_point(ptarray, &p1, LW_TRUE);
+	ptarray_append_point(ptarray, &p1, LW_FALSE);
 
 	oline = lwline_construct(icurve->srid, NULL, ptarray);
 	return oline;



More information about the postgis-tickets mailing list