Definition at line 1340 of file lwgeodetic.c.
References distance(), GEOGRAPHIC_EDGE::end, FP_EQUALS, FP_IS_ZERO, gbox_init_point3d(), gbox_merge_point3d(), geog2cart(), LW_SUCCESS, LWDEBUG, normalize(), sphere_distance(), GEOGRAPHIC_EDGE::start, POINT3D::x, GBOX::xmax, GBOX::xmin, POINT3D::y, GBOX::ymax, GBOX::ymin, POINT3D::z, GBOX::zmax, and GBOX::zmin.
1342 int steps = 1000000;
1351 LWDEBUG(4,
"edge is zero length. returning");
1363 LWDEBUG(4,
"edge is antipodal. setting to maximum size box, and returning");
1373 dx = (end.
x - start.
x)/steps;
1374 dy = (end.
y - start.
y)/steps;
1375 dz = (end.
z - start.
z)/steps;
1380 for ( i = 0; i < steps; i++ )
double sphere_distance(const GEOGRAPHIC_POINT *s, const GEOGRAPHIC_POINT *e)
Given two points on a unit sphere, calculate their distance apart in radians.
void normalize(POINT3D *p)
Normalize to a unit vector.
#define LWDEBUG(level, msg)
int gbox_init_point3d(const POINT3D *p, GBOX *gbox)
Initialize a GBOX using the values of the point.
int gbox_merge_point3d(const POINT3D *p, GBOX *gbox)
Update the GBOX to be large enough to include itself and the new point.
Datum distance(PG_FUNCTION_ARGS)
void geog2cart(const GEOGRAPHIC_POINT *g, POINT3D *p)
Convert spherical coordinates to cartesion coordinates on unit sphere.