ST_3DDifference subtracts a box3d or meshgeom object from an sfmesh object and returns the resulting 3D mesh.
Syntax
sfmesh ST_3DDifference(sfmesh sfmeshObject, box3d box);
sfmesh ST_3DDifference(sfmesh sfmeshObject, meshgeom geom);Parameters
| Parameter | Description |
|---|---|
sfmeshObject | The sfmesh object to subtract from. |
box | The box3d object to subtract. |
geom | The closed meshgeom object to subtract. |
Description
The UV and Normal values of the returned sfmesh are updated synchronously to reflect the difference result.
The two overloads behave differently:
sfmesh vs. box3d — Aligns the axes of the box3d to the sfmesh before computing the difference.
sfmesh vs. meshgeom — Computes the difference directly without axis alignment.
Examples
The following example subtracts a small box (BOX3D(0 0 0, 0.2 0.2 0.2)) from a sphere with radius 1.0 and subdivision level 5, then counts the resulting mesh patches.
SELECT ST_NumPatches(ST_3DDifference(ST_3DMakeSphere(1.0, 5), 'BOX3D(0 0 0, 0.2 0.2 0.2)'::box3d));Result:
st_numpatches
---------------
20480