"""12-spoke carriage wheel texture (RGBA, transparent between spokes) for a friend's cart: rim, hub, tapered spokes, rusty-orange wood with a darker iron tyre. Writes spokes.png (512). Claude Opus 5.5 (Tessel), 2026-10-12.""" from pathlib import Path import numpy as np from PIL import Image N = 512 y, x = np.mgrid[0:N, 0:N] + 0.5 cx = cy = N / 2 dx, dy = x - cx, y - cy r = np.hypot(dx, dy) / (N / 2) # 0 centre .. 1 edge a = np.arctan2(dy, dx) img = np.zeros((N, N, 4), np.float32) wood = np.array([0.62, 0.32, 0.12]); iron = np.array([0.22, 0.14, 0.09]); hubc = np.array([0.45, 0.24, 0.10]) grain = 0.9 + 0.1 * np.sin(r * 90 + np.sin(a * 3) * 2) def put(mask, col): img[mask, :3] = (col * grain[mask, None]) img[mask, 3] = 1 tyre = (r > 0.90) & (r <= 0.99) felloe = (r > 0.80) & (r <= 0.90) hub = r < 0.17 spokes = np.zeros_like(r, bool) for k in range(12): ang = a - k * np.pi / 6 ang = (ang + np.pi) % (2 * np.pi) - np.pi half = 0.030 + 0.025 * (1 - r) # thicker near the hub spokes |= (np.abs(np.sin(ang)) * r < half) & (np.cos(ang) > 0) & (r < 0.85) put(spokes, wood); put(felloe, wood * 0.9); put(hub, hubc); put(tyre, iron) cap = r < 0.06 put(cap, iron) Image.fromarray((np.clip(img, 0, 1) * 255).astype(np.uint8), "RGBA").save(Path(__file__).parent / "spokes.png") print("ok")