Find coordinate by angle
Posted
by George Johnston
on Stack Overflow
See other posts from Stack Overflow
or by George Johnston
Published on 2010-03-26T19:37:40Z
Indexed on
2010/03/26
19:43 UTC
Read the original article
Hit count: 555
I am developing in application in XNA which draws random paths. Unfortunately, I'm out of touch with graphing, so I'm a bit stuck. My application needs to do the following:
- Pick a random angle from my origin (0,0), which is simple.
- Draw a circle in relation to that origin, 16px away (or any distance I specify), at the angle found above.
(Excuse my horrible photoshoping)
The second circle at (16,16) would represent a 45 degree angle 16 pixels away from my origin.
I would like to have a method in which I pass in my distance and angle that returns a point to graph at. i.e.
private Point GetCoordinate(float angle, int distance)
{
// Do something.
return new Point(x,y);
}
I know this is simple, but agian, I'm pretty out of touch with graphing. Any help?
Thanks, George
© Stack Overflow or respective owner