analytics

Tuesday, May 1, 2012

Elementary Parameterization of shapes made of straight lines

First I'd like to introduce this function I made that I call T(p). Here's it written out in full with a couple of graphs for different p values.
The gist of the function is that is 0 everywhere except from p-1 to p+1, where it linearly rises, peaks at a height of 1 and then falls back to 0.

It's a fairly big function but it is easy to calculate and it is made up of only elementary operations, and it's behavior is useful for a lot of applications that I can think of. Here's one example:

Suppose you have these 6 [x,y] points:
[1,1], [6,3.5], [0,3.5],[5,1],[3,5],[1,1]

You can make a function that connects each of these with a straight line between them over time. You make a parametric function:
See how x(t) is basically just T(1..6) times each x coordinate in order? And the same for y(t). Here's the graph, you can imagine if t were going from 1 to 6 it would be drawing this out animated instead of one picture.
Now I realize if each T(p) were written out instead of using this notation this function would be hideous looking but it is still an elementary parametric equation there are just a lot of elementary operations.


No comments:

Post a Comment