This topic describes the ST_3DDistance function. This function calculates the 3D distance between two objects.

Syntax

float8 ST_3DDistance(meshgeom geom, meshgeom geom);
float8 ST_3DDistance(sfmesh sfmeshObject, sfmesh sfmeshObject);
float8 ST_3DDistance(meshgeom geom, geometry geometry);
float8 ST_3DDistance(sfmesh sfmeshObject, geometry geometry);

Parameters

ParameterDescription
geomThe meshgeom object.
sfmeshThe sfmesh object.
geometryThe geometry object.

Description

  • This function calculates the shortest distance between two 3D models.
  • This function calculates the shortest distance between a 3D model and a 3D geometry object.
  • If the geom parameter is invalid, NULL is returned.

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_3DDistanc(
    '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