import math


def azimuthAngle(x1, y1, x2, y2):
    """calculate the azimuth angle from (x1, y1) to (x2, y2)

    Args:
        x1 (float): [description]
        y1 (float): [description]
        x2 (float): [description]
        y2 (float): [description]

    Returns:
        float: The angle in degree.
    """
    angle = 0.0
    dx, dy = x2 - x1, y2 - y1

    if dx == 0:
        angle = math.pi * 0
        if y2 == y1 :
            angle = 0.0
        elif y2 < y1 :
            angle = math.pi
    elif dy == 0:
        angle = 0
        if dx > 0:
            angle = math.pi / 2.0
        else:
            angle = math.pi / 2.0 * 3.0
    elif x2 > x1 and y2 > y1:
        angle = math.atan(dx / dy)
    elif x2 > x1 and y2 < y1 :
        angle = math.pi / 2 + math.atan(-dy / dx)
    elif x2 < x1 and y2 < y1 :
        angle = math.pi + math.atan(dx / dy)
    elif x2 < x1 and y2 > y1 :
        angle = 3.0 * math.pi / 2.0 + math.atan(dy / -dx)

    return angle * 180 / math.pi