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

Definition at line 974 of file lwgeom_functions_basic.c.

References LW_FALSE, lwgeom_from_gserialized(), lwgeom_maxdistance3d_tolerance(), and LWGEOM::srid.

975 {
976  double maxdist;
977  GSERIALIZED *geom1 = (GSERIALIZED*)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
978  GSERIALIZED *geom2 = (GSERIALIZED*)PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
979  double tolerance = PG_GETARG_FLOAT8(2);
980  LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
981  LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
982 
983  if ( tolerance < 0 )
984  {
985  elog(ERROR,"Tolerance cannot be less than zero\n");
986  PG_RETURN_NULL();
987  }
988 
989  if (lwgeom1->srid != lwgeom2->srid)
990  {
991  elog(ERROR,"Operation on two GEOMETRIES with different SRIDs\n");
992  PG_RETURN_NULL();
993  }
994  maxdist = lwgeom_maxdistance3d_tolerance(lwgeom1, lwgeom2, tolerance);
995 
996  PG_FREE_IF_COPY(geom1, 0);
997  PG_FREE_IF_COPY(geom2, 1);
998 
999  /*If function is feed with empty geometries we should return false*/
1000  if (maxdist>-1)
1001  PG_RETURN_BOOL(tolerance >= maxdist);
1002 
1003  PG_RETURN_BOOL(LW_FALSE);
1004 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int32_t srid
Definition: liblwgeom.h:355
#define LW_FALSE
Definition: liblwgeom.h:52
double lwgeom_maxdistance3d_tolerance(LWGEOM *lw1, LWGEOM *lw2, double tolerance)
Function handling 3d max distance calculations and dfyllywithin calculations.
Definition: measures3d.c:132

Here is the call graph for this function: