<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>
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>
<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>
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