开发者

resampling a series of points

开发者 https://www.devze.com 2022-12-29 06:33 出处:网络
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.

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. the开发者_JAVA百科re will always be at least 1 sample.

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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消