All Products
Search
Document Center

PolarDB:ST_3DIntersection

Last Updated:Mar 28, 2026

ST_3DIntersection clips a 3D mesh object against a bounding box or another mesh, returning the portion of the mesh that falls within the clipping boundary.

Syntax

sfmesh ST_3DIntersection(sfmesh sfmeshObject, box3d box);
sfmesh ST_3DIntersection(sfmesh sfmeshObject, meshgeom geom);

Parameters

ParameterDescription
sfmeshObjectThe sfmesh object to clip.
boxThe box3d bounding box to clip against.
geomThe closed meshgeom object to clip against. The object must be closed.

Return value

Returns an sfmesh object representing the intersection geometry. UV and normal values on the returned mesh are synchronized with the original sfmeshObject.

Behavior

ST_3DIntersection supports two overloads with different clipping behaviors:

  • `sfmesh` + `box3d`: Aligns the axes of the bounding box and clips the mesh, then returns the intersection.

  • `sfmesh` + `meshgeom`: Clips the mesh directly against the closed mesh boundary and returns the intersection. The meshgeom object must be closed.

Example

Clip a mesh against a bounding box

The following example clips a sphere created by ST_3DMakeSphere against a unit bounding box and returns the number of patches in the resulting mesh.

SELECT ST_NumPatches(ST_3DIntersection(ST_3DMakeSphere(1.0, 5), 'BOX3D(0 0 0, 1 1 1)'::box3d));

Result:

2608