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

◆ test_point_interpolate()

static void test_point_interpolate ( void  )
static

Definition at line 436 of file cu_algorithm.c.

437{
438 POINT4D p, q, r = {0, 0, 0, 0};
439 int rv = 0;
440
441 p.x = 10.0;
442 p.y = 20.0;
443 p.z = 30.0;
444 p.m = 40.0;
445
446 q.x = 20.0;
447 q.y = 30.0;
448 q.z = 40.0;
449 q.m = 50.0;
450
451 rv = point_interpolate(&p, &q, &r, 1, 1, 'Z', 35.0);
452 CU_ASSERT_EQUAL(rv, LW_SUCCESS);
453 CU_ASSERT_EQUAL(r.x, 15.0);
454
455 rv = point_interpolate(&p, &q, &r, 1, 1, 'M', 41.0);
456 CU_ASSERT_EQUAL(rv, LW_SUCCESS);
457 CU_ASSERT_EQUAL(r.y, 21.0);
458
459 rv = point_interpolate(&p, &q, &r, 1, 1, 'M', 50.0);
460 CU_ASSERT_EQUAL(rv, LW_SUCCESS);
461 CU_ASSERT_EQUAL(r.y, 30.0);
462
463 rv = point_interpolate(&p, &q, &r, 1, 1, 'M', 40.0);
464 CU_ASSERT_EQUAL(rv, LW_SUCCESS);
465 CU_ASSERT_EQUAL(r.y, 20.0);
466}
char * r
Definition cu_in_wkt.c:24
#define LW_SUCCESS
Definition liblwgeom.h:97
int point_interpolate(const POINT4D *p1, const POINT4D *p2, POINT4D *p, int hasz, int hasm, char ordinate, double interpolation_value)
Given two points, a dimensionality, an ordinate, and an interpolation value generate a new point that...
double m
Definition liblwgeom.h:414
double x
Definition liblwgeom.h:414
double z
Definition liblwgeom.h:414
double y
Definition liblwgeom.h:414

References LW_SUCCESS, POINT4D::m, point_interpolate(), r, POINT4D::x, POINT4D::y, and POINT4D::z.

Referenced by algorithms_suite_setup().

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