x = x + distance * cos(angle)
y = y + distance * sin(angle)
---
http://www.mathsisfun.com/sine-cosine-tangent.html
<img src="http://www.mathsisfun.com/images/adjacent-opposite-hypotenuse.gif" border="0">
- (x,y) the starting position, is the left-most point of the triangle
- you know the hypotenuse - that's the distance you want to travel
- you know the angle ?
- you want to find the length of the adjacent side which is the how far you need to travel in the x direction
- and the length of the opposite side which is how far to travel in the y direction
Sine Function: sin(?) = Opposite / Hypotenuse
Cosine Function: cos(?) = Adjacent / Hypotenuse
Sine Function (to find Opposite side):
=> sin(?) = Opposite / Hypotenuse
=> Opposite = Hypotenuse * sin(?)
=> y amount = distance * sin(angle)
Cosine Function (to find Adjacent side):
=> cos(?) = Adjacent / Hypotenuse
=> Adjacent = Hypotenuse * cos(?)
=> x amount = distance * cos(angle)