How to use the rpg.rpg function in rpg

To help you get started, we’ve selected a few rpg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aewallin / openvoronoi / test / 2opt_random_polygon.py View on Github external
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])