import type { ElementKind } from "@/lib/tatting"; type Props = { kind: ElementKind; picots: number; radius: number; color: string; }; const r3 = (n: number) => Math.round(n * 1000) / 1000; /** Renders a tatting motif centered at (0,0) in local coordinates. */ export function Shape({ kind, picots, radius, color }: Props) { const picotR = Math.max(3, radius * 0.11); if (kind === "ring") { const dots = Array.from({ length: picots }, (_, i) => { const a = (i / picots) * Math.PI * 2 - Math.PI / 2; return { cx: r3(Math.cos(a) * (radius + picotR * 0.7)), cy: r3(Math.sin(a) * (radius + picotR * 0.7)), }; }); return ( {dots.map((d, i) => ( ))} ); } // Arc: half-circle bow with picots along the outer edge const start = { x: -radius, y: 0 }; const end = { x: radius, y: 0 }; const dots = Array.from({ length: picots }, (_, i) => { const t = (i + 1) / (picots + 1); const a = Math.PI - t * Math.PI; const rr = radius + picotR * 0.7; return { cx: r3(Math.cos(a) * rr), cy: r3(-Math.sin(a) * rr) }; }); return ( {dots.map((d, i) => ( ))} ); }