Name

CG_GenerateSkillionRoof — Generate a skillion (single-slope) roof from a footprint polygon.

Synopsis

geometry CG_GenerateSkillionRoof(geometry geom, float8 height, float8 slope_angle, integer primary_edge_index);

描述

Generate a skillion (single-slope, shed-style) roof as a 3D PolyhedralSurface Z from a 2D footprint polygon. The entire roof surface slopes in one direction. height sets the maximum ridge height (default 3.0), slope_angle sets the pitch in degrees (default 30.0), and primary_edge_index selects which polygon edge defines the high side (0-based, default 0).

When the combination of height and slope_angle would cause a side wall to vanish (the slope reaches the far edge before the full height is achieved), that face is omitted from the result. This means the number of output patches can vary depending on the parameters — a lower height relative to the footprint depth produces more faces than a taller, steeper configuration.

Availability: 3.7.0 - requires SFCGAL >= 2.3.0.

该方法需要SFCGAL后端。

该函数支持多面体曲面。

示例

Height 2.0 produces 6 faces (all walls present); height 4.0 produces 5 faces (one side wall is filtered out because the slope reaches the far edge before the full height).

-- height 2.0 → 6 patches
SELECT ST_NumPatches(
  CG_GenerateSkillionRoof(
    'POLYGON((0 0,5 0,5 4,0 4,0 0))',
    2.0));
-- 6

-- height 4.0 → 5 patches (one face filtered)
SELECT ST_NumPatches(
  CG_GenerateSkillionRoof(
    'POLYGON((0 0,5 0,5 4,0 4,0 0))',
    4.0));
-- 5