Find the bearing angle between two points in a 2D space I continue developing a 2D Collision Detection System in a programming language (Javascript) and one of the last things I need to sharpen it is to know a formula to find this angle:
NOTE: X and Y increase their value FROM LEFT TO RIGHT AND TOP TO BOTTOM

As you can see the angle is relative to the 0° degree or north pole of the 2D space.
Knowing the coordinates of the two points, how can I know that angle?
I might have an idea of finding the bearing to rectangle vertices and stuff like that (I just used them for the system) but I want to know if there is already a simple formula for this.
Thank you beforehand!

I was trying to do the same thing and K. Miller's answer helped me. Since I did it in R, I thought I'd post my code here. 
I'm not 100% sure that I did the right thing by returning 360 when it could also be 0. This is the first I've touched trig since high school, make sure it's correct before you use it.
bearing = function(x1=10, y1 = 10, x2=3, y2=3){
  require(NISTunits)
  if((x1 == x2) & (y1 > y2)){
    return(360)
  }else if((y1 == y2) & (x1 < x2)){
    return(90)
  } else if((y1==y2 & x1 > x2)){
    return(270)
  }else if(y1 == y2 & x1 < x2){
    return(180)
  }else if((x1 == x2) & (y1==y2)){
    return(NaN)
  }
  else
  theta = atan2(x2 - x1, y1 - y2)
  if(theta < 0){
    theta = theta + 2*pi
  }
  theta = NISTradianTOdeg(theta)
  return(theta)
}

