def addMiddlePoints(p1, p2, n = 2):
    """ Function to calculate the middle point between two points

    Args:
        p1: (Required) set of coordinates of first point
        p2: (Required) set of coordinates of second point
        n: (Required) number of divisions
        """

    x_1 = p1[0]
    y_1 = p1[1]

    x_2 = p2[0]
    y_2 = p2[1]

    dx = (x_2 - x_1)/n
    dy = (y_2 - y_1)/n

    ps = [[x_1,y_1]]

    for i in range(1,n):
        x = x_1 + i*dx
        y = y_1 + i*dy

        ps.append([x,y])

    ps.append([x_2,y_2])

    return ps