227 const double gtolerance = 0.000001;
239 ll[0] = -3.083333333333333333333333333333333;
240 ll[1] = 9.83333333333333333333333333333333;
251 for ( i = 0; i < loops; i++ )
253 rndlat = (int)(90.0 - 180.0 * (
double)random() / pow(2.0, 31.0));
254 rndlon = (int)(180.0 - 360.0 * (
double)random() / pow(2.0, 31.0));
255 ll[0] = (double)rndlon;
256 ll[1] = (double)rndlat;
258 rndlat = (int)(90.0 - 180.0 * (
double)random() / pow(2.0, 31.0));
259 rndlon = (int)(180.0 - 360.0 * (
double)random() / pow(2.0, 31.0));
260 ll[2] = (double)rndlon;
261 ll[3] = (double)rndlat;
270 ( fabs( gbox.
xmin - gbox_slow.
xmin ) > gtolerance ) ||
271 ( fabs( gbox.
xmax - gbox_slow.
xmax ) > gtolerance ) ||
272 ( fabs( gbox.
ymin - gbox_slow.
ymin ) > gtolerance ) ||
273 ( fabs( gbox.
ymax - gbox_slow.
ymax ) > gtolerance ) ||
274 ( fabs( gbox.
zmin - gbox_slow.
zmin ) > gtolerance ) ||
275 ( fabs( gbox.
zmax - gbox_slow.
zmax ) > gtolerance ) )
277 printf(
"\n-------\n");
278 printf(
"If you are seeing this, cut and paste it, it is a randomly generated test case!\n");
279 printf(
"LOOP: %d\n", i);
280 printf(
"SEGMENT (Lon Lat): (%.9g %.9g) (%.9g %.9g)\n", ll[0], ll[1], ll[2], ll[3]);
283 printf(
"-------\n\n");
284 CU_FAIL_FATAL(Slow (GOOD) and fast (CALC) box calculations returned different values!!);
char * gbox_to_string(const GBOX *gbox)
Allocate a string representation of the GBOX, based on dimensionality of flags.
POINTARRAY * ptarray_construct_reference_data(char hasz, char hasm, uint32_t npoints, uint8_t *ptlist)
Construct a new POINTARRAY, referencing to the data from ptlist.
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
void lwgeom_free(LWGEOM *geom)
int lwgeom_calculate_gbox_geodetic(const LWGEOM *geom, GBOX *gbox)
Calculate the geodetic bounding box for an LWGEOM.
#define FLAGS_SET_GEODETIC(flags, value)
#define LW_TRUE
Return types for functions with status returns.
#define SRID_UNKNOWN
Unknown SRID value.
LWLINE * lwline_construct(int srid, GBOX *bbox, POINTARRAY *points)
int gbox_geocentric_slow
For testing geodetic bounding box, we have a magic global variable.