interpolation in 3d computer graphics

可紊 提交于 2019-12-11 02:12:06

问题


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


回答1:


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

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

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.

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

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

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

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

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

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

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

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.

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




回答2:


Interpolation is the smooth adjustment from one thing to another. It is used in animation.

For example, if an object is at location 1, and we want to move it to location 2 over the course of six seconds, we need to slowly interpolate its location between the two endpoints. Interpolation also refers to any search for a location on that path.




回答3:


Interpolation is the 'guessing' of points based on other points.

for example when you have the points (0,0) and (2,2) you might 'guess' that the point (1,1) also belongs to the set.

The simples application is to deduce a line from two points.

The same thing works in 3 or actually n-dimension.

In 3D graphics it will be used

  • for animations, to calculate the position of things based on start and end coordinations
  • calculating lines
  • gradients
  • scaling of graphics and probably many more


来源:https://stackoverflow.com/questions/4640503/interpolation-in-3d-computer-graphics

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!