def in_circle(a, b, c, d):
    """
    This function is used to check whether a point 'd' is contained by the
    circle defined by three other points 'a', 'b', 'c'. This is achieved by
    calculating the sign of the following 4x4 matrix determinant.
        │ a.x  a.y  a.x**2+a.y**2  1 │
        │ b.x  b.y  b.x**2+b.y**2  1 │
        │ c.x  c.y  c.x**2+c.y**2  1 │
        │ d.x  d.y  d.x**2+d.y**2  1 │
    
    Parameters
    ----------
    a, b, c : list
        The three points that define the circle
    d : list
        Testing if this point is in the circle
        
    Returns
    -------
    out : Bool
        True if the point 'd' is within the circle defined by 'a', 'b', 'c'
    """
    c1 = a[0] - d[0]
    c2 = b[0] - d[0]
    c3 = c[0] - d[0]
    
    u1 = a[1] - d[1]
    u2 = b[1] - d[1]
    u3 = c[1] - d[1]

    v1 = c1**2 + u1**2
    v2 = c2**2 + u2**2
    v3 = c3**2 + u3**2
    
    det = c1*((u2*v3)-(v2*u3)) - c2*((u1*v3)-(v1*u3)) + c3*((u1*v2)-(v1*u2))
    
    return det < 0