ST_Volume/ST_3DVolume

更新时间:
复制 MD 格式

Calculates the volume of a closed 3D object represented as a meshgeom or sfmesh geometry. Returns NULL if the geometry is not closed or the input is invalid.

Syntax

float8 ST_Volume(meshgeom geom);
float8 ST_Volume(sfmesh sfmesh);

Parameters

ParameterDescription
geomThe meshgeom object.
sfmeshThe sfmesh object.

Usage notes

  • The volume of a point, linestring, or polygon is 0.

  • Returns NULL if geom is invalid.

  • Returns NULL if the 3D model is not closed.

Examples

select ST_Volume('MESHGEOM(PATCH(TRIANGLESTRIP Z(0 0 0,0 10 0,0 0 10,10 0  0,0 0 0), TRIANGLE Z( 0 0 0,0 10 0,10 0 0)))'::mesh);

Output:

 166.666666666667