CG_OptimalConvexPartition — Berechnet eine optimale konvexe Partition der Polygongeometrie
geometry CG_OptimalConvexPartition(geometry geom);
Berechnet eine optimale konvexe Partition der Polygongeometrie.
|
|
|
Eine Partition eines Polygons P ist eine Menge von Polygonen, die so beschaffen ist, dass sich die Innenräume der Polygone nicht schneiden und die Vereinigung der Polygone gleich dem Innenraum des ursprünglichen Polygons P ist. CG_OptimalConvexPartition erzeugt eine Partition, die hinsichtlich der Anzahl der Teile optimal ist. |
Verfügbarkeit: 3.5.0 - erfordert SFCGAL >= 1.5.0.
Erfordert SFCGAL >= 1.5.0
Diese Methode benötigt ein SFCGAL-Backend.
The optimal convex partition uses the same polygon and produces the smallest documented piece count.
WITH data AS (
SELECT 'POLYGON((156 150,83 181,89 131,148 120,107 61,32 159,0 45,41 86,45 1,177 2,67 24,109 31,170 60,180 110,156 150))'::geometry AS input_polygon
)
SELECT input_polygon AS input_polygon,
CG_OptimalConvexPartition(input_polygon) AS partition
FROM data;
POLYGON((156 150,83 181,89 131,148 120,107 61,32 159,0 45,41 86,45 1,177 2,67 24,109 31,170 60,180 110,156 150)) | GEOMETRYCOLLECTION(POLYGON((156 150,83 181,89 131,148 120,156 150)), POLYGON((32 159,0 45,41 86,32 159)), POLYGON((45 1,177 2,67 24,45 1)), POLYGON((41 86,45 1,67 24,41 86)), POLYGON((107 61,32 159,41 86,67 24,109 31,107 61)), POLYGON((148 120,107 61,109 31,170 60,180 110,148 120)), POLYGON((156 150,148 120,180 110,156 150)))