Given two points, a dimensionality, an ordinate, and an interpolation value generate a new point that is proportionally between the input points, using the values in the provided dimension as the scaling factors.
323{
324 static char *dims = "XYZM";
327 double proportion;
328 int i = 0;
329
330 assert(ordinate == 'X' || ordinate == 'Y' ||
331 ordinate == 'Z' || ordinate == 'M');
332 assert(
FP_MIN(p1_value, p2_value) <= interpolation_value &&
333 FP_MAX(p1_value, p2_value) >= interpolation_value);
334
335 proportion = (interpolation_value - p1_value) / (p2_value - p1_value);
336
337 for (i = 0; i < 4; i++)
338 {
339 if (dims[i] == 'Z' && !hasz)
340 continue;
341 if (dims[i] == 'M' && !hasm)
342 continue;
343 if (dims[i] == ordinate)
345 else
346 {
347 double newordinate = 0.0;
350 newordinate = p1_value + proportion * (p2_value - p1_value);
352 }
353 }
354
356}
void lwpoint_set_ordinate(POINT4D *p, char ordinate, double value)
Given a point, ordinate number and value, set that ordinate on the point.
double lwpoint_get_ordinate(const POINT4D *p, char ordinate)
Given a POINT4D and an ordinate number, return the value of the ordinate.