/// <summary> /// compute the angle between two lines. /// </summary> /// <param name="Line1"></param> /// <param name="Line2"></param> /// <returns></returns> public static double AngleBetween(LineCoordinates Line1, LineCoordinates Line2) { // the start point of each line is the common point between the two lines. var commonPoint = LineCoordinates.CommonEndPoint(Line1, Line2); // the end points of each line. var end1 = Line1.OtherPoint(commonPoint); var end2 = Line2.OtherPoint(commonPoint); // the 360 degree angles of each line. var angle1 = LineExt.GetAngle(commonPoint, end1); var angle2 = LineExt.GetAngle(commonPoint, end2); // the angle between is the diff between the 360 degree angles of the 2 lines. var angleBet = Angle360.Subtract(angle1, angle2); if (angleBet.Value > 180) { angleBet = Angle360.Subtract(angle2, angle1); } return(angleBet.Value); }