<\- / />

更新时间:
复制 MD 格式

The <-> operator returns the 3D distance between two sfmesh objects or two meshgeom objects.

Syntax

double <->(sfmesh A, sfmesh B);
double <->(meshgeom A, meshgeom B);

Parameters

ParameterDescription
AAn sfmesh or meshgeom object.
BAn sfmesh or meshgeom object.

Description

The <-> operator calculates the 3D distance between the centroids of two sfmesh objects or two meshgeom objects, and returns the result as a double.

Centroid-based distance is an efficient approximation for nearest-neighbor queries and spatial indexing.

Example

The following query computes the 3D centroid distance between a literal mesh value and each row in the mesh_gist_test table, returning the closest match.

SELECT '{"version" : 1, "root" : 0, "meshgeoms" : ["MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(307248.723802283 296449.440306073 6500.00004882812,307248.723802283 296449.440306073 100,307258.460240141 296449.440306073 6500.00004882812,307258.460240141 296449.440306073 100,307258.460240141 296474.440306263 6500.00004882812,307258.460240141 296474.440306263 100,307248.723802283 296474.440306263 6500.00004882812,307248.723802283 296474.440306263 100),INDEX((0,1,2),(3,2,1),(4,5,6),(7,6,5),(3,1,7),(7,5,3),(2,3,4),(5,4,3),(0,2,4),(4,6,0),(1,0,7),(6,7,0)))))"], "primitives" : [{"meshgeom" : 0}], "nodes" : [{"primitive" : 0}]}'::mesh <-> the_mesh FROM mesh_gist_test LIMIT 1;

Output:

3229821.634972401