Name

CG_Buffer3D — Computes a 3D buffer around a geometry.

Synopsis

geometry CG_Buffer3D(geometry geom, float8 radius, integer segments, integer buffer_type);

Descrizione

Generates a 3D buffer around the input geometry geom with a specified radius. The buffer is constructed in 3D space, creating a volumetric representation of the geometry's surroundings. The segments parameter defines the number of segments used to approximate the curved sections of the buffer. The buffer_type specifies the type of buffer to create: 0: Rounded buffer (default) 1: Flat buffer 2: Square buffer

Availability: 3.6.0 - requires SFCGAL >= 2.0.0

Questo metodo richiede il backend SFCGAL.

Questa funzione supporta il 3d e non distrugge gli z-index.

Questa funzione supporta le Polyhedral Surface.

Questa funzione supporta i Triangoli e le Triangulated Irregular Network Surfaces (TIN).

Esempi

SELECT ST_AsText(CG_Buffer3D('POINT(0 0 0)', 1, 8, 0));
-- Result: POLYHEDRALSURFACE Z (((0 0 1, 0.5 -0.5 0.71, 0 -0.71 0.71, 0 0 1)), ... )

The following images were rendered pasting the output of the ST_AsX3D query into X3D Viewer.

SELECT string_agg('<Shape
>' || ST_AsX3D(cgbuffer3d_output)  || '<Appearance>
          <Material diffuseColor="0 0.8 0.2" specularColor="0 1 0"/>
        </Appearance>
    </Shape
>', '');

segments=32 (rounded buffer)

SELECT CG_Buffer3D(ST_GeomFromText('POINT(100 90)'), 50,32,0);

5 segments rounded

SELECT CG_Buffer3D(
 ST_GeomFromText('POINT(100 90)'),
 50,5,0);
            

32 segments, round

SELECT CG_Buffer3D(
  ST_GeomFromText(
    'LINESTRING(50 50,150 150,150 50)'
    ),
 10,32,0);
            

32 segments, square

SELECT CG_Buffer3D(
  ST_GeomFromText(
    'LINESTRING(50 50,150 150,150 50)'
    ),
 10,32,2);