ST_DelaunayTriangles — 返回幾何圖形頂點的 Delaunay 三角剖分。
geometry ST_DelaunayTriangles(
geometry g1, float tolerance = 0.0, int4 flags = 0)
;
計算輸入幾何圖形頂點的 Delaunay 三角剖分。 可選的 tolerance
可用於將附近的輸入頂點捕捉在一起,這在某些情況下可以提高穩健性。 結果幾何圖形以輸入頂點的凸包為界。結果幾何圖形的表示形式由 flags
代碼確定。
0
- 三角形 POLYGON 的 GEOMETRYCOLLECTION(預設值)
1
- 三角剖分邊緣的 MULTILINESTRING
2
- 三角剖分的 TIN
由 GEOS 模組執行。
可用性:2.1.0
此函數支援 3D,且不會丟失 z 索引。
此函數支援三角形和不規則三角網格表面 (TIN)。
![]() 原始多邊形 our original geometry
ST_Union(ST_GeomFromText('POLYGON((175 150, 20 40,
50 60, 125 100, 175 150))'),
ST_Buffer(ST_GeomFromText('POINT(110 170)'), 20)
) |
![]() 2 個多邊形的 ST_DelaunayTriangles:Delaunay 三角形多邊形,每個三角形都以不同的顏色為主題
geometries overlaid multilinestring triangles
SELECT
ST_DelaunayTriangles(
ST_Union(ST_GeomFromText('POLYGON((175 150, 20 40,
50 60, 125 100, 175 150))'),
ST_Buffer(ST_GeomFromText('POINT(110 170)'), 20)
))
As dtriag;
|
![]() -- 以多線字串表示的 Delaunay 三角形
SELECT ST_DelaunayTriangles( ST_Union(ST_GeomFromText('POLYGON((175 150, 20 40, 50 60, 125 100, 175 150))'), ST_Buffer(ST_GeomFromText('POINT(110 170)'), 20) ),0.001,1) As dtriag;
|
![]() -- 45 個點的 Delaunay 三角形,表示為 55 個三角形多邊形
this produces a table of 42 points that form an L shape SELECT (ST_DumpPoints(ST_GeomFromText( 'MULTIPOINT(14 14,34 14,54 14,74 14,94 14,114 14,134 14, 150 14,154 14,154 6,134 6,114 6,94 6,74 6,54 6,34 6, 14 6,10 6,8 6,7 7,6 8,6 10,6 30,6 50,6 70,6 90,6 110,6 130, 6 150,6 170,6 190,6 194,14 194,14 174,14 154,14 134,14 114, 14 94,14 74,14 54,14 34,14 14)'))).geom INTO TABLE l_shape; output as individual polygon triangles SELECT ST_AsText((ST_Dump(geom)).geom) As wkt FROM ( SELECT ST_DelaunayTriangles(ST_Collect(geom)) As geom FROM l_shape) As foo; wkt POLYGON((6 194,6 190,14 194,6 194)) POLYGON((14 194,6 190,14 174,14 194)) POLYGON((14 194,14 174,154 14,14 194)) POLYGON((154 14,14 174,14 154,154 14)) POLYGON((154 14,14 154,150 14,154 14)) POLYGON((154 14,150 14,154 6,154 14))
|
使用帶有 Z 值的頂點的範例。
3D multipoint SELECT ST_AsText(ST_DelaunayTriangles(ST_GeomFromText( 'MULTIPOINT Z(14 14 10, 150 14 100,34 6 25, 20 10 150)'))) As wkt; wkt GEOMETRYCOLLECTION Z (POLYGON Z ((14 14 10,20 10 150,34 6 25,14 14 10)) ,POLYGON Z ((14 14 10,34 6 25,150 14 100,14 14 10)))