diff --git a/icon/make.py b/icon/make.py index d9db674..1c0a8ce 100644 --- a/icon/make.py +++ b/icon/make.py @@ -1,7 +1,7 @@ import svgwrite import random import time -from math import factorial +from math import factorial,sin,cos,pi from itertools import permutations import tsp as m_tsp @@ -48,7 +48,7 @@ def generate(seed,name=None,small=False): random.seed(seed) w=2 max_rings=3 - num_points=10 + num_points=5 min_dist=10+10+20*(max_rings+1) base_r=10 ring_step=lambda v:10+v*10 @@ -62,17 +62,7 @@ def generate(seed,name=None,small=False): color="#eee" pos=make_points(num_points,size,min_dist=min_dist) print("TSP...") - - min_d=float('inf') - - for p1 in pos: - for p2 in pos: - if p1==p2: - continue - min_d=min(min_d,dist(p1,p2)) - print(min_d,min_dist) pos=tsp(pos) - for (x1,y1),(x2,y2) in zip(pos,pos[1:]): if small: x1/=sd @@ -87,8 +77,6 @@ def generate(seed,name=None,small=False): base_r=5 px/=sd py/=sd - px=svgwrite.px(px) - py=svgwrite.px(py) if random.random()>0.8: dwg.add(dwg.circle((px,py),r=base_r+random.random()*base_r,stroke_width=w,stroke='#0ae')).fill('#0ae') else: @@ -96,20 +84,26 @@ def generate(seed,name=None,small=False): r=base_r for _ in range(random.randint(1,max_rings)): if small: + random.random() random.random() random.random() continue r+=ring_step(random.random()) + ring_col=color if random.random()>0.75: - circ=dwg.add(dwg.circle((px,py),r=r,stroke_width=w,stroke="#ea0")) - else: - circ=dwg.add(dwg.circle((px,py),r=r,stroke_width=w,stroke=color)) + ring_col="#ea0" + circ=dwg.add(dwg.circle((px,py),r=r,stroke_width=w,stroke=ring_col)) circ.fill(color,opacity=0) + d=random.random()*pi*2 + dx=cos(d) + dy=sin(d) + m=random.random() + moon=dwg.add(dwg.circle((px+dx*r,py+dy*r),r=2+2*m,stroke_width=w,stroke=ring_col)) + moon.fill(ring_col) dwg.save() - -seed=0 +seed=-4 generate(seed,"icon_1",small=False) generate(seed,"icon_1_small",small=True) diff --git a/icon/out/icon_1.svg b/icon/out/icon_1.svg index 1fb9797..0538a0a 100644 --- a/icon/out/icon_1.svg +++ b/icon/out/icon_1.svg @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/icon/out/icon_1_small.svg b/icon/out/icon_1_small.svg index e31b894..9a6c926 100644 --- a/icon/out/icon_1_small.svg +++ b/icon/out/icon_1_small.svg @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file