there's a good function that always works when interpolating linearly between two tensors (be they numbers, vectors, points... any kind of data that can be blended).
If you have 2 values (A & B) and you want to interpolate between them at f (a blending factor), the function is always:
R = A + f * (B-A)
For example, let's fill in a few numbers and see what happens... Let's assume we want to find the value one quarter along the way between 15 and 19:
R = 15 + 0.25 * (19-15)
R = 16
Or, let's go twice beyond two points {10, 10, 0} and {12, 15, 4}
R = {10, 10, 0} + 2.0 * ({12, 15, 4} - {10, 10, 0})
R = {10, 10, 0} + 2.0 * ({2, 5, 4}) <---- if you subtract two points you get the vector going from A to B R = {10, 10, 0} + {4, 10, 8} R = {14, 20, 8}
Well, nothing really new to those of you guys who followed the seminar, we talked and applied a lot of interpolations as a basic task of implementing gradients at different levels of discretization, but I think Rutten explains it very straightforward so it might be useful to have it as a reminder. Now go and apply it to any attractor/repellor/blend case you might undergo from now on.
No comments:
Post a Comment