PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int lwcircstring_calculate_gbox_cartesian ( LWCIRCSTRING curve,
GBOX gbox 
)
static

Definition at line 515 of file g_box.c.

References GBOX::flags, LWCIRCSTRING::flags, FLAGS_GET_M, FLAGS_GET_Z, gbox_merge(), getPoint4d_p(), gflags(), lw_arc_calculate_gbox_cartesian(), LW_FAILURE, LW_SUCCESS, MAXFLOAT, GBOX::mmax, GBOX::mmin, POINTARRAY::npoints, LWCIRCSTRING::points, GBOX::xmax, GBOX::xmin, GBOX::ymax, GBOX::ymin, GBOX::zmax, and GBOX::zmin.

Referenced by lwgeom_calculate_gbox_cartesian().

516 {
517  uint8_t flags = gflags(FLAGS_GET_Z(curve->flags), FLAGS_GET_M(curve->flags), 0);
518  GBOX tmp;
519  POINT4D p1, p2, p3;
520  int i;
521 
522  if ( ! curve ) return LW_FAILURE;
523  if ( curve->points->npoints < 3 ) return LW_FAILURE;
524 
525  tmp.flags = flags;
526 
527  /* Initialize */
528  gbox->xmin = gbox->ymin = gbox->zmin = gbox->mmin = MAXFLOAT;
529  gbox->xmax = gbox->ymax = gbox->zmax = gbox->mmax = -1 * MAXFLOAT;
530 
531  for ( i = 2; i < curve->points->npoints; i += 2 )
532  {
533  getPoint4d_p(curve->points, i-2, &p1);
534  getPoint4d_p(curve->points, i-1, &p2);
535  getPoint4d_p(curve->points, i, &p3);
536 
537  if (lw_arc_calculate_gbox_cartesian(&p1, &p2, &p3, &tmp) == LW_FAILURE)
538  continue;
539 
540  gbox_merge(&tmp, gbox);
541  }
542 
543  return LW_SUCCESS;
544 }
uint8_t flags
Definition: liblwgeom.h:397
int npoints
Definition: liblwgeom.h:327
static int lw_arc_calculate_gbox_cartesian(const POINT4D *p1, const POINT4D *p2, const POINT4D *p3, GBOX *gbox)
Definition: g_box.c:457
double xmax
Definition: liblwgeom.h:249
#define LW_SUCCESS
Definition: liblwgeom.h:55
int gbox_merge(const GBOX *new_box, GBOX *merge_box)
Update the merged GBOX to be large enough to include itself and the new box.
Definition: g_box.c:215
#define LW_FAILURE
Definition: liblwgeom.h:54
double zmax
Definition: liblwgeom.h:253
double ymin
Definition: liblwgeom.h:250
double xmin
Definition: liblwgeom.h:248
double ymax
Definition: liblwgeom.h:251
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
uint8_t flags
Definition: liblwgeom.h:247
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:131
double mmin
Definition: liblwgeom.h:254
double zmin
Definition: liblwgeom.h:252
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:107
#define MAXFLOAT
Largest float value.
double mmax
Definition: liblwgeom.h:255
POINTARRAY * points
Definition: liblwgeom.h:400
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
Definition: lwgeom_api.c:217

Here is the call graph for this function:

Here is the caller graph for this function: