def main(args):

    from render.render import Render
    from dddUtils.ioOBJ import load_2d as load

    #from modules.show import show
    from modules.show import show_closed

    data = load(args.fn)

    size = args.size
    one = 1.0 / size
    vertices = data['vertices']
    lines = data['lines']

    render = Render(size, BACK, FRONT)

    render.ctx.set_source_rgba(*FRONT)
    render.ctx.set_line_width(args.width * one)

    out = ''.join(args.fn.split('.')[:-1]) + '.png'

    show_closed(render, vertices[lines[0], :], out, fill=args.closed)
    #for vv in vertices:
    #render.circle(vv[0], vv[1], one, fill=True)

    render.write_to_png(out)

    return
def main(args):

  from render.render import Render
  from dddUtils.ioOBJ import load_2d as load

  #from modules.show import show
  from modules.show import show_closed

  data = load(args.fn)

  size = args.size
  one = 1.0/size
  vertices = data['vertices']
  lines = data['lines']

  render = Render(size, BACK, FRONT)

  render.ctx.set_source_rgba(*FRONT)
  render.ctx.set_line_width(args.width*one)

  out = ''.join(args.fn.split('.')[:-1])+'.png'

  show_closed(render, vertices[lines[0],:], out, fill=args.closed)
  #for vv in vertices:
    #render.circle(vv[0], vv[1], one, fill=True)

  render.write_to_png(out)


  return
Ejemplo n.º 3
0
def main():

  from time import time
  from itertools import count

  from render.render import Render
  from modules.helpers import print_stats
  from modules.show import show
  from modules.show import show_closed

  from differentialLine import DifferentialLine


  DF = DifferentialLine(NMAX, FARL*2, NEARL, FARL, PROCS)

  render = Render(SIZE, BACK, FRONT)

  render.ctx.set_source_rgba(*FRONT)
  render.ctx.set_line_width(LINEWIDTH)

  angles = sorted(random(NINIT)*TWOPI)

  DF.init_circle_segment(MID,MID,RAD, angles)

  t_start = time()


  for i in count():

    DF.optimize_position(STP)
    spawn_curl(DF,NEARL)

    if i % STAT_ITT == 0:

      print_stats(i,time()-t_start,DF)

    if i % EXPORT_ITT == 0:

      fn = './res/oryx_bb_{:010d}.png'.format(i)
      num = DF.np_get_edges_coordinates(np_edges)
      show(render,np_edges[:num,:],fn)

      fn = './res/oryx_bb_closed_{:010d}.png'.format(i)
      num = DF.np_get_sorted_vert_coordinates(np_verts)
      show_closed(render,np_verts[:num,:],fn)
def main(args):

  from dddUtils.ddd import get_mid_2d as get_mid
  from render.render import Render
  from dddUtils.ioOBJ import load
  from modules.show import show_closed

  from numpy import array

  data = load(args.fn)
  size = args.size

  if args.fill:
    fill = True
  else:
    fill = False

  one = 1.0/size
  vertices = data['vertices']

  print(vertices)

  if args.scale:

    vertices -= get_mid(vertices)
    vertices *= args.scale
    vertices += array([[0.5,0.5]])

  render = Render(size, BACK, FRONT)

  render.ctx.set_source_rgba(*FRONT)
  render.ctx.set_line_width(args.width*one)

  out = ''.join(args.fn.split('.')[:-1])+'.png'

  show_closed(render, vertices, out, fill=fill)

  #render.ctx.set_source_rgba(*[1,0,0,1])
  #for vv in vertices:
    #render.circle(vv[0], vv[1], one*4, fill=False)

  render.write_to_png(out)

  return
Ejemplo n.º 5
0
def main():

  from time import time
  from itertools import count

  from render.render import Render
  from modules.helpers import print_stats
  from modules.show import show
  from modules.show import show_closed

  from differentialLine import DifferentialLine


  DF = DifferentialLine(NMAX, FARL*2, NEARL, FARL, PROCS)

  render = Render(SIZE, BACK, FRONT)

  render.ctx.set_source_rgba(*FRONT)
  render.ctx.set_line_width(LINEWIDTH)

  angles = sorted(random(NINIT))

  DF.init_circle_segment(MID,MID,RAD, angles)


  for i in count():

    t_start = time()

    steps(DF,STEPS_ITT)

    t_stop = time()

    print_stats(i*STEPS_ITT,t_stop-t_start,DF)

    fn = './res/oryx_bb_{:010d}.png'.format(i*STEPS_ITT)
    edges_coordinates = DF.get_edges_coordinates()
    show(render,edges_coordinates,fn)


    fn = './res/oryx_bb_closed_{:010d}.png'.format(i*STEPS_ITT)
    sorted_vert_coordinates = DF.get_sorted_vert_coordinates()
    show_closed(render,sorted_vert_coordinates,fn)
Ejemplo n.º 6
0
def main():

    from time import time
    from itertools import count

    from render.render import Render
    from modules.helpers import print_stats
    from modules.show import show
    from modules.show import show_closed

    from differentialLine import DifferentialLine

    DF = DifferentialLine(NMAX, FARL * 2, NEARL, FARL, PROCS)

    render = Render(SIZE, BACK, FRONT)

    render.ctx.set_source_rgba(*FRONT)
    render.ctx.set_line_width(LINEWIDTH)

    angles = sorted(random(NINIT))

    DF.init_circle_segment(MID, MID, RAD, angles)

    for i in count():

        t_start = time()

        steps(DF, STEPS_ITT)

        t_stop = time()

        print_stats(i * STEPS_ITT, t_stop - t_start, DF)

        fn = './res/oryx_bb_{:010d}.png'.format(i * STEPS_ITT)
        edges_coordinates = DF.get_edges_coordinates()
        show(render, edges_coordinates, fn)

        fn = './res/oryx_bb_closed_{:010d}.png'.format(i * STEPS_ITT)
        sorted_vert_coordinates = DF.get_sorted_vert_coordinates()
        show_closed(render, sorted_vert_coordinates, fn)