3D计算机图形学中的插值 [英] interpolation in 3d computer graphics

查看:166
本文介绍了3D计算机图形学中的插值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人可以用简单的术语来解释什么是插值及其在3d计算机图形学中的用法

I was wondering if someone could help with explaining in simple terms what interpolation is and how its used in 3d computer graphics

推荐答案

简而言之:给定两个点A和B,在它们之间找到一个点。

Simply put: given two points A and B, find a point between them.

例如,如果我要一步一步将某物从位置x = 1移到x = 4:

For example, if I want to move something along a line from a position x=1 to x=4 in one step:

1-----------------------4

第一步在位置1,第二步在位置4,因此对象立即从一个位置移动到另一个位置。但是,如果我希望对象花费一定的时间或帧数来进行过渡,则需要通过找到间隔均匀的中间点来完善它。

The first step is at location 1, the second step is at location 4, so the object moves instantly from one location to the other. However, if I want the object to take a certain amount of time or number of frames to make the transition, I'll need to refine that by finding intermediate points that are evenly spaced.

如果我希望对象采取两个步骤(或框架)从1移到4,

If I want the object to take two steps (or frames) to move from 1 to 4,

1-----------X-----------4

我需要计算新点(X)是什么,以便可以在适当的时候在此处绘制对象。在这种情况下,点X将为

I need to calculate what the new point (X) is so I can draw the object there at the appropriate time. In this case, the point X will be

                                  (max-min)
location = min + (current_step) * --------
                                    steps

位置是我们要查找的内容。 min = 1, max = 4,在此示例中,步长 = 2,因为我们要将跨度分为两个步骤:

location is what we're trying to find. min=1, max=4, and in this example steps=2 since we want to divide the span into two steps:

step:   location:
0       1
1       2.5
2       4

1------------(2.5)-----------4

如果我们要采取4个步骤:

If we want to take 4 steps:

step:   location:
0       1
1       1.75
2       2.5
3       3.25
4       4

1---(1.75)---(2.5)---(3.25)---4

依此类推。对于四个步骤,对象将移动每帧总距离的25%。对于10个步骤,10%的等等,等等。

And so forth. For four steps, the object moves 25% of the total distance per frame. For 10 steps, 10%, etc ad nauseum.

对于多维(对象具有二维或三维轨迹),只需将其应用于每个X ,Y,Z轴独立。

For multiple dimensions (when an object has a 2- or 3-dimensional trajectory), just apply this to each X,Y,Z axis independently.

这是线性插值。还有其他种类。与往常一样, Google可以帮助您

This is linear interpolation. There are other kinds. As always, Google can help you out.

其他应用程序包括纹理映射,抗锯齿,图像平滑和缩放等,当然还有游戏和图形之外的许多其他用途。

Other applications include texture mapping, anti-aliasing, image smoothing and scaling, etc., and of course many other uses outside of games and graphics.

注意:许多框架已经提供了此功能。例如,在XNA中,它是 Matrix.Lerp

Note: a lot of frameworks already provide this. In XNA, for instance, it's Matrix.Lerp.

这篇关于3D计算机图形学中的插值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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