title: How to find the angle from the center of a rectangle to its vertices
body: <p>I'm developing a collision detection system in Javascript, and I need to find from which side of the rectangle a ball collided.</p>
  
  <p>Anyway, what I need right now is to find the angle from the center of a rectangle to its vertices. Like this:</p>
  
  <p><a href="https://i.stack.imgur.com/Pe8sl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pe8sl.png" alt="enter image description here"></a></p>
  
  <p>As you can see in the image, I want to find that angle, but also the rest of the angles to the bottom left and top left vertices.</p>
  
  <p>I know this is math, but I need to code the formula in Javascript anyway.</p>
  
  <p>Let's say I have this:</p>
  
  <pre><code>var box = {
     width : 200,
     height : 100
  };
  
  var boxCenter = {x : box.width / 2, y : box.height / 2 };
  
  var angleRight = // ... ;
  var angleBottom = // ... ;
  </code></pre>
  
  <p>And so on</p>