PostGIS  2.5.0beta2dev-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 167 of file lwgeodetic_tree.c.

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

Referenced by circ_node_internal_new().

168 {
169  /* Direction from c1 to c2 */
170  double dir = sphere_direction(c1, c2, distance);
171 
172  LWDEBUGF(4,"calculating spherical center", dir);
173 
174  LWDEBUGF(4,"dir is %g", dir);
175 
176  /* Catch sphere_direction when it barfs */
177  if ( isnan(dir) )
178  return LW_FAILURE;
179 
180  /* Center of new circle is projection from start point, using offset distance*/
181  return sphere_project(c1, offset, dir, center);
182 }
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:1283
#define LW_FAILURE
Definition: liblwgeom.h:78
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:944
Here is the call graph for this function:
Here is the caller graph for this function: