title: Calculating angle between two points - java
body: <p>I need to calculate the angle in degrees between two points, with a fixed point that is connected with the given two points by a line.</p>
  
  <p>Here is an image that illustrates what I need:</p>
  
  <p><img src="https://i.stack.imgur.com/JVPIq.png" alt="enter image description here"></p>
  
  <p>Here is what I have tried so far:</p>
  
  <pre><code>public static float GetAngleOfLineBetweenTwoPoints(float x1, float x2, float y1, float y2) {
          float xDiff = x2 - x1;
          float yDiff = y2 - y1;
          return (float) (Math.atan2(yDiff, xDiff) * (180 / Math.PI));
  }
  </code></pre>
  
  <p>It's pointless to say that it doesn't provide the correct answer.</p>