[SCM] PostGIS branch master updated. 3.4.0rc1-954-gbccab952f

git at osgeo.org git at osgeo.org
Wed Feb 28 15:28:05 PST 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  bccab952f00696d5a48e9eb495e827825eda23a2 (commit)
      from  0fed221e6c3afc73dcb4da1fff20961cf3108b30 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bccab952f00696d5a48e9eb495e827825eda23a2
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Feb 28 15:27:47 2024 -0800

    ST_3DDistance on segments with identical start, references #5589

diff --git a/liblwgeom/liblwgeom_internal.h b/liblwgeom/liblwgeom_internal.h
index dd2398b59..5428d1f24 100644
--- a/liblwgeom/liblwgeom_internal.h
+++ b/liblwgeom/liblwgeom_internal.h
@@ -251,6 +251,7 @@ void decode_geohash_bbox(char *geohash, double *lat, double *lon, int precision)
 */
 int p4d_same(const POINT4D *p1, const POINT4D *p2);
 int p3d_same(const POINT3D *p1, const POINT3D *p2);
+int p3dz_same(const POINT3DZ *p1, const POINT3DZ *p2);
 int p2d_same(const POINT2D *p1, const POINT2D *p2);
 
 /*
diff --git a/liblwgeom/lwalgorithm.c b/liblwgeom/lwalgorithm.c
index a2220048c..a60d0b0f2 100644
--- a/liblwgeom/lwalgorithm.c
+++ b/liblwgeom/lwalgorithm.c
@@ -45,6 +45,14 @@ p3d_same(const POINT3D *p1, const POINT3D *p2)
 	    && FP_EQUALS(p1->z, p2->z);
 }
 
+int
+p3dz_same(const POINT3DZ *p1, const POINT3DZ *p2)
+{
+	return FP_EQUALS(p1->x, p2->x)
+	    && FP_EQUALS(p1->y, p2->y)
+	    && FP_EQUALS(p1->z, p2->z);
+}
+
 int
 p2d_same(const POINT2D *p1, const POINT2D *p2)
 {
diff --git a/liblwgeom/measures3d.c b/liblwgeom/measures3d.c
index 6f2996be5..e304e348f 100644
--- a/liblwgeom/measures3d.c
+++ b/liblwgeom/measures3d.c
@@ -31,7 +31,7 @@
 #include "lwgeom_log.h"
 
 static inline int
-get_3dvector_from_points(POINT3DZ *p1, POINT3DZ *p2, VECTOR3D *v)
+get_3dvector_from_points(const POINT3DZ *p1, const POINT3DZ *p2, VECTOR3D *v)
 {
 	v->x = p2->x - p1->x;
 	v->y = p2->y - p1->y;
@@ -41,7 +41,7 @@ get_3dvector_from_points(POINT3DZ *p1, POINT3DZ *p2, VECTOR3D *v)
 }
 
 static inline int
-get_3dcross_product(VECTOR3D *v1, VECTOR3D *v2, VECTOR3D *v)
+get_3dcross_product(const VECTOR3D *v1, const VECTOR3D *v2, VECTOR3D *v)
 {
 	v->x = (v1->y * v2->z) - (v1->z * v2->y);
 	v->y = (v1->z * v2->x) - (v1->x * v2->z);
@@ -50,6 +50,40 @@ get_3dcross_product(VECTOR3D *v1, VECTOR3D *v2, VECTOR3D *v)
 	return (!FP_IS_ZERO(v->x) || !FP_IS_ZERO(v->y) || !FP_IS_ZERO(v->z));
 }
 
+/**
+Finds a point on a plane from where the original point is perpendicular to the plane
+*/
+static double
+project_point_on_plane(const POINT3DZ *p, PLANE3D *pl, POINT3DZ *p0)
+{
+	/*In our plane definition we have a point on the plane and a normal vector (pl.pv), perpendicular to the plane
+	this vector will be parallel to the line between our inputted point above the plane and the point we are
+	searching for on the plane. So, we already have a direction from p to find p0, but we don't know the distance.
+	*/
+
+	VECTOR3D v1;
+	double f;
+
+	if (!get_3dvector_from_points(&(pl->pop), p, &v1))
+		return 0.0;
+
+	f = DOT(pl->pv, v1);
+	if (FP_IS_ZERO(f))
+	{
+		/* Point is in the plane */
+		*p0 = *p;
+		return 0;
+	}
+
+	f = -f / DOT(pl->pv, pl->pv);
+
+	p0->x = p->x + pl->pv.x * f;
+	p0->y = p->y + pl->pv.y * f;
+	p0->z = p->z + pl->pv.z * f;
+
+	return f;
+}
+
 /**
 This function is used to create a vertical line used for cases where one if the
 geometries lacks z-values. The vertical line crosses the 2d point that is closest
@@ -702,7 +736,7 @@ So far the only way to do 3D-calculations
 point to point calculation
 */
 int
-lw_dist3d_point_point(LWPOINT *point1, LWPOINT *point2, DISTPTS3D *dl)
+lw_dist3d_point_point(const LWPOINT *point1, const LWPOINT *point2, DISTPTS3D *dl)
 {
 	POINT3DZ p1;
 	POINT3DZ p2;
@@ -718,7 +752,7 @@ lw_dist3d_point_point(LWPOINT *point1, LWPOINT *point2, DISTPTS3D *dl)
 point to line calculation
 */
 int
-lw_dist3d_point_line(LWPOINT *point, LWLINE *line, DISTPTS3D *dl)
+lw_dist3d_point_line(const LWPOINT *point, const LWLINE *line, DISTPTS3D *dl)
 {
 	POINT3DZ p;
 	POINTARRAY *pa = line->points;
@@ -741,7 +775,7 @@ for max distance it is always point against boundary
 */
 
 int
-lw_dist3d_point_poly(LWPOINT *point, LWPOLY *poly, DISTPTS3D *dl)
+lw_dist3d_point_poly(const LWPOINT *point, const LWPOLY *poly, DISTPTS3D *dl)
 {
 	POINT3DZ p, projp; /*projp is "point projected on plane"*/
 	PLANE3D plane;
@@ -767,7 +801,7 @@ lw_dist3d_point_poly(LWPOINT *point, LWPOLY *poly, DISTPTS3D *dl)
 
 /* point to triangle calculation */
 int
-lw_dist3d_point_tri(LWPOINT *point, LWTRIANGLE *tri, DISTPTS3D *dl)
+lw_dist3d_point_tri(const LWPOINT *point, const LWTRIANGLE *tri, DISTPTS3D *dl)
 {
 	POINT3DZ p, projp; /*projp is "point projected on plane"*/
 	PLANE3D plane;
@@ -789,7 +823,7 @@ lw_dist3d_point_tri(LWPOINT *point, LWTRIANGLE *tri, DISTPTS3D *dl)
 
 /** line to line calculation */
 int
-lw_dist3d_line_line(LWLINE *line1, LWLINE *line2, DISTPTS3D *dl)
+lw_dist3d_line_line(const LWLINE *line1, const LWLINE *line2, DISTPTS3D *dl)
 {
 	POINTARRAY *pa1 = line1->points;
 	POINTARRAY *pa2 = line2->points;
@@ -800,7 +834,7 @@ lw_dist3d_line_line(LWLINE *line1, LWLINE *line2, DISTPTS3D *dl)
 
 /** line to polygon calculation */
 int
-lw_dist3d_line_poly(LWLINE *line, LWPOLY *poly, DISTPTS3D *dl)
+lw_dist3d_line_poly(const LWLINE *line, const LWPOLY *poly, DISTPTS3D *dl)
 {
 	PLANE3D plane;
 	LWDEBUG(2, "lw_dist3d_line_poly is called");
@@ -817,7 +851,7 @@ lw_dist3d_line_poly(LWLINE *line, LWPOLY *poly, DISTPTS3D *dl)
 
 /** line to triangle calculation */
 int
-lw_dist3d_line_tri(LWLINE *line, LWTRIANGLE *tri, DISTPTS3D *dl)
+lw_dist3d_line_tri(const LWLINE *line, const LWTRIANGLE *tri, DISTPTS3D *dl)
 {
 	PLANE3D plane;
 
@@ -833,7 +867,7 @@ lw_dist3d_line_tri(LWLINE *line, LWTRIANGLE *tri, DISTPTS3D *dl)
 
 /** polygon to polygon calculation */
 int
-lw_dist3d_poly_poly(LWPOLY *poly1, LWPOLY *poly2, DISTPTS3D *dl)
+lw_dist3d_poly_poly(const LWPOLY *poly1, const LWPOLY *poly2, DISTPTS3D *dl)
 {
 	PLANE3D plane1, plane2;
 	int planedef1, planedef2;
@@ -874,7 +908,7 @@ lw_dist3d_poly_poly(LWPOLY *poly1, LWPOLY *poly2, DISTPTS3D *dl)
 
 /** polygon to triangle calculation */
 int
-lw_dist3d_poly_tri(LWPOLY *poly, LWTRIANGLE *tri, DISTPTS3D *dl)
+lw_dist3d_poly_tri(const LWPOLY *poly, const LWTRIANGLE *tri, DISTPTS3D *dl)
 {
 	PLANE3D plane1, plane2;
 	int planedef1, planedef2;
@@ -915,7 +949,7 @@ lw_dist3d_poly_tri(LWPOLY *poly, LWTRIANGLE *tri, DISTPTS3D *dl)
 
 /** triangle to triangle calculation */
 int
-lw_dist3d_tri_tri(LWTRIANGLE *tri1, LWTRIANGLE *tri2, DISTPTS3D *dl)
+lw_dist3d_tri_tri(const LWTRIANGLE *tri1, const LWTRIANGLE *tri2, DISTPTS3D *dl)
 {
 	PLANE3D plane1, plane2;
 	int planedef1, planedef2;
@@ -959,7 +993,7 @@ lw_dist3d_tri_tri(LWTRIANGLE *tri1, LWTRIANGLE *tri2, DISTPTS3D *dl)
  * Returns distance between point and pointarray
  */
 int
-lw_dist3d_pt_ptarray(POINT3DZ *p, POINTARRAY *pa, DISTPTS3D *dl)
+lw_dist3d_pt_ptarray(const POINT3DZ *p, const POINTARRAY *pa, DISTPTS3D *dl)
 {
 	uint32_t t;
 	POINT3DZ start, end;
@@ -989,7 +1023,7 @@ If searching for min distance, this one finds the closest point on segment A-B f
 if searching for max distance it just sends p-A and p-B to pt-pt calculation
 */
 int
-lw_dist3d_pt_seg(POINT3DZ *p, POINT3DZ *A, POINT3DZ *B, DISTPTS3D *dl)
+lw_dist3d_pt_seg(const POINT3DZ *p, const POINT3DZ *A, const POINT3DZ *B, DISTPTS3D *dl)
 {
 	POINT3DZ c;
 	double r;
@@ -1045,7 +1079,7 @@ or most far away from each other
 depending on dl->mode (max or min)
 */
 int
-lw_dist3d_pt_pt(POINT3DZ *thep1, POINT3DZ *thep2, DISTPTS3D *dl)
+lw_dist3d_pt_pt(const POINT3DZ *thep1, const POINT3DZ *thep2, DISTPTS3D *dl)
 {
 	double dx = thep2->x - thep1->x;
 	double dy = thep2->y - thep1->y;
@@ -1085,7 +1119,7 @@ lw_dist3d_pt_pt(POINT3DZ *thep1, POINT3DZ *thep2, DISTPTS3D *dl)
 Finds all combinations of segments between two pointarrays
 */
 int
-lw_dist3d_ptarray_ptarray(POINTARRAY *l1, POINTARRAY *l2, DISTPTS3D *dl)
+lw_dist3d_ptarray_ptarray(const POINTARRAY *l1, const POINTARRAY *l2, DISTPTS3D *dl)
 {
 	uint32_t t, u;
 	POINT3DZ start, end;
@@ -1136,7 +1170,7 @@ lw_dist3d_ptarray_ptarray(POINTARRAY *l1, POINTARRAY *l2, DISTPTS3D *dl)
 Finds the two closest points on two linesegments
 */
 int
-lw_dist3d_seg_seg(POINT3DZ *s1p1, POINT3DZ *s1p2, POINT3DZ *s2p1, POINT3DZ *s2p2, DISTPTS3D *dl)
+lw_dist3d_seg_seg(const POINT3DZ *s1p1, const POINT3DZ *s1p2, const POINT3DZ *s2p1, const POINT3DZ *s2p2, DISTPTS3D *dl)
 {
 	VECTOR3D v1, v2, vl;
 	double s1k, s2k; /*two variables representing where on Line 1 (s1k) and where on Line 2 (s2k) a connecting line
@@ -1145,17 +1179,23 @@ lw_dist3d_seg_seg(POINT3DZ *s1p1, POINT3DZ *s1p2, POINT3DZ *s2p1, POINT3DZ *s2p2
 	double a, b, c, d, e, D;
 
 	/*s1p1 and s1p2 are the same point */
-	if ((s1p1->x == s1p2->x) && (s1p1->y == s1p2->y) && (s1p1->z == s1p2->z))
+	if (p3dz_same(s1p1, s1p2))
 	{
 		return lw_dist3d_pt_seg(s1p1, s2p1, s2p2, dl);
 	}
 	/*s2p1 and s2p2 are the same point */
-	if ((s2p1->x == s2p2->x) && (s2p1->y == s2p2->y) && (s2p1->z == s2p2->z))
+	if (p3dz_same(s2p1, s2p2))
 	{
 		dl->twisted = ((dl->twisted) * (-1));
 		return lw_dist3d_pt_seg(s2p1, s1p1, s1p2, dl);
 	}
-
+	/*s2p1 and s1p1 are the same point */
+	if (p3dz_same(s2p1, s1p1))
+	{
+		dl->distance = 0.0;
+		dl->p1 = dl->p2 = *s2p1;
+		return LW_TRUE;
+	}
 	/*
 		Here we use algorithm from softsurfer.com
 		that can be found here
@@ -1248,7 +1288,7 @@ If not we check from original point to the boundary.
 If the projected point is inside a hole of the polygon we check the distance to the boundary of that hole.
 */
 int
-lw_dist3d_pt_poly(POINT3DZ *p, LWPOLY *poly, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl)
+lw_dist3d_pt_poly(const POINT3DZ *p, const LWPOLY *poly, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl)
 {
 	uint32_t i;
 
@@ -1274,7 +1314,7 @@ lw_dist3d_pt_poly(POINT3DZ *p, LWPOLY *poly, PLANE3D *plane, POINT3DZ *projp, DI
 }
 
 int
-lw_dist3d_pt_tri(POINT3DZ *p, LWTRIANGLE *tri, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl)
+lw_dist3d_pt_tri(const POINT3DZ *p, const LWTRIANGLE *tri, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl)
 {
 	if (pt_in_ring_3d(projp, tri->points, plane))
 		/* if the projected point is inside the polygon the shortest distance is between that point and the
@@ -1290,7 +1330,7 @@ lw_dist3d_pt_tri(POINT3DZ *p, LWTRIANGLE *tri, PLANE3D *plane, POINT3DZ *projp,
 
 /** Computes pointarray to polygon distance */
 int
-lw_dist3d_ptarray_poly(POINTARRAY *pa, LWPOLY *poly, PLANE3D *plane, DISTPTS3D *dl)
+lw_dist3d_ptarray_poly(const POINTARRAY *pa, const LWPOLY *poly, PLANE3D *plane, DISTPTS3D *dl)
 {
 	uint32_t i, j, k;
 	double f, s1, s2;
@@ -1370,7 +1410,7 @@ lw_dist3d_ptarray_poly(POINTARRAY *pa, LWPOLY *poly, PLANE3D *plane, DISTPTS3D *
 
 /** Computes pointarray to triangle distance */
 int
-lw_dist3d_ptarray_tri(POINTARRAY *pa, LWTRIANGLE *tri, PLANE3D *plane, DISTPTS3D *dl)
+lw_dist3d_ptarray_tri(const POINTARRAY *pa, const LWTRIANGLE *tri, PLANE3D *plane, DISTPTS3D *dl)
 {
 	uint32_t i;
 	double f, s1, s2;
@@ -1448,7 +1488,7 @@ lw_dist3d_ptarray_tri(POINTARRAY *pa, LWTRIANGLE *tri, PLANE3D *plane, DISTPTS3D
  * We use [3] breaks to contemplate the special case of 3d triangles
  */
 int
-define_plane(POINTARRAY *pa, PLANE3D *pl)
+define_plane(const POINTARRAY *pa, PLANE3D *pl)
 {
 	const uint32_t POL_BREAKS = 3;
 
@@ -1516,40 +1556,6 @@ define_plane(POINTARRAY *pa, PLANE3D *pl)
 	return (!FP_IS_ZERO(pl->pv.x) || !FP_IS_ZERO(pl->pv.y) || !FP_IS_ZERO(pl->pv.z));
 }
 
-/**
-
-Finds a point on a plane from where the original point is perpendicular to the plane
-*/
-double
-project_point_on_plane(POINT3DZ *p, PLANE3D *pl, POINT3DZ *p0)
-{
-	/*In our plane definition we have a point on the plane and a normal vector (pl.pv), perpendicular to the plane
-	this vector will be parallel to the line between our inputted point above the plane and the point we are
-	searching for on the plane. So, we already have a direction from p to find p0, but we don't know the distance.
-	*/
-
-	VECTOR3D v1;
-	double f;
-
-	if (!get_3dvector_from_points(&(pl->pop), p, &v1))
-		return 0.0;
-
-	f = DOT(pl->pv, v1);
-	if (FP_IS_ZERO(f))
-	{
-		/* Point is in the plane */
-		*p0 = *p;
-		return 0;
-	}
-
-	f = -f / DOT(pl->pv, pl->pv);
-
-	p0->x = p->x + pl->pv.x * f;
-	p0->y = p->y + pl->pv.y * f;
-	p0->z = p->z + pl->pv.z * f;
-
-	return f;
-}
 
 /**
  * pt_in_ring_3d(): crossing number test for a point in a polygon
diff --git a/liblwgeom/measures3d.h b/liblwgeom/measures3d.h
index fd79084c9..f71608fe7 100644
--- a/liblwgeom/measures3d.h
+++ b/liblwgeom/measures3d.h
@@ -74,34 +74,33 @@ int lw_dist3d_distribute_fast(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS3D
 /*
 Brute force functions
 */
-int lw_dist3d_pt_ptarray(POINT3DZ *p, POINTARRAY *pa, DISTPTS3D *dl);
-int lw_dist3d_point_point(LWPOINT *point1, LWPOINT *point2, DISTPTS3D *dl);
-int lw_dist3d_point_line(LWPOINT *point, LWLINE *line, DISTPTS3D *dl);
-int lw_dist3d_point_poly(LWPOINT *point, LWPOLY *poly, DISTPTS3D *dl);
-int lw_dist3d_point_tri(LWPOINT *point, LWTRIANGLE *tri, DISTPTS3D *dl);
+int lw_dist3d_pt_ptarray(const POINT3DZ *p, const POINTARRAY *pa, DISTPTS3D *dl);
+int lw_dist3d_point_point(const LWPOINT *point1, const LWPOINT *point2, DISTPTS3D *dl);
+int lw_dist3d_point_line(const LWPOINT *point, const LWLINE *line, DISTPTS3D *dl);
+int lw_dist3d_point_poly(const LWPOINT *point, const LWPOLY *poly, DISTPTS3D *dl);
+int lw_dist3d_point_tri(const LWPOINT *point, const LWTRIANGLE *tri, DISTPTS3D *dl);
 
-int lw_dist3d_line_line(LWLINE *line1, LWLINE *line2, DISTPTS3D *dl);
-int lw_dist3d_line_poly(LWLINE *line, LWPOLY *poly, DISTPTS3D *dl);
-int lw_dist3d_line_tri(LWLINE *line, LWTRIANGLE *tri, DISTPTS3D *dl);
+int lw_dist3d_line_line(const LWLINE *line1, const LWLINE *line2, DISTPTS3D *dl);
+int lw_dist3d_line_poly(const LWLINE *line, const LWPOLY *poly, DISTPTS3D *dl);
+int lw_dist3d_line_tri(const LWLINE *line, const LWTRIANGLE *tri, DISTPTS3D *dl);
 
-int lw_dist3d_poly_poly(LWPOLY *poly1, LWPOLY *poly2, DISTPTS3D *dl);
-int lw_dist3d_poly_tri(LWPOLY *poly, LWTRIANGLE *tri, DISTPTS3D *dl);
+int lw_dist3d_poly_poly(const LWPOLY *poly1, const LWPOLY *poly2, DISTPTS3D *dl);
+int lw_dist3d_poly_tri(const LWPOLY *poly, const LWTRIANGLE *tri, DISTPTS3D *dl);
 
-int lw_dist3d_tri_tri(LWTRIANGLE *tri1, LWTRIANGLE *tri2, DISTPTS3D *dl);
+int lw_dist3d_tri_tri(const LWTRIANGLE *tri1, const LWTRIANGLE *tri2, DISTPTS3D *dl);
 
-int lw_dist3d_pt_pt(POINT3DZ *p1, POINT3DZ *p2, DISTPTS3D *dl);
-int lw_dist3d_pt_seg(POINT3DZ *p, POINT3DZ *A, POINT3DZ *B, DISTPTS3D *dl);
-int lw_dist3d_pt_poly(POINT3DZ *p, LWPOLY *poly, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl);
-int lw_dist3d_pt_tri(POINT3DZ *p, LWTRIANGLE *tri, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl);
+int lw_dist3d_pt_pt(const POINT3DZ *p1, const POINT3DZ *p2, DISTPTS3D *dl);
+int lw_dist3d_pt_seg(const POINT3DZ *p, const POINT3DZ *A, const POINT3DZ *B, DISTPTS3D *dl);
+int lw_dist3d_pt_poly(const POINT3DZ *p, const LWPOLY *poly, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl);
+int lw_dist3d_pt_tri(const POINT3DZ *p, const LWTRIANGLE *tri, PLANE3D *plane, POINT3DZ *projp, DISTPTS3D *dl);
 
-int lw_dist3d_seg_seg(POINT3DZ *A, POINT3DZ *B, POINT3DZ *C, POINT3DZ *D, DISTPTS3D *dl);
+int lw_dist3d_seg_seg(const POINT3DZ *A, const POINT3DZ *B, const POINT3DZ *C, const POINT3DZ *D, DISTPTS3D *dl);
 
-int lw_dist3d_ptarray_ptarray(POINTARRAY *l1, POINTARRAY *l2, DISTPTS3D *dl);
-int lw_dist3d_ptarray_poly(POINTARRAY *pa, LWPOLY *poly, PLANE3D *plane, DISTPTS3D *dl);
-int lw_dist3d_ptarray_tri(POINTARRAY *pa, LWTRIANGLE *tri, PLANE3D *plane, DISTPTS3D *dl);
+int lw_dist3d_ptarray_ptarray(const POINTARRAY *l1, const POINTARRAY *l2, DISTPTS3D *dl);
+int lw_dist3d_ptarray_poly(const POINTARRAY *pa, const LWPOLY *poly, PLANE3D *plane, DISTPTS3D *dl);
+int lw_dist3d_ptarray_tri(const POINTARRAY *pa, const LWTRIANGLE *tri, PLANE3D *plane, DISTPTS3D *dl);
 
-double project_point_on_plane(POINT3DZ *p, PLANE3D *pl, POINT3DZ *p0);
-int define_plane(POINTARRAY *pa, PLANE3D *pl);
+int define_plane(const POINTARRAY *pa, PLANE3D *pl);
 int pt_in_ring_3d(const POINT3DZ *p, const POINTARRAY *ring, PLANE3D *plane);
 
 /*
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index a7ef7bae4..3c2bbe0a7 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1541,7 +1541,7 @@ FROM (VALUES
 SELECT '#5597', ST_AsGeoJSON(r.*) from (values (null::geometry)) as r(geom);
 
 SELECT '#5677',
- st_asewkt(
+ st_asewkt(st_normalize(
    st_union(
      array[
        st_geomfromtext(
@@ -1551,5 +1551,5 @@ SELECT '#5677',
          )'
        )
      ]
-   )
+   ))
  );
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index a374322d5..8d8161c29 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -478,4 +478,4 @@ ERROR:  Geometry contains invalid coordinates
 #5639|fullywithin6|f
 #5639|fullywithin7|t
 #5597|{"type": "Feature", "geometry": null, "properties": {}}
-#5677|POLYGON((10 0,0 0,0 10,20 22,20 30,30 30,30 20,22 20,10 0))
+#5677|POLYGON((0 0,0 10,20 22,20 30,30 30,30 20,22 20,10 0,0 0))

-----------------------------------------------------------------------

Summary of changes:
 liblwgeom/liblwgeom_internal.h |   1 +
 liblwgeom/lwalgorithm.c        |   8 +++
 liblwgeom/measures3d.c         | 124 +++++++++++++++++++++--------------------
 liblwgeom/measures3d.h         |  41 +++++++-------
 regress/core/tickets.sql       |   4 +-
 regress/core/tickets_expected  |   2 +-
 6 files changed, 97 insertions(+), 83 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list