title: Calculate angle (gradient) from a vector with x-axis
body: <p>I have two points in a cathesian 2D system, both give me the start and end point of a vector. Now i need the angle between the new vector and the x-axis.</p>
  
  <p>I know that gradient = (y2-y1) / (x2-x1)  and i know that angle = arctan(gradient).</p>
  
  <p>But i dont know if this works for every case (direction) the vector takes.
  When do i need to add 180 degrees or something like that.</p>
  
  <p>can anyone provide me with some c / java like code or hints for all the cases.</p>
  
  <p>Thx and best regards</p>