views:

59

answers:

2

hello, i have an array of points in 3d (imagine the trajectory of a ball) with X samples.

now, i want to resample these points so that i have a new array with positions with y samples.

y can be bigger or smaller than x but not smaller than 1. there will always be at least 1 sample.

how would an algorithm look like to resample the original array into a new one? thanks!

+3  A: 

You have to select some kind of interpolation/approximation function based on the original x samples (e.g. some kind of spline). Then you can evaluate this function at y (equally spaced, if wanted) points to get your new samples.

For the math, you can use the Wikipedia article about spline interpolation as starting point.

MartinStettner
+3  A: 

The basic idea is to take your X points and plot them on a graph. Then interpolate between them using some reasonable interpolation function. You could use linear interpolation, quadric B-splines, etc. Generally, unless you have a specific reason to believe the points represent a higher-order function (e.g. N4) you want to stick to a relatively low-order interpolation function.

Once you've done that, you have (essentially) a continuous line on your graph. To get your Y points, you just select Y points equally spaced along the graph's X axis.

Jerry Coffin
thanks, yes linear interpolation would be enough
clamp