Skip to content

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.

Merge #35 (empty SVG clip intersections) with #32 and #34

R.7895e19d2d8d
diff --cc CHANGELOG.md
index 9fb908b,01001d8..679cc2e
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -13,11 -12,7 +13,12 @@@ All notable changes to Anatomy are reco
### Fixed
+- Preserve configured pipe clearances in broad-phase solid and pipe sampling.
+- Observe replacement and late-mounted DOM targets through useInView.
+- Check texture line attachments against rounded rectangle corners, including separate radii, SVG clamping and transformed outlines.
+- Honor explicit capture, drive and line-check selectors, and scope reported readouts to the requested figure.
+- Decode valid SVG attribute quotes, whitespace and XML character references in audit bounds.
+ - Exclude invisible empty clip intersections from authored SVG bounds.
- `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.
diff --cc kit/audit.mjs
index 1284e61,879e75d..126ec0d
--- a/kit/audit.mjs
+++ b/kit/audit.mjs
@@@ -1467,20 -1453,12 +1467,24 @@@ const boxOfPoints = (points, m) =>
}
return box;
};
+const cornersOfBox = ([x0, y0, x1, y1]) => [[x0, y0], [x1, y0], [x1, y1], [x0, y1]];
+const boxOfShape = (tag, attrs, m) => {
+ if (tag !== "circle" && tag !== "ellipse") return boxOfPoints(pointsOfShape(tag, attrs), m);
- const num = (name) => Number((attrs.match(new RegExp(`(?:^|\\s)${name}="([^"]*)"`)) ?? [])[1] ?? 0);
++ const num = (name) => Number(attributeOf(attrs, name) ?? 0);
+ const rx = tag === "circle" ? num("r") : num("rx");
+ const ry = tag === "circle" ? rx : num("ry");
+ const x = m[0] * num("cx") + m[2] * num("cy") + m[4];
+ const y = m[1] * num("cx") + m[3] * num("cy") + m[5];
+ const dx = Math.hypot(m[0] * rx, m[2] * ry);
+ const dy = Math.hypot(m[1] * rx, m[3] * ry);
+ return [x - dx, y - dy, x + dx, y + dy];
+};
const unionBox = (a, b) => (!a ? b : !b ? a : [Math.min(a[0], b[0]), Math.min(a[1], b[1]), Math.max(a[2], b[2]), Math.max(a[3], b[3])]);
- const meetBox = (a, b) => (!a || !b ? a ?? null : [Math.max(a[0], b[0]), Math.max(a[1], b[1]), Math.min(a[2], b[2]), Math.min(a[3], b[3])]);
+ const meetBox = (a, b) => {
+ if (!a || !b) return a ?? null;
+ const box = [Math.max(a[0], b[0]), Math.max(a[1], b[1]), Math.min(a[2], b[2]), Math.min(a[3], b[3])];
+ return box[0] <= box[2] && box[1] <= box[3] ? box : null;
+ };
const areaOf = (box) => (box ? Math.max(0, box[2] - box[0]) * Math.max(0, box[3] - box[1]) : 0);
export function markupBox(svg) {
@@@ -1489,7 -1467,9 +1493,9 @@@
let clipId = null;
for (const [, close, tag, attrs, self] of tags) {
if (tag === "clipPath" && !close) {
- clipId = self ? null : attributeOf(attrs, "id");
- const id = (attrs.match(/id="([^"]*)"/) ?? [])[1] ?? null;
++ const id = attributeOf(attrs, "id");
+ if (id) clips.set(id, null);
+ clipId = self ? null : id;
continue;
}
if (clipId) {
@@@ -1508,12 -1488,14 +1514,14 @@@
if (stack.length > 1) stack.pop();
continue;
}
- const m = multiply(top.m, matrixOf((attrs.match(/transform="([^"]*)"/) ?? [])[1]));
- const ref = (attrs.match(/clip-path="url\(#([^)]*)\)"/) ?? [])[1];
- const own = ref && clips.get(ref) ? boxOfPoints([[clips.get(ref)[0], clips.get(ref)[1]], [clips.get(ref)[2], clips.get(ref)[3]]], m) : null;
+ const m = multiply(top.m, matrixOf(attributeOf(attrs, "transform")));
+ const ref = ((attributeOf(attrs, "clip-path") ?? "").match(/url\(#([^)]*)\)/) ?? [])[1];
+ const own = ref && clips.get(ref) ? boxOfPoints(cornersOfBox(clips.get(ref)), m) : null;
- const frame = { m, clip: own ? meetBox(top.clip ?? own, own) : top.clip, skip: top.skip || ["defs", "clipPath", "mask", "linearGradient", "radialGradient", "pattern", "text", "title"].includes(tag) || (attributeOf(attrs, "class") ?? "").includes("iso-halo") };
+ const clip = own ? meetBox(top.clip ?? own, own) : top.clip;
+ const empty = ref && clips.has(ref) && (!own || areaOf(own) === 0 || (top.clip && (!clip || areaOf(clip) === 0)));
- const frame = { m, clip, skip: Boolean(empty) || top.skip || ["defs", "clipPath", "mask", "linearGradient", "radialGradient", "pattern", "text", "title"].includes(tag) || /class="[^"]*iso-halo/.test(attrs) };
++ const frame = { m, clip, skip: Boolean(empty) || top.skip || ["defs", "clipPath", "mask", "linearGradient", "radialGradient", "pattern", "text", "title"].includes(tag) || (attributeOf(attrs, "class") ?? "").includes("iso-halo") };
if (!frame.skip) {
- const shape = boxOfPoints(pointsOfShape(tag, attrs), m);
+ const shape = boxOfShape(tag, attrs, m);
if (shape) box = unionBox(box, frame.clip ? meetBox(shape, frame.clip) : shape);
}
if (!self) stack.push(frame);