Computes the average(ish) center of the box and returns success.
Definition at line 267 of file lwgeodetic.c.
References cart2geog(), GEOGRAPHIC_POINT::lat, latitude_degrees_normalize(), GEOGRAPHIC_POINT::lon, longitude_degrees_normalize(), LW_SUCCESS, normalize(), rad2deg, POINT2D::x, POINT3D::x, GBOX::xmin, POINT2D::y, POINT3D::y, and POINT3D::z.
Referenced by geography_bestsrid(), and test_gbox_utils().
276 memcpy(d, &(gbox->
xmin), 6*
sizeof(
double));
279 pt.
x = pt.
y = pt.
z = 0.0;
281 for ( i = 0; i < 8; i++ )
286 pt_n.
y = d[2 + ((i % 4) / 2)];
287 pt_n.z = d[4 + (i % 2)];
void normalize(POINT3D *p)
Normalize to a unit vector.
void cart2geog(const POINT3D *p, GEOGRAPHIC_POINT *g)
Convert cartesion coordinates on unit sphere to spherical coordinates.
double longitude_degrees_normalize(double lon)
Convert a longitude to the range of -180,180.
Point in spherical coordinates on the world.
double latitude_degrees_normalize(double lat)
Convert a latitude to the range of -90,90.