CG_StraightSkeletonPartition
Name
CG_StraightSkeletonPartition — Computes the straight skeleton partition of a polygon.
Synopsis
geometry
CG_StraightSkeletonPartition
(
geometry
geom
, boolean
auto_orientation
)
;
Description
Computes the straight skeleton partition of the input polygon geometry
geom
.
The straight skeleton is a partitioning of the polygon into faces formed by tracing the collapse of its edges.
If
auto_orientation
is set to true, the function will automatically adjust the orientation of the input polygon to ensure correct results.
Availability: 3.6.0 - requires SFCGAL >= 2.0.0.
This method needs SFCGAL backend.
Examples
SELECT CG_StraightSkeletonPartition('POLYGON((0 0,4 0,2 2,0 0))', true);
POLYHEDRALSURFACE(((0 0,2 0.82842712474619,2 2,0 0)),((4 0,2 0.82842712474619,0 0,4 0)),((2 2,2 0.82842712474619,4 0,2 2)))
Straight skeleton partition of a polygon.
WITH data AS (
SELECT 'POLYGON((190 190,10 190,10 10,190 10,190 20,160 30,60 30,60 130,190 140,190 190))'::geometry AS polygon
)
SELECT polygon AS input_polygon,
CG_StraightSkeletonPartition(polygon, true) AS skeleton_partition
FROM data;
POLYGON((190 190,10 190,10 10,190 10,190 20,160 30,60 30,60 130,190 140,190 190)) | POLYHEDRALSURFACE(((190 190,164.04 164.04,190 140,190 190)),((10 190,40.697 159.303,164.04 164.04,190 190,10 190)),((10 10,35 35,35 153.151,40.697 159.303,10 190,10 10)),((190 10,184.189 15.811,158.377 20,50 20,35 35,10 10,190 10)),((190 20,184.189 15.811,190 10,190 20)),((160 30,158.377 20,184.189 15.811,190 20,160 30)),((60 30,50 20,158.377 20,160 30,60 30)),((60 130,35 153.151,35 35,50 20,60 30,60 130)),((190 140,164.04 164.04,40.697 159.303,35 153.151,60 130,190 140)))