Abfrage über doc_query_bin/queries::run_bin (plan_domains_buf: neun Gruppen, Ausmass, Hashes); generatePlan liest den Puffer (decodePlanBuf) und merkt sich die Kern-Abschnitte als Plan.bufRuns (über Abzugskörper, Geschoss-Überlagerung und kompakte Unterlage nachgeführt). Grosses Projekt (Beispielhaus 20x20) generatePlan 386 → 171 ms, Beispiel-EG 0,63 → 0,32 ms. Primitive-JSON nach Dekodierung gleich zum alten planDomains (Beispiel, 120 Zufallsprojekte, grosses Projekt), CLI-SVG byte-gleich. Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
57 lines
2.2 KiB
TypeScript
57 lines
2.2 KiB
TypeScript
// Testhilfe ([K3d]): grosses Projekt für Messungen — das Beispielhaus n × n Mal gekachelt
|
||
// (n = 20: 3600 Wände, 1200 Öffnungen, 400 Decken/Räume/Treppen/Dächer, 1600 Stützen).
|
||
// Ids bekommen ein Kachel-Suffix, Verweise (Öffnung → Wand) werden mitgeführt.
|
||
|
||
import type { Column, Project, Vec2 } from "../model/types";
|
||
import { sampleProject } from "../model/sampleProject";
|
||
|
||
const shift = (p: Vec2, dx: number, dy: number): Vec2 => ({ x: p.x + dx, y: p.y + dy });
|
||
|
||
export function bigSampleProject(n = 20, pitch = 8): Project {
|
||
const s = sampleProject;
|
||
const out: Project = {
|
||
...s,
|
||
walls: [],
|
||
openings: [],
|
||
ceilings: [],
|
||
roofs: [],
|
||
stairs: [],
|
||
rooms: [],
|
||
columns: [],
|
||
};
|
||
for (let i = 0; i < n; i++) {
|
||
for (let j = 0; j < n; j++) {
|
||
const dx = i * pitch;
|
||
const dy = j * pitch;
|
||
const sfx = `_${i}_${j}`;
|
||
for (const w of s.walls) out.walls.push({ ...w, id: w.id + sfx, start: shift(w.start, dx, dy), end: shift(w.end, dx, dy) });
|
||
for (const o of s.openings ?? []) out.openings!.push({ ...o, id: o.id + sfx, hostWallId: o.hostWallId + sfx });
|
||
for (const c of s.ceilings ?? []) out.ceilings!.push({ ...c, id: c.id + sfx, outline: c.outline.map((p) => shift(p, dx, dy)) });
|
||
for (const r of s.roofs ?? []) out.roofs!.push({ ...r, id: r.id + sfx, outline: r.outline.map((p) => shift(p, dx, dy)) });
|
||
for (const st of s.stairs ?? []) out.stairs!.push({ ...st, id: st.id + sfx, start: shift(st.start, dx, dy) });
|
||
for (const r of s.rooms ?? []) {
|
||
out.rooms!.push({
|
||
...r,
|
||
id: r.id + sfx,
|
||
boundary: r.boundary.map((p) => shift(p, dx, dy)),
|
||
...(r.stampAnchor ? { stampAnchor: shift(r.stampAnchor, dx, dy) } : {}),
|
||
});
|
||
}
|
||
for (let k = 0; k < 4; k++) {
|
||
const col: Column = {
|
||
id: `COL${k}${sfx}`,
|
||
type: "column",
|
||
floorId: "eg",
|
||
categoryCode: "50",
|
||
position: { x: dx + 1 + k, y: dy + 2 },
|
||
profile: k % 2 ? { kind: "round", radius: 0.12 } : { kind: "rect", width: 0.25, depth: 0.25 },
|
||
rotation: k * 0.3,
|
||
height: 2.6,
|
||
};
|
||
out.columns!.push(col);
|
||
}
|
||
}
|
||
}
|
||
return out;
|
||
}
|