def main(args): from render.render import Render from dddUtils.ioOBJ import load from numpy import array data = load(args.fn) size = args.size one = 1.0/size vertices = data['vertices'][:,:2] back = [1,1,1,1] front = [0,0,0,args.alpha] rad = args.rad*one 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(one) out = ''.join(args.fn.split('.')[:-1])+'.png' for vv in vertices: render.circle(vv[0], vv[1], rad, 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
def main(args): from render.render import Render from dddUtils.ioOBJ import load from numpy import array data = load(args.fn) size = args.size one = 1.0 / size vertices = data['vertices'][:, :2] back = [1, 1, 1, 1] front = [0, 0, 0, args.alpha] rad = args.rad * one 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(one) out = ''.join(args.fn.split('.')[:-1]) + '.png' for vv in vertices: render.circle(vv[0], vv[1], rad, 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
def main(args): from dddUtils.ioOBJ import load_2d as load from render.render import Render fn = args.fn dot_size = args.dotSize data = load(fn) vertices = data['vertices'] render = Render(SIZE, BACK, FRONT) draw(render, vertices, dot_size) out = fn + '.png' render.write_to_png(out)
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
def main(args, **argv): from dddUtils.ioOBJ import load_2d as load from cairo import SVGSurface, Context from numpy import array from glob import glob prefix = args.prefix size = args.size scale = args.scale one = 1.0/size steps = args.steps stride = args.stride skip = args.skip out = prefix + '.svg' print('making file: {:s}'.format(out)) s = SVGSurface(out, size, size) c = Context(s) c.set_line_width(0.1) c.set_source_rgba(*BLACK) for fn in sorted(glob(prefix + '*.2obj'))[skip:steps:stride]: print(fn) data = load(fn) vertices = data['vertices'] vertices *= scale*size edges = data['edges'] # make_random_line(c, vertices, edges) make_line(c, vertices, edges) c.save() return
def main(args, **argv): # from render.render import Render from dddUtils.ioOBJ import load_2d as load from cairo import SVGSurface, Context from numpy import array size = args.size scale = args.scale one = 1.0 / size data = load(args.fn) print(data) vertices = data['vertices'] faces = data['faces'] edges = data['edges'] out = '.'.join(args.fn.split('.')[:-1]) + '.svg' print('making file: {:s}'.format(out)) s = SVGSurface(out, size, size) c = Context(s) c.set_line_width(0.1) c.set_source_rgba(*BLACK) vertices -= get_mid(vertices) vertices *= scale vertices += array([[0.5, 0.5]]) vertices *= size make_triangles(c, vertices, faces, edges) # make_random_length_strips(c, vertices, faces, edges) c.save() return
def main(args, **argv): # from render.render import Render from dddUtils.ioOBJ import load_2d as load from cairo import SVGSurface, Context from numpy import array size = args.size scale = args.scale one = 1.0/size data = load(args.fn) print(data) vertices = data['vertices'] faces = data['faces'] edges = data['edges'] out = '.'.join(args.fn.split('.')[:-1])+'.svg' print('making file: {:s}'.format(out)) s = SVGSurface(out, size, size) c = Context(s) c.set_line_width(0.1) c.set_source_rgba(*BLACK) vertices -= get_mid(vertices) vertices *= scale vertices += array([[0.5,0.5]]) vertices *= size make_triangles(c, vertices, faces, edges) # make_random_length_strips(c, vertices, faces, edges) c.save() return