title: Calculating velocity from speed and direction
body: <p>I have an object which wants to move from point A to point B, at a certain speed (using SFML C++).</p>
  
  <pre><code>sf::Vector2f aPos; //sf::Vector2f has two members x and y, stored as floats
  sf::Vector2f bPos;
  float speed; //pixels per tick
  </code></pre>
  
  <p>I want to use these variables to find out a velocity, with an x speed and a y speed, such that the hypotenuse of <code>vel.x</code> and <code>vel.y</code> has length <code>speed</code>, and has the same bearing as that from point <code>aPos</code> to point <code>bPos</code>.</p>
  
  <pre><code>sf::Vector2f vel;
  </code></pre>
  
  <p>What is the simplest and most effective function that I can write, which takes <code>sf::Vector2f aPos</code>, <code>sf::Vector2f bPos</code> and <code>float speed</code> as arguments, and returns <code>sf::Vector2f vel</code></p>
  
  <pre><code>sf::Vector2f findVel(sf::Vector2f aPos, sf::Vector2f bPos, float speed) {
      sf::Vector2f vel;
      //the code I need
      return vel;
  }
  </code></pre>
  
  <p>Thank you in advance! :)</p>