Name

CG_ApproximateMedialAxis — 计算几何区域的近似中轴。

Synopsis

geometry CG_ApproximateMedialAxis(geometry geom);

geometry CG_ApproximateMedialAxis(geometry geom, boolean projected);

描述

基于直骨架,返回实际输入的近似中心轴。如果在支持的版本(1.2.0+)下构建,将使用 SFCGAL 特有的 API;否则,此函数将是 CG_StraightSkeleton(较慢的情况)函数的封装。

When projected is true, free endpoints of the medial axis are extended to reach the polygon boundary (projected medial axis). Requires SFCGAL 2.3.0+. When built against an older SFCGAL version, a notice is emitted and the non-projected result is returned instead.

可用性:3.5.0

Availability: 3.7.0 - projected parameter. Requires SFCGAL >= 2.3.0 for projected result; falls back to non-projected with a notice on older versions.

[Note]

此函数忽略 Z 维度。 即使在 3D 几何体上使用时,它也始终给出 2D 结果。

该方法需要SFCGAL后端。

该函数支持多面体曲面。

此函数支持三角形和不规则三角网面 (TIN)。

示例

SELECT CG_ApproximateMedialAxis(ST_GeomFromText('POLYGON (( 190 190, 10 190, 10 10, 190 10, 190 20, 160 30, 60 30, 60 130, 190 140, 190 190 ))'));

多边形及其近似中轴

-- Projected medial axis: free endpoints extended to polygon boundary
SELECT CG_ApproximateMedialAxis('POLYGON((0 0,2 0,2 1,0 1,0 0))', true);
-- Result: MULTILINESTRING((0 0.5,2 0.5))