PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ LWGEOM_mindistance3d()

Datum LWGEOM_mindistance3d ( PG_FUNCTION_ARGS  )

Definition at line 915 of file lwgeom_functions_basic.c.

References error_if_srid_mismatch(), LWGEOM_dwithin3d(), lwgeom_from_gserialized(), lwgeom_mindistance3d(), PG_FUNCTION_INFO_V1(), and LWGEOM::srid.

Referenced by LWGEOM_longestline3d().

916 {
917  double mindist;
918  GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
919  GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
920  LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
921  LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
922 
923  error_if_srid_mismatch(lwgeom1->srid, lwgeom2->srid);
924 
925  mindist = lwgeom_mindistance3d(lwgeom1, lwgeom2);
926 
927  PG_FREE_IF_COPY(geom1, 0);
928  PG_FREE_IF_COPY(geom2, 1);
929 
930  /*if called with empty geometries the ingoing mindistance is untouched, and makes us return NULL*/
931  if (mindist<FLT_MAX)
932  PG_RETURN_FLOAT8(mindist);
933 
934  PG_RETURN_NULL();
935 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
double lwgeom_mindistance3d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing 3d min distance calculation.
Definition: measures3d.c:352
void error_if_srid_mismatch(int srid1, int srid2)
Definition: lwutil.c:371
int32_t srid
Definition: liblwgeom.h:399
Here is the call graph for this function:
Here is the caller graph for this function: