def prepare(V):
    """Prepare the surface for slicing operation."""
    global VA
    V = V.translate(-V.center())
    P = V.center()
    print "Initial P = %s" % P
    VA = draw(V,bbox=None,color='black')
    area,norm = stl.areaNormals(V.f)
    N = norm[0]
    return V,P,N
def testview(F,V,P):
    global VA,waiting
    p = array(GD.canvas.camera.getCenter())
    waiting = True
    while waiting:
        GD.app.processEvents()
    p -= array(GD.canvas.camera.getCenter())
    print "TRANSLATE: %s" % p
    m = GD.canvas.camera.getRot()
    P += p
    print "TOTAL TRANSLATE: %s" % P
    V = V.affine(inverse(m[0:3,0:3])).translate(-P)
    print V.center()
    print F.center()
    undraw(VA)
    VA = draw(V)
    area,norm = stl.areaNormals(V.f)
    N = norm[0]
    return P,N