View Full Version : Trigonometry Questions
kkbbcute
02-22-2009, 10:14 AM
Hi guys, basically what I need is a formula to calculate the x and y coordinates of a new point just by knowing the distance, angle and of course the coordinates of the old point. For example, if I need to extend (500, 500) out by 200 pixels by 50 degrees, how should I get about calculating it?
It's for some shading tech that I'll be using for a game in the near future.
Thanks in advance!
cjx3711
02-22-2009, 10:25 AM
I can tell you one thing, you need sin cos and tan :)
So in other words, you need to know how to convert a distance of 200px and an angle of 50 degrees into X and Y values?
x2 = x1 + dist*cos(angle)
y2 = y1 + dist*sin(angle)
the angle is in radians
kkbbcute
02-22-2009, 10:28 AM
cjx3711: I tried that formula, didn't work, never mind, I think the problem lies in my conversion from degrees to radians. I got that one off from a physics forum.
Anyway I was just wondering if you were to repeat this code about a thousand times every frame, is it possible to sustain a playable framerate.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.