[postgis-tickets] r16827 - ST_ChaikinSmoothing: also smooth start/end point of polygon by default
Darafei
komzpa at gmail.com
Fri Sep 21 06:20:13 PDT 2018
Author: komzpa
Date: 2018-09-21 06:20:12 -0700 (Fri, 21 Sep 2018)
New Revision: 16827
Modified:
branches/2.5/doc/reference_processing.xml
branches/2.5/postgis/postgis.sql.in
Log:
ST_ChaikinSmoothing: also smooth start/end point of polygon by default
Closes #4156
Closes https://github.com/postgis/postgis/pull/305
Modified: branches/2.5/doc/reference_processing.xml
===================================================================
--- branches/2.5/doc/reference_processing.xml 2018-09-18 05:57:56 UTC (rev 16826)
+++ branches/2.5/doc/reference_processing.xml 2018-09-21 13:20:12 UTC (rev 16827)
@@ -3158,9 +3158,9 @@
<funcsynopsis>
<funcprototype>
<funcdef>geometry <function>ST_ChaikinSmoothing</function></funcdef>
- <paramdef><type>geometry</type> <parameter>geomA</parameter></paramdef>
- <paramdef><type>integer</type> <parameter>nIterations</parameter></paramdef>
- <paramdef><type>boolean</type> <parameter>preserveEndPoints</parameter></paramdef>
+ <paramdef><type>geometry</type> <parameter>geom</parameter></paramdef>
+ <paramdef><type>integer</type> <parameter>nIterations = 1</parameter></paramdef>
+ <paramdef><type>boolean</type> <parameter>preserveEndPoints = false</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
@@ -3173,13 +3173,12 @@
The function puts new vertex points at 1/4 of the line before and after each point and removes the original point.
To reduce the number of points use one of the simplification functions on the result.
The new points gets interpolated values for all included dimensions, also z and m.</para>
-
+ <para>Second argument, number of iterations is limited to max 5 iterations</para>
+ <para>Note third argument is only valid for polygons, and will be ignored for linestrings</para>
+ <para>This function handles 3D and the third dimension will affect the result.</para>
<note><para>Note that returned geometry will get more points than the original.
To reduce the number of points again use one of the simplification functions on the result.
(see <xref linkend="ST_Simplify" /> and <xref linkend="ST_SimplifyVW" />)</para></note>
- <note><para>Second argument, number of iterations is limited to max 5 iterations</para></note>
- <note><para>Note third argument is only valid for polygons, and will be ignored for linestrings</para></note>
- <note><para>This function handles 3D and the third dimension will affect the result.</para></note>
<para>Availability: 2.5.0</para>
</refsection>
@@ -3187,14 +3186,13 @@
<title>Examples</title>
<para>A triangle is smoothed</para>
<programlisting>
-
select ST_AsText(ST_ChaikinSmoothing(geom)) smoothed
-FROM (SELECT 'LINESTRING(0 0, 8 8, 0 16)'::geometry geom) As foo;
--result
- smoothed
-------------------------------
-LINESTRING(0 0,6 6,6 10,0 16)
-
+FROM (SELECT 'POLYGON((0 0, 8 8, 0 16, 0 0))'::geometry geom) As foo;
+┌───────────────────────────────────────────┐
+│ smoothed │
+├───────────────────────────────────────────┤
+│ POLYGON((2 2,6 6,6 10,2 14,0 12,0 4,2 2)) │
+└───────────────────────────────────────────┘
</programlisting>
</refsection>
<refsection>
Modified: branches/2.5/postgis/postgis.sql.in
===================================================================
--- branches/2.5/postgis/postgis.sql.in 2018-09-18 05:57:56 UTC (rev 16826)
+++ branches/2.5/postgis/postgis.sql.in 2018-09-21 13:20:12 UTC (rev 16827)
@@ -3156,7 +3156,7 @@
COST 1; -- reset cost, see #3675
-- Availability: 2.5.0
-CREATE OR REPLACE FUNCTION ST_ChaikinSmoothing(geometry, integer default 1, boolean default true)
+CREATE OR REPLACE FUNCTION ST_ChaikinSmoothing(geometry, integer default 1, boolean default false)
RETURNS geometry
AS 'MODULE_PATHNAME', 'LWGEOM_ChaikinSmoothing'
LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL
More information about the postgis-tickets
mailing list