title: Moving a point along a vector
body: <p><br>
  I have a point defined by x,y and a vector defined by heading, speed. I am attempting to move the point x,y along this vector, at a distance of 'speed'. Below is the code I am currently using:</p>
  
  <pre><code>self.x += self.speed * cos(self.heading);
  self.y += self.speed * sin(self.heading);
  </code></pre>
  
  <p>Heading can be any angle in a full circle - 0 to 2π (0-360 degrees). The problem is the above code:</p>
  
  <ul>
  <li>Only moves along the x or y axis when angle is 0->270<br>
  <ul>
  <li>for example, when the avatar is facing the top-right corner (45 degrees relative), it moves straight up.<br></li>
  </ul></li>
  <li>Does not move at all when angle is 270->360</li>
  </ul>
  
  <p>heading, speed, X and Y are all doubles, and heading is reported by the user touching a direction-pad in the lower corner. I know the heading is correct because the avatar rotates to the correct direction, it is just the actual movement I am having problems with.</p>
  
  <p>Thanks for any help<br>
  - Chris</p>