PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum LWGEOM_dwithin3d ( PG_FUNCTION_ARGS  )

Definition at line 937 of file lwgeom_functions_basic.c.

References lwgeom_from_gserialized(), lwgeom_mindistance3d_tolerance(), and LWGEOM::srid.

938 {
939  double mindist;
940  GSERIALIZED *geom1 = (GSERIALIZED*)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
941  GSERIALIZED *geom2 = (GSERIALIZED*)PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
942  double tolerance = PG_GETARG_FLOAT8(2);
943  LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
944  LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
945 
946  if ( tolerance < 0 )
947  {
948  elog(ERROR,"Tolerance cannot be less than zero\n");
949  PG_RETURN_NULL();
950  }
951 
952  if (lwgeom1->srid != lwgeom2->srid)
953  {
954  elog(ERROR,"Operation on two GEOMETRIES with different SRIDs\n");
955  PG_RETURN_NULL();
956  }
957 
958  mindist = lwgeom_mindistance3d_tolerance(lwgeom1,lwgeom2,tolerance);
959 
960  PG_FREE_IF_COPY(geom1, 0);
961  PG_FREE_IF_COPY(geom2, 1);
962 
963  /*empty geometries cases should be right handled since return from underlying
964  functions should be MAXFLOAT which causes false as answer*/
965  PG_RETURN_BOOL(tolerance >= mindist);
966 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int32_t srid
Definition: liblwgeom.h:355
double lwgeom_mindistance3d_tolerance(LWGEOM *lw1, LWGEOM *lw2, double tolerance)
Function handling 3d min distance calculations and dwithin calculations.
Definition: measures3d.c:164

Here is the call graph for this function: