def dot(g, x, y, z=None):
    """ Dot Product for 2 or 3-Dimensional vectors

    Args:
        g (np.ndarray): First Vector
        x (float): X Coordinate
        y (float): Y Coordinate
        z (float): Z Coordinate (Default: None)

    Returns:
        (float) Dot Product
    """
    if z is None:
        return g[0] * x + g[1] * y
    return g[0] * x + g[1] * y + g[2] * z