]> granicus.if.org Git - postgis/commitdiff
[sfcgal] Expose ST_ConstrainedDelaunayTriangles
authorDarafei Praliaskouski <me@komzpa.net>
Fri, 31 May 2019 19:59:40 +0000 (19:59 +0000)
committerDarafei Praliaskouski <me@komzpa.net>
Fri, 31 May 2019 19:59:40 +0000 (19:59 +0000)
Closes #4198
Closes https://github.com/postgis/postgis/pull/405

git-svn-id: http://svn.osgeo.org/postgis/trunk@17448 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
doc/html/image_src/Makefile.in
doc/html/image_src/st_constraineddelaunaytriangles01.wkt [new file with mode: 0644]
doc/html/image_src/st_constraineddelaunaytriangles02.wkt [new file with mode: 0644]
doc/html/image_src/styles.conf
doc/reference_processing.xml
doc/reference_sfcgal.xml
postgis/lwgeom_sfcgal.c
postgis/sfcgal.sql.in
regress/sfcgal/regress_sfcgal.sql
regress/sfcgal/regress_sfcgal_expected

diff --git a/NEWS b/NEWS
index 1ca139b1b7ac7d1ee6f15731bda3c51a0c97509c..7c35077505649315b2741756d703ae0c94d4fcf2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -128,6 +128,8 @@ PostGIS 3.0.0
   - #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
index 243fd43c4644ed9280680d7d62c1d8e25bdba034..4809f3a6bbe173e05b786a594e8f46f8a80218bb 100644 (file)
@@ -67,6 +67,8 @@ IMAGES= \
        ../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 \
diff --git a/doc/html/image_src/st_constraineddelaunaytriangles01.wkt b/doc/html/image_src/st_constraineddelaunaytriangles01.wkt
new file mode 100644 (file)
index 0000000..70ff7ca
--- /dev/null
@@ -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))
diff --git a/doc/html/image_src/st_constraineddelaunaytriangles02.wkt b/doc/html/image_src/st_constraineddelaunaytriangles02.wkt
new file mode 100644 (file)
index 0000000..8a834dc
--- /dev/null
@@ -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))
index 412dd6c0cb580711f6eb68379f14816c42d1f129..dc5d4ef45f543c301034f71156705e3ad493fc4d 100644 (file)
@@ -167,8 +167,8 @@ polygonStrokeWidth = 0
 styleName = StrokedPoly1
 pointSize = 6
 pointColor = "#00bfff"
-lineWidth = 7
-lineColor = "#00bfff"
+lineWidth = 1
+lineColor = "#000000"
 polygonFillColor = "#00bfff"
 polygonStrokeColor = "#000000"
 polygonStrokeWidth = 1
index 88c5b463962e2e165fe7980181406fd7fb9e623d..3b6620bdaf9eafad0b43ce123e73315c7e1c0478 100644 (file)
@@ -1236,7 +1236,7 @@ GEOMETRYCOLLECTION Z (POLYGON Z ((14 14 10,20 10 150,34 6 25,14 14 10))
                </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>
index f698f9e9ce6712fa5e6c35eddf959645a2fb1a1c..2b031a8ed6ee982d9229838c1a6606064b5ff644 100644 (file)
@@ -475,7 +475,88 @@ MULTIPOLYGON(
        </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>
index 0745965022a4db25cc2b56501f24238cd0234c8c..749988b883f6fa7cb0854da3e5d3c8ad3e1b3eba 100644 (file)
@@ -45,7 +45,7 @@ Datum sfcgal_approximate_medial_axis(PG_FUNCTION_ARGS);
 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 @@ Datum sfcgal_tesselate(PG_FUNCTION_ARGS)
        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;
index fd0ed0d39e66c8d8c18a705e8286e9fb546e3fb6..bb3f83aeb5d069376185083aef9386e42b0ecf3e 100644 (file)
@@ -133,4 +133,10 @@ CREATE OR REPLACE FUNCTION ST_IsSolid(geometry)
        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;
index 6597b369687b2369037642e4a16d84f29d83b6eb..896bb3af04b5deed510b03d68b129f9db141cbb2 100644 (file)
@@ -29,3 +29,4 @@ SELECT 'ST_Orientation_1', ST_Orientation(ST_ForceLHR('POLYGON((0 0,0 1,1 1,1 0,
 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)))'));
index 9d2ce151d6f706d7b4645143e7a774ce4f7d5982..785d51fde2f724f9cbe4dc1aa2815588c7beb4bc 100644 (file)
@@ -9,3 +9,4 @@ ST_Orientation_1|-1
 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)))