PostGIS  2.1.10dev-r@@SVN_REVISION@@
double circ_tree_distance_tree ( const CIRC_NODE n1,
const CIRC_NODE n2,
const SPHEROID spheroid,
double  threshold 
)

Definition at line 553 of file lwgeodetic_tree.c.

References SPHEROID::a, SPHEROID::b, circ_tree_distance_tree_internal(), MAXFLOAT, SPHEROID::radius, sphere_distance(), and spheroid_distance().

Referenced by geography_distance_cache_tolerance(), geography_tree_distance(), and test_tree_circ_distance().

554 {
555  double min_dist = MAXFLOAT;
556  double max_dist = MAXFLOAT;
557  GEOGRAPHIC_POINT closest1, closest2;
558  double threshold_radians = threshold / spheroid->radius;
559 
560  circ_tree_distance_tree_internal(n1, n2, threshold_radians, &min_dist, &max_dist, &closest1, &closest2);
561 
562  /* Spherical case */
563  if ( spheroid->a == spheroid->b )
564  {
565  return spheroid->radius * sphere_distance(&closest1, &closest2);
566  }
567  else
568  {
569  return spheroid_distance(&closest1, &closest2, spheroid);
570  }
571 }
double sphere_distance(const GEOGRAPHIC_POINT *s, const GEOGRAPHIC_POINT *e)
Given two points on a unit sphere, calculate their distance apart in radians.
Definition: lwgeodetic.c:897
double b
Definition: liblwgeom.h:270
double radius
Definition: liblwgeom.h:274
static double circ_tree_distance_tree_internal(const CIRC_NODE *n1, const CIRC_NODE *n2, double threshold, double *min_dist, double *max_dist, GEOGRAPHIC_POINT *closest1, GEOGRAPHIC_POINT *closest2)
Point in spherical coordinates on the world.
Definition: lwgeodetic.h:33
double a
Definition: liblwgeom.h:269
#define MAXFLOAT
Largest float value.
double spheroid_distance(const GEOGRAPHIC_POINT *a, const GEOGRAPHIC_POINT *b, const SPHEROID *spheroid)
Computes the shortest distance along the surface of the spheroid between two points.
Definition: lwspheroid.c:59

Here is the call graph for this function:

Here is the caller graph for this function: