title: Determine angle between 3 coordinates
body: <p>As you can see in my screenshot i try to calculate the angle between the coordinates AB and BC, in this case the angle is obviously 90°. But how can i determine this angle with javascript code?</p>
  
  <p><a href="https://i.stack.imgur.com/28woZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/28woZ.png" alt="I try to determine the angle between AB and BC"></a></p>
  
  <p>I found this <a href="https://stackoverflow.com/questions/17763392/how-to-calculate-in-javascript-angle-between-3-points">thread</a> and tried the accepted solution, but i always get <code>1.57</code>instead of 90 like i expected. I rewrote the original function because i did not understood how to pass my parameters to it.</p>
  
  <p>Please excuse my bad paint and math skills.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> function find_angle(Ax,Ay,Bx,By,Cx,Cy)
   {
    var AB = Math.sqrt(Math.pow(Bx-Ax,2) + Math.pow(By-Ay,2));    
    var BC = Math.sqrt(Math.pow(Bx-Cx,2) +  Math.pow(By-Cy,2)); 
    var AC = Math.sqrt(Math.pow(Cx-Ax,2) +  Math.pow(Cy-Ay,2));
    
    return Math.acos((BC*BC+AB*AB-AC*AC) / (2*BC*AB));
   }
   var angle = find_angle
      (
       4 ,  //Ax
       3 ,  //Ay
       
       4 ,  //Bx
       2 ,  //By
       
       0 ,  //Cx
       2  //Cy
      )
      
   alert ( angle );</code></pre>
  </div>
  </div>
  </p>