Note: This isn't mine, but he poses a very interesting, and (therefore?) good question:
The characters are botched because maxpc doesn't support them, so here's the link:
so iv been playing super metroid lately, and as some of you know, there is a weapon called the wave beam in that game. the graphic for it is basically a cosine wave (technically its a sine wave in super metroid, but whatever). it got me thinking about the math behind graphing cosines at an angle for 360 degree wave beam firing. i know how to get the cosine curve straight up or straight forward, but not at an angle.
this is f(x) = cos(x). this is more or less what the wave beam looks like shooting straight forward.
this is as close to what i have gotten. basically, i just added a linear function to the cosine function where the slope of the linear function is an angle of my choosing
f(x,θ) = cos(x) + (tan(θ)*x) where θ is the angle i want the curve at
this is both ugly, and not what i want. the green line is the linear function i added
this is what im looking for. i just rotated the first image 45 degrees in gimp. θ is the angle the wave is tilted
what i want to know is the mathematical function that generates a cosine wave that looks like the third image. i want to implement this into a little sprite game im working on, but i dont know the math to put it at an angle. iv toyed with the idea of using f(x) = cos(x) and just tilting the result, but i dont really know how to program that either, but what im mainly looking for is the math behind a tilted cosine graph.
before anybody lmgtfy's me, i asked google, and google didnt know. i asked one of my teachers, and he didnt know, so HE asked google, and google still didnt know.