Extrudes a 2D polygon into a 3D mesh geometry along the positive z-axis direction.
Syntax
meshgeom ST_Extrude(geometry geom2d, float8 height);Parameters
| Parameter | Type | Description |
|---|---|---|
geom2d | geometry | The input geometry. Accepts Polygon and MultiPolygon types. |
height | float8 | The extrusion height along the positive z-axis. |
Description
ST_Extrude takes a flat 2D polygon and generates a 3D mesh geometry (meshgeom) by extruding it upward along the positive z-axis by the specified height.
The input geometry must be a Polygon or MultiPolygon. The output is a meshgeom object composed of top and bottom polygon faces and lateral triangle strips connecting them.
Effect diagram
A 2D polygon is extruded along the z-axis. 
Examples
Extrude a triangle polygon by a height of 1:
SELECT ST_AsText(ST_Extrude('POLYGON((0 0, 1 0, 1 1, 0 0))', 1));Output:
MESHGEOM(PATCH(POLYGON Z ((0 0 1,1 0 1,1 1 1,0 0 1)),TRIANGLESTRIP Z (0 0 1,0 0 0,1 0 1,1 0 0,1 1 1,1 1 0,0 0 1,0 0 0),POLYGON Z ((0 0 0,1 1 0,1 0 0,0 0 0))))The output meshgeom contains:
A top face (
POLYGON Z) atz = heightA bottom face (
POLYGON Z) atz = 0Lateral faces represented as a
TRIANGLESTRIP Zconnecting the top and bottom edges
该文章对您有帮助吗?