简单的方法来在三维空间中的点之间进行内插,以形成光滑的表面 [英] Simple way to interpolate between points in 3D space to form a smooth surface

查看:181
本文介绍了简单的方法来在三维空间中的点之间进行内插,以形成光滑的表面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图想出了一个简单有效的方法来创建一个平滑的表面相交一批获得采样点。

I'm trying to come up with a simple and efficient way to create a smooth surface which intersects a number of given "sample" points.

有关的任​​何的X,Y点的表面上,我标识多达4的采样点中的每个的4个方向(在X的下一个较高和较低的点,然后将Y轴)。考虑到这一点,我想一个方法来计算Z值的4个采样点之间进行插值。

For any X,Y point on the surface, I identify up to 4 sample points in each of the 4 directions (the next higher and lower points on the X, and then the Y axes). Given this point, I want a way to compute a Z value that interpolates between the 4 sample points.

当然该算法给定的任何的4个采样点的X,Y位置,应输出该点的Z值。还要注意,有可能小于4的采样点。

Of course the algorithm, given the X, Y position of any of the 4 sample points, should output the Z value for that point. Note also that there may be less than 4 sample points.

我想为4采样点,以某种方式由负到采样点的距离偏的Z值的某些功能,但我无法弄清楚如何做到这一点。

I guess some function of the Z values for the 4 sample points, somehow inversely biased by the distance to the sample point, but I can't figure out how to do this.

任何人有关于一个简单的方法来做到这一点任何想法?

Anyone got any ideas about a simple way to do this?

推荐答案

您可以通过从卡特莫尔-ROM样条构造补丁做到这一点。这些花键将击中每个控制点和它们是连续的,在一阶导数(虽然不是第二)。我也觉得他们是非常容易的工作。数学很简单,他们的行为与直观的控制点的微小变化。

You can do this by constructing patches from Catmull-Rom splines. These splines will hit each of the control points and they are continuous in the first derivative (though not the second). I also find them to be extremely easy to work with. The math is straightforward and they behave intuitively with slight changes in the control points.

目前的最高水平,你需要每个修补16个点(在你的数据集的边缘,你可以在同花键两次使用的角落和边缘点)。

At the highest level, you'll need 16 points per patch (at the edge of your dataset, you can use the corner and edge points twice in the same spline).

首先,您需要通过点的 P [I] [J] 的在你的4x4矩阵每一行以创建一组四个中间控制点的 Q [我要插] 的。下面是我的意思是一个粗略的ASCII草图。

First, you'll need to interpolate across the points p[i][j] in each row in your 4x4 matrix to create a set of four intermediate control points q[i]. Here's a rough ASCII sketch of what I mean.

p00 p01 q0 p02 p03
p10 p11 q1 p12 p13
p20 p21 q2 p22 p23
p30 p31 q3 p32 p33

现在,你可以在每个那四个中间控制点之间插值来找到你的面最终花键点。

Now you can interpolate between each of those four intermediate control points to find a final splined point on your surface.

这里是一个建设的Catmull-Rom样条的在四个点。在这个例子中,你点的 P [I-1] 的之间内插的 P [I] 的,采用两侧控制点的 P [I-2] P [I + 1] 的。的 U 的是内插因子的范围从零到一。 τ的定义为在花键的紧张局势,并会影响到你的花键表面的紧密程度符合你的控制点。

Here is a construction of the Catmull-Rom spline across four points. In this example, you are interpolating between points p[i-1] and p[i], using control points on either side p[i-2] and p[i+1]. u is the interpolation factor ranging from zero to one. τ is defined as the tension on the spline and will affect how tightly your splined surface conforms to your control points.

                 | 0   1   0    0 | | p[i−2] |
                 |−τ   0   τ    0 | | p[i−1] |
p(u) = 1 u u2 u3 | 2τ τ−3 3−2τ −τ | | p[i]   |
                 |−τ  2−τ τ−2   τ | | p[i+1] |

请注意:这不是显而易见如何奠定了这一点,在#1的图形用户界面,但 U2 U3 的都应该重新present的 U的平方,U立方的分别。

NOTE: it's not immediately obvious how to lay this out in Stackoverflow's gui but u2 and u3 are supposed to represent u squared and u cubed, respectively.

这篇关于简单的方法来在三维空间中的点之间进行内插,以形成光滑的表面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆