PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ geography_dwithin_cache()

int geography_dwithin_cache ( FunctionCallInfoData *  fcinfo,
const SPHEROID s,
double  tolerance,
int *  dwithin 

Definition at line 234 of file geography_measurement_trees.c.

References distance(), FP_TOLERANCE, geography_distance_cache_tolerance(), LW_FAILURE, LW_FALSE, LW_SUCCESS, and LW_TRUE.

Referenced by geography_dwithin().

235 {
236  double distance;
237  /* Ticket #2422, difference between sphere and spheroid distance can trip up the */
238  /* threshold shortcircuit (stopping a calculation before the spheroid distance is actually */
239  /* below the threshold. Lower in the code line, we actually reduce the threshold a little to */
240  /* avoid this. */
241  /* Correct fix: propogate the spheroid information all the way to the bottom of the calculation */
242  /* so the "right thing" can be done in all cases. */
243  if ( LW_SUCCESS == geography_distance_cache_tolerance(fcinfo, g1, g2, s, tolerance, &distance) )
244  {
245  *dwithin = (distance <= (tolerance + FP_TOLERANCE) ? LW_TRUE : LW_FALSE);
246  return LW_SUCCESS;
247  }
248  return LW_FAILURE;
249 }
static int geography_distance_cache_tolerance(FunctionCallInfoData *fcinfo, const GSERIALIZED *g1, const GSERIALIZED *g2, const SPHEROID *s, double tolerance, double *distance)
#define LW_SUCCESS
Definition: liblwgeom.h:65
#define LW_FAILURE
Definition: liblwgeom.h:64
#define LW_FALSE
Definition: liblwgeom.h:62
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
Floating point comparators.
Datum distance(PG_FUNCTION_ARGS)
Here is the call graph for this function:
Here is the caller graph for this function: