}
-static void test_lwpoint_interpolate(void)
+static void test_point_interpolate(void)
{
POINT4D p, q, r;
int rv = 0;
q.z = 40.0;
q.m = 50.0;
- rv = lwpoint_interpolate(&p, &q, &r, 1, 1, 'Z', 35.0);
+ rv = point_interpolate(&p, &q, &r, 1, 1, 'Z', 35.0);
CU_ASSERT_EQUAL( r.x, 15.0);
- rv = lwpoint_interpolate(&p, &q, &r, 1, 1, 'M', 41.0);
+ rv = point_interpolate(&p, &q, &r, 1, 1, 'M', 41.0);
CU_ASSERT_EQUAL( r.y, 21.0);
- rv = lwpoint_interpolate(&p, &q, &r, 1, 1, 'M', 50.0);
+ rv = point_interpolate(&p, &q, &r, 1, 1, 'M', 50.0);
CU_ASSERT_EQUAL( r.y, 30.0);
- rv = lwpoint_interpolate(&p, &q, &r, 1, 1, 'M', 40.0);
+ rv = point_interpolate(&p, &q, &r, 1, 1, 'M', 40.0);
CU_ASSERT_EQUAL( r.y, 20.0);
}
PG_TEST(test_lwline_crossing_bugs),
PG_TEST(test_lwpoint_set_ordinate),
PG_TEST(test_lwpoint_get_ordinate),
- PG_TEST(test_lwpoint_interpolate),
+ PG_TEST(test_point_interpolate),
PG_TEST(test_lwline_clip),
PG_TEST(test_lwline_clip_big),
PG_TEST(test_lwmline_clip),
* generate a new point that is proportionally between the input points,
* using the values in the provided dimension as the scaling factors.
*/
-int lwpoint_interpolate(const POINT4D *p1, const POINT4D *p2, POINT4D *p, int hasz, int hasm, char ordinate, double interpolation_value)
+int point_interpolate(const POINT4D *p1, const POINT4D *p2, POINT4D *p, int hasz, int hasm, char ordinate, double interpolation_value)
{
static char* dims = "XYZM";
double p1_value = lwpoint_get_ordinate(p1, ordinate);
{
double interpolation_value;
(ordinate_value_q > to) ? (interpolation_value = to) : (interpolation_value = from);
- rv = lwpoint_interpolate(q, p, r, hasz, hasm, ordinate, interpolation_value);
+ rv = point_interpolate(q, p, r, hasz, hasm, ordinate, interpolation_value);
rv = ptarray_append_point(dp, r, LW_FALSE);
LWDEBUGF(4, "[0] interpolating between (%g, %g) with interpolation point (%g)", ordinate_value_q, ordinate_value_p, interpolation_value);
}
* to the point array at the range boundary. */
double interpolation_value;
(ordinate_value_p > to) ? (interpolation_value = to) : (interpolation_value = from);
- rv = lwpoint_interpolate(q, p, r, hasz, hasm, ordinate, interpolation_value);
+ rv = point_interpolate(q, p, r, hasz, hasm, ordinate, interpolation_value);
rv = ptarray_append_point(dp, r, LW_FALSE);
LWDEBUGF(4, " [1] interpolating between (%g, %g) with interpolation point (%g)", ordinate_value_q, ordinate_value_p, interpolation_value);
}
{
double interpolation_value;
(ordinate_value_p > to) ? (interpolation_value = to) : (interpolation_value = from);
- rv = lwpoint_interpolate(q, p, r, hasz, hasm, ordinate, interpolation_value);
+ rv = point_interpolate(q, p, r, hasz, hasm, ordinate, interpolation_value);
rv = ptarray_append_point(dp, r, LW_FALSE);
LWDEBUGF(4, " [2] interpolating between (%g, %g) with interpolation point (%g)", ordinate_value_q, ordinate_value_p, interpolation_value);
}
* so we need to add *two* interpolated points! */
dp = ptarray_construct(hasz, hasm, 2);
/* Interpolate lower point. */
- rv = lwpoint_interpolate(p, q, r, hasz, hasm, ordinate, from);
+ rv = point_interpolate(p, q, r, hasz, hasm, ordinate, from);
ptarray_set_point4d(dp, 0, r);
/* Interpolate upper point. */
- rv = lwpoint_interpolate(p, q, r, hasz, hasm, ordinate, to);
+ rv = point_interpolate(p, q, r, hasz, hasm, ordinate, to);
ptarray_set_point4d(dp, 1, r);
}
else if ( i && ordinate_value_q > to && ordinate_value_p < from )
* so we need to add *two* interpolated points! */
dp = ptarray_construct(hasz, hasm, 2);
/* Interpolate upper point. */
- rv = lwpoint_interpolate(p, q, r, hasz, hasm, ordinate, to);
+ rv = point_interpolate(p, q, r, hasz, hasm, ordinate, to);
ptarray_set_point4d(dp, 0, r);
/* Interpolate lower point. */
- rv = lwpoint_interpolate(p, q, r, hasz, hasm, ordinate, from);
+ rv = point_interpolate(p, q, r, hasz, hasm, ordinate, from);
ptarray_set_point4d(dp, 1, r);
}
/* We have an extant point-array, save it out to a multi-line. */