PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void test_point_interpolate ( void  )
static

Definition at line 435 of file cu_algorithm.c.

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

Referenced by algorithms_suite_setup().

436 {
437  POINT4D p, q, r;
438  int rv = 0;
439 
440  p.x = 10.0;
441  p.y = 20.0;
442  p.z = 30.0;
443  p.m = 40.0;
444 
445  q.x = 20.0;
446  q.y = 30.0;
447  q.z = 40.0;
448  q.m = 50.0;
449 
450  rv = point_interpolate(&p, &q, &r, 1, 1, 'Z', 35.0);
451  CU_ASSERT_EQUAL( r.x, 15.0);
452 
453  rv = point_interpolate(&p, &q, &r, 1, 1, 'M', 41.0);
454  CU_ASSERT_EQUAL( r.y, 21.0);
455 
456  rv = point_interpolate(&p, &q, &r, 1, 1, 'M', 50.0);
457  CU_ASSERT_EQUAL( r.y, 30.0);
458 
459  rv = point_interpolate(&p, &q, &r, 1, 1, 'M', 40.0);
460  CU_ASSERT_EQUAL( r.y, 20.0);
461 
462 }
double x
Definition: liblwgeom.h:308
double m
Definition: liblwgeom.h:308
char * r
Definition: cu_in_wkt.c:25
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 z
Definition: liblwgeom.h:308
double y
Definition: liblwgeom.h:308

Here is the call graph for this function:

Here is the caller graph for this function: