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

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

592 {
593  uint8_t flags = gflags(FLAGS_GET_Z(curve->flags), FLAGS_GET_M(curve->flags), 0);
594  GBOX tmp;
595  POINT4D p1, p2, p3;
596  int i;
597 
598  if ( ! curve ) return LW_FAILURE;
599  if ( curve->points->npoints < 3 ) return LW_FAILURE;
600 
601  tmp.flags = flags;
602 
603  /* Initialize */
604  gbox->xmin = gbox->ymin = gbox->zmin = gbox->mmin = FLT_MAX;
605  gbox->xmax = gbox->ymax = gbox->zmax = gbox->mmax = -1*FLT_MAX;
606 
607  for ( i = 2; i < curve->points->npoints; i += 2 )
608  {
609  getPoint4d_p(curve->points, i-2, &p1);
610  getPoint4d_p(curve->points, i-1, &p2);
611  getPoint4d_p(curve->points, i, &p3);
612 
613  if (lw_arc_calculate_gbox_cartesian(&p1, &p2, &p3, &tmp) == LW_FAILURE)
614  continue;
615 
616  gbox_merge(&tmp, gbox);
617  }
618 
619  return LW_SUCCESS;
620 }
uint8_t flags
Definition: liblwgeom.h:440
int npoints
Definition: liblwgeom.h:370
static int lw_arc_calculate_gbox_cartesian(const POINT4D *p1, const POINT4D *p2, const POINT4D *p3, GBOX *gbox)
Definition: g_box.c:533
double xmax
Definition: liblwgeom.h:292
#define LW_SUCCESS
Definition: liblwgeom.h:79
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:269
#define LW_FAILURE
Definition: liblwgeom.h:78
double zmax
Definition: liblwgeom.h:296
double ymin
Definition: liblwgeom.h:293
double xmin
Definition: liblwgeom.h:291
double ymax
Definition: liblwgeom.h:294
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:139
uint8_t flags
Definition: liblwgeom.h:290
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:145
double mmin
Definition: liblwgeom.h:297
double zmin
Definition: liblwgeom.h:295
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:140
double mmax
Definition: liblwgeom.h:298
POINTARRAY * points
Definition: liblwgeom.h:443
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
Definition: lwgeom_api.c:244

Here is the call graph for this function:

Here is the caller graph for this function: