PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ mbc_test()

static void mbc_test ( LWGEOM g)
static

Definition at line 16 of file cu_minimum_bounding_circle.c.

17 {
19  CU_ASSERT_TRUE(result != NULL);
20 
22 
23  POINT2D p;
24  POINT4D p4;
25  char *msg1 = "mbc_test failed (got %.12f should be less than radius %.12f) \n";
26  while (lwpointiterator_next(it, &p4))
27  {
28  p.x = p4.x;
29  p.y = p4.y;
30 
31  /* We need to store the distance in a variable before the assert so that
32  * it is rounded from its 80-bit representation (on x86) down to 64 bits.
33  * */
34  volatile double d = distance2d_pt_pt(result->center, &p);
35  if ( (d - result->radius) > 0.0000001 )
36  {
37  printf(msg1, d, result->radius);
38  CU_FAIL();
39  }
40  else
41  {
42  CU_PASS();
43  }
44  }
45 
48 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:262
double distance2d_pt_pt(const POINT2D *p1, const POINT2D *p2)
Definition: measures.c:2398
LWPOINTITERATOR * lwpointiterator_create(const LWGEOM *g)
Create a new LWPOINTITERATOR over supplied LWGEOM*.
Definition: lwiterator.c:242
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:210
void lwpointiterator_destroy(LWPOINTITERATOR *s)
Free all memory associated with the iterator.
Definition: lwiterator.c:267
LWBOUNDINGCIRCLE * lwgeom_calculate_mbc(const LWGEOM *g)
void lwboundingcircle_destroy(LWBOUNDINGCIRCLE *c)
double y
Definition: liblwgeom.h:390
double x
Definition: liblwgeom.h:390
double x
Definition: liblwgeom.h:414
double y
Definition: liblwgeom.h:414

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

Referenced by basic_test().

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