PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_point_interpolate()

static void test_point_interpolate ( void  )
static

Definition at line 434 of file cu_algorithm.c.

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

Referenced by algorithms_suite_setup().

435 {
436  POINT4D p, q, r;
437  int rv = 0;
438 
439  p.x = 10.0;
440  p.y = 20.0;
441  p.z = 30.0;
442  p.m = 40.0;
443 
444  q.x = 20.0;
445  q.y = 30.0;
446  q.z = 40.0;
447  q.m = 50.0;
448 
449  rv = point_interpolate(&p, &q, &r, 1, 1, 'Z', 35.0);
450  CU_ASSERT_EQUAL( rv, LW_SUCCESS );
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( rv, LW_SUCCESS );
455  CU_ASSERT_EQUAL( r.y, 21.0);
456 
457  rv = point_interpolate(&p, &q, &r, 1, 1, 'M', 50.0);
458  CU_ASSERT_EQUAL( rv, LW_SUCCESS );
459  CU_ASSERT_EQUAL( r.y, 30.0);
460 
461  rv = point_interpolate(&p, &q, &r, 1, 1, 'M', 40.0);
462  CU_ASSERT_EQUAL( rv, LW_SUCCESS );
463  CU_ASSERT_EQUAL( r.y, 20.0);
464 
465 }
double x
Definition: liblwgeom.h:352
double m
Definition: liblwgeom.h:352
char * r
Definition: cu_in_wkt.c:24
#define LW_SUCCESS
Definition: liblwgeom.h:80
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:352
double y
Definition: liblwgeom.h:352
Here is the call graph for this function:
Here is the caller graph for this function: