All Products
Search
Document Center

PolarDB:ST_3DDistance

Last Updated:Aug 22, 2026

Calculates the 3D distance between two models.

Syntax

float8 ST_3DDistance(meshgeomgeom, meshgeomgeom);
float8 ST_3DDistance(sfmeshsfmeshObject, sfmeshsfmeshObject);
float8 ST_3DDistance(meshgeomgeom, geometrygeometry);
float8 ST_3DDistance(sfmeshsfmeshObject, geometrygeometry);

Parameters

Parameter Name

Description

geom

The meshgeom object.

sfmeshObject

The sfmesh object.

geometry

The geometry object.

Description

  • Calculates the shortest spatial distance between two 3D models.

  • Calculates the shortest spatial distance between a 3D model and a 3D geometry object.

  • If the geom parameter is invalid, the function returns NULL.

Examples

select ST_3DDistance('MESHGEOM(PATCH(TRIANGLE Z(0 0 0,0 10 0,0 0 10)))'::meshgeom, 'MESHGEOM(PATCH(TRIANGLE Z(1 0 0,1 1 0,1 0 1)))'::meshgeom);

---------------
             1

select ST_3DDistance(
    'MESHGEOM(PATCH(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,
    'POINT(-1 0 0)'::geometry);

---------------
             1