title: 2D Euclidean vector rotations
body: <p>I have a euclidean vector <code>a</code> sitting at the coordinates <code>(0, 1)</code>.
  I want to rotate <code>a</code> by 90 degrees (clockwise) around the origin: <code>(0, 0)</code>.</p>
  
  <p>If I have a proper understanding of how this should work, the resultant (x, y) coordinates after the rotation should be <code>(1, 0)</code>.
  If I were to rotate it by 45 degrees (still clockwise) instead, I would have expected the resultant coordinates to be <code>(0.707, 0.707)</code>.</p>
  
  <pre><code>theta = deg2rad(angle);
  
  cs = cos(theta);
  sn = sin(theta);
  
  x = x * cs - y * sn;
  y = x * sn + y * cs;
  </code></pre>
  
  <p>Using the above code, with an <code>angle</code> value of 90.0 degrees, the resultant coordinates are: <code>(-1, 1)</code>.
  And I am so damn confused.
  The examples seen in the following links represent the same formula shown above surely?</p>
  
  <p>What have I done wrong?
  Or have I misunderstood how a vector is to be rotated?</p>