PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ LWGEOM_mindistance3d()

Datum LWGEOM_mindistance3d ( PG_FUNCTION_ARGS  )

Definition at line 900 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().

901 {
902  double mindist;
903  GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
904  GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
905  LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
906  LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
907 
908  error_if_srid_mismatch(lwgeom1->srid, lwgeom2->srid);
909 
910  mindist = lwgeom_mindistance3d(lwgeom1, lwgeom2);
911 
912  PG_FREE_IF_COPY(geom1, 0);
913  PG_FREE_IF_COPY(geom2, 1);
914 
915  /*if called with empty geometries the ingoing mindistance is untouched, and makes us return NULL*/
916  if (mindist<FLT_MAX)
917  PG_RETURN_FLOAT8(mindist);
918 
919  PG_RETURN_NULL();
920 }
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:328
void error_if_srid_mismatch(int srid1, int srid2)
Definition: lwutil.c:341
int32_t srid
Definition: liblwgeom.h:383
Here is the call graph for this function:
Here is the caller graph for this function: