Ejemplo n.º 1
0
def drawDiag(far, framenr):
    myscreen = camvtk.VTKScreen()
    myscreen.camera.SetFocalPoint(0, 0, 0)
    camvtk.drawOCLtext(myscreen)
    w2if = vtk.vtkWindowToImageFilter()
    w2if.SetInput(myscreen.renWin)
    lwr = vtk.vtkPNGWriter()
    lwr.SetInput( w2if.GetOutput() )
    scale=10000
    #far = 0.00001
    vd = ocl.VoronoiDiagram(far,1200)
    camPos = 0.4* (far/0.00001)
    myscreen.camera.SetPosition(camPos/10000, 0, camPos) 
    myscreen.camera.SetClippingRange(-2*camPos,2*camPos)
    random.seed(42)
    vod = VD(myscreen,vd,scale)
    drawFarCircle(myscreen, scale*vd.getFarRadius(), camvtk.orange)
    Nmax = 300
    plist=[]
    for n in range(Nmax):
        x=-far/2+far*random.random()
        y=-far/2+far*random.random()
        plist.append( ocl.Point(x,y) )
    n=1
    #ren = [300]
    for p in plist:
        print "PYTHON: adding generator: ",n," at ",p
        #if n in ren:
        vd.addVertexSite( p )
        n=n+1
        
    vod.setAll(vd)
    myscreen.render()
            
    w2if.Modified() 
    lwr.SetFileName("frames/vd_v_"+ ('%05d' % framenr)+".png")
    lwr.Write()
        
    print "PYTHON All DONE."


    
    myscreen.render()    
Ejemplo n.º 2
0
    lwr = vtk.vtkPNGWriter()
    lwr.SetInput( w2if.GetOutput() )
    #w2if.Modified()
    #lwr.SetFileName("tux1.png")
    
    scale=1000
    myscreen.render()
    random.seed(42)
    far = 0.000002
    
    #camPos = 0.3
    camPos = 0.4* (far/0.0001)
    myscreen.camera.SetPosition(camPos/1000, 0, camPos) 
    myscreen.camera.SetClippingRange(-2*camPos,2*camPos)

    vd = ocl.VoronoiDiagram(far,1200)
    
    vod = VD(myscreen,vd,scale)
    #vod.setAll(vd)
    drawFarCircle(myscreen, scale*vd.getFarRadius(), camvtk.orange)
    
    Nmax = 65
    # far = 0.000010 crashes at n=192
    plist=[]
    for n in range(Nmax):
        x=-far/2+far*random.random()
        y=-far/2+far*random.random()
        plist.append( ocl.Point(x,y) )
    

    #print plist[169]
Ejemplo n.º 3
0
 myscreen.camera.SetFocalPoint(0, 0, 0)
 myscreen.camera.SetClippingRange(-20,5000)
 camvtk.drawOCLtext(myscreen)
 
 w2if = vtk.vtkWindowToImageFilter()
 w2if.SetInput(myscreen.renWin)
 lwr = vtk.vtkPNGWriter()
 lwr.SetInput( w2if.GetOutput() )
 #w2if.Modified()
 #lwr.SetFileName("tux1.png")
 
 
 myscreen.render()
 random.seed(42)
 
 vd = ocl.VoronoiDiagram(400,10)
 
 vod = VD(myscreen)
 #vod.setAll(vd)
 drawFarCircle(myscreen, vd.getFarRadius(), camvtk.orange)
 #plist=[ocl.Point(61,61)  ]
 #plist.append(ocl.Point(-20,-20))
 #plist.append(ocl.Point(0,0)) 
 
 Nmax = 30
 plist=[]
 for n in range(Nmax):
     x=-50+100*random.random()
     y=-50+100*random.random()
     plist.append( ocl.Point(x,y) )
 
Ejemplo n.º 4
0
def addVertexSlow(myscreen, vd, vod, p):
    pass


if __name__ == "__main__":
    print ocl.revision()
    myscreen = camvtk.VTKScreen()
    myscreen.camera.SetPosition(0.1, 0,
                                300)  # 1200 for far view, 300 for circle view
    myscreen.camera.SetFocalPoint(0, 0, 0)
    myscreen.camera.SetClippingRange(-20, 5000)

    myscreen.render()
    random.seed(42)

    vd = ocl.VoronoiDiagram()

    vod = VD(myscreen)
    vod.setAll(vd)
    drawFarCircle(myscreen, vd.getFarRadius(), camvtk.orange)
    #plist=[ocl.Point(61,61)  ]
    #plist.append(ocl.Point(-20,-20))
    #plist.append(ocl.Point(0,0))

    Nmax = 400
    plist = []
    for n in range(Nmax):
        x = -50 + 100 * random.random()
        y = -50 + 100 * random.random()
        plist.append(ocl.Point(x, y))
Ejemplo n.º 5
0
 myscreen.camera.SetFocalPoint(0, 0, 0)
 myscreen.camera.SetClippingRange(-100,3000)
 camvtk.drawOCLtext(myscreen)
 
 w2if = vtk.vtkWindowToImageFilter()
 w2if.SetInput(myscreen.renWin)
 lwr = vtk.vtkPNGWriter()
 lwr.SetInput( w2if.GetOutput() )
 #w2if.Modified()
 #lwr.SetFileName("tux1.png")
 
 
 myscreen.render()
 random.seed(42)
 
 vd = ocl.VoronoiDiagram(130,10)
 
 vod = VD(myscreen)
 #vod.setAll(vd)
 drawFarCircle(myscreen, vd.getFarRadius(), camvtk.orange)
 #plist=[ocl.Point(61,61)  ]
 #plist.append(ocl.Point(-20,-20))
 #plist.append(ocl.Point(0,0)) 
 
 plist=[]
 
 
 #RANDOM points
 
 Nmax = 30
 rpos=[-50,-50]