diff --git a/src/plan/toWalls3d.test.ts b/src/plan/toWalls3d.test.ts index 848ed222..f01b0b05 100644 --- a/src/plan/toWalls3d.test.ts +++ b/src/plan/toWalls3d.test.ts @@ -687,9 +687,10 @@ describe("Rahmen-/Sprossen-Riegel typisierter Öffnungen (emitOpeningFrames)", ( const withMullionsFrames = projectToModel3d(withMullions).meshes.filter(isFrame); // Mit den Mittelpfosten (wingCount-1) und Kämpfern (mullionRows-1): // 1 Flügelpfosten (wingCount−1) - // 1 Kämpfer (mullionRows−1) - // → zusammen 2 Riegel mehr als Basis (1×1 =1). - expect(withMullionsFrames.length).toBe(baselineFrames.length + 2); + // 1 Kämpfer (mullionRows−1), am Pfosten in zwei Hälften geteilt (keine + // Überlappung an der Kreuzung) + // → zusammen 3 Riegel mehr als Basis (1×1 =1). + expect(withMullionsFrames.length).toBe(baselineFrames.length + 3); }); it("wingCount=2 + mullionCols=2 -> je ein zusätzlicher Sprossen-Spalte", () => { diff --git a/src/plan/toWalls3d/openings.ts b/src/plan/toWalls3d/openings.ts index 29b0378d..4ce24ae2 100644 --- a/src/plan/toWalls3d/openings.ts +++ b/src/plan/toWalls3d/openings.ts @@ -575,29 +575,33 @@ function frameMeshesForOpening( // Flügel-Mittelpfosten + Kämpfer-Zeilen (Sprossen) nur bei FEINEM Detailgrad — // bei „mittel" bleibt es beim reinen Rahmen (+ Oberlicht-Kämpfer oben). if (fine) { - // Flügel-Mittelpfosten (vertikal, wingCount−1) im Sash-Bereich. - if (params.wingCount > 1 && sashTo - sashFrom > EPS) { - const cell = (sashTo - sashFrom) / params.wingCount; - for (let i = 1; i < params.wingCount; i++) { + // Senkrechte Teiler (Flügel-Mittelpfosten + Sprossen-Spalten) laufen durch; + // die waagrechten Kämpfer-Zeilen werden dazwischen unterbrochen, damit sich + // die Profile an den Kreuzungen nicht überlappen. Gleiche Lage nur einmal. + const posts: number[] = []; + const addPosts = (count: number): void => { + if (count <= 1 || sashTo - sashFrom <= EPS) return; + const cell = (sashTo - sashFrom) / count; + for (let i = 1; i < count; i++) { const center = sashFrom + i * cell; - push(center - fw / 2, center + fw / 2, sashBottom, sashTop); + if (!posts.some((c) => Math.abs(c - center) < 1e-4)) posts.push(center); } - } + }; + addPosts(params.wingCount); + addPosts(params.mullionCols); + posts.sort((x, y) => x - y); + for (const center of posts) push(center - fw / 2, center + fw / 2, sashBottom, sashTop); // Kämpfer-Zeilen (horizontal, mullionRows−1) im Sash-Bereich. if (params.mullionRows > 1 && sashTop - sashBottom > EPS) { const cell = (sashTop - sashBottom) / params.mullionRows; for (let i = 1; i < params.mullionRows; i++) { const center = sashBottom + i * cell; - push(sashFrom, sashTo, center - fw / 2, center + fw / 2); - } - } - - // Sprossen-Spalten (vertikal, mullionCols−1) im Sash-Bereich. - if (params.mullionCols > 1 && sashTo - sashFrom > EPS) { - const cell = (sashTo - sashFrom) / params.mullionCols; - for (let i = 1; i < params.mullionCols; i++) { - const center = sashFrom + i * cell; - push(center - fw / 2, center + fw / 2, sashBottom, sashTop); + let from = sashFrom; + for (const post of [...posts, sashTo + fw / 2]) { + const to = Math.min(sashTo, post - fw / 2); + if (to - from > EPS) push(from, to, center - fw / 2, center + fw / 2); + from = post + fw / 2; + } } } }