This topic describes the ST_3DBuffer function. This function constructs a buffer for a 3D point or linestring.

Syntax

meshgeom ST_3DBuffer(geometry geom3d, float8 buffer_radius, boolean round_end  default true, float8 smooth default 0.5);

Parameters

Parameter Description
geom3d The geometry object, which can be of the Point or LineString type.
buffer_radius The buffer radius, which is a floating-point number.
round_end The value is of the Boolean type. Default value: true.
  • If you set the round_end parameter to true for a linestring, hemisphere buffers are created for the end points of the linestring.
  • If you set the round_end parameter to false for a linestring, no buffers are created for the end points of the linestring.
smooth The side length of the triangle on the buffer surface. The value is a floating-point number. Default value: 0.5. Valid values: (0,1]. A small value indicates a small side length of the triangle. The surface is smoother and more approximate to a curved surface.
Important
  • If you do not configure the round_end parameter, you do not need to configure the smooth parameter.
  • If you do not configure the round_end parameter but configure the smooth parameter, parsing errors occur.

Description

This function extends a 3D point or linestring by a certain distance to form a closed buffer.

Effect diagram

Figure 1. Buffer for a 3D point when the smooth parameter is set to 0.5
Figure 1
Figure 2. Buffer for a 3D point when the smooth parameter is set to 0.8
Figure 2
Figure 3. Buffer for a 3D linestring when the round_end parameter is set to true
Figure 3
Figure 4. Buffer for a 3D linestring when the round_end parameter is set to false
Figure 4
Figure 5. Buffer for a 3D linestring when the round_end parameter is set to true and the smooth parameter is set to 0.3
Figure 1

Examples

SELECT ST_AsText(ST_3DBuffer('POINT(0 0 0)', 2));
---------------------------------------------------
MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(0 0 2,-0.894427190999916 0 1.78885438199983,-0.447213595499958 ...

SELECT ST_AsText(ST_3DBuffer('LINESTRING(1 2 3, 0 0 4)', 0.5, false));
---------------------------------------------------
MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(1.43294188107951 1.89763792560716 3.22821773229382,1.30266373925419...

SELECT ST_AsText(ST_3DBuffer('LINESTRING(0 1 0, 1 3 2, 2 1 1)', 1, true, 0.6));
------------------------------------------------------
MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(-0.89885050178969 1.01131599079557 0.438109260099278...