PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ gbox_angular_height()

double gbox_angular_height ( const GBOX gbox)

GBOX utility functions to figure out coverage/location on the globe.

GBOX utility functions to figure out coverage/location on the globe.

Definition at line 188 of file lwgeodetic.c.

References normalize(), POINT3D::x, GBOX::xmin, POINT3D::y, and POINT3D::z.

Referenced by geography_bestsrid(), and test_gbox_utils().

189 {
190  double d[6];
191  int i;
192  double zmin = FLT_MAX;
193  double zmax = -1 * FLT_MAX;
194  POINT3D pt;
195 
196  /* Take a copy of the box corners so we can treat them as a list */
197  /* Elements are xmin, xmax, ymin, ymax, zmin, zmax */
198  memcpy(d, &(gbox->xmin), 6*sizeof(double));
199 
200  /* Generate all 8 corner vectors of the box */
201  for ( i = 0; i < 8; i++ )
202  {
203  pt.x = d[i / 4];
204  pt.y = d[2 + (i % 4) / 2];
205  pt.z = d[4 + (i % 2)];
206  normalize(&pt);
207  if ( pt.z < zmin ) zmin = pt.z;
208  if ( pt.z > zmax ) zmax = pt.z;
209  }
210  return asin(zmax) - asin(zmin);
211 }
void normalize(POINT3D *p)
Normalize to a unit vector.
Definition: lwgeodetic.c:611
double y
Definition: liblwgeom.h:340
double x
Definition: liblwgeom.h:340
double z
Definition: liblwgeom.h:340
double xmin
Definition: liblwgeom.h:292
Here is the call graph for this function:
Here is the caller graph for this function: