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

◆ test_geography_tree_closestpoint()

static void test_geography_tree_closestpoint ( void  )
static

Definition at line 626 of file cu_tree.c.

627{
628 LWGEOM *lwg1, *lwg2, *lwg3;
629 LWPOINT *lwpt;
630 POINT2D pt;
631
632 /* Simple case */
633 lwg1 = lwgeom_from_wkt("LINESTRING (18 9, 18 1)", LW_PARSER_CHECK_NONE);
634 lwg2 = lwgeom_from_wkt("POINT (16 4)", LW_PARSER_CHECK_NONE);
635 lwg3 = geography_tree_closestpoint(lwg1, lwg2, 0.1);
636 lwpt = (LWPOINT *)lwg3;
637
638 lwpoint_getPoint2d_p(lwpt, &pt);
639 CU_ASSERT_DOUBLE_EQUAL(pt.x, 18, 0.0001);
640 CU_ASSERT_DOUBLE_EQUAL(pt.y, 4.0024302, 0.0001);
641
642 lwgeom_free(lwg1);
643 lwgeom_free(lwg2);
644 lwgeom_free(lwg3);
645}
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
int lwpoint_getPoint2d_p(const LWPOINT *point, POINT2D *out)
Definition lwpoint.c:40
LWGEOM * geography_tree_closestpoint(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2, double threshold)
double y
Definition liblwgeom.h:390
double x
Definition liblwgeom.h:390

References geography_tree_closestpoint(), LW_PARSER_CHECK_NONE, lwgeom_free(), lwgeom_from_wkt(), lwpoint_getPoint2d_p(), POINT2D::x, and POINT2D::y.

Referenced by tree_suite_setup().

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