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

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

587 {
588  GBOX tmp;
589  POINT4D p1, p2, p3;
590  uint32_t i;
591 
592  if (!curve) return LW_FAILURE;
593  if (curve->points->npoints < 3) return LW_FAILURE;
594 
595  tmp.flags =
596  gflags(FLAGS_GET_Z(curve->flags), FLAGS_GET_M(curve->flags), 0);
597 
598  /* Initialize */
599  gbox->xmin = gbox->ymin = gbox->zmin = gbox->mmin = FLT_MAX;
600  gbox->xmax = gbox->ymax = gbox->zmax = gbox->mmax = -1*FLT_MAX;
601 
602  for ( i = 2; i < curve->points->npoints; i += 2 )
603  {
604  getPoint4d_p(curve->points, i-2, &p1);
605  getPoint4d_p(curve->points, i-1, &p2);
606  getPoint4d_p(curve->points, i, &p3);
607 
608  if (lw_arc_calculate_gbox_cartesian(&p1, &p2, &p3, &tmp) == LW_FAILURE)
609  continue;
610 
611  gbox_merge(&tmp, gbox);
612  }
613 
614  return LW_SUCCESS;
615 }
uint8_t flags
Definition: liblwgeom.h:440
static int lw_arc_calculate_gbox_cartesian(const POINT4D *p1, const POINT4D *p2, const POINT4D *p3, GBOX *gbox)
Definition: g_box.c:528
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:264
#define LW_FAILURE
Definition: liblwgeom.h:78
unsigned int uint32_t
Definition: uthash.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
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:113
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
uint32_t npoints
Definition: liblwgeom.h:370

Here is the call graph for this function:

Here is the caller graph for this function: