go to previous page   go to home page   go to next page


#include <math.h>

double length, angle;
double vector[2];

 . . .
length = some value
angle = some number of degrees

vector[0] =  length * cos( angle*M_PI/180.0 )

vector[1] =  length * sin( angle*M_PI/180.0 )

Practice with Radians

Recall the steps to take in converting a vector given as length and direction into (x,y):

  1. Draw a sketch.
  2. Calculate x by projecting the length onto the x-axis: usually length*cos( θ )
  3. Calculate y by projecting the length onto the y-axis: usually length*sin( θ )
  4. Check answers against the sketch.

The steps are the same (of course) if the angle is given in radians.


A vector is 4.5 units long oriented at 0.70 radians. Express the vector as ( x, y )T.