问题描述
我在3d(想象一个球的轨迹)中有X个采样点.
i have an array of points in 3d (imagine the trajectory of a ball) with X samples.
现在,我想对这些点进行重新采样,以使我拥有一个位置为y个采样点的新数组.
now, i want to resample these points so that i have a new array with positions with y samples.
y可以大于或小于x,但不能小于1.总会有至少1个样本.
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!
推荐答案
基本思想是获取X点并将其绘制在图形上.然后使用一些合理的插值函数在它们之间进行插值.您可以使用线性插值,二次B样条曲线等.通常,除非您有特定的理由认为这些点代表一个高阶函数(例如N ),否则您要坚持相对低阶插值功能.
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. N) you want to stick to a relatively low-order interpolation function.
完成此操作后,您的图形上(基本上)将有一条连续的线.要获取Y点,只需选择沿图形X轴等距分布的Y点即可.
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.
这篇关于重采样一系列点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!