From 5be067fcc4bce218a842df02fa2f5bbd0f609d6e Mon Sep 17 00:00:00 2001 From: Darafei Praliaskouski Date: Fri, 21 Sep 2018 13:20:50 +0000 Subject: [PATCH] ST_ChaikinSmoothing: also smooth start/end point of polygon by default Closes #4156 Closes https://github.com/postgis/postgis/pull/305 git-svn-id: http://svn.osgeo.org/postgis/trunk@16828 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/reference_processing.xml | 26 ++++++++++++-------------- postgis/postgis.sql.in | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/doc/reference_processing.xml b/doc/reference_processing.xml index dd412603c..e48e7d8e9 100644 --- a/doc/reference_processing.xml +++ b/doc/reference_processing.xml @@ -3158,9 +3158,9 @@ LINESTRING(5 2,7 25,10 10) geometry ST_ChaikinSmoothing - geometry geomA - integer nIterations - boolean preserveEndPoints + geometry geom + integer nIterations = 1 + boolean preserveEndPoints = false @@ -3173,13 +3173,12 @@ LINESTRING(5 2,7 25,10 10) 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. - + Second argument, number of iterations is limited to max 5 iterations + Note third argument is only valid for polygons, and will be ignored for linestrings + This function handles 3D and the third dimension will affect the result. 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 and ) - Second argument, number of iterations is limited to max 5 iterations - Note third argument is only valid for polygons, and will be ignored for linestrings - This function handles 3D and the third dimension will affect the result. Availability: 2.5.0 @@ -3187,14 +3186,13 @@ LINESTRING(5 2,7 25,10 10) Examples A triangle is smoothed - 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)) │ +└───────────────────────────────────────────┘ diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in index 12e0b774c..6afb0352a 100644 --- a/postgis/postgis.sql.in +++ b/postgis/postgis.sql.in @@ -3178,7 +3178,7 @@ CREATE OR REPLACE FUNCTION ST_FilterByM(geometry, double precision, double preci 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 -- 2.40.0