An agent skill for creating detailed, interactive isometric illustrations of real-world machines and complex systems. Generates polished SVGs with optional WebGL shaders and 3D effects.
Follow rounded rectangle outlines in line-end verification
Rudy Celeklied35629722ec
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex fe3a3ed..4dc0ef3 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,6 +12,8 @@ All notable changes to Anatomy are recorded here. The format follows [Keep a Cha### Fixed+- Check texture line attachments against rounded rectangle corners, including separate radii, SVG clamping and transformed outlines.+- `scripts/drive.mjs` now fails when a browser evaluation throws or rejects, rather than reporting a clean successful session.- The arcade cabinet now accepts coins with reduced motion enabled, preserving the meter, credit and power-on events when the coin animation is skipped.- The turning dial stops its idle tour when reduced motion is enabled while the page is open and cancels its pending automatic restart while preserving keyboard and pointer input.diff --git a/scripts/line-ends.mjs b/scripts/line-ends.mjsindex 4fc4085..ebd038e 100644--- a/scripts/line-ends.mjs+++ b/scripts/line-ends.mjs@@ -123,7 +123,18 @@ function lineEnds({ select = null, tolerance = 1, root: rootSlack = 2, mark = 7,}if (tag === "rect") {const [x, y, w, h] = [num("x"), num("y"), num("width"), num("height")];- return [{ points: [[x, y], [x + w, y], [x + w, y + h], [x, y + h], [x, y]], closed: true }];+ const rx = Math.min(w / 2, Math.max(0, el.hasAttribute("rx") ? num("rx") : num("ry")));+ const ry = Math.min(h / 2, Math.max(0, el.hasAttribute("ry") ? num("ry") : num("rx")));+ if (!rx || !ry) return [{ points: [[x, y], [x + w, y], [x + w, y + h], [x, y + h], [x, y]], closed: true }];+ const points = [];+ for (const [cx, cy, start] of [[x + w - rx, y + ry, -Math.PI / 2], [x + w - rx, y + h - ry, 0], [x + rx, y + h - ry, Math.PI / 2], [x + rx, y + ry, Math.PI]]) {+ for (let index = 0; index <= 32; index++) {+ const angle = start + index * Math.PI / 64;+ points.push([cx + rx * Math.cos(angle), cy + ry * Math.sin(angle)]);+ }+ }+ points.push(points[0]);+ return [{ points, closed: true }];}return [];};diff --git a/scripts/lines-rounded-rect.test.mjs b/scripts/lines-rounded-rect.test.mjsnew file mode 100644index 0000000..7fd1df4--- /dev/null+++ b/scripts/lines-rounded-rect.test.mjs@@ -0,0 +1,32 @@+import assert from "node:assert/strict";+import { execFile } from "node:child_process";+import { mkdtemp, rm, writeFile } from "node:fs/promises";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { promisify } from "node:util";+import test from "node:test";++const execute = promisify(execFile);+for (const [name, attributes, x, y, rooted, transform = ""] of [+ ["rounded cutaway rejects square-corner attachment", 'width="100" height="80" rx="30"', 0, 0, false],+ ["rounded curve accepts its native attachment", 'width="100" height="80" rx="30"', 8.78679656440357, 8.786796564403573, true],+ ["elliptical corner accepts its native attachment", 'width="100" height="80" rx="30" ry="10"', 4.019237886466836, 5, true],+ ["missing horizontal radius follows vertical radius", 'width="100" height="80" ry="20"', 5.857864376269049, 5.857864376269051, true],+ ["oversized radii clamp independently", 'width="100" height="80" rx="200" ry="200"', 14.644660940672622, 11.715728752538102, true],+ ["affine corner preserves transformed attachment", 'width="100" height="80" rx="30"', 8.78679656440357, 8.786796564403573, true, "matrix(2 .2 .4 1 50 50)"],+ ["ordinary square retains its original attachment", 'width="100" height="80"', 0, 0, true],+ ["explicit zero radius remains square", 'width="100" height="80" rx="0" ry="30"', 0, 0, true],+]) test(name, async () => {+ const directory = await mkdtemp(join(tmpdir(), "anatomy-rounded-rect-lines-"));+ try {+ const file = join(directory, "figure.html");+ await writeFile(file, `<!doctype html><div class="iso-plate"><svg width="360" height="300" viewBox="0 0 360 300"><g transform="${transform}"><rect id="outline" x="0" y="0" ${attributes} fill="none" stroke="black"/><path class="iso-line" data-free="start" fill="none" stroke="black" d="M${x} -20 L${x} ${y}"/></g></svg></div>`);+ const actions = JSON.stringify([["eval", `document.querySelector('#outline').isPointInStroke(new DOMPoint(${x},${y}))`], ["lines"]]);+ let result;+ try { result = { code: 0, ...await execute(process.execPath, ["scripts/drive.mjs", file, actions], { timeout: 30000 }) }; }+ catch (error) { result = { code: error.code, stdout: error.stdout, stderr: error.stderr }; }+ assert.match(result.stdout, new RegExp(`eval: ${rooted}`));+ assert.equal(result.code, rooted ? 0 : 1, result.stderr);+ assert.match(result.stdout, new RegExp(`line ends: ${rooted ? 0 : 1} of 1`));+ } finally { await rm(directory, { recursive: true, force: true }); }+});