Esempio n. 1
0
def rpg_vd(Npts, seed, debug):
    far = 1
    vd = ovd.VoronoiDiagram(1, 120)
    vd.reset_vertex_count()
    poly = rpg.rpg(Npts, seed)

    pts = []
    for p in poly:
        ocl_pt = ovd.Point(p[0], p[1])
        pts.append(ocl_pt)

    id_list = []
    for p in pts:
        id_list.append(vd.addVertexSite(p))

    for n in range(len(id_list)):
        n_nxt = n + 1
        if n == (len(id_list) - 1):
            n_nxt = 0  # point 0 is the endpoint of the last segment
        vd.addLineSite(id_list[n], id_list[n_nxt])
    print " all segs inserted."
    is_valid = vd.check()
    print " vd-check: ", is_valid

    return is_valid
Esempio n. 2
0
def rpg_vd(Npts, seed, debug):
    far = 1
    vd = ovd.VoronoiDiagram(1,120)
    vd.reset_vertex_count()    
    poly = rpg.rpg(Npts, seed)

    pts=[]
    for p in poly:
        ocl_pt = ovd.Point( p[0], p[1] )
        pts.append(  ocl_pt )
        
    id_list = []
    for p in pts:
        id_list.append( vd.addVertexSite( p ) )


    for n in range(len(id_list)):
        n_nxt = n+1
        if n==(len(id_list)-1):
            n_nxt=0 # point 0 is the endpoint of the last segment
        vd.addLineSite( id_list[n], id_list[n_nxt])
    print " all segs inserted."
    is_valid = vd.check()
    print " vd-check: ", is_valid
    
    return is_valid
Esempio n. 3
0
def rpg_vd(Npts, seed, debug):
    far = 1
    
    vd = ovd.VoronoiDiagram(far,120)
    vd.reset_vertex_count()    
    poly = rpg.rpg(Npts, seed)

    pts=[]
    for p in poly:
        ocl_pt = ovd.Point( p[0], p[1] )
        pts.append(  ocl_pt )
        print ocl_pt
        
    times=[]
    id_list = []
    m=0
    t_before = time.time()
    for p in pts:
        #print " adding vertex ",m
        id_list.append( vd.addVertexSite( p ) )
        m=m+1
    """
    print "polygon is: "
    for idx in id_list:
        print idx," ",
    print "."
    """
    t_after = time.time()
    times.append( t_after-t_before )
    
    #print " pts inserted in ", times[0], " s"
    #print " vd-check: ",vd.check()
    if (debug):
        vd.debug_on()

    t_before = time.time()
    for n in range(len(id_list)):
        n_nxt = n+1
        if n==(len(id_list)-1):
            n_nxt=0 # point 0 is the endpoint of the last segment
        #print " adding line-site ", id_list[n]," - ", id_list[n_nxt]
        vd.addLineSite( id_list[n], id_list[n_nxt])
    t_after = time.time()
    times.append( t_after-t_before )


    print " segs inserted in ", times[1], " s"
    is_valid = vd.check()
    print " vd-check: ", is_valid
    
    return [is_valid, vd, times]
Esempio n. 4
0
 print ovd.version()
 
 # for vtk visualization
 vod = ovdvtk.VD(myscreen,vd,float(scale), textscale=0.01, vertexradius=0.003)
 vod.drawFarCircle()
 vod.textScale = 0.02
 vod.vertexRadius = 0.0031
 vod.drawVertices=0
 vod.drawVertexIndex=0
 vod.drawGenerators=0
 vod.offsetEdges = 0
 vd.setEdgeOffset(0.05)
 linesegs = 1 # switch to turn on/off line-segments
 
 Npts = 100
 poly = rpg.rpg(Npts, 0)
 # N=3 working seeds: 25-43 45
 
 
 n_problem=Npts # go all the way to the end
 #n_problem=2
 n_step=10
 
 pts=[]
 for p in poly:
     pts.append( ovd.Point( p[0], p[1] ) )
     
 times=[]
 id_list = []
 m=0
 t_before = time.time()
Esempio n. 5
0
                    vd,
                    float(scale),
                    textscale=0.01,
                    vertexradius=0.003)
    vod.drawFarCircle()
    vod.textScale = 0.02
    vod.vertexRadius = 0.0031
    vod.drawVertices = 0
    vod.drawVertexIndex = 0
    vod.drawGenerators = 0
    vod.offsetEdges = 0
    vd.setEdgeOffset(0.05)
    linesegs = 1  # switch to turn on/off line-segments

    Npts = 500
    poly = rpg.rpg(Npts, 0)
    # N=3 working seeds: 25-43 45

    n_problem = Npts  # go all the way to the end
    #n_problem=2
    n_step = 10

    pts = []
    for p in poly:
        pts.append(ovd.Point(p[0], p[1]))

    times = []
    id_list = []
    m = 0
    t_before = time.time()
    for p in pts: