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

◆ test_ptarray_closest_vertex_2d()

static void test_ptarray_closest_vertex_2d ( )
static

Definition at line 656 of file cu_ptarray.c.

657{
658 LWLINE *line;
659 POINTARRAY *pa;
660 double dist;
661 POINT2D qp;
662 const char *wkt;
663 int rv;
664
665 wkt = "LINESTRING (0 0 0, 1 0 0, 2 0 0, 3 0 10)";
667 pa = line->points;
668
669 qp.x = qp.y = 0;
670 rv = ptarray_closest_vertex_2d(pa, &qp, &dist);
671 ASSERT_INT_EQUAL(rv, 0);
672 ASSERT_DOUBLE_EQUAL(dist, 0);
673
674 qp.x = qp.y = 1;
675 rv = ptarray_closest_vertex_2d(pa, &qp, &dist);
676 ASSERT_INT_EQUAL(rv, 1);
677 ASSERT_DOUBLE_EQUAL(dist, 1);
678
679 qp.x = 5; qp.y = 0;
680 rv = ptarray_closest_vertex_2d(pa, &qp, &dist);
681 ASSERT_INT_EQUAL(rv, 3);
682 ASSERT_DOUBLE_EQUAL(dist, 2);
683
684
685 lwline_free(line);
686}
static LWGEOM * lwgeom_from_text(const char *str)
Definition cu_ptarray.c:24
#define ASSERT_DOUBLE_EQUAL(o, e)
#define ASSERT_INT_EQUAL(o, e)
int ptarray_closest_vertex_2d(const POINTARRAY *pa, const POINT2D *qp, double *dist)
Definition ptarray.c:1485
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
Definition lwgeom.c:207
void lwline_free(LWLINE *line)
Definition lwline.c:67
POINTARRAY * points
Definition liblwgeom.h:483
double y
Definition liblwgeom.h:390
double x
Definition liblwgeom.h:390

References ASSERT_DOUBLE_EQUAL, ASSERT_INT_EQUAL, lwgeom_as_lwline(), lwgeom_from_text(), lwline_free(), LWLINE::points, ptarray_closest_vertex_2d(), POINT2D::x, and POINT2D::y.

Referenced by ptarray_suite_setup().

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