def main(): from differentialMesh import DifferentialMesh from iutils.render import Animate from modules.helpers import darts DM = DifferentialMesh(NMAX, 2 * FARL, NEARL, FARL, PROCS) DM.new_faces_in_ngon(MID, MID, H, 3, 0) DM.set_edge_intensity(1, 1) sources = [(x, y) for x, y in darts(NUM_SOURCES, MID, MID, 0.40, 3 * NEARL)] DM.initialize_sources(sources, NEARL) def wrap(render): res = steps(DM) show(render, DM, sources) return res render = Animate(SIZE, BACK, FRONT, wrap) render.set_line_width(LINEWIDTH) render.start()
def main(): from differentialMesh import DifferentialMesh from iutils.render import Animate from modules.helpers import darts DM = DifferentialMesh(NMAX, 2*FARL, NEARL, FARL, PROCS) DM.new_faces_in_ngon(MID,MID, H, 3, 0) DM.set_edge_intensity(1, 1) sources = [(x,y) for x,y in darts(NUM_SOURCES, MID, MID, 0.40, 3*NEARL)] DM.initialize_sources(sources, NEARL) def wrap(render): res = steps(DM) show(render, DM, sources) return res render = Animate(SIZE, BACK, FRONT, wrap) render.set_line_width(LINEWIDTH) render.start()
def main(): from modules.fracture import Fracture from iutils.render import Animate from numpy.random import random from iutils.random import darts_rect from time import time from fn import Fn fn = Fn(prefix='./res/') start = time() initial_sources = darts_rect(SOURCES, 0.5, 0.5, 1.0 - 2.0 * EDGE, 1.0 - 2.0 * EDGE, FRAC_STP) F = Fracture(FRAC_DOT, FRAC_DST, FRAC_STP, initial_sources=initial_sources, zone_leap=ZONE_LEAP, nmax=NMAX) for _ in range(20): F.blow(1, EDGE + random((1, 2)) * (1.0 - 2.0 * EDGE)) def wrap(render): print('itt', F.itt, 'num', F.num, 'fnum', F.fnum, 'anum', F.anum, 'time', time() - start) res = F.step() n = F.frac_front(factor=SPAWN_FACTOR, angle=SPAWN_ANGLE, dbg=DBG) if n > 0: print('new fracs: {:d}'.format(n)) if not F.itt % DRAW_ITT: show(render, F) return res render = Animate(SIZE, BACK, FRONT, wrap) render.set_line_width(LINEWIDTH) render.start() name = fn.name() render.write_to_png(name + '.png') export(name + '.2obj', F)
def main(): from differentialMesh import DifferentialMesh from iutils.render import Animate DM = DifferentialMesh(NMAX, 2*FARL, NEARL, FARL, PROCS) DM.new_faces_in_ngon(MID,MID, H, 6, 0.0) def wrap(render): res = steps(DM) show(render, DM) return res render = Animate(SIZE, BACK, FRONT, wrap) render.set_line_width(LINEWIDTH) render.start()
def main(): from differentialMesh import DifferentialMesh from iutils.render import Animate DM = DifferentialMesh(NMAX, 2 * FARL, NEARL, FARL, PROCS) DM.new_faces_in_ngon(MID, MID, H, 6, 0.0) def wrap(render): res = steps(DM) show(render, DM) return res render = Animate(SIZE, BACK, FRONT, wrap) render.set_line_width(LINEWIDTH) render.start()
def main(): from differentialMesh import DifferentialMesh from iutils.render import Animate DM = DifferentialMesh(NMAX, 2 * FARL, NEARL, FARL, PROCS) DM.new_faces_in_ngon(MID, MID, H, 6, 0.0) show = get_show(DM) def wrap(render): res = steps(DM) show(render) return res render = Animate(SIZE, BACK, FRONT, wrap) # render.get_colors_from_file('../colors/red_earth.gif') render.set_line_width(LINEWIDTH) render.start()
def main(): import gtk from differentialMesh import DifferentialMesh from iutils.render import Animate DM = DifferentialMesh(NMAX, 2 * FARL, NEARL, FARL, PROCS) DM.new_faces_in_ngon(MID, MID, H, 6, 0.0) def wrap(render): res = steps(DM) show(render, DM) return res render = Animate(SIZE, BACK, FRONT, wrap) # render.get_colors_from_file('../colors/red_earth.gif') render.set_line_width(LINEWIDTH) gtk.main()
def main(): from modules.leaf import LeafClosed as Leaf from iutils.render import Animate from numpy.random import random from numpy import array colors = { 'back': [1,1,1,1], 'front': [0,0,0,0.3], 'vein': [0,0,0,0.9], 'edge': [0,0,0,0.6], 'cyan': [0,0.6,0.6,0.3], 'red': [0.7,0.0,0.0,0.8], 'blue': [0.0,0.0,0.7,0.8], 'light': [0,0,0,0.2], } threads = 512 render_steps = 3 export_steps = 3 size = 512 one = 1.0/size node_rad = 0.5*one area_rad = 20*node_rad stp = node_rad*2 kill_rad = 2*stp sources_dst = 2*kill_rad # init_num_sources = 4 # init_veins = 0.2+0.6*random((init_num_sources,2)) init_veins = array([[0.5, 0.5]]) init_num_sources = 10000 from iutils.random import darts init_sources = darts(init_num_sources, 0.5, 0.5, 0.45, sources_dst) # from iutils.random import darts_rect # init_sources = darts_rect(init_num_sources, 0.5, 0.5, 0.95, 0.95, sources_dst) L = Leaf( size, stp, init_sources, init_veins, area_rad, kill_rad, threads = threads ) print('nz', L.nz) print('dens', L.sv_leap) wrap = get_wrap( L, colors, node_rad=node_rad, export_steps=export_steps, render_steps=render_steps ) render = Animate(size, colors['back'], colors['front'], wrap) render.set_line_width(L.one*2) render.start()
def main(): from numpy import array from modules.differentialLattice import DifferentialLattice from iutils.render import Animate from modules.helpers import spawn_circle colors = { 'back': [1, 1, 1, 1], 'front': [0, 0, 0, 0.7], 'cyan': [0, 0.6, 0.6, 0.7], 'purple': [0.6, 0.0, 0.6, 0.7], 'light': [0, 0, 0, 0.2], } threads = 512 zone_leap = 512 size = 2048 one = 1.0/size export_steps = 100 render_steps = 100 init_num = 20 line_width = one*2.5 stp = one*0.03 spring_stp = 5 reject_stp = 0.1 cohesion_stp = 1.0 max_capacity = 30 node_rad = 4*one spring_reject_rad = node_rad*1.9 spring_attract_rad = node_rad*2.0 outer_influence_rad = 10.0*node_rad link_ignore_rad = 0.5*outer_influence_rad DL = DifferentialLattice( size, stp, spring_stp, reject_stp, cohesion_stp, max_capacity, node_rad, spring_reject_rad, spring_attract_rad, outer_influence_rad, link_ignore_rad, threads=threads, zone_leap=zone_leap, nmax=50000000 ) spawn_circle(DL, init_num, xy=array([[0.5, 0.5]]), dst=node_rad*0.8, rad=0.01) wrap = get_wrap(DL, colors, render_steps, export_steps) render = Animate(size, colors['back'], colors['front'], wrap) render.set_line_width(line_width) render.start()