PostGIS  2.4.9dev-r@@SVN_REVISION@@

## ◆ circ_center_spherical()

 static int circ_center_spherical ( const GEOGRAPHIC_POINT * c1, const GEOGRAPHIC_POINT * c2, double distance, double offset, GEOGRAPHIC_POINT * center )
static

Given the centers of two circles, and the offset distance we want to put the new center between them (calculated as the distance implied by the radii of the inputs and the distance between the centers) figure out where the new center point is, by getting the direction from c1 to c2 and projecting from c1 in that direction by the offset distance.

Definition at line 165 of file lwgeodetic_tree.c.

References LW_FAILURE, LWDEBUGF, sphere_direction(), and sphere_project().

Referenced by circ_node_internal_new().

166 {
167  /* Direction from c1 to c2 */
168  double dir = sphere_direction(c1, c2, distance);
169
170  LWDEBUGF(4,"calculating spherical center", dir);
171
172  LWDEBUGF(4,"dir is %g", dir);
173
174  /* Catch sphere_direction when it barfs */
175  if ( isnan(dir) )
176  return LW_FAILURE;
177
178  /* Center of new circle is projection from start point, using offset distance*/
179  return sphere_project(c1, offset, dir, center);
180 }
int sphere_project(const GEOGRAPHIC_POINT *r, double distance, double azimuth, GEOGRAPHIC_POINT *n)
Given a starting location r, a distance and an azimuth to the new point, compute the location of the ...
Definition: lwgeodetic.c:1310
#define LW_FAILURE
Definition: liblwgeom.h:79
Datum distance(PG_FUNCTION_ARGS)
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
double sphere_direction(const GEOGRAPHIC_POINT *s, const GEOGRAPHIC_POINT *e, double d)
Given two points on a unit sphere, calculate the direction from s to e.
Definition: lwgeodetic.c:971
Here is the call graph for this function:
Here is the caller graph for this function: