##include <math.h> #define PI 3.14159265 double length, angle; double vector[2]; . . . length = some value angle = some number of degrees vector[0] = length * cos( angle*PI/180.0 ) vector[1] = length * sin( angle*PI/180.0 )
(Unfortunately, different compilers use different symbols for PI, and define it in different header files.)
Recall the steps to take in converting a vector given as length and direction into (x,y):
The steps are the same (of course) if the angle is given in radians.