Get a vector given velocity and angle

431 Views Asked by At

I have a plane's velocity, and its angle relative to the north. I'm having a difficulty representing it as a vector $(x, y)$ in my code.

Since the velocity is the vector's length (I suppose?) it should be equal to $ \sqrt{x^2+y^2}$, but how do I convert the angle I have into a formula?

1

There are 1 best solutions below

3
On BEST ANSWER

Use trigonometry. Assuming that $x$ is positive towards East and $y$ is positive towards North and that the angle $\theta$ is in radians and it increases counter-clockwise:

$$\begin{align} x & = - \sin(\theta) \\ y & = \cos(\theta) \end{align}$$