[postgis-tickets] [SCM] PostGIS branch master updated. 3.2.0-13-g5f0640152

git at osgeo.org git at osgeo.org
Sun Dec 26 13:59:49 PST 2021


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  5f0640152cecc35712c7818011a8f4e0c59feab7 (commit)
       via  f52d3daa6b5bdafe67f1fa161ee025316de9013f (commit)
      from  96906a919d3cdeac3125ed2cdb224cb247b2884a (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 5f0640152cecc35712c7818011a8f4e0c59feab7
Author: Regina Obe <lr at pcorp.us>
Date:   Sun Dec 26 16:57:50 2021 -0500

    Add ST_3DConvexHull. Closes #5037 Closes
    https://git.osgeo.org/gitea/postgis/postgis/pulls/62

diff --git a/NEWS b/NEWS
index d05ba5f62..c710b74de 100644
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,7 @@ PostGIS 3.3.0dev
   - ...
 
  * Enhancements *
-  - ...
+  - #5037, add convexhull 3D (Loïc Bartoletti)
 
 PostGIS 3.2.0 (Olivier Courtin Edition)
 2021/12/17

commit f52d3daa6b5bdafe67f1fa161ee025316de9013f
Author: Loïc Bartoletti <loic.bartoletti at oslandia.com>
Date:   Mon Nov 15 21:54:02 2021 +0100

    add convexhull3D

diff --git a/doc/reference_sfcgal.xml b/doc/reference_sfcgal.xml
index b4a0afdb8..a917e4189 100644
--- a/doc/reference_sfcgal.xml
+++ b/doc/reference_sfcgal.xml
@@ -1105,5 +1105,39 @@ FROM ( SELECT ST_Extrude(ST_Buffer(ST_GeomFromText('POINT(100 90)'),
 	</refentry>
 
 
+	<refentry id="ST_3DConvexHull">
+	  <refnamediv>
+		<refname>ST_3DConvexHull</refname>
+
+		<refpurpose>Computes the 3D convex hull of a geometry.</refpurpose>
+	  </refnamediv>
+
+	  <refsynopsisdiv>
+		<funcsynopsis>
+		  <funcprototype>
+			<funcdef>geometry<function>ST_3DConvexHull</function></funcdef>
+			<paramdef><type>geometry</type> <parameter>geom1</parameter></paramdef>
+		  </funcprototype>
+		</funcsynopsis>
+	  </refsynopsisdiv>
+
+	  <refsection>
+		<title>Description</title>
+
+		<para>Availability: 3.3.0</para>
+		<para>&sfcgal_required;</para>
+		<para>&Z_support;</para>
+		<para>&P_support;</para>
+		<para>&T_support;</para>
+	  </refsection>
+
+	  <refsection>
+	      <title>Example</title>
+          <programlisting>SELECT ST_AsText(ST_3DConvexHull('MULTIPOINTZ(0 0 5, 1 5 3, 5 7 6, 9 5 3 , 5 7 5, 6 3 5)')) As 3DHull;</programlisting>
+          <para>ST_AsText output</para>
+          <screen>POLYHEDRALSURFACE Z (((1 5 3,9 5 3,0 0 5,1 5 3)),((1 5 3,0 0 5,5 7 6,1 5 3)),((5 7 6,5 7 5,1 5 3,5 7 6)),((0 0 5,6 3 5,5 7 6,0 0 5)),((6 3 5,9 5 3,5 7 6,6 3 5)),((0 0 5,9 5 3,6 3 5,0 0 5)),((9 5 3,5 7 5,5 7 6,9 5 3)),((1 5 3,5 7 5,9 5 3,1 5 3)))</screen>
+	  </refsection>
+
+	</refentry>
 
 </sect1>
diff --git a/sfcgal/lwgeom_sfcgal.c b/sfcgal/lwgeom_sfcgal.c
index 3e3729bc5..23cfc783b 100644
--- a/sfcgal/lwgeom_sfcgal.c
+++ b/sfcgal/lwgeom_sfcgal.c
@@ -117,6 +117,7 @@ Datum sfcgal_minkowski_sum(PG_FUNCTION_ARGS);
 Datum sfcgal_make_solid(PG_FUNCTION_ARGS);
 Datum sfcgal_is_solid(PG_FUNCTION_ARGS);
 Datum postgis_sfcgal_noop(PG_FUNCTION_ARGS);
+Datum sfcgal_convexhull3D(PG_FUNCTION_ARGS);
 
 GSERIALIZED *geometry_serialize(LWGEOM *lwgeom);
 char *text_to_cstring(const text *textptr);
@@ -617,3 +618,27 @@ Datum postgis_sfcgal_noop(PG_FUNCTION_ARGS)
 	PG_FREE_IF_COPY(input, 0);
 	PG_RETURN_POINTER(output);
 }
+
+PG_FUNCTION_INFO_V1(sfcgal_convexhull3D);
+Datum sfcgal_convexhull3D(PG_FUNCTION_ARGS)
+{
+	GSERIALIZED *input, *output;
+	sfcgal_geometry_t *geom;
+	sfcgal_geometry_t *result;
+	srid_t srid;
+
+	sfcgal_postgis_init();
+
+	input = PG_GETARG_GSERIALIZED_P(0);
+	srid = gserialized_get_srid(input);
+	geom = POSTGIS2SFCGALGeometry(input);
+	PG_FREE_IF_COPY(input, 0);
+
+	result = sfcgal_geometry_convexhull_3d(geom);
+	sfcgal_geometry_delete(geom);
+
+	output = SFCGALGeometry2POSTGIS(result, 0, srid);
+	sfcgal_geometry_delete(result);
+
+	PG_RETURN_POINTER(output);
+}
diff --git a/sfcgal/lwgeom_sfcgal.h b/sfcgal/lwgeom_sfcgal.h
index e3ffec2af..7340cf10e 100644
--- a/sfcgal/lwgeom_sfcgal.h
+++ b/sfcgal/lwgeom_sfcgal.h
@@ -49,6 +49,7 @@ Datum sfcgal_distance(PG_FUNCTION_ARGS);
 Datum sfcgal_distance3D(PG_FUNCTION_ARGS);
 Datum sfcgal_make_solid(PG_FUNCTION_ARGS);
 Datum sfcgal_is_solid(PG_FUNCTION_ARGS);
+Datum sfcgal_convexhull3D(PG_FUNCTION_ARGS);
 
 /* Initialize sfcgal with PostGIS error handlers */
 void sfcgal_postgis_init(void);
diff --git a/sfcgal/regress/regress_sfcgal.sql b/sfcgal/regress/regress_sfcgal.sql
index 6853ec4d3..a337793b6 100644
--- a/sfcgal/regress/regress_sfcgal.sql
+++ b/sfcgal/regress/regress_sfcgal.sql
@@ -31,3 +31,4 @@ SELECT 'ST_MinkowskiSum', ST_AsText(ST_MinkowskiSum('LINESTRING(0 0,4 0)','POLYG
 SELECT 'ST_StraightSkeleton', ST_AsText(ST_StraightSkeleton('POLYGON((1 1,2 1,2 2,1 2,1 1))'));
 SELECT 'ST_ConstrainedDelaunayTriangles', ST_AsText(ST_ConstrainedDelaunayTriangles('GEOMETRYCOLLECTION(POINT(0 0), POLYGON((2 2, 2 -2, 4 0, 2 2)))'));
 SELECT 'postgis_sfcgal_noop', ST_NPoints(postgis_sfcgal_noop(ST_Buffer('POINT(0 0)', 5)));
+SELECT 'ST_3DConvexHull', ST_AsText(ST_3DConvexHull('MULTIPOINTZ(0 0 5, 1 5 3, 5 7 6, 9 5 3 , 5 7 5, 6 3 5)'));
diff --git a/sfcgal/regress/regress_sfcgal_expected b/sfcgal/regress/regress_sfcgal_expected
index a67ed5660..347a8e749 100644
--- a/sfcgal/regress/regress_sfcgal_expected
+++ b/sfcgal/regress/regress_sfcgal_expected
@@ -11,3 +11,4 @@ ST_MinkowskiSum|MULTIPOLYGON(((0 0,1 0,5 0,5 1,4 1,0 1,0 0)))
 ST_StraightSkeleton|MULTILINESTRING((1 1,1.5 1.5),(2 1,1.5 1.5),(2 2,1.5 1.5),(1 2,1.5 1.5))
 ST_ConstrainedDelaunayTriangles|TIN(((4 0,2 2,2 -2,4 0)),((2 2,0 0,2 -2,2 2)))
 postgis_sfcgal_noop|33
+ST_3DConvexHull|POLYHEDRALSURFACE Z (((1 5 3,9 5 3,0 0 5,1 5 3)),((1 5 3,0 0 5,5 7 6,1 5 3)),((5 7 6,5 7 5,1 5 3,5 7 6)),((0 0 5,6 3 5,5 7 6,0 0 5)),((6 3 5,9 5 3,5 7 6,6 3 5)),((0 0 5,9 5 3,6 3 5,0 0 5)),((9 5 3,5 7 5,5 7 6,9 5 3)),((1 5 3,5 7 5,9 5 3,1 5 3)))
diff --git a/sfcgal/sfcgal.sql.in b/sfcgal/sfcgal.sql.in
index 5d8a629f3..d5af9de3d 100644
--- a/sfcgal/sfcgal.sql.in
+++ b/sfcgal/sfcgal.sql.in
@@ -147,3 +147,11 @@ CREATE OR REPLACE FUNCTION ST_ConstrainedDelaunayTriangles(geometry)
        LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
        COST 100;
 COMMIT;
+
+-- Availability: 3.3.0
+CREATE OR REPLACE FUNCTION ST_3DConvexHull(geometry)
+       RETURNS geometry
+       AS 'MODULE_PATHNAME', 'sfcgal_convexhull3D'
+       LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
+       COST 100;
+COMMIT;

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

Summary of changes:
 NEWS                                   |  2 +-
 doc/reference_sfcgal.xml               | 34 ++++++++++++++++++++++++++++++++++
 sfcgal/lwgeom_sfcgal.c                 | 25 +++++++++++++++++++++++++
 sfcgal/lwgeom_sfcgal.h                 |  1 +
 sfcgal/regress/regress_sfcgal.sql      |  1 +
 sfcgal/regress/regress_sfcgal_expected |  1 +
 sfcgal/sfcgal.sql.in                   |  8 ++++++++
 7 files changed, 71 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list