[postgis-tickets] r17448 - [sfcgal] Expose ST_ConstrainedDelaunayTriangles
Darafei
komzpa at gmail.com
Fri May 31 12:59:40 PDT 2019
Author: komzpa
Date: 2019-05-31 12:59:40 -0700 (Fri, 31 May 2019)
New Revision: 17448
Added:
trunk/doc/html/image_src/st_constraineddelaunaytriangles01.wkt
trunk/doc/html/image_src/st_constraineddelaunaytriangles02.wkt
Modified:
trunk/NEWS
trunk/doc/html/image_src/Makefile.in
trunk/doc/html/image_src/styles.conf
trunk/doc/reference_processing.xml
trunk/doc/reference_sfcgal.xml
trunk/postgis/lwgeom_sfcgal.c
trunk/postgis/sfcgal.sql.in
trunk/regress/sfcgal/regress_sfcgal.sql
trunk/regress/sfcgal/regress_sfcgal_expected
Log:
[sfcgal] Expose ST_ConstrainedDelaunayTriangles
Closes #4198
Closes https://github.com/postgis/postgis/pull/405
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2019-05-29 13:57:59 UTC (rev 17447)
+++ trunk/NEWS 2019-05-31 19:59:40 UTC (rev 17448)
@@ -128,6 +128,8 @@
- #4368, Reorder LWGEOM struct members to minimize extra padding (Raúl Marín)
- #4141, Use uint64 to handle row counts in the topology extension (Raúl Marín)
- #4225, Upgrade tiger to use tiger 2018 census files
+ - #4198, Add ST_ConstrainedDelaunayTriangles SFCGAL function (Darafei
+ Praliaskouski)
PostGIS 2.5.0
Modified: trunk/doc/html/image_src/Makefile.in
===================================================================
--- trunk/doc/html/image_src/Makefile.in 2019-05-29 13:57:59 UTC (rev 17447)
+++ trunk/doc/html/image_src/Makefile.in 2019-05-31 19:59:40 UTC (rev 17448)
@@ -67,6 +67,8 @@
../images/st_crosses02.png \
../images/st_crosses03.png \
../images/st_crosses04.png \
+ ../images/st_constraineddelaunaytriangles01.png \
+ ../images/st_constraineddelaunaytriangles02.png \
../images/st_delaunaytriangles04.png \
../images/st_difference01.png \
../images/st_dumppoints01.png \
Added: trunk/doc/html/image_src/st_constraineddelaunaytriangles01.wkt
===================================================================
--- trunk/doc/html/image_src/st_constraineddelaunaytriangles01.wkt (rev 0)
+++ trunk/doc/html/image_src/st_constraineddelaunaytriangles01.wkt 2019-05-31 19:59:40 UTC (rev 17448)
@@ -0,0 +1,2 @@
+Style1;MULTIPOLYGON(((175 150,125 100,50 60,20 40,175 150)),((130 170,130 166,128 162,127 159,124 156,121 153,118 152,114 150,110 150,106 150,102 152,99 153,96 156,93 159,92 162,90 166,90 170,90 174,92 178,93 181,96 184,99 187,102 188,106 190,110 190,114 190,118 188,121 187,124 184,127 181,128 178,130 174,130 170)))
+StrokedPoly1;MULTILINESTRING((20 40,125 100,50 60,20 40),(125 100,175 150,50 60,125 100),(110 150,106 150,20 40,110 150),(175 150,20 40,50 60,175 150),(114 150,118 152,110 150,114 150),(127 159,130 166,130 170,127 159),(175 150,130 170,130 166,175 150),(127 159,128 162,130 166,127 159),(175 150,130 166,128 162,175 150),(121 153,127 159,130 170,121 153),(175 150,128 162,127 159,175 150),(175 150,124 156,121 153,175 150),(175 150,127 159,124 156,175 150),(175 150,121 153,118 152,175 150),(124 156,127 159,121 153,124 156),(175 150,118 152,114 150,175 150),(121 153,130 170,124 184,121 153),(175 150,114 150,20 40,175 150),(118 152,121 153,110 150,118 152),(114 150,110 150,20 40,114 150),(106 150,102 152,20 40,106 150),(121 153,106 150,110 150,121 153),(102 152,99 153,20 40,102 152),(121 153,102 152,106 150,121 153),(99 153,96 156,20 40,99 153),(121 153,93 181,102 152,121 153),(96 156,93 159,20 40,96 156),(102 152,96 156,99 153,102 152),(93 159,92 162,20 40,93 159),(102 152,93 181,96 156,
102 152),(92 162,90 166,20 40,92 162),(96 156,90 166,93 159,96 156),(90 166,90 170,20 40,90 166),(93 159,90 166,92 162,93 159),(90 170,90 174,20 40,90 170),(96 156,90 174,90 166,96 156),(90 174,92 178,20 40,90 174),(90 166,90 174,90 166),(96 156,93 181,90 174,96 156),(90 174,93 181,92 178,90 174),(121 153,118 188,93 181,121 153),(93 181,99 187,93 181),(124 184,175 150,121 187,124 184),(93 181,102 188,99 187,93 181),(93 181,118 188,102 188,93 181),(102 188,118 188,106 190,102 188),(106 190,114 190,106 190),(106 190,118 188,114 190,106 190),(121 153,124 184,118 188,121 153),(118 188,124 184,121 187,118 188),(127 181,175 150,124 184,127 181),(130 170,128 178,124 184,130 170),(128 178,175 150,127 181,128 178),(124 184,128 178,127 181,124 184),(130 174,175 150,128 178,130 174),(130 170,130 174,128 178,130 170),(130 170,175 150,130 174,130 170))
Added: trunk/doc/html/image_src/st_constraineddelaunaytriangles02.wkt
===================================================================
--- trunk/doc/html/image_src/st_constraineddelaunaytriangles02.wkt (rev 0)
+++ trunk/doc/html/image_src/st_constraineddelaunaytriangles02.wkt 2019-05-31 19:59:40 UTC (rev 17448)
@@ -0,0 +1,2 @@
+Style1;MULTIPOLYGON(((175 150,125 100,50 60,20 40,175 150)),((130 170,130 166,128 162,127 159,124 156,121 153,118 152,114 150,110 150,106 150,102 152,99 153,96 156,93 159,92 162,90 166,90 170,90 174,92 178,93 181,96 184,99 187,102 188,106 190,110 190,114 190,118 188,121 187,124 184,127 181,128 178,130 174,130 170)))
+StrokedPoly1;MULTILINESTRING((121 187,175 150),(118 188,121 187),(114 190,118 188),(110 190,114 190),(106 190,110 190),(102 188,106 190),(99 187,102 188),(96 184,99 187),(93 181,96 184),(92 178,93 181),(20 40,92 178),(20 40,125 100),(125 100,175 150),(124 156,125 100),(124 156,175 150),(124 156,127 159),(127 159,175 150),(127 159,128 162),(128 162,175 150),(128 162,130 166),(130 166,175 150),(130 166,130 170),(130 170,175 150),(130 174,130 170),(130 174,175 150),(128 178,130 174),(128 178,175 150),(127 181,128 178),(127 181,175 150),(124 184,127 181),(124 184,175 150),(121 187,124 184),(118 188,124 184),(121 153,124 184),(118 188,121 153),(93 181,121 153),(93 181,118 188),(93 181,102 188),(102 188,118 188),(93 181,99 187),(90 174,121 153),(90 174,93 181),(90 174,92 178),(20 40,90 174),(90 170,90 174),(20 40,90 170),(90 170,90 166),(20 40,90 166),(50 60,90 166),(20 40,50 60),(50 60,125 100),(50 60,99 153),(99 153,125 100),(99 153,102 152),(102 152,125 100),(102 152,106 150),(106 150,
125 100),(106 150,110 150),(110 150,125 100),(110 150,114 150),(114 150,125 100),(114 150,118 152),(118 152,125 100),(118 152,121 153),(121 153,125 100),(121 153,124 156),(121 153,127 159),(121 153,130 170),(127 159,130 170),(110 150,118 152),(110 150,121 153),(106 150,121 153),(102 152,121 153),(90 174,102 152),(96 156,102 152),(90 174,96 156),(93 159,96 156),(90 174,93 159),(90 170,93 159),(90 166,93 159),(92 162,93 159),(90 166,92 162),(50 60,92 162),(50 60,93 159),(50 60,96 156),(96 156,99 153),(124 184,130 170),(124 184,128 178),(128 178,130 170),(127 159,130 166),(106 190,118 188),(106 190,114 190))
Modified: trunk/doc/html/image_src/styles.conf
===================================================================
--- trunk/doc/html/image_src/styles.conf 2019-05-29 13:57:59 UTC (rev 17447)
+++ trunk/doc/html/image_src/styles.conf 2019-05-31 19:59:40 UTC (rev 17448)
@@ -167,8 +167,8 @@
styleName = StrokedPoly1
pointSize = 6
pointColor = "#00bfff"
-lineWidth = 7
-lineColor = "#00bfff"
+lineWidth = 1
+lineColor = "#000000"
polygonFillColor = "#00bfff"
polygonStrokeColor = "#000000"
polygonStrokeWidth = 1
Modified: trunk/doc/reference_processing.xml
===================================================================
--- trunk/doc/reference_processing.xml 2019-05-29 13:57:59 UTC (rev 17447)
+++ trunk/doc/reference_processing.xml 2019-05-31 19:59:40 UTC (rev 17448)
@@ -1236,7 +1236,7 @@
</refsection>
<refsection>
<title>See Also</title>
- <para><xref linkend="ST_ConcaveHull" />, <xref linkend="ST_Dump" />
+ <para><xref linkend="ST_ConstrainedDelaunayTriangles" />, <xref linkend="ST_ConcaveHull" />, <xref linkend="ST_Dump" />
</para>
</refsection>
</refentry>
Modified: trunk/doc/reference_sfcgal.xml
===================================================================
--- trunk/doc/reference_sfcgal.xml 2019-05-29 13:57:59 UTC (rev 17447)
+++ trunk/doc/reference_sfcgal.xml 2019-05-31 19:59:40 UTC (rev 17448)
@@ -475,7 +475,88 @@
</refsection>
</refentry>
+ <refentry id="ST_ConstrainedDelaunayTriangles">
+ <refnamediv>
+ <refname>ST_ConstrainedDelaunayTriangles</refname>
+ <refpurpose>
+Return a constrained Delaunay triangulation around the given input geometry.
+ </refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_ConstrainedDelaunayTriangles</function></funcdef>
+ <paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsection>
+ <title>Description</title>
+
+ <para>
+Return a <ulink
+url="https://en.wikipedia.org/wiki/Constrained_Delaunay_triangulation">Constrained Delaunay
+triangulation</ulink> around the vertices of the input geometry.
+Output is a TIN.
+ </para>
+ <para>&sfcgal_required;</para>
+ <para>Availability: 3.0.0</para>
+ <para>&Z_support;</para>
+ </refsection>
+ <refsection>
+ <title>Examples</title>
+ <informaltable>
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry><para><informalfigure>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/st_constraineddelaunaytriangles01.png" />
+ </imageobject>
+ <caption><para>ST_ConstrainedDelaunayTriangles of 2 polygons</para></caption>
+ </mediaobject>
+ </informalfigure>
+ <programlisting>
+select ST_ConstrainedDelaunayTriangles(
+ ST_Union(
+ 'POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))'::geometry,
+ ST_Buffer('POINT(110 170)'::geometry, 20)
+ )
+ );
+ </programlisting>
+ </para></entry>
+ <entry><para><informalfigure>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/st_constraineddelaunaytriangles02.png" />
+ </imageobject>
+ <caption><para><xref linkend="ST_DelaunayTriangles" /> of 2 polygons. Triangle edges cross polygon boundaries.</para></caption>
+ </mediaobject>
+ </informalfigure>
+ <programlisting>
+select ST_DelaunayTriangles(
+ ST_Union(
+ 'POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))'::geometry,
+ ST_Buffer('POINT(110 170)'::geometry, 20)
+ )
+ );
+</programlisting>
+ </para></entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+ </refsection>
+ <refsection>
+ <title>See Also</title>
+ <para><xref linkend="ST_DelaunayTriangles" />, <xref linkend="ST_ConcaveHull" />, <xref linkend="ST_Dump" />
+ </para>
+ </refsection>
+ </refentry>
<refentry id="ST_3DIntersection">
<refnamediv>
<refname>ST_3DIntersection</refname>
Modified: trunk/postgis/lwgeom_sfcgal.c
===================================================================
--- trunk/postgis/lwgeom_sfcgal.c 2019-05-29 13:57:59 UTC (rev 17447)
+++ trunk/postgis/lwgeom_sfcgal.c 2019-05-31 19:59:40 UTC (rev 17448)
@@ -45,7 +45,7 @@
Datum sfcgal_is_planar(PG_FUNCTION_ARGS);
Datum sfcgal_orientation(PG_FUNCTION_ARGS);
Datum sfcgal_force_lhr(PG_FUNCTION_ARGS);
-Datum sfcgal_triangulate(PG_FUNCTION_ARGS);
+Datum ST_ConstrainedDelaunayTriangles(PG_FUNCTION_ARGS);
Datum sfcgal_tesselate(PG_FUNCTION_ARGS);
Datum sfcgal_minkowski_sum(PG_FUNCTION_ARGS);
Datum sfcgal_make_solid(PG_FUNCTION_ARGS);
@@ -227,8 +227,8 @@
PG_RETURN_POINTER(output);
}
-PG_FUNCTION_INFO_V1(sfcgal_triangulate);
-Datum sfcgal_triangulate(PG_FUNCTION_ARGS)
+PG_FUNCTION_INFO_V1(ST_ConstrainedDelaunayTriangles);
+Datum ST_ConstrainedDelaunayTriangles(PG_FUNCTION_ARGS)
{
GSERIALIZED *input, *output;
sfcgal_geometry_t *geom;
Modified: trunk/postgis/sfcgal.sql.in
===================================================================
--- trunk/postgis/sfcgal.sql.in 2019-05-29 13:57:59 UTC (rev 17447)
+++ trunk/postgis/sfcgal.sql.in 2019-05-31 19:59:40 UTC (rev 17448)
@@ -133,4 +133,10 @@
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL
COST 100;
+-- Availability: 3.0.0
+CREATE OR REPLACE FUNCTION ST_ConstrainedDelaunayTriangles(geometry)
+ RETURNS geometry
+ AS 'MODULE_PATHNAME', 'ST_ConstrainedDelaunayTriangles'
+ LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL
+ COST 100;
COMMIT;
Modified: trunk/regress/sfcgal/regress_sfcgal.sql
===================================================================
--- trunk/regress/sfcgal/regress_sfcgal.sql 2019-05-29 13:57:59 UTC (rev 17447)
+++ trunk/regress/sfcgal/regress_sfcgal.sql 2019-05-31 19:59:40 UTC (rev 17448)
@@ -29,3 +29,4 @@
SELECT 'ST_Orientation_2', ST_Orientation(ST_ForceRHR('POLYGON((0 0,0 1,1 1,1 0,0 0))'));
SELECT 'ST_MinkowskiSum', ST_AsText(ST_MinkowskiSum('LINESTRING(0 0,4 0)','POLYGON((0 0,1 0,1 1,0 1,0 0))'));
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)))'));
Modified: trunk/regress/sfcgal/regress_sfcgal_expected
===================================================================
--- trunk/regress/sfcgal/regress_sfcgal_expected 2019-05-29 13:57:59 UTC (rev 17447)
+++ trunk/regress/sfcgal/regress_sfcgal_expected 2019-05-31 19:59:40 UTC (rev 17448)
@@ -9,3 +9,4 @@
ST_Orientation_2|1
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)))
More information about the postgis-tickets
mailing list