PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ mbc_test()

static void mbc_test ( LWGEOM g)
static

Definition at line 16 of file cu_minimum_bounding_circle.c.

References LWBOUNDINGCIRCLE::center, distance2d_pt_pt(), lwboundingcircle_destroy(), lwgeom_calculate_mbc(), lwpointiterator_create(), lwpointiterator_destroy(), lwpointiterator_next(), POINT2D::x, POINT4D::x, POINT2D::y, and POINT4D::y.

Referenced by basic_test().

17 {
19  CU_ASSERT_TRUE(result != NULL);
20 
22 
23  POINT2D p;
24  POINT4D p4;
25  while (lwpointiterator_next(it, &p4))
26  {
27  p.x = p4.x;
28  p.y = p4.y;
29 
30  /* We need to store the distance in a variable before the assert so that
31  * it is rounded from its 80-bit representation (on x86) down to 64 bits.
32  * */
33  volatile double d = distance2d_pt_pt(result->center, &p);
34 
35  CU_ASSERT_TRUE(d <= result->radius);
36  }
37 
40 }
double x
Definition: liblwgeom.h:352
int lwpointiterator_next(LWPOINTITERATOR *s, POINT4D *p)
Attempts to assign the next point in the iterator to p, and advances the iterator to the next point...
Definition: lwiterator.c:212
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
The old function nessecary for ptarray_segmentize2d in ptarray.c.
Definition: measures.c:2317
LWPOINTITERATOR * lwpointiterator_create(const LWGEOM *g)
Create a new LWPOINTITERATOR over supplied LWGEOM*.
Definition: lwiterator.c:244
double x
Definition: liblwgeom.h:328
LWBOUNDINGCIRCLE * lwgeom_calculate_mbc(const LWGEOM *g)
void lwpointiterator_destroy(LWPOINTITERATOR *s)
Free all memory associated with the iterator.
Definition: lwiterator.c:269
double y
Definition: liblwgeom.h:328
POINT2D * center
Definition: liblwgeom.h:1643
double y
Definition: liblwgeom.h:352
void lwboundingcircle_destroy(LWBOUNDINGCIRCLE *c)
Here is the call graph for this function:
Here is the caller graph for this function: