Namn

CG_Volume — Computes the volume of a 3D geometry. Closed surfaces can have non-zero volume.

Synopsis

float CG_Volume(geometry geom1);

Beskrivning

Tillgänglighet: 3.5.0

Denna metod behöver SFCGAL-backend.

Denna funktion stöder 3d och kommer inte att tappa z-index.

Denna funktion stöder polyedriska ytor.

Denna funktion stöder trianglar och triangulerade oregelbundna nätverksytor (TIN).

Denna metod implementerar SQL/MM-specifikationen. SQL-MM IEC 13249-3: 9.1 (samma som CG_3DVolume)

Closed surface geometries can have non-zero volume. Use CG_MakeSolid when the geometry value itself must carry the solid flag.

Exempel

A closed polyhedral surface has volume. CG_MakeSolid makes the solid representation explicit.

Code
SELECT CG_Volume(geom) As cube_surface_vol,
CG_Volume(CG_MakeSolid(geom)) As solid_surface_vol
FROM (SELECT 'POLYHEDRALSURFACE( ((0 0 0,0 0 1,0 1 1,0 1 0,0 0 0)),
((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),
((0 0 0,1 0 0,1 0 1,0 0 1,0 0 0)),
((1 1 0,1 1 1,1 0 1,1 0 0,1 1 0)),
((0 1 0,0 1 1,1 1 1,1 1 0,0 1 0)),
((0 0 1,1 0 1,1 1 1,0 1 1,0 0 1)) )'::geometry) As f(geom);
Rasterutdata
cube_surface_vol │ solid_surface_vol
─────────────────┼──────────────────
1                │ 1
Figure
Geometry figure for visual-cg-volume-01