ST_NumPatches

更新时间: 2026-04-12 04:09:38

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
上一篇: ST_NDims 下一篇: ST_IsEmpty
阿里云首页 云原生数据库 PolarDB 相关技术圈