def fitPlane(points):
    """Best fits a plane to a cloud of points"""
    import numpy as np
    XYZ = np.array(points)
    [rows, cols] = XYZ.shape
    p = np.ones((rows, 1))
    AB = np.hstack([XYZ, p])
    [u, d, v] = np.linalg.svd(AB, 0)
    B = v[(3), :]
    nn = np.linalg.norm(B[0:3])
    B = B / nn
    pplane = [0, 0, -(B[3] / B[2])]
    vplane = B[0:3].tolist()
    return pplane, vplane
