[postgis-tickets] r16163 - Use original vertex values where available in contructing new pointarray (references #3941)

Paul Ramsey pramsey at cleverelephant.ca
Mon Dec 18 03:53:53 PST 2017


Author: pramsey
Date: 2017-12-18 15:53:53 -0800 (Mon, 18 Dec 2017)
New Revision: 16163

Modified:
   branches/2.4/liblwgeom/lwgeodetic.c
Log:
Use original vertex values where available in contructing new pointarray (references #3941)



Modified: branches/2.4/liblwgeom/lwgeodetic.c
===================================================================
--- branches/2.4/liblwgeom/lwgeodetic.c	2017-12-18 23:49:55 UTC (rev 16162)
+++ branches/2.4/liblwgeom/lwgeodetic.c	2017-12-18 23:53:53 UTC (rev 16163)
@@ -1545,17 +1545,17 @@
 	double d, double max_seg_length, /* current segment length and segment limit */
 	POINTARRAY *pa) /* write out results here */
 {
+	GEOGRAPHIC_POINT g;
 	/* Reached the terminal leaf in recursion. Add */
 	/* the left-most point to the pointarray here */
 	/* We recurse down the left side first, so outputs should */
 	/* end up added to the array in order this way */
 	if (d <= max_seg_length)
 	{
-		GEOGRAPHIC_POINT g;
 		POINT4D p;
 		cart2geog(p1, &g);
-		p.x = rad2deg(g.lon);
-		p.y = rad2deg(g.lat);
+		p.x = v1->x;
+		p.y = v1->y;
 		p.z = v1->z;
 		p.m = v1->m;
 		return ptarray_append_point(pa, &p, LW_FALSE);
@@ -1571,8 +1571,10 @@
 		normalize(&mid);
 
 		/* Calculate z/m mid-values */
-		/* (ignore x/y, we get those from the 3-space calculations) */
 		POINT4D midv;
+		cart2geog(&mid, &g);
+		midv.x = rad2deg(g.lon);
+		midv.y = rad2deg(g.lat);
 		midv.z = (v1->z + v2->z) / 2.0;
 		midv.m = (v1->m + v2->m) / 2.0;
 		/* Recurse on the left first */



More information about the postgis-tickets mailing list