All Products
Search
Document Center

PolarDB:ST_3DContains

Last Updated:Mar 28, 2026

Checks whether a closed 3D volume contains a 3D geometry object or 3D model.

Syntax

bool ST_3DContains(meshgeom geom1, meshgeom geom2);
bool ST_3DContains(sfmesh sfmeshObject1, sfmesh sfmeshObject2);

bool ST_3DContains(box3d box3d, meshgeom geom);
bool ST_3DContains(box3d box3d, sfmesh sfmeshObject);

Parameters

ParameterDescription
geomThe meshgeom object.
sfmeshObjectThe sfmesh object.
box3dThe box3d object.

Return value

Returns true if the first argument contains the second argument, false if it does not, and NULL if the function fails.

Usage notes

  • The first argument can be a meshgeom, sfmesh, or box3d object. The second argument must be a meshgeom or sfmesh object.

  • When the first argument is an sfmesh, it must be a closed sfmesh object.

Examples

Check whether an indexed surface mesh contains a triangle strip mesh:

SELECT ST_3DContains(
    'MESH(INDEXSURFACE  Z(VERTEX(0 0 0,0 10 0,0 0 10,10 0  0), INDEX((0,1,2),(1,0,3),(3,0,2),(2,1,3))))'::meshgeom,
    'MESH(TRIANGLESTRIP Z(0.1 0.1 0.1,0.1 1 0.1,0.1 0.1 1,0.1 1 1))'::meshgeom);

The smaller triangle strip mesh falls entirely within the indexed surface mesh, so the result is t (true).