Credibility pass over the Green Man generator

Turn audit.py into a run() function and drop audit_run.py, which only
existed to import it quietly. Remove unused parameters, keys, helpers
and imports from draw.py, manifest.py and stl_build.py, and the source
file names in stl_build.FILES that pointed at nothing. Keep the brow
strip's taper and knob positions in geom.py only. Correct comments and
docstrings that disagreed with the code, and the README's claim about
counts.

The page changes only in markup: no stray spaces in class attributes,
and three CSS declarations that did nothing are gone. Guide HTML,
templates and print files are byte-identical apart from that.

Credibility pass over a7c04e5..HEAD; the next one can scope from here.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Eric WagonerandClaude Fable 5.2 committed 2026-11-10 19:14:03 -05:00
1 parent b86153a9fd
commit f2bb87caeb
15 files changed
+148 -151

No files matched your search

+17 -18
View File
@@ -1,9 +1,10 @@
"""SVG drawings generated from the manifest. Units are mm (viewBox in mm); y is flipped for SVG."""
import numpy as np
from shapely.geometry import Polygon, MultiPolygon, LineString, Point, box
from shapely.geometry import LineString, Point, box
from shapely import affinity
import geom as G, manifest as M
from geom import TOP
from paths import WORK
VB = (-130.0, -(TOP+156), 260.0, TOP+156+104) # x, y, w, h for the full mask, front or back view
@@ -37,22 +38,22 @@ def line(ls, mirror=False):
def _leaf(p, pal, mirror, hl):
size = p['part']; tone = p.get('tone')
fill = (pal.get(tone) if tone else None) or pal[size]
edge = (pal.get('edge_' + tone) if tone else None) or pal.get('edge')
edge = pal.get('edge_' + tone) if tone else None
vein = (pal.get('vein_' + tone) if tone else None) or pal['vein']
s = f'<path d="{path(p["shape"], mirror)}" fill="{fill}" stroke="{HL if hl else edge or pal["leaf_s"]}" stroke-width="{0.9 if hl else (pal.get("edge_w", 1.0) if edge else 0.45)}" stroke-linejoin="round"/>'
s = f'<path d="{path(p["shape"], mirror)}" fill="{fill}" stroke="{HL if hl else edge or pal["leaf_s"]}" stroke-width="{0.9 if hl else (1.0 if edge else 0.45)}" stroke-linejoin="round"/>'
v = ' '.join(line(G.place(l, p['x'], p['y'], p['ang'], p['flip']), mirror) for l in G.vein_lines(size, p.get('variant', 0)))
return s + f'<path d="{v}" fill="none" stroke="{vein}" stroke-width="{pal.get("vein_w", 0.35)}" stroke-linecap="round"/>'
return s + f'<path d="{v}" fill="none" stroke="{vein}" stroke-width="0.35" stroke-linecap="round"/>'
def _strip(p, pal, mirror, hl):
s = f'<path d="{path(p["shape"], mirror)}" fill="{pal["bark"]}" stroke="{HL if hl else pal["bark_s"]}" stroke-width="{0.9 if hl else 0.5}"/>'
x = np.linspace(-G.STRIP_L/2+4, G.STRIP_L/2-4, 60); grooves = []
for k in range(5):
y = -7 + k*3.5 + 1.6*np.sin(x*0.09+k) + 0.7*np.sin(x*0.31+2*k)
keep = np.abs(y) < (11 - 5*(np.abs(x)/(G.STRIP_L/2))**1.6) - 1.5
keep = np.abs(y) < G.strip_half(x) - 1.5
seg = [(a, b + G.STRIP_Y) for a, b, kk in zip(x, y, keep) if kk]
if len(seg) > 2: grooves.append(line(LineString(seg), mirror))
s += f'<path d="{" ".join(grooves)}" fill="none" stroke="{pal["ridge"]}" stroke-width="0.7" stroke-linecap="round"/>'
for kx in (-52, -26, -5, 16, 40, 58):
for kx in G.STRIP_KNOB_X:
s += f'<ellipse cx="{f((-1 if mirror else 1)*kx)}" cy="{f(-G.STRIP_Y)}" rx="4.2" ry="2.6" fill="{pal["bark"]}" stroke="{pal["ridge"]}" stroke-width="0.6"/>'
return s
@@ -95,9 +96,8 @@ def _part(p, pal, mirror, hl):
if k == 'WIRE': return f'<circle cx="{f((-1 if mirror else 1)*p["x"])}" cy="{f(-p["y"])}" r="1.4" fill="{HL if hl else pal["wire"]}"/>'
return ''
def _base(base, pal, mirror, slits=True):
s = f'<path d="{path(base["outline"], mirror)}" fill="{pal["base"]}" stroke="{pal["base_s"]}" stroke-width="0.6" fill-rule="evenodd" stroke-linejoin="round"/>'
return s
def _base(base, pal, mirror):
return f'<path d="{path(base["outline"], mirror)}" fill="{pal["base"]}" stroke="{pal["base_s"]}" stroke-width="0.6" fill-rule="evenodd" stroke-linejoin="round"/>'
def _glasses(pal):
s = ''.join(f'<path d="{path(G.lens(sg))}" fill="none" stroke="{pal["glasses"]}" stroke-width="1.1"/>' for sg in (-1, 1))
@@ -106,10 +106,10 @@ def _glasses(pal):
s += f'<path d="M{f(sg*(G.FRAME_W/2-3))} {f(-(TOP-4))} L{f(sg*(G.FRAME_W/2+30))} {f(-(TOP-3))}" stroke="{pal["glasses"]}" stroke-width="1.6" stroke-linecap="round" fill="none"/>'
return s
def scene(view='front', done=(), hl=None, palette=None, numbers=False, glasses=True, base=None, hang_wire=True, vb=None, tones=None, extra=''):
def scene(view='front', done=(), hl=None, palette=None, numbers=False, glasses=True, tones=None):
"""One picture of the mask. done = steps already on (ghosted unless palette given); hl = step being added now."""
base = base or G.base_glasses(); mirror = view == 'back'
order = list(M.STEPS); show = set(done) | ({hl} if hl else set())
base = G.base_glasses(); mirror = view == 'back'
show = set(done) | ({hl} if hl else set())
parts = [p for p in M.PLACEMENTS if p['step'] in show]
def pal_for(p):
if palette: return palette
@@ -123,11 +123,11 @@ def scene(view='front', done=(), hl=None, palette=None, numbers=False, glasses=T
body += [_part(p, pal_for(p), False, p['step'] == hl and not palette) for p in backs if p['part'] != 'PATCH']
body.append(_base(base, bpal, False))
for p in fronts:
if p['part'] == 'AF' and hang_wire:
if p['part'] == 'AF':
w = next(q for q in M.PLACEMENTS if q['id'] == p['onto'][0])
body.append(f'<path d="M{f(w["x"])} {f(-w["y"])} Q{f(p["x"])} {f(-w["y"]+2)} {f(p["x"])} {f(-(p["y"]+G.ACORN["AF"][1]/2))}" fill="none" stroke="{pal_for(p)["wire"]}" stroke-width="0.5"/>')
body.append(_part(p, pal_for(p), False, p['step'] == hl and not palette))
if glasses and base['kind'] == 'glasses': body.append(_glasses(bpal))
if glasses: body.append(_glasses(bpal))
else:
body.append(_base(base, bpal, True))
for p in sorted(backs, key=lambda p: p['z']): body.append(_part(p, pal_for(p), True, p['step'] == hl and not palette))
@@ -138,12 +138,11 @@ def scene(view='front', done=(), hl=None, palette=None, numbers=False, glasses=T
body.append(f'<rect x="{f(min(x0, out+(-sg)*30))}" y="{f(-G.SLIT_Y1)}" width="{f(abs(out-x0)+30)}" height="{f(G.SLIT_Y1-G.SLIT_Y0)}" fill="{sp["strap"]}" opacity="0.9"/>')
body.append(f'<rect x="{f(min(x0, out))}" y="{f(-G.SLIT_Y1+2)}" width="{f(abs(out-x0))}" height="{f(G.SLIT_Y1-G.SLIT_Y0-4)}" fill="#6a6a6a" stroke="#fff" stroke-width="0.3" stroke-dasharray="1 1"/>')
if numbers and hl:
seq = [p for p in M.step_placements(hl) if p['footprint'] is not None and p['part'] not in ('STRAP',) and (p['face'] == 'back') == mirror]
seq = [p for p in M.step_placements(hl) if p['footprint'] is not None and p['part'] != 'STRAP' and (p['face'] == 'back') == mirror]
for i, p in enumerate(seq):
c = p['footprint'].centroid; x = (-1 if mirror else 1)*c.x
body.append(f'<circle cx="{f(x)}" cy="{f(-c.y)}" r="3.3" fill="#fff" stroke="{HL}" stroke-width="0.6"/><text x="{f(x)}" y="{f(-c.y+1.25)}" font-size="3.6" font-weight="700" text-anchor="middle" fill="{HL}" font-family="Inter, Helvetica, Arial, sans-serif">{i+1}</text>')
v = vb or VB
return f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="{f(v[0])} {f(v[1])} {f(v[2])} {f(v[3])}" role="img">{"".join(body)}{extra}</svg>'
return f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="{" ".join(f(v) for v in VB)}" role="img">{"".join(body)}</svg>'
if __name__ == '__main__':
steps = list(M.STEPS)
@@ -154,4 +153,4 @@ if __name__ == '__main__':
html += f'<div>{scene("back", done=["strap","strip"], hl="back", numbers=True)}</div>'
html += f'<div>{scene("front", done=steps[:8], hl="tendrils", numbers=True)}</div>'
html += f'<div>{scene("front", done=steps[:9], hl="cheeks", numbers=True)}</div>'
open(G.__file__.replace('geom.py', 'work/preview.html'), 'w').write(html + '</body></html>')
open(WORK / 'preview.html', 'w').write(html + '</body></html>')