PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwcircstring_calculate_gbox_cartesian()

static int lwcircstring_calculate_gbox_cartesian ( LWCIRCSTRING curve,
GBOX gbox 
)
static

Definition at line 586 of file g_box.c.

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 }
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
static int lw_arc_calculate_gbox_cartesian(const POINT4D *p1, const POINT4D *p2, const POINT4D *p3, GBOX *gbox)
Definition: g_box.c:528
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:145
#define LW_FAILURE
Definition: liblwgeom.h:79
#define LW_SUCCESS
Definition: liblwgeom.h:80
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:123
double ymax
Definition: liblwgeom.h:298
double zmax
Definition: liblwgeom.h:300
double xmax
Definition: liblwgeom.h:296
double zmin
Definition: liblwgeom.h:299
double mmax
Definition: liblwgeom.h:302
double ymin
Definition: liblwgeom.h:297
double xmin
Definition: liblwgeom.h:295
double mmin
Definition: liblwgeom.h:301
uint8_t flags
Definition: liblwgeom.h:294
uint8_t flags
Definition: liblwgeom.h:444
POINTARRAY * points
Definition: liblwgeom.h:447
uint32_t npoints
Definition: liblwgeom.h:374
unsigned int uint32_t
Definition: uthash.h:78

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().

Here is the call graph for this function:
Here is the caller graph for this function: