ST_NumPatches

更新时间:
复制 MD 格式

Returns the number of patches (faces) in a meshgeom or sfmesh object.

Syntax

int4 ST_NumPatches(meshgeom geom);
int4 ST_NumPatches(sfmesh sfmesh);

Parameters

ParameterDescription
geomA meshgeom object.
sfmeshAn sfmesh object.

Usage notes

ST_NumPatches counts the polygon faces that make up the mesh surface. The return value is an int4 (32-bit integer).

Example

The following example returns the patch count for a meshgeom object built from an indexed surface with two triangle faces.

SELECT ST_NumPatches(
  'MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0 2,0 10 3,10 10 1,10 0 1), INDEX((0,1,2),(1,2,3)))))'::meshgeom
);

Output:

 st_numpatches
---------------
             2