"""Generate the continuous red/blue infinity identity as editable SVG assets."""
import json
import math
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
OUT = ROOT / 'public' / 'brand'
OUT.mkdir(exist_ok=True)
def point(t):
return 160 + 130 * math.sin(t), 96 + 59 * math.sin(2 * t)
def tangent(t):
return 130 * math.cos(t), 118 * math.cos(2 * t)
# Cubic segments retain a smooth tangent through both loops and the crossover.
step=math.pi/4
parts=['M160 96']
for i in range(8):
a,b=i*step,(i+1)*step
p,q=point(a),point(b)
u,v=tangent(a),tangent(b)
parts.append('C'+ ' '.join(f'{n:.3f}' for n in (p[0]+u[0]*step/3,p[1]+u[1]*step/3,q[0]-v[0]*step/3,q[1]-v[1]*step/3,q[0],q[1])))
path=''.join(parts)+'Z'
(ROOT/'src'/'brandGeometry.json').write_text(json.dumps({'path':path},separators=(',', ':'))+'\n')
body=f''
(OUT/'ouroboros-mark.svg').write_text(f'\n')
(OUT/'ouroboros-avatar.svg').write_text(f'\n')
(ROOT/'public'/'favicon.svg').write_text(f'\n')
print('Generated continuous infinity mark, avatar, favicon and shared React geometry.')