title: Calculate angles between consecutive lines on the computer screen
body: <p>I'm creating <code>Concave Hull</code> algorithm and I almost finished it. The problem is I need to change some fragment of my code that calculates angles between consecutive lines.</p>
  
  <p><img src="https://i.stack.imgur.com/LTiZb.png" alt="Angles"></p>
  
  <p>Starting from horizontal line, clockwise direction. I have written a method that returns an angle between this horizontal line and my line. It works fine. But how to modify it to obtain an angle between two my lines? Please, note that the coordinate system is from top-left corner (pixels on the screen) and the consecutive lines will create a polygon as a result so they are connecting each other in different order (so the line could be tinted turned in different directions).</p>
  
  <p>My code that counts current angles betweet a horizontal line and my line:</p>
  
  <pre><code>private static double Angle(Vertex v1, Vertex v2, double offsetInDegrees = 0.0)
  {
      return (RadianToDegree(Math.Atan2(-v2.Y + v1.Y, -v2.X + v1.X)) + offsetInDegrees)%360.0;
  }
  
  public static double RadianToDegree(double radian)
  {
      var degree = radian * (180.0 / Math.PI);
      if (degree &lt; 0)
          degree = 360 + degree;
  
      return degree;
  }
  </code></pre>