Update
This commit is contained in:
parent
bc0419bd2b
commit
757bcb3cf1
19 changed files with 1827 additions and 1796 deletions
|
@ -25,7 +25,7 @@ The base case of interpolation takes place in one dimension (imagine e.g. interp
|
|||
float interpolate(float a, float b, float t);
|
||||
```
|
||||
|
||||
Many times we apply our interpolation not just to two points but to many points, by segments, i.e. we apply the interpolation between each two neighboring points (a segment) in a series of many points to create a longer curve through all the points. Here we are usually interested in how the segments transition into each other, i.e. what the whole curve looks like at the locations of the points.
|
||||
Many times we apply our interpolation not just to two points but to many points, by segments, i.e. we apply the interpolation between each two neighboring points (a segment) in a series of many points to create a longer curve through all the points. Here we are usually interested in how the segments transition into each other, i.e. what the whole curve looks like at the exact locations of the points.
|
||||
|
||||
**[Nearest neighbor](nearest_neighbor.md)** is probably the simplest interpolation (so simple that it's sometimes not even called an interpolation, even though it technically is). This method simply returns the closest value, i.e. either *A* (for *t* < 0.5) or *B* (otherwise). This creates kind of sharp steps between the points, the function is not continuous, i.e. the transition between the points is not gradual but simply jumps from one value to the other at one point.
|
||||
|
||||
|
@ -35,6 +35,8 @@ Many times we apply our interpolation not just to two points but to many points,
|
|||
|
||||
**[Cubic](cubic.md) interpolation** can be considered a bit more advanced, it uses a [polynomial](polynomial.md) of degree 3 and creates a nice smooth curve through multiple points but requires knowledge of one additional point on each side of the interpolated interval (this may create slight issues with the first and last point of the sequence of values). This is so as to know at what slope to approach an endpoint so as to continue in the direction of the point behind it.
|
||||
|
||||
Besides these we may potentially use many other functions, curves and splines (for example Akima spline, Steffen spline and so on).
|
||||
|
||||
The above mentioned methods can be generalized to more dimensions (the number of dimensions are equal to the number of interpolation parameters) -- we encounter this a lot e.g. in [computer graphics](graphics.md) when upscaling [textures](texture.md) (sometimes called texture filtering). 2D nearest neighbor interpolation creates "blocky" images in which [pixels](pixel.md) simply "get bigger" but stay sharp squares if we upscale the texture. Linear interpolation in 2D is called [bilinear interpolation](bilinear.md) and is visually much better than nearest neighbor, [bicubic interpolation](bicubic.md) is a generalization of cubic interpolation to 2D and is yet smoother that bilinear interpolation.
|
||||
|
||||
TODO: simple C code pls, maybe linear interpolation without floats
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue