def MirrorPoint(PP, LP1, LP2):
    """
    Function to return the mirror point of point PP over the line between points LP1 and LP2

    Parameters
    ----------
    PP : 1D numpy array, floats
        x- and y-coordinates of point. 
    LP1 : 1D numpy array, floats
        x- and y-coordinates of point along line segment. 
    LP2 : 1D numpy array, floats
        x- and y-coordinates of point along line segment. 

    Returns
    -------
    Xm : float
        X-coordinate of the mirrorred point.
    Ym : float
        Y-coordinate of the mirrorred point.

    Source
    -------
    https://stackoverflow.com/questions/3306838/algorithm-for-reflecting-a-point-across-a-line
    """        
    X1, Y1 = PP
    X2, Y2 = LP1
    X3, Y3 = LP2
    if Y2 == Y3: #horizontal line
        Xm = X1
        Ym = Y2 - (Y1 - Y2)
    elif X3 == X2: #vertical line
        Xm = X2 - (X1 - X2)
        Ym = Y1
    else: #sloped line
        a = (Y3 - Y2) / (X3 - X2) #slope
        b = (X3 * Y2 - X2 * Y3) / (X3 - X2) #intercept
        d = (X1 + (Y1 - b) * a) / (1 + a**2)
        Xm = 2 * d - X1
        Ym = 2 * d * a - Y1 + 2 * b
    return Xm, Ym