import svgwrite import random import time from math import factorial from itertools import permutations import tsp as m_tsp def dist(p1,p2): return dist2(p1,p2)**0.5 def dist2(p1,p2): diff=0 for a,b in zip(p1,p2): diff+=(a-b)**2 return diff def tsp(points): res=[] for idx in m_tsp.tsp(points)[1]: res.append(points[idx]) return res def make_points(n,size,min_dist=0): min_dist*=min_dist points=[] while len(points)0.8: dwg.add(dwg.circle((px,py),r=base_r+random.random()*base_r,stroke_width=w,stroke='#0ae')).fill('#0ae') else: dwg.add(dwg.circle((px,py),r=base_r+random.random()*base_r,stroke_width=w,stroke=color)).fill(color) r=base_r for _ in range(random.randint(1,max_rings)): if small: random.random() random.random() continue r+=ring_step(random.random()) 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)) circ.fill(color,opacity=0) dwg.save() seed=0 generate(seed,"icon_1",small=False) generate(seed,"icon_1_small",small=True)