PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ geography_dwithin_cache()

int geography_dwithin_cache ( FunctionCallInfo  fcinfo,
SHARED_GSERIALIZED *  g1,
SHARED_GSERIALIZED *  g2,
const SPHEROID s,
double  tolerance,
int *  dwithin 
)

Definition at line 264 of file geography_measurement_trees.c.

270 {
271  double distance;
272  /* Ticket #2422, difference between sphere and spheroid distance can trip up the */
273  /* threshold shortcircuit (stopping a calculation before the spheroid distance is actually */
274  /* below the threshold. Lower in the code line, we actually reduce the threshold a little to */
275  /* avoid this. */
276  /* Correct fix: propogate the spheroid information all the way to the bottom of the calculation */
277  /* so the "right thing" can be done in all cases. */
278  if ( LW_SUCCESS == geography_distance_cache_tolerance(fcinfo, g1, g2, s, tolerance, &distance) )
279  {
280  *dwithin = (distance <= (tolerance + FP_TOLERANCE) ? LW_TRUE : LW_FALSE);
281  return LW_SUCCESS;
282  }
283  return LW_FAILURE;
284 }
char * s
Definition: cu_in_wkt.c:23
static int geography_distance_cache_tolerance(FunctionCallInfo fcinfo, SHARED_GSERIALIZED *shared_g1, SHARED_GSERIALIZED *shared_g2, const SPHEROID *s, double tolerance, double *distance)
#define LW_FALSE
Definition: liblwgeom.h:94
#define LW_FAILURE
Definition: liblwgeom.h:96
#define LW_SUCCESS
Definition: liblwgeom.h:97
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:93
#define FP_TOLERANCE
Floating point comparators.
static double distance(double x1, double y1, double x2, double y2)
Definition: lwtree.c:1032

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

Referenced by geography_dwithin().

Here is the call graph for this function:
Here is the caller graph for this function: