import math


def Rotate2D(ax, ay, ix, iy, angle):
    """
    Rotate a point around the anchor point

    Input
    -----
    ax, ay: coordinates of the anchor point
    ix, iy: coordinates of the point to rotate
    angle: angle in degree (counter-clockwise rotation is positive rotation)

    Output
    ------
    x, y : coordinates of a rotated point
    """
    dx = ix - ax
    dy = iy - ay
    # Convert degree into radian
    angle_rad = math.radians(angle)

    # do the rotation
    xp = dx * math.cos(angle_rad) - dy * math.sin(angle_rad) + ax
    yp = dx * math.sin(angle_rad) + dy * math.cos(angle_rad) + ay

    return xp, yp