News for hackers. Stuff that matters.
Re:Calculus for Beginners and Artists (2003) by mkl on Sunday July 14, 2019 @10:06PM (#20437606)
Try this idea:

  g(t) = (1-t) f(a) + t f(b)
where t goes from 0 to 1. At the end points, we get

  g(0) = (1) f(a) + (0) f(b) = f(a)
  g(1) = (0) f(a) + (1) f(b) = f(b).
This can be used to linearly blend any two things, as for t in between 0 and 1, we'll get part of f(a) and part of f(b).

Now, if we want to use x instead of t, where x goes from a to b, we need to convert:

  x = a  <=>  t = 0
  x = b  <=>  t = 1
The distance that x has travelled from a is (x-a). The total distance from a to b is (b-a). t is the proportion of that total distance, so t is the distance travelled over the total distance:

      x-a
  t = ---
      b-a
Now (renaming g to f as we're changing parameterisation* )

  f(x) = (1 - (x-a)/(b-a)) f(a) + ((x-a)/(b-a)) f(b)
       = (1 + (x-a)/(a-b)) f(a) + ((x-a)/(b-a)) f(b)             //since -(b-a) = a-b
       = ((a-b)/(a-b) + (x-a)/(a-b)) f(a) + ((x-a)/(b-a)) f(b)   //since 1 = (a-b)/(a-b)
       = ((a-b+x-a)/(a-b)) f(a) + ((x-a)/(b-a)) f(b)             //combining terms with common denominator
       = ((x-b)/(a-b)) f(a) + ((x-a)/(b-a)) f(b)
Does that explain it?

* g(x) is something different: g(x) = (1-x) f(a) + x f(b), just by substituting in.

There are no comments on this comment yet.