import sys
NAR, LUZ, INK, BL = "#f04e23", "#f45a1c", "#111", "#fff"
def onda(a, b, amp):
(x0, y0), (x1, y1) = a, b
dx, dy = x1 - x0, y1 - y0
L = (dx * dx + dy * dy) ** .5
px, py = -dy / L * amp, dx / L * amp
c1 = (x0 + dx / 3 + px, y0 + dy / 3 + py)
c2 = (x0 + dx * 2 / 3 - px, y0 + dy * 2 / 3 - py)
return f"C{c1[0]:.1f},{c1[1]:.1f} {c2[0]:.1f},{c2[1]:.1f} {x1},{y1}"
def farola(estilo="aro", ink=INK, luz=LUZ, fondo=None, papel=BL):
bg = f'' if fondo else ""
if estilo == "aro":
defs = ''
cono = f''
suelo = f''
poste = f''
cabeza = f''
aro = f''
return defs + cono + suelo + f'{poste}' + cabeza + aro
pegatina = f''
poste = f''
cabeza = f''
rayos = "".join(f''
for x0, y0, x1, y1 in ((58, 35, 50, 52), (67, 36, 67, 56), (76, 35, 84, 52)))
return f'{pegatina}{poste}{cabeza}{rayos}'
def svg(cuerpo, fondo=None):
bg = f'' if fondo else ""
return f'\n'
if __name__ == "__main__":
d = sys.argv[1]
open(f"{d}/simbolo.svg", "w").write(svg(farola()))
open(f"{d}/simbolo-negativo.svg", "w").write(svg(farola(ink=BL, papel=INK), INK))
open(f"{d}/simbolo-naranja.svg", "w").write(svg(farola(luz=BL, papel=NAR), NAR))
open(f"{d}/simbolo-pegatina.svg", "w").write(svg(farola("pegatina")))