title: Find movement turn angle using Location
body: <p>I need find angle of vehicle turn measured in degrees. </p>
  
  <p><img src="https://i.stack.imgur.com/vQWrw.png" alt="Problem description"></p>
  
  <p>Location points update with equal intervals (1 sec). Therefore device makes like 4-5 points during turn. I schematically displayed that on picture.</p>
  
  <p><strong>Is it possible to calculate the angle of turn using Location?</strong> If it is possible, how?</p>
  
  <hr>
  
  <p>What I tried:</p>
  
  <ol>
  <li>Create two geometric vectors from points 3, 4 and 1, 2 respectively and find angle between those vectors. Coordinates of vectors I calculated like <code>Vector1 (lat2 - lat1; lon2 - lon2)</code>. Not sure this approach could be applied to Location coordinates.</li>
  <li>Use <code>location1.bearingTo(location2)</code>. But this doesn't give expected results. Seems like it gives "compass" results. Perhabs I could use it somehow but not sure.</li>
  <li>Also tried few trigonometric formulas like <a href="https://stackoverflow.com/questions/6189258/angle-between-two-known-android-geolocations">here</a> or <a href="https://stackoverflow.com/questions/9970281/java-calculating-the-angle-between-two-points-in-degrees">here</a> or <a href="https://stackoverflow.com/questions/9566069/how-to-calculate-angle-between-two-geographical-gps-coordinates">here</a>. They didn't give expected angle.</li>
  </ol>
  
  <hr>
  
  <p><strong>EDIT: Solution</strong> 
  The accepted answer works great. But to complete the answer I have to show that method of <code>angleDifference</code>. This one works for me:</p>
  
  <pre><code>public int getAngleDifference(int currentAngle){
      int r = 0;
      angleList.add(currentAngle);
      if (angleList.size() == 4) {
          int d = Math.abs(angleList.get(0) - angleList.get(3)) % 360;
          r = d &gt; 180 ? 360 - d : d;
  
          angleList.clear();
      }
      return r;
  }
  </code></pre>
  
  <p>I add points to list untill there're 4 of them and then calculate angle difference between 1st and 4th points for better results. </p>
  
  <p>Hope it will help for someone!</p>