PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ do_test_mindistance_tolerance()

static void do_test_mindistance_tolerance ( char *  in1,
char *  in2,
double  expected_res,
int  line,
double(*)(const LWGEOM *, const LWGEOM *, double)  distancef,
double  accepted_error 
)
static

Definition at line 41 of file cu_measures.c.

47{
48 LWGEOM *lw1;
49 LWGEOM *lw2;
50 double distance;
51 char *msg1 = "test_mindistance2d_tolerance failed (got %g expected %g) at line %d\n";
52 char *msg2 = "\n\ndo_test_mindistance2d_tolerance: NULL lwgeom generated from WKT\n %s\n\n";
53
56
57 if ( ! lw1 )
58 {
59 printf(msg2, in1);
60 exit(1);
61 }
62 if ( ! lw2 )
63 {
64 printf(msg2, in2);
65 exit(1);
66 }
67
68 FLAGS_SET_SOLID(lw1->flags, 1);
69 FLAGS_SET_SOLID(lw2->flags, 1);
70
71 distance = distancef(lw1, lw2, 0.0);
72 lwgeom_free(lw1);
73 lwgeom_free(lw2);
74 if ( fabs(distance - expected_res) > accepted_error )
75 {
76 printf(msg1, distance, expected_res, line);
77 CU_FAIL();
78 }
79 else
80 {
81 CU_PASS();
82 }
83
84}
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition lwin_wkt.c:940
#define FLAGS_SET_SOLID(flags, value)
Definition liblwgeom.h:177
static double distance(double x1, double y1, double x2, double y2)
Definition lwtree.c:1032
lwflags_t flags
Definition liblwgeom.h:461

References distance(), LWGEOM::flags, FLAGS_SET_SOLID, LW_PARSER_CHECK_NONE, lwgeom_free(), and lwgeom_from_wkt().

Here is the call graph for this function: