ST_Loft
Lofts a 2D polygon along a 3D path to produce a mesh geometry. Path corners are chamfered using Bezier curves.
Syntax
meshgeom ST_Loft(geometry geom2d, geometry line3d, int4 chamfer);Parameters
| Parameter | Type | Description |
|---|---|---|
geom2d | geometry | A 2D polygon to use as the cross-section profile. Only 2D polygons are accepted. |
line3d | geometry | A 3D linestring that defines the path along which the polygon is lofted. |
chamfer | int4 | Number of Bezier curve segments used to chamfer each corner of the 3D path. A higher value produces more vertices in the output meshgeom. |
Usage notes
geom2dmust be a 2D polygon. 3D geometries and non-polygon types are not accepted.line3dmust be a 3D linestring.If
geom2dcontains holes (interior rings), the function lofts the full polygon including holes.The output meshgeom is compatible with
ST_AsText.
Example
The following example lofts a 2D polygon with a hole along a four-vertex 3D path with chamfer=5.
SELECT ST_AsText(ST_Loft(
'POLYGON((0 0, 1 0, 1 1, 0 0), (0.5 0.5, 0.6 0.5, 0.6 0.6, 0.5 0.5))',
'LINESTRING(0 0 0, 10 0 0, 10 10 0, 10 10 10)', 5));Output (truncated):
MESHGEOM(PATCH(POLYGON Z ((0 -0.333333333333333 0.666666666666667,0 0.666666666666667 -0.333333333333333,0 -0.333333333333333 -0.333333333333333 ...Effect diagram
The following figure shows the result of lofting a 2D polygon with holes along a 3D path (chamfer=4). The output is a mesh geometry with Bezier-chamfered corners at each path vertex.
