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

Definition at line 556 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, 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().

557 {
558  uint8_t flags = gflags(FLAGS_GET_Z(curve->flags), FLAGS_GET_M(curve->flags), 0);
559  GBOX tmp;
560  POINT4D p1, p2, p3;
561  int i;
562 
563  if ( ! curve ) return LW_FAILURE;
564  if ( curve->points->npoints < 3 ) return LW_FAILURE;
565 
566  tmp.flags = flags;
567 
568  /* Initialize */
569  gbox->xmin = gbox->ymin = gbox->zmin = gbox->mmin = FLT_MAX;
570  gbox->xmax = gbox->ymax = gbox->zmax = gbox->mmax = -1*FLT_MAX;
571 
572  for ( i = 2; i < curve->points->npoints; i += 2 )
573  {
574  getPoint4d_p(curve->points, i-2, &p1);
575  getPoint4d_p(curve->points, i-1, &p2);
576  getPoint4d_p(curve->points, i, &p3);
577 
578  if (lw_arc_calculate_gbox_cartesian(&p1, &p2, &p3, &tmp) == LW_FAILURE)
579  continue;
580 
581  gbox_merge(&tmp, gbox);
582  }
583 
584  return LW_SUCCESS;
585 }
uint8_t flags
Definition: liblwgeom.h:425
int npoints
Definition: liblwgeom.h:355
static int lw_arc_calculate_gbox_cartesian(const POINT4D *p1, const POINT4D *p2, const POINT4D *p3, GBOX *gbox)
Definition: g_box.c:498
double xmax
Definition: liblwgeom.h:277
#define LW_SUCCESS
Definition: liblwgeom.h:65
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:234
#define LW_FAILURE
Definition: liblwgeom.h:64
double zmax
Definition: liblwgeom.h:281
double ymin
Definition: liblwgeom.h:278
double xmin
Definition: liblwgeom.h:276
double ymax
Definition: liblwgeom.h:279
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
uint8_t flags
Definition: liblwgeom.h:275
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:130
double mmin
Definition: liblwgeom.h:282
double zmin
Definition: liblwgeom.h:280
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:125
double mmax
Definition: liblwgeom.h:283
POINTARRAY * points
Definition: liblwgeom.h:428
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
Definition: lwgeom_api.c:231

Here is the call graph for this function:

Here is the caller graph for this function: