def drawFiber(myscreen, f, fibercolor=camvtk.red):
    inter = f.getInts()
    for i in inter:
        if not i.empty():
            ip1 = f.point(i.lower)
            ip2 = f.point(i.upper)
            myscreen.addActor(
                camvtk.Line(p1=(ip1.x, ip1.y, ip1.z),
                            p2=(ip2.x, ip2.y, ip2.z),
                            color=fibercolor))
            myscreen.addActor(
                camvtk.Sphere(center=(ip1.x, ip1.y, ip1.z),
                              radius=0.005,
                              color=camvtk.clColor(i.lower_cc)))
            myscreen.addActor(
                camvtk.Sphere(center=(ip2.x, ip2.y, ip2.z),
                              radius=0.005,
                              color=camvtk.clColor(i.upper_cc)))
            cc1 = i.lower_cc
            cc2 = i.upper_cc
            myscreen.addActor(
                camvtk.Sphere(center=(cc1.x, cc1.y, cc1.z),
                              radius=0.005,
                              color=camvtk.lgreen))
            myscreen.addActor(
                camvtk.Sphere(center=(cc2.x, cc2.y, cc2.z),
                              radius=0.005,
                              color=camvtk.lgreen))
def drawFiber_clpts(myscreen, f, clcolor):
    inter = f.getInts()
    #print "fiber has ", len(inter) , " intervals"
    for i in inter:
        if not i.empty():
            ip1 = f.point( i.lower )
            ip2 = f.point( i.upper )
            #myscreen.addActor( camvtk.Line(p1=(ip1.x,ip1.y,ip1.z),p2=(ip2.x,ip2.y,ip2.z), color=fibercolor) )
            sphcolor = camvtk.clColor( i.lower_cc) 
            myscreen.addActor( camvtk.Sphere(center=(ip1.x,ip1.y,ip1.z),radius=0.005, color=sphcolor ) )
            sphcolor = camvtk.clColor( i.upper_cc)
            myscreen.addActor( camvtk.Sphere(center=(ip2.x,ip2.y,ip2.z),radius=0.005, color=sphcolor ) )
def drawFiber_clpts(myscreen, f, clcolor):
    inter = f.getInts()
    #print "fiber has ", len(inter) , " intervals"
    for i in inter:
        if not i.empty():
            ip1 = f.point( i.lower )
            ip2 = f.point( i.upper )
            #myscreen.addActor( camvtk.Line(p1=(ip1.x,ip1.y,ip1.z),p2=(ip2.x,ip2.y,ip2.z), color=fibercolor) )
            sphcolor = camvtk.clColor( i.lower_cc) 
            myscreen.addActor( camvtk.Sphere(center=(ip1.x,ip1.y,ip1.z),radius=0.005, color=sphcolor ) )
            sphcolor = camvtk.clColor( i.upper_cc)
            myscreen.addActor( camvtk.Sphere(center=(ip2.x,ip2.y,ip2.z),radius=0.005, color=sphcolor ) )
def drawFiber(myscreen, f, fibercolor=camvtk.red):
    inter = f.getInts()
    for i in inter:
        if not i.empty():
            ip1 = f.point( i.lower )
            ip2 = f.point( i.upper )
            ballradius = 0.0005
            myscreen.addActor( camvtk.Line(p1=(ip1.x,ip1.y,ip1.z),p2=(ip2.x,ip2.y,ip2.z), color=fibercolor) )
            myscreen.addActor( camvtk.Sphere(center=(ip1.x,ip1.y,ip1.z),radius=ballradius, color=camvtk.clColor( i.lower_cc) ) )
            myscreen.addActor( camvtk.Sphere(center=(ip2.x,ip2.y,ip2.z),radius=ballradius, color=camvtk.clColor( i.upper_cc) ) )
            cc1 = i.lower_cc
            cc2 = i.upper_cc
            myscreen.addActor( camvtk.Sphere(center=(cc1.x,cc1.y,cc1.z),radius=ballradius, color=camvtk.lgreen ) )
            myscreen.addActor( camvtk.Sphere(center=(cc2.x,cc2.y,cc2.z),radius=ballradius, color=camvtk.lgreen ) )
    bpc_y.run()
    t_after = time.time()
    push_calctime = t_after - t_before
    print " BPC 3 done in ", push_calctime, " s", bpc_x.getCalls(
    ), " push-calls"

    clpoints = bpc_x.getCLPoints()
    clp2 = bpc_y.getCLPoints()
    clpoints += clp2
    print "got ", len(clpoints), " CL-points"
    print "rendering raw CL-points."

    # draw the CL-points
    camvtk.drawCLPointCloud(myscreen, clpoints)
    for p in clpoints:
        myscreen.addActor(
            camvtk.Sphere(center=(p.x, p.y, p.z),
                          radius=0.02,
                          color=camvtk.clColor(p.cc())))

    print "done."
    myscreen.camera.SetPosition(0.5, 3, 2)
    myscreen.camera.SetFocalPoint(0.5, 0.5, 0)
    camvtk.drawArrows(myscreen, center=(-0.5, -0.5, -0.5))
    camvtk.drawOCLtext(myscreen)

    myscreen.render()

    myscreen.iren.Start()
    #raw_input("Press Enter to terminate")
    bpc_y.run()
    t_after = time.time()
    push_calctime = t_after-t_before
    print " BPC 3 done in ", push_calctime," s", bpc_x.getCalls()," push-calls" 
    
        
    clpoints = bpc_x.getCLPoints()
    clp2 = bpc_y.getCLPoints()
    clpoints+=clp2
    print "got ", len(clpoints), " CL-points"
    print "rendering raw CL-points."
    
    # draw the CL-points
    camvtk.drawCLPointCloud(myscreen, clpoints)
    for p in clpoints:
         myscreen.addActor( camvtk.Sphere(center=(p.x,p.y,p.z),radius=0.02, color=camvtk.clColor( p.cc() ) ) )
    

    
    
    print "done."
    myscreen.camera.SetPosition(0.5, 3, 2)
    myscreen.camera.SetFocalPoint(0.5, 0.5, 0)
    camvtk.drawArrows(myscreen,center=(-0.5,-0.5,-0.5))
    camvtk.drawOCLtext(myscreen)

    myscreen.render()    

    myscreen.iren.Start()
    #raw_input("Press Enter to terminate") 
    bpc_y.run()
    t_after = time.time()
    push_calctime = t_after-t_before
    print(" BPC 3 done in ", push_calctime," s", bpc_x.getCalls()," push-calls" )
    
        
    clpoints = bpc_x.getCLPoints()
    clp2 = bpc_y.getCLPoints()
    clpoints+=clp2
    print("got ", len(clpoints), " CL-points")
    print("rendering raw CL-points.")
    
    # draw the CL-points
    camvtk.drawCLPointCloud(myscreen, clpoints)
    for p in clpoints:
         myscreen.addActor( camvtk.Sphere(center=(p.x,p.y,p.z),radius=0.02, color=camvtk.clColor( p.cc() ) ) )
    

    
    
    print("done.")
    myscreen.camera.SetPosition(0.5, 3, 2)
    myscreen.camera.SetFocalPoint(0.5, 0.5, 0)
    camvtk.drawArrows(myscreen,center=(-0.5,-0.5,-0.5))
    camvtk.drawOCLtext(myscreen)

    myscreen.render()    

    myscreen.iren.Start()
    #raw_input("Press Enter to terminate")