From 3f3ffadffff34f5c7ad3374f7c0ee9d443098006 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 9 Nov 2026 17:49:36 +0000 Subject: [PATCH] =?UTF-8?q?[168]=20Schichteinzug/Anschlag-Nase=20als=20Tei?= =?UTF-8?q?l=20der=20Schicht;=20Vorgabe=20bei=20Aussend=C3=A4mmung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Grundriss: Die Anschlag-Nasen (Schichtstücke vor dem Rahmen) waren eigene Flächen mit schwerer Umrisslinie und eigener Schraffur-Phase — sie gehen jetzt als Zusatzstücke in die Wand-Poché (Raster in wall_poche::adjusted_segment: Umriss nur zur Leere, keine Linie zwischen Schicht und Einzug); Band, Einzug und Nase je Schicht als EINE Fläche (i_overlay, Ecken auf die Eingabe zurückgerastet, Bogenwände polar). Schnitt: Band und Schichteinzug auch ohne Nase ein Umriss. Vorgabe (nur wo am Typ/an der Öffnung nichts gesetzt ist): in Wänden mit Aussendämmung sitzt der Rahmen in der Leibung der tragenden Schicht (bündig mit deren Aussenfläche), kein Anschlag, die Dämmung überdämmt ihn 3 cm — Grundriss, Schnitt, Ansicht, 3D, IFC. IFC: Wand mit Stücken als ein Manifold-Körper, Öffnungskörper in der Rahmenlage (schneidet die Stücke nicht weg); der IFC-Import erkennt Wände, deren Löcher schon im Körper sind. Goldens: Musterhaus komplex Grundrisse/Schnitt A (Nasen in der Schicht), Muster EG und 3D (Vorgabe: 12 Überdämmungs-Stücke). Geprüft: cargo test core + fileio, tsc, vitest (inkl. ifcopenshell), CLI-Grundriss 1:20/1:50 und Schnitt A-A als PNG vorher/nachher (Linux). Nicht in der Tauri-App/Mac. --- TODO.md | 11 + src-tauri/core/src/ifc_data.rs | 103 +++++++- src-tauri/core/src/model3d/openings.rs | 8 +- src-tauri/core/src/model3d/tests.rs | 4 + src-tauri/core/src/opening_detail.rs | 125 +++++++++- src-tauri/core/src/plan/elevation/openings.rs | 4 +- src-tauri/core/src/plan/hatch_dir_tests.rs | 4 +- src-tauri/core/src/plan/section/bands.rs | 6 +- src-tauri/core/src/plan/section/openings.rs | 2 +- src-tauri/core/src/plan/section/tests.rs | 24 +- src-tauri/core/src/plan/wall_poche.rs | 44 +++- src-tauri/core/src/plan/walls.rs | 235 +++++++++++++++--- src-tauri/fileio/src/ifc_semantic.rs | 75 +++++- src/export/openingSchedule.test.ts | 6 +- .../__golden__/komplex-grundriss-dg-50.txt | 6 +- .../__golden__/komplex-grundriss-eg-50.txt | 6 +- .../__golden__/komplex-grundriss-og-50.txt | 6 +- .../__golden__/komplex-grundriss-ug-50.txt | 6 +- .../__golden__/komplex-schnitt-schnitt-a.txt | 10 +- .../__golden__/muster-grundriss-eg-50.txt | 6 +- src/plan/__golden__/muster-model3d.txt | 14 +- src/plan/glPlan/glPlanChunks.test.ts | 2 +- src/plan/toWalls3d.test.ts | 6 +- 23 files changed, 624 insertions(+), 89 deletions(-) diff --git a/TODO.md b/TODO.md index b31bc9c1..076e94ce 100644 --- a/TODO.md +++ b/TODO.md @@ -62,6 +62,17 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `* lasen den Schraffur-Winkel um 90° verschieden (Standard 0°↔90° hin und her); jetzt alle über `hatch::build_hatch_runs` (DXF 90° − Winkel), Standard 0°, Laden stellt 90° zurück, Bogenwand-Nasen polar; Test `plan/hatch_dir_tests.rs`. Offen: render3d-Live-Schnitt und Mac nicht angesehen. · S +- ◐ **[168]** Schichteinzug/Anschlag-Nase als Teil der Schicht (9.11.). Grundriss: Nasen gehen als Zusatzstücke in die + Poché (`walls.rs` `take_noses`/`append_nose_reveals` → `wall_poche::adjusted_segment`), je Schicht EINE Fläche + (i_overlay, Ecken zurückgerastet), Umriss/Fugen aus dem Raster — keine Linie zwischen Schicht und Einzug, gleiche + Schraffur; Schnitt: Band + Einzug auch ohne Nase ein Umriss (`section/bands.rs`). Vorgabe bei Aussendämmung, wo + nichts gesetzt ist (`opening_detail::default_frame_inset`/`reveal_rules`): Rahmen in der Leibung der tragenden + Schicht, kein Anschlag, Dämmung überdämmt 3 cm — Grundriss, Schnitt, Ansicht, 3D, IFC (Wand mit Stücken als EIN + Manifold-Körper, Öffnungskörper in der Rahmenlage; Import erkennt so gelochte Wände). Tests `walls.rs` + `schichteinzug_ein_stueck_mit_der_schicht`, `opening_detail.rs` `aussendaemmung_vorgabe_rahmen_in_der_leibung`, + `ifc_data.rs` `schichteinzug_wand_als_ein_koerper`. Offen: schwarze Sammelfläche (ab 1:100) ohne Einzug/Nase wie + bisher; Fenster ohne Typ ohne Vorgabe; Aussenputz bleibt an der Rohbaukante (nur die Dämmung überdeckt); nicht in + der Tauri-App/auf dem Mac (render2d nativ, 3D) angesehen. · S - ◐ **[145]** Texte beim Zoomen synchron. Falls der Mac noch nachläuft: Raumstempel nativ zeichnen (vtext kann nur einzeilig/linksbündig, eine Schrift, kein Fett). 9.11.: `clampInside` nur noch im Kern (`grip_clamp_inside`, Fassade `clampInside` in `src/core`); die Öffnungs-Vorschau beim Setzen zeigt die geklemmte/gerückte Lage diff --git a/src-tauri/core/src/ifc_data.rs b/src-tauri/core/src/ifc_data.rs index ce23faf6..78797bf8 100644 --- a/src-tauri/core/src/ifc_data.rs +++ b/src-tauri/core/src/ifc_data.rs @@ -372,6 +372,63 @@ fn bands_match_openings(wall: &Wall, bands: &[&RWall], cutouts: &[Cutout]) -> bo true } +/// [168] Rahmenlage quer zur Wand (Versatz entlang der linken Normalen ab `wall.start`, wie +/// `cross_extent`), wenn der Schichteinzug der Öffnung Stücke in die Öffnung setzt; sonst `None`. +fn reveal_frame_slice(p: &Project, wall: &Wall, o: &Opening) -> Option<(f64, f64)> { + let r = crate::opening_detail::opening_reveal(p, wall, o)?; + if r.sides.iter().flatten().all(|a| a.pieces.is_empty()) { + return None; + } + let total: f64 = r.thick.iter().sum(); + let (lo, hi) = crate::opening_detail::frame_of(p, o)?.range(total); + let face = crate::joins::reference_offset(model3d::wall_reference(wall), total) - total / 2.0; + (hi - lo > 1e-4).then_some((face + lo, face + hi)) +} + +/// [168] Bänder einer Wand als EIN Körper (Manifold, exakt): je Band der volle Quader (Enden an den +/// Schnittlinien wie das 3D) minus die Löcher, dann alle vereinigt — IFC-Koordinaten (x, y, z − `base`). +/// `None` bei Bändern mit schräger Oberkante oder wenn Manifold ablehnt (dann bleibt das Schalen-Netz). +fn union_bands(bands: &[&RWall], base: f64) -> Option<(Vec, Vec)> { + use crate::solid_bool::{Mesh, Solid}; + let solid = |w: &CutWall, shift: Option<&RWall>| -> Option { + let mut cut = wall_cut_mesh_checked(w); + if let Some(b) = shift { + crate::mesh_data::shift_cut_ends(&mut cut, b); + } + let positions: Vec = cut.chunks_exact(3).flat_map(|c| [c[0], c[2], c[1] - base]).collect(); + let n = (positions.len() / 3) as u32; + Solid::new(&Mesh { positions, indices: (0..n).collect() }).ok() + }; + let mut acc: Option = None; + for b in bands { + if b.top_plane.is_some() || b.top_drop.is_some_and(|d| d[0].abs() > 1e-9 || d[1].abs() > 1e-9) { + return None; + } + let mut m = solid(&CutWall { start: b.start, end: b.end, thickness: b.thickness, base_elevation: b.base_elevation, height: b.height, holes: vec![] }, Some(b))?; + let (dx, dy) = (b.end[0] - b.start[0], b.end[1] - b.start[1]); + let len = hypot2(dx, dy); + if !(len > 1e-9) { + return None; + } + let (ux, uy) = (dx / len, dy / len); + for h in b.holes.as_deref().unwrap_or(&[]) { + let at = |d: f64| [b.start[0] + ux * d, b.start[1] + uy * d]; + // Bündig mit Band-UK/-OK (Tür): über die Fläche hinaus, keine deckungsgleichen Flächen. + let (z0, z1) = (b.base_elevation, b.base_elevation + b.height); + let lo = if h.z_bottom <= z0 + 1e-6 { z0 - 0.1 } else { h.z_bottom }; + let hi = if h.z_top >= z1 - 1e-6 { z1 + 0.1 } else { h.z_top }; + let hole = solid(&CutWall { start: at(h.from), end: at(h.to), thickness: b.thickness + 0.1, base_elevation: lo, height: hi - lo, holes: vec![] }, None)?; + m = m.difference(&hole).ok()?; + } + acc = Some(match acc { + None => m, + Some(a) => a.union(&m).ok()?, + }); + } + let m = acc?.to_mesh(); + (!m.indices.is_empty()).then_some((m.positions, m.indices)) +} + /// Ausdehnung aller Bänder quer zur Wandachse (entlang der linken Normalen ab `wall.start`). fn cross_extent(wall: &Wall, bands: &[&RWall]) -> (f64, f64) { let n = left_normal(normalize(sub(wall.end, wall.start))); @@ -490,7 +547,7 @@ fn fill_params(p: &Project, o: &Opening) -> FillParams { let wt = if is_door { None } else { p.window_type(o) }; FillParams { frame_depth: dt.map_or(wt.and_then(|t| t.frame_depth), |t| t.frame_depth), - inset: dt.map_or(wt.and_then(|t| t.inset_from_face), |t| t.inset_from_face), + inset: dt.map_or(wt.and_then(|t| t.inset_from_face), |t| t.inset_from_face).or_else(|| crate::opening_detail::default_frame_inset(p, o)), inset_outside: match (dt, wt) { (Some(t), _) => matches!(t.inset_face, None | Some(DoorTypeInsetFace::Aussen)), (None, Some(t)) => matches!(t.inset_face, None | Some(WindowTypeInsetFace::Aussen)), @@ -980,6 +1037,15 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result } } let arc = crate::wall_arc::WallArc::of_wall(wall); + // [168] Schichteinzug-Stücke (Überdämmung, Leibungsputz) berühren die Bänder nur teilweise: dann die + // Bänder zu EINEM Körper vereinigen (Manifold, exakt) — mehrere sich teilweise berührende Schalen + // verrechnet ein IFC-Leser beim Abzug der Öffnungskörper (ifcopenshell: Volumen falsch). + let pieces = arc.is_none() && openings.iter().any(|o| o.host_wall_id == wall.id && reveal_frame_slice(&p, wall, o).is_some()); + if pieces { + if let Some((up, ui)) = union_bands(bands, base) { + (positions, indices) = (up, ui); + } + } // Formöffnungen ([G3]): Füllkörper zwischen Rechteck-Loch und Umriss gehören zur Wand (nicht bei // Bogenwänden: dort bleibt das Rechteck-Loch). for &(k, c) in cutouts_by_wall.get(&wall.id).map_or(&[][..], |v| v.as_slice()).iter().filter(|_| arc.is_none()) { @@ -1119,7 +1185,13 @@ pub fn ifc_export_data(src: &Project, opt: &IfcOptions) -> Result let oid = f.str(&o.id); let lab = f.str(&label); f.nums(&[REC_OPENING, a, structure, oid, if is_door { 1.0 } else { 0.0 }, lab]); - let (vlo, vhi) = (host.0 - sag - OPENING_OVERSHOOT, host.1 + sag + OPENING_OVERSHOOT); + // [168] Schichteinzug mit Stücken in der Öffnung (Überdämmung, Leibungsputz): das Wandnetz trägt + // die Löcher schon; der Öffnungskörper bleibt in der Rahmenlage (frei von Stücken), sonst schnitte + // er die Stücke wieder aus der Wand. + let (vlo, vhi) = match reveal_frame_slice(&p, wall, o).filter(|_| chord.is_none()) { + Some(s) => s, + None => (host.0 - sag - OPENING_OVERSHOOT, host.1 + sag + OPENING_OVERSHOOT), + }; match &radial { Some(q) => w_pts(&mut f, q), None => w_pts(&mut f, &axis_rect(wall, c.from + shrink, c.to - shrink, vlo, vhi)), @@ -1838,4 +1910,31 @@ mod tests { assert_eq!(layer_classification(&p, ""), None); assert_eq!(layer_classification(&p, " "), None); } + + /// [168] Wand mit Schichteinzug-Stücken (Beispiel W1: Vorgabe bei Aussendämmung, Dämmung überdeckt + /// den Rahmen): die Bänder als EIN geschlossener Körper mit dem Volumen der 3D-Bänder; der + /// Öffnungskörper bleibt in der Rahmenlage (schneidet die Stücke nicht weg). + #[test] + fn schichteinzug_wand_als_ein_koerper() { + let p = sample(); + let all = model3d::emit_walls(&p, true).unwrap(); + let bands: Vec<&RWall> = all.iter().filter(|b| b.wall_id == "W1").collect(); + let shells: f64 = bands + .iter() + .map(|b| { + let cut = wall_cut_mesh_checked(&CutWall { start: b.start, end: b.end, thickness: b.thickness, base_elevation: b.base_elevation, height: b.height, holes: b.holes.as_deref().unwrap_or(&[]).iter().map(|h| [h.from, h.to, h.z_bottom, h.z_top]).collect() }); + let n = (cut.len() / 3) as u32; + crate::export_flat::mesh_volume(&cut, &(0..n).collect::>()).abs() + }) + .sum(); + assert!(bands.iter().any(|b| b.holes.as_ref().is_none_or(|h| h.is_empty()) && b.thickness < 0.2), "Stücke fehlen"); + let (pos, idx) = union_bands(&bands, 0.0).expect("ein Körper"); + assert!(is_watertight(&pos, &idx, 1e-6)); + let v = crate::export_flat::mesh_volume(&pos, &idx); + assert!((v - shells).abs() < 1e-6, "{v} vs {shells}"); + let w1 = p.walls.iter().find(|w| w.id == "W1").unwrap(); + let o = p.openings.as_ref().unwrap().iter().find(|o| o.host_wall_id == "W1" && o.kind == ElementKind::Window).unwrap(); + let (lo, hi) = reveal_frame_slice(&p, w1, o).expect("Stücke ⇒ Rahmenlage"); + assert!(hi > lo); + } } diff --git a/src-tauri/core/src/model3d/openings.rs b/src-tauri/core/src/model3d/openings.rs index 5addf85b..321d8823 100644 --- a/src-tauri/core/src/model3d/openings.rs +++ b/src-tauri/core/src/model3d/openings.rs @@ -78,7 +78,7 @@ fn write_opening(w: &mut FlatWriter, p: &Project, op: &Opening) { Some(WindowTypeInsetFace::Mitte) => 2.0, _ => 0.0, }; - write_common(w, wt.frame_depth, wt.inset_from_face, side, wt.frame_corner_join, wt.frame_width, wt.transom_height, wt.rebate_depth); + write_common(w, wt.frame_depth, wt.inset_from_face.or_else(|| crate::opening_detail::default_frame_inset(p, op)), side, wt.frame_corner_join, wt.frame_width, wt.transom_height, wt.rebate_depth); let sturz = wt.shading.as_ref().is_some_and(|s| s.mount == Some(WindowShadingMount::Sturz)); let rails = sturz && wt.shading.as_ref().is_some_and(|s| s.kind != WindowShadingKind::Markise); let shading = wt.shading.as_ref().filter(|s| s.create).map(|s| &s.r#box); @@ -137,7 +137,7 @@ fn write_opening(w: &mut FlatWriter, p: &Project, op: &Opening) { Some(DoorTypeInsetFace::Mitte) => 2.0, _ => 0.0, }; - write_common(w, dt.frame_depth, dt.inset_from_face, side, dt.frame_corner_join, dt.frame_width, dt.transom_height, dt.rebate_depth); + write_common(w, dt.frame_depth, dt.inset_from_face.or_else(|| crate::opening_detail::default_frame_inset(p, op)), side, dt.frame_corner_join, dt.frame_width, dt.transom_height, dt.rebate_depth); w.nums(&[ flag(dt.threshold == Some(true)), dt.leaf_count, @@ -432,9 +432,9 @@ pub(crate) fn shaped_wall_opening_meshes(p: &Project, wall: &Wall, wr: &WallRef, let mut out: Vec = shaped_wall_fill(p, wall, op, wr.total, w, h).into_iter().map(|(q, n0, n1, rgb)| box_mesh(os::quad_box(&q, n0, n1, &map), rgb)).collect(); let door = op.kind == ElementKind::Door; let ty = if door { - p.door_type(op).map(|t| (t.frame_depth, t.inset_from_face, t.inset_face == Some(DoorTypeInsetFace::Innen), t.inset_face == Some(DoorTypeInsetFace::Mitte), t.frame_width)) + p.door_type(op).map(|t| (t.frame_depth, t.inset_from_face.or_else(|| crate::opening_detail::default_frame_inset(p, op)), t.inset_face == Some(DoorTypeInsetFace::Innen), t.inset_face == Some(DoorTypeInsetFace::Mitte), t.frame_width)) } else { - p.window_type(op).map(|t| (t.frame_depth, t.inset_from_face, t.inset_face == Some(WindowTypeInsetFace::Innen), t.inset_face == Some(WindowTypeInsetFace::Mitte), t.frame_width)) + p.window_type(op).map(|t| (t.frame_depth, t.inset_from_face.or_else(|| crate::opening_detail::default_frame_inset(p, op)), t.inset_face == Some(WindowTypeInsetFace::Innen), t.inset_face == Some(WindowTypeInsetFace::Mitte), t.frame_width)) }; let glass = PART_RGB[0]; let Some((fd, inset_face, inner, mid, fw)) = ty else { diff --git a/src-tauri/core/src/model3d/tests.rs b/src-tauri/core/src/model3d/tests.rs index 03981326..af1c8755 100644 --- a/src-tauri/core/src/model3d/tests.rs +++ b/src-tauri/core/src/model3d/tests.rs @@ -242,6 +242,10 @@ fn sample() -> Project { #[test] fn formoeffnung_fuellkoerper_rahmen_glas() { let mut p = sample(); + // Ohne die [168]-Vorgabe (Dämmung überdeckt den Rahmen): Fenster ausdrücklich aussen bündig. + for t in p.window_types.iter_mut().flatten() { + t.inset_face = Some(WindowTypeInsetFace::Aussen); + } let plain = emit_opening_meshes(&p, 2.0).len(); for o in p.openings.iter_mut().flatten().filter(|o| o.id == "O1") { o.shape = Some(OpeningShape::Rundbogen); diff --git a/src-tauri/core/src/opening_detail.rs b/src-tauri/core/src/opening_detail.rs index 8961326d..5b136a88 100644 --- a/src-tauri/core/src/opening_detail.rs +++ b/src-tauri/core/src/opening_detail.rs @@ -164,7 +164,7 @@ pub fn frame_of(p: &Project, o: &Opening) -> Option { Some(Frame { sides: Sides::with(d.and_then(|d| d.frame_sides.as_ref()), Sides::all(width)), depth: fin(d.and_then(|d| d.frame_depth)).or(fin(depth)).unwrap_or(nan), - inset: fin(d.and_then(|d| d.inset_from_face)).or(fin(inset)).unwrap_or(0.0).max(0.0), + inset: fin(d.and_then(|d| d.inset_from_face)).or(fin(inset)).or_else(|| default_frame_inset(p, o)).unwrap_or(0.0).max(0.0), face, sash_width: num(|d| d.sash_width), sash_depth: num(|d| d.sash_depth), @@ -204,15 +204,57 @@ impl Frame { } } +// ── Vorgabe bei Aussendämmung ([168]) ─────────────────────────────────────── + +/// Aussendämmung einer Wand: Dämmschicht(en) aussen vor der ersten tragenden Schicht (Funktion aus +/// `layer_function`: eigenes Feld oder Baustoff). Ergebnis: Lage der Aussenfläche der tragenden +/// Schicht (ab Wand-Aussenfläche) und die Indizes der Dämmschichten davor; `None` ohne solche. +pub fn external_insulation(p: &Project, w: &Wall) -> Option<(f64, Vec)> { + let wt = p.wall_type(w)?; + let f = |l: &Layer| crate::plan::overrides::layer_function(p, l); + let s = wt.layers.iter().position(|l| f(l) == Some(LayerFunction::Structure))?; + let ins: Vec = (0..s).filter(|&i| f(&wt.layers[i]) == Some(LayerFunction::Insulation) && wt.layers[i].thickness > EPS).collect(); + if ins.is_empty() { + return None; + } + Some((wt.layers[..s].iter().map(|l| l.thickness.max(0.0)).sum(), ins)) +} + +fn host_wall<'a>(p: &'a Project, o: &Opening) -> Option<&'a Wall> { + p.walls.iter().find(|w| w.id == o.host_wall_id) +} + +/// [168] Vorgabe der Rahmenlage, wo am Typ und an der Öffnung nichts gesetzt ist (weder Einzug noch +/// Bezugsfläche, auch nicht im Rahmen-Detail): in einer Wand mit Aussendämmung sitzt der Rahmen in der +/// Leibung der tragenden Schicht, bündig mit deren Aussenfläche — Mauerwerk/Beton stösst stumpf an den +/// Rahmen (kein Anschlag), nur die Dämmung davor überdeckt ihn (`reveal_rules`). Gibt den Einzug ab +/// der Aussenfläche (Bezugsfläche aussen) zurück, sonst `None` (bisherige Vorgabe: aussen bündig). +pub fn default_frame_inset(p: &Project, o: &Opening) -> Option { + let (inset, face, detail) = if o.kind == ElementKind::Door { + let t = p.door_type(o)?; + (t.inset_from_face, t.inset_face.is_some(), t.frame_detail.as_ref()) + } else { + let t = p.window_type(o)?; + (t.inset_from_face, t.inset_face.is_some(), t.frame_detail.as_ref()) + }; + let set = |d: Option<&FrameDetail>| d.is_some_and(|d| d.inset_from_face.is_some() || d.inset_face.is_some()); + if inset.is_some() || face || set(detail) || set(o.frame_detail.as_ref()) { + return None; + } + external_insulation(p, host_wall(p, o)?).map(|(face, _)| face) +} + // ── Schichteinzug ([106]) ─────────────────────────────────────────────────── -/// Schichteinzug-Regeln einer Öffnung: Öffnung > Typ > veraltetes `innerLayerRecess`. +/// Schichteinzug-Regeln einer Öffnung: Öffnung > Typ > veraltetes `innerLayerRecess` > [168] Vorgabe +/// bei Aussendämmung (Dämmung vor der tragenden Schicht überdeckt den Rahmen um `DEFAULT_OVERLAP`). pub fn reveal_rules(p: &Project, o: &Opening) -> Vec { if let Some(r) = o.layer_reveals.as_ref() { return r.clone(); } if o.kind == ElementKind::Door { - return p.door_type(o).and_then(|t| t.layer_reveals.clone()).unwrap_or_default(); + let Some(t) = p.door_type(o) else { return Vec::new() }; + return t.layer_reveals.clone().unwrap_or_else(|| default_reveals(p, o)); } let Some(t) = p.window_type(o) else { return Vec::new() }; if let Some(r) = t.layer_reveals.as_ref() { @@ -221,7 +263,17 @@ pub fn reveal_rules(p: &Project, o: &Opening) -> Vec { if t.inner_layer_recess == Some(true) { return vec![LayerReveal { layer: -1.0, mode: RevealMode::Zurueck, ..Default::default() }]; } - Vec::new() + default_reveals(p, o) +} + +/// [168] Vorgabe-Schichteinzug: nur mit der Vorgabe-Rahmenlage (`default_frame_inset`) — die +/// Aussendämmung überdämmt den Rahmen; Lage/Anschlag eigens gesetzt ⇒ keine Vorgabe. +fn default_reveals(p: &Project, o: &Opening) -> Vec { + if default_frame_inset(p, o).is_none() { + return Vec::new(); + } + let Some((_, ins)) = host_wall(p, o).and_then(|w| external_insulation(p, w)) else { return Vec::new() }; + ins.into_iter().map(|i| LayerReveal { layer: i as f64, mode: RevealMode::Ueberdaemmt, ..Default::default() }).collect() } /// Anschluss EINER Schicht an EINER Seite: Rücksprung (`shift` ≥ 0, die Schicht endet um so viel @@ -817,6 +869,71 @@ mod tests { assert_eq!(plan_reveal_block(&p0, &p0.walls[0], &[&p0.openings.as_ref().unwrap()[0]]), vec![0.0]); } + /// [168] Wand mit Aussendämmung aus Standard-Baustoffen (Putz 2 · EPS 18 · Backstein 17.5 · Putz 1.5 cm, + /// Schichtfunktion aus dem Baustoff), Fenster 1.0..2.2 eines Typs `t`. + fn aussendaemmung_mit(t: WindowType) -> Project { + let mut p = Project::default(); + for c in crate::standards::components() { + p.components.push(serde_json::from_value(c).unwrap()); + } + let wt = crate::standards::wall_types().into_iter().find(|t| t["id"] == "std-wt-aw-kompakt").unwrap(); + p.wall_types.push(serde_json::from_value(wt).unwrap()); + p.drawing_levels.push(DrawingLevel { id: "eg".into(), kind: DrawingLevelKind::Floor, floor_height: Some(2.6), ..Default::default() }); + p.walls.push(Wall { id: "w".into(), floor_id: "eg".into(), wall_type_id: "std-wt-aw-kompakt".into(), start: Vec2 { x: 0.0, y: 0.0 }, end: Vec2 { x: 5.0, y: 0.0 }, height: 2.6, ..Default::default() }); + p.window_types = Some(vec![WindowType { id: "t".into(), ..t }]); + p.openings = Some(vec![Opening { id: "o".into(), host_wall_id: "w".into(), kind: ElementKind::Window, type_id: Some("t".into()), position: 1.0, width: 1.2, height: 1.4, sill_height: 0.9, ..Default::default() }]); + p + } + + /// [168] Vorgabe bei Aussendämmung (nichts gesetzt): Rahmen in der Leibung der tragenden Schicht, + /// bündig mit deren Aussenfläche (Einzug 0.20 = Putz + EPS), kein Anschlag, nur die Dämmung + /// überdeckt den Rahmen (3 cm). 3D: Rahmen ∩ Mauerwerk = 0 — der Rahmen liegt quer ganz in der + /// Backstein-Schicht und längs/vertikal ganz in deren (unverengtem) Loch. Gesetzte Werte bleiben. + #[test] + fn aussendaemmung_vorgabe_rahmen_in_der_leibung() { + let p = aussendaemmung_mit(WindowType { frame_depth: Some(0.07), ..Default::default() }); + let o = p.openings.as_ref().unwrap()[0].clone(); + assert_eq!(external_insulation(&p, &p.walls[0]).map(|e| e.1), Some(vec![1])); + let f = frame_of(&p, &o).unwrap(); + assert!((f.inset - 0.2).abs() < 1e-12 && f.face == Face::Aussen && f.rebate == Sides::default(), "{f:?}"); + let r = reveal_rules(&p, &o); + assert_eq!(r.len(), 1); + assert_eq!((r[0].layer, r[0].mode), (1.0, RevealMode::Ueberdaemmt)); + // Zusatzstück nur in der Dämmung (vor dem Rahmen), keins im Backstein. + let rv = opening_reveal(&p, &p.walls[0], &o).unwrap(); + for side in &rv.sides { + assert!(side.iter().all(|a| a.layer == 1), "{side:?}"); + } + // 3D: Backstein-Band (17.5 cm) mit Loch = Öffnung; Rahmen darin. + let walls = crate::model3d::emit_walls(&p, true).unwrap(); + let brick = walls.iter().find(|w| (w.thickness - 0.175).abs() < 1e-9 && w.holes.as_ref().is_some_and(|h| !h.is_empty())).expect("Backstein mit Loch"); + let hole = &brick.holes.as_ref().unwrap()[0]; + assert!((hole.from - 1.0).abs() < 1e-9 && (hole.to - 2.2).abs() < 1e-9, "Mauerwerk ohne Anschlag: {hole:?}"); + let (b0, b1) = (brick.start[1] - 0.0875, brick.start[1] + 0.0875); + let frames: Vec<_> = crate::model3d::emit_opening_meshes(&p, 1.0).into_iter().filter(|m| m.color == crate::model3d::PART_RGB[1]).collect(); + assert!(!frames.is_empty()); + for m in &frames { + for c in m.positions.chunks_exact(3) { + assert!(c[1] > b0 - 1e-6 && c[1] < b1 + 1e-6, "Rahmen quer ausserhalb der Backstein-Leibung: {} ∉ [{b0}, {b1}]", c[1]); + assert!(c[0] > hole.from - 1e-6 && c[0] < hole.to + 1e-6, "Rahmen längs im Mauerwerk: {}", c[0]); + } + } + // Ausdrücklich gesetzt: Lage (auch nur die Bezugsfläche), Schichteinzug — keine Vorgabe. + let p1 = aussendaemmung_mit(WindowType { inset_from_face: Some(0.18), ..Default::default() }); + assert!((frame_of(&p1, &p1.openings.as_ref().unwrap()[0]).unwrap().inset - 0.18).abs() < 1e-12); + assert!(reveal_rules(&p1, &p1.openings.as_ref().unwrap()[0]).is_empty()); + let p2 = aussendaemmung_mit(WindowType { inset_face: Some(WindowTypeInsetFace::Aussen), ..Default::default() }); + assert_eq!(frame_of(&p2, &p2.openings.as_ref().unwrap()[0]).unwrap().inset, 0.0); + let p3 = aussendaemmung_mit(WindowType { layer_reveals: Some(vec![]), ..Default::default() }); + assert!(reveal_rules(&p3, &p3.openings.as_ref().unwrap()[0]).is_empty()); + assert!((frame_of(&p3, &p3.openings.as_ref().unwrap()[0]).unwrap().inset - 0.2).abs() < 1e-12); + // Wand ohne Aussendämmung (Backstein verputzt): alte Vorgabe, aussen bündig. + let mut p4 = aussendaemmung_mit(WindowType::default()); + p4.wall_types[0].layers.remove(1); + assert_eq!(frame_of(&p4, &p4.openings.as_ref().unwrap()[0]).unwrap().inset, 0.0); + assert!(reveal_rules(&p4, &p4.openings.as_ref().unwrap()[0]).is_empty()); + } + /// [T2]/[106] Schichteinzug in der Bogenwand: Zusatzstücke im 3D (auf der Sehne über die Öffnung /// samt Einzug), Grundriss-Block auf der Abwicklung, Öffnungsteile auf derselben Sehne. #[test] diff --git a/src-tauri/core/src/plan/elevation/openings.rs b/src-tauri/core/src/plan/elevation/openings.rs index 42be7c0c..094dc919 100644 --- a/src-tauri/core/src/plan/elevation/openings.rs +++ b/src-tauri/core/src/plan/elevation/openings.rs @@ -119,8 +119,8 @@ pub(super) fn collect_openings(p: &Project, frame: &[f64; 9]) -> Vec 0 oder mittig), sonst gibt es keine Wandnase. match (dt, wt) { - (Some(t), _) if t.inset_face == Some(DoorTypeInsetFace::Mitte) || t.inset_from_face.unwrap_or(0.0) > 1e-4 => t.rebate_depth.unwrap_or(0.0), - (_, Some(t)) if t.inset_face == Some(WindowTypeInsetFace::Mitte) || t.inset_from_face.unwrap_or(0.0) > 1e-4 => t.rebate_depth.unwrap_or(0.0), + (Some(t), _) if t.inset_face == Some(DoorTypeInsetFace::Mitte) || t.inset_from_face.or_else(|| crate::opening_detail::default_frame_inset(p, op)).unwrap_or(0.0) > 1e-4 => t.rebate_depth.unwrap_or(0.0), + (_, Some(t)) if t.inset_face == Some(WindowTypeInsetFace::Mitte) || t.inset_from_face.or_else(|| crate::opening_detail::default_frame_inset(p, op)).unwrap_or(0.0) > 1e-4 => t.rebate_depth.unwrap_or(0.0), _ => 0.0, }, if (door && dt.and_then(|t| t.inset_face) == Some(DoorTypeInsetFace::Innen)) || (!door && wt.and_then(|t| t.inset_face) == Some(WindowTypeInsetFace::Innen)) { -1.0 } else { 1.0 }, diff --git a/src-tauri/core/src/plan/hatch_dir_tests.rs b/src-tauri/core/src/plan/hatch_dir_tests.rs index d38f4780..12a354b8 100644 --- a/src-tauri/core/src/plan/hatch_dir_tests.rs +++ b/src-tauri/core/src/plan/hatch_dir_tests.rs @@ -299,7 +299,7 @@ fn daemm_striche_quer_zur_wand_im_grundriss() { } } // Fenster mit Anschlag: die Wandnasen (Schichtstücke in der Leibung) schraffiert wie ihre Wand, auch in - // der Bogenwand (radial). + // der Bogenwand (radial) — [168] als Teil der Schicht-Fläche (kein eigenes Öffnungs-Stück mehr). for (what, arc) in [("Fenster in schräger Wand", false), ("Fenster in Bogenwand", true)] { let mut p = base(); if arc { @@ -309,7 +309,7 @@ fn daemm_striche_quer_zur_wand_im_grundriss() { } add_window(&mut p, "W1", 1.8); for scale in [50.0, 20.0] { - assert!(plan_case(&p, scale, what) > 0, "{what}: keine Nasen-Stücke"); + assert_eq!(plan_case(&p, scale, what), 0, "{what}: Nase als eigenes Stück"); } } } diff --git a/src-tauri/core/src/plan/section/bands.rs b/src-tauri/core/src/plan/section/bands.rs index 19f28e51..ac0734d8 100644 --- a/src-tauri/core/src/plan/section/bands.rs +++ b/src-tauri/core/src/plan/section/bands.rs @@ -406,13 +406,13 @@ pub(super) fn split_wall_layers(cp: &Cut, p: &Project, layers: &[Layer], owner: } } let rect_pts = |r: [f64; 4]| vec![[r[0], r[3]], [r[1], r[3]], [r[1], r[2]], [r[0], r[2]]]; - if nibs.is_empty() { + if nibs.is_empty() && pieces.is_empty() { if vt - vb > 1e-6 { out.push(mk(rect_pts([u_left, u_right, vb, vt]))); } - out.extend(pieces.into_iter().map(|r| mk(rect_pts(r)))); } else { - // Band, Nase(n) und Zusatzstücke der Schicht als EIN Umriss (keine Fuge an der Nase). + // Band, Nase(n) und Zusatzstücke der Schicht als EIN Umriss (keine Fuge an der Nase, [168] + // auch ohne Nase keine am Schichteinzug). let mut rects = nibs; if vt - vb > 1e-6 { rects.push([u_left, u_right, vb, vt]); diff --git a/src-tauri/core/src/plan/section/openings.rs b/src-tauri/core/src/plan/section/openings.rs index f479147b..993cc669 100644 --- a/src-tauri/core/src/plan/section/openings.rs +++ b/src-tauri/core/src/plan/section/openings.rs @@ -117,7 +117,7 @@ fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection) -> Result sashes: sashes_of_window_type(t), frame_width: t.frame_width.unwrap_or(DEFAULT_FRAME_WIDTH), frame_depth: t.frame_depth.unwrap_or(f64::NAN), - inset_from_face: t.inset_from_face.unwrap_or(f64::NAN), + inset_from_face: t.inset_from_face.or_else(|| crate::opening_detail::default_frame_inset(p, o)).unwrap_or(f64::NAN), inset_inner: t.inset_face == Some(WindowTypeInsetFace::Innen), inset_mid: t.inset_face == Some(WindowTypeInsetFace::Mitte), frame_width_end: f64::NAN, diff --git a/src-tauri/core/src/plan/section/tests.rs b/src-tauri/core/src/plan/section/tests.rs index a493cb2f..f9d24892 100644 --- a/src-tauri/core/src/plan/section/tests.rs +++ b/src-tauri/core/src/plan/section/tests.rs @@ -6,6 +6,16 @@ fn sample() -> Project { serde_json::from_str(include_str!("../../../tests/fixtures/sample_project.json")).unwrap() } +/// Beispiel mit ausdrücklich aussen bündigen Fenstern (ohne die [168]-Vorgabe bei Aussendämmung: +/// Rahmen in der Leibung, Dämmung überdeckt ihn). +fn sample_flush() -> Project { + let mut p = sample(); + for t in p.window_types.iter_mut().flatten() { + t.inset_face = Some(WindowTypeInsetFace::Aussen); + } + p +} + fn level(p: &Project, id: &str) -> LevelSpec { let l = p.drawing_levels.iter().find(|l| l.id == id).unwrap(); LevelSpec::from_json(&serde_json::to_value(l).unwrap()) @@ -446,7 +456,7 @@ fn sturz_baenke_und_storenkasten_im_schnitt() { /// Bands (ein Umriss, keine Fuge), nicht als eigenes Öffnungs-Stück. Ohne Anschlag bleibt das Loch glatt. #[test] fn anschlag_im_schnitt_sturz_nase_und_bruestung() { - let mut p = sample(); + let mut p = sample_flush(); let o1 = p.openings.as_deref().unwrap().iter().find(|o| o.id == "O1").unwrap().clone(); let w1 = p.walls.iter().find(|w| w.id == "W1").unwrap().clone(); let (u, n) = axis_frame(&w1); @@ -514,12 +524,20 @@ fn anschlag_im_schnitt_sturz_nase_und_bruestung() { } let without = section_opening_primitives(&p, &l, &Visibility::default()).unwrap().len(); assert_eq!(with, without); + // [168] Ohne Anschlag (keine Nase): der Schichteinzug (Dämmung überdämmt 3 cm) ist trotzdem Teil des + // Schicht-Bands — eine Fläche, kein eigens umrandetes Stück unter dem Sturz. + for o in p.openings.iter_mut().flatten().filter(|o| o.id == "O1") { + o.layer_reveals = Some(reveal(0.03)); + } + let (h, s, k) = edges(&p, "insulation"); + assert!((h - (zt - 0.03)).abs() < 1e-6 && (s - (zb + 0.03)).abs() < 1e-6, "{h} {s}"); + assert_eq!(k, count["insulation"], "Einzug gehört zum Band"); } /// [G3] Rundbogen-Fenster: an der Schnittstelle reicht die Wand bis an den Bogen, Rahmen/Glas folgen. #[test] fn rundbogen_im_schnitt() { - let mut p = sample(); + let mut p = sample_flush(); let o1 = p.openings.as_deref().unwrap().iter().find(|o| o.id == "O1").unwrap().clone(); let w1 = p.walls.iter().find(|w| w.id == o1.host_wall_id).unwrap().clone(); let (u, n) = axis_frame(&w1); @@ -547,7 +565,7 @@ fn rundbogen_im_schnitt() { /// am Sturz (Sehne zwischen den Laibungen). #[test] fn rundbogen_und_einzug_in_bogenwand() { - let mut p = sample(); + let mut p = sample_flush(); p.walls.iter_mut().find(|w| w.id == "W1").unwrap().bulge = Some(-0.3); let o1 = p.openings.as_deref().unwrap().iter().find(|o| o.id == "O1").unwrap().clone(); let w1 = p.walls.iter().find(|w| w.id == "W1").unwrap().clone(); diff --git a/src-tauri/core/src/plan/wall_poche.rs b/src-tauri/core/src/plan/wall_poche.rs index 5420fe8a..62b24f1f 100644 --- a/src-tauri/core/src/plan/wall_poche.rs +++ b/src-tauri/core/src/plan/wall_poche.rs @@ -765,6 +765,9 @@ fn adjusted_segment(o: &mut Out, g: &Seg, thick: &[f64], off0: f64, layer_cuts: let x_lo = if cutouts.iter().any(|c| c.lo() < s - CUTOUT_EPS) { ends_at(g.sc, s, false) } else { s }; let x_hi = if cutouts.iter().any(|c| c.hi() > e + CUTOUT_EPS) { ends_at(g.ec, e, true) } else { e }; let mut rects: Vec<(f64, f64, f64, f64, usize)> = Vec::new(); + // [168] Flächen je Schicht (Band-Stücke, Zusatzstücke, Anschlag-Nasen) — am Ende je Schicht vereinigt. + let mut fills: Vec<(usize, Vec)> = Vec::new(); + let mut side_lines: Vec<(usize, V, V)> = Vec::new(); for li in 0..n_layers { let (mut a, mut b) = (x_lo, x_hi); for ad in adj.iter().filter(|ad| ad.layer == li) { @@ -782,7 +785,7 @@ fn adjusted_segment(o: &mut Out, g: &Seg, thick: &[f64], off0: f64, layer_cuts: for (pa, pb) in subtract_intervals(a, b, &holes) { let bsc = if pa <= s + CUTOUT_EPS { start_cut } else { None }; let bec = if pb >= e - CUTOUT_EPS { end_cut } else { None }; - o.polygon(ART_BAND, li, band_join_edges, &clipped_band(axis_pt(pa), axis_pt(pb), lo, hi, bsc, bec)); + fills.push((li, clipped_band(axis_pt(pa), axis_pt(pb), lo, hi, bsc, bec).to_vec())); rects.push((pa, pb, lo, hi, li)); } } @@ -796,10 +799,10 @@ fn adjusted_segment(o: &mut Out, g: &Seg, thick: &[f64], off0: f64, layer_cuts: line_intersect(pt, u_seg, cut.point, cut.dir).unwrap_or(pt) }; if let Some(c) = side_start { - o.line(LINE_JOINT_L, li, side_point(g.p1, lo, c), side_point(g.p1, hi, c)); + side_lines.push((li, side_point(g.p1, lo, c), side_point(g.p1, hi, c))); } if let Some(c) = side_end { - o.line(LINE_JOINT_L, li, side_point(g.p2, lo, c), side_point(g.p2, hi, c)); + side_lines.push((li, side_point(g.p2, lo, c), side_point(g.p2, hi, c))); } } for ad in adj { @@ -809,10 +812,43 @@ fn adjusted_segment(o: &mut Out, g: &Seg, thick: &[f64], off0: f64, layer_cuts: if x1 - x0 <= CUTOUT_EPS || y1 - y0 <= CUTOUT_EPS { continue; } - o.polygon(ART_BAND, ad.layer, &[], &clipped_band(axis_pt(x0), axis_pt(x1), y0, y1, None, None)); + fills.push((ad.layer, clipped_band(axis_pt(x0), axis_pt(x1), y0, y1, None, None).to_vec())); rects.push((x0, x1, y0, y1, ad.layer)); } } + // [168] Je Schicht EINE Fläche aus Band, Einzug und Nase (i_overlay): Füllung und Schraffur laufen + // durch, wie in der Schicht selbst. Nur Einzelringe; mit Loch (kommt hier nicht vor) die Stücke. + for li in 0..n_layers { + let group: Vec<&Vec> = fills.iter().filter(|f| f.0 == li).map(|f| &f.1).collect(); + if group.len() > 1 { + let polys: Vec = group.iter().map(|r| vec![r.iter().map(|p| [p.x, p.y]).collect()]).collect(); + let merged = crate::polygon_bool::union(&polys); + if !merged.is_empty() && merged.iter().all(|m| m.len() == 1) { + // i_overlay rechnet auf einem Ganzzahlraster: Ecken auf die Eingabe zurückrasten (die + // Bogenwand biegt nur Kanten mit exakt gleichem Querversatz, `Unroll::is_arc_edge`). + let inp: Vec = group.iter().flat_map(|r| r.iter().copied()).collect(); + let snap1 = |x: f64, pick: fn(&V) -> f64| inp.iter().map(pick).filter(|c| (c - x).abs() < 1e-6).min_by(|a, b| (a - x).abs().total_cmp(&(b - x).abs())).unwrap_or(x); + let snap = |q: &[f64; 2]| -> V { + let p = v(q[0], q[1]); + match inp.iter().filter(|r| (r.x - p.x).hypot(r.y - p.y) < 1e-6).min_by(|a, b| (a.x - p.x).hypot(a.y - p.y).total_cmp(&(b.x - p.x).hypot(b.y - p.y))) { + Some(r) => *r, + None => v(snap1(p.x, |r| r.x), snap1(p.y, |r| r.y)), + } + }; + for m in &merged { + let pts: Vec = m[0].iter().map(snap).collect(); + o.polygon(ART_BAND, li, &[], &pts); + } + continue; + } + } + for r in group { + o.polygon(ART_BAND, li, band_join_edges, r); + } + } + for (li, a, b) in side_lines { + o.line(LINE_JOINT_L, li, a, b); + } // Raster der Teilflächen. let mut xs: Vec = vec![x_lo, x_hi]; let mut ys: Vec = offs.clone(); diff --git a/src-tauri/core/src/plan/walls.rs b/src-tauri/core/src/plan/walls.rs index 846beb3d..87586390 100644 --- a/src-tauri/core/src/plan/walls.rs +++ b/src-tauri/core/src/plan/walls.rs @@ -232,9 +232,10 @@ pub fn thin_layer_targets(thick: &[f64], detail: Detail, scale: f64) -> Vec, e: &EffWall, gaps: &[(f64, f64)], cuts: &WallCuts, greyed: bool, wall_lw: f64, category: Option<&LayerCategory>, view_only: bool, reveals: &[f64], bend: Option<&Unroll>) -> Result<(), String> { +fn wall_poche(c: &Ctx, out: &mut Vec, e: &EffWall, gaps: &[(f64, f64)], cuts: &WallCuts, greyed: bool, wall_lw: f64, category: Option<&LayerCategory>, view_only: bool, reveals: &[f64], bend: Option<&Unroll>) -> Result { let p = c.p; let w = e.w; let detail = c.a.detail; @@ -255,8 +256,9 @@ fn wall_poche(c: &Ctx, out: &mut Vec, e: &EffWall, gaps: &[(f64, f64) let f = crate::plan::wall_poche::wall_poche(&encode_wall_poche(w, &thick, total, ref_off, gaps, cuts, solid && !layered_solid, view_only, reveals)); let target = thin_layer_targets(&thick, detail, c.a.scale); if f.is_empty() { - return Ok(()); + return Ok(false); } + let layered = !view_only && !(solid && !layered_solid); let ov_of = |li: usize| lov.get(target.get(li).copied().unwrap_or(li)); // Stil einer Schicht mit Override bzw. schwarz (Schicht ohne Override in `layered_solid`). let apply_ov = |li: usize, (hatch, fill): (HatchRender, String)| -> (HatchRender, String) { @@ -372,7 +374,7 @@ fn wall_poche(c: &Ctx, out: &mut Vec, e: &EffWall, gaps: &[(f64, f64) } } } - Ok(()) + Ok(layered) } /// [141] Gerichtete Schichtmuster (Dämmschlange, Zickzack, Welle, Holzkreuz) an den Wandenden @@ -538,7 +540,7 @@ fn opening_symbol(c: &Ctx, out: &mut Vec, w: &Wall, o: &Opening, colo 1.0, t.frame_width.unwrap_or(0.06), b01(t.frame_kind == Some(DoorTypeFrameKind::Blockrahmen)), - t.inset_from_face.unwrap_or(0.0), + t.inset_from_face.or_else(|| crate::opening_detail::default_frame_inset(p, o)).unwrap_or(0.0), match t.inset_face { Some(DoorTypeInsetFace::Innen) => 1.0, Some(DoorTypeInsetFace::Mitte) => 2.0, @@ -564,7 +566,8 @@ fn opening_symbol(c: &Ctx, out: &mut Vec, w: &Wall, o: &Opening, colo None => { b.push(wt.map_or(0.0, |t| t.frame_width.unwrap_or(0.06))); b.push(wt.and_then(|t| t.frame_depth).unwrap_or(f64::NAN)); - b.push(wt.and_then(|t| t.inset_from_face).unwrap_or(f64::NAN)); + // [168] Ohne Lage: Vorgabe bei Aussendämmung (Rahmen in der Leibung der tragenden Schicht). + b.push(wt.and_then(|t| t.inset_from_face).or_else(|| crate::opening_detail::default_frame_inset(p, o)).unwrap_or(f64::NAN)); b.push(match wt.and_then(|t| t.inset_face) { Some(WindowTypeInsetFace::Innen) => 1.0, Some(WindowTypeInsetFace::Mitte) => 2.0, @@ -888,7 +891,7 @@ pub fn plan_walls(c: &Ctx, reference_lines: bool, out: &mut Vec, boun let cut = cut_by_id.get(w.id.as_str()).copied().unwrap_or(&empty); let (zb, zt) = p.wall_vertical_extent(w); let view_only = zt < cut_z || zb > cut_z; - let reveals = crate::opening_detail::plan_reveal_block(p, w, &openings); + let mut reveals = crate::opening_detail::plan_reveal_block(p, w, &openings); let (unroll, cut_u) = match &arc_wall { Some((arc, _)) => { let total = p.wall_thickness(w, 0.2); @@ -899,14 +902,42 @@ pub fn plan_walls(c: &Ctx, reference_lines: bool, out: &mut Vec, boun } None => (None, WallCuts::default()), }; + // [168] Öffnungs-Symbole vorab (auf der Ersatzwand `wv`, noch nicht gebogen): ihre Anschlag-Nasen + // (Schichtstücke an den Leibungen) zeichnet die Poché als Teil ihrer Schicht mit — eine Fläche, + // durchlaufende Schraffur, keine Linie zwischen Schicht und Nase. + let mut syms: Vec<(Vec, Vec, Option<&'static [f64]>)> = Vec::new(); + for (o, oz) in &all_openings { + let (o, oz) = (o.as_ref(), *oz); + if !c.vis(&o.category_code, &o.id) || oz == Zone::Hidden { + continue; + } + let ov = c.overrides(Some("opening"), &o.category_code, Some(&opening_label(o))); + let olw = ov.lineweight.unwrap_or_else(|| c.cat(&o.category_code).map_or(LAYER_LINE_MM, |k| k.lw)); + let color = ov.color.as_deref().or(o.color.as_deref()); + let detail = match o.detail_level { + Some(DetailLevel::Grob) => Detail::Grob, + Some(DetailLevel::Mittel) => Detail::Mittel, + Some(DetailLevel::Fein) => Detail::Fein, + _ => c.a.detail, + }; + let wall_line = (e.color.as_deref().unwrap_or(POCHE_STROKE), lw * c.a.detail.outline_factor()); + let mut tmp = Vec::new(); + opening_symbol(c, &mut tmp, wv, o, color, c.greyed(&o.category_code), detail, olw, wall_line)?; + // Nur Öffnungen mit Wandlücke (sonst schliesst die Wand, die Nase hätte keine Leibung). + let in_gap = openings.iter().any(|g| std::ptr::eq(*g, o)); + let noses = if in_gap && !view_only && !cut.covered { take_noses(&mut tmp) } else { Vec::new() }; + syms.push((noses, tmp, closed_dash(oz))); + } + append_nose_reveals(&mut reveals, p, wv, &gaps, syms.iter().flat_map(|s| s.0.iter())); // [95] Taschen der Taschen-Schiebetüren (Hohlraum in der Wand, aus der Schraffur ausgespart). let pockets = if view_only { WallPockets { o: wv.start, u: v2(1.0, 0.0), n: v2(0.0, 1.0), cuts: vec![] } } else { wall_pockets(p, wv, &openings) }; + let mut layered = false; match &unroll { Some(u) => { let mut tmp = Vec::new(); // [141] Ganz in einer Bogenwand gleichen Kreises und Typs: deren Körper zeigt sie mit. if !cut.covered { - wall_poche(c, &mut tmp, &ev, &gaps, &cut_u, greyed, lw, category, view_only, &reveals, Some(u))?; + layered = wall_poche(c, &mut tmp, &ev, &gaps, &cut_u, greyed, lw, category, view_only, &reveals, Some(u))?; } cut_pockets(&mut tmp, 0, &pockets); if reference_lines { @@ -918,7 +949,7 @@ pub fn plan_walls(c: &Ctx, reference_lines: bool, out: &mut Vec, boun let at = out.len(); // [141] Ganz in einer kollinearen Wand gleichen Typs: deren Körper zeigt sie mit. if !cut.covered { - wall_poche(c, out, e, &gaps, cut, greyed, lw, category, view_only, &reveals, None)?; + layered = wall_poche(c, out, e, &gaps, cut, greyed, lw, category, view_only, &reveals, None)?; } cut_pockets(out, at, &pockets); if reference_lines { @@ -926,32 +957,19 @@ pub fn plan_walls(c: &Ctx, reference_lines: bool, out: &mut Vec, boun } } } - for (o, oz) in &all_openings { - let (o, oz) = (o.as_ref(), *oz); - if !c.vis(&o.category_code, &o.id) || oz == Zone::Hidden { - continue; - } + for (noses, prims, dash) in syms { let sym_start = out.len(); - let ov = c.overrides(Some("opening"), &o.category_code, Some(&opening_label(o))); - let olw = ov.lineweight.unwrap_or_else(|| c.cat(&o.category_code).map_or(LAYER_LINE_MM, |k| k.lw)); - let color = ov.color.as_deref().or(o.color.as_deref()); - let detail = match o.detail_level { - Some(DetailLevel::Grob) => Detail::Grob, - Some(DetailLevel::Mittel) => Detail::Mittel, - Some(DetailLevel::Fein) => Detail::Fein, - _ => c.a.detail, - }; - let wall_line = (e.color.as_deref().unwrap_or(POCHE_STROKE), lw * c.a.detail.outline_factor()); + // Ohne Schicht-Poché (schwarze Sammelfläche) bleiben die Nasen eigene Stücke wie bisher. + let mut all = if layered { Vec::new() } else { noses }; + all.extend(prims); match &unroll { Some(u) => { - let mut tmp = Vec::new(); - opening_symbol(c, &mut tmp, wv, o, color, c.greyed(&o.category_code), detail, olw, wall_line)?; - polar_layer_pieces(u, &mut tmp); - bend_prims(u, tmp, out); + polar_layer_pieces(u, &mut all); + bend_prims(u, all, out); } - None => opening_symbol(c, out, w, o, color, c.greyed(&o.category_code), detail, olw, wall_line)?, + None => out.extend(all), } - if let Some(d) = closed_dash(oz) { + if let Some(d) = dash { super::view_range::restyle(out, sym_start, d); } } @@ -1273,6 +1291,70 @@ fn polar_layer_pieces(u: &Unroll, prims: &mut [Primitive]) { } } +/// [168] Anschlag-Nasen (Schichtstücke an einer Öffnung: Fläche mit Wand- UND Öffnungs-id) aus den +/// Symbol-Primitiven nehmen. +fn take_noses(prims: &mut Vec) -> Vec { + let (noses, rest): (Vec, Vec) = std::mem::take(prims).into_iter().partition(|q| matches!(q, Primitive::Polygon { wall_id: Some(_), opening_id: Some(_), .. })); + *prims = rest; + noses +} + +/// [168] Anschlag-Nasen als Zusatzstücke an den Schichteinzug-Block der Poché (`plan_reveal_block`) +/// hängen: je Nase und geschnittener Schicht ein Stück `[x0, x1, o0, o1]` an der nächsten Leibung +/// (x ab Rohbaukante in die Öffnung, o quer ab Aussenfläche). So entstehen Umriss und Fugen aus dem +/// Raster der Teilflächen (`wall_poche::adjusted_segment`): Nase und Schicht sind eine Fläche. +fn append_nose_reveals<'a>(reveals: &mut Vec, p: &Project, w: &Wall, gaps: &[(f64, f64)], noses: impl Iterator) { + let Some(wt) = p.wall_type(w) else { return }; + let total = thickness(&wt.layers); + let (dx, dy) = (w.end.x - w.start.x, w.end.y - w.start.y); + let len = dx.hypot(dy); + if !(total > 1e-9) || !(len > 1e-9) { + return; + } + let u = v2(dx / len, dy / len); + let n = v2(-u.y, u.x); + let face = joins::reference_offset(crate::model3d::wall_reference(w), total) - total / 2.0; + let mut bounds = Vec::with_capacity(wt.layers.len()); + let mut acc = 0.0; + for l in &wt.layers { + bounds.push((acc, acc + l.thickness)); + acc += l.thickness; + } + if reveals.is_empty() { + reveals.push(0.0); + } + for q in noses { + let Primitive::Polygon { pts, .. } = q else { continue }; + let (mut x0, mut x1, mut o0, mut o1) = (f64::INFINITY, f64::NEG_INFINITY, f64::INFINITY, f64::NEG_INFINITY); + for pt in pts { + let (rx, ry) = (pt.x - w.start.x, pt.y - w.start.y); + let (x, o) = (rx * u.x + ry * u.y, rx * n.x + ry * n.y - face); + (x0, x1, o0, o1) = (x0.min(x), x1.max(x), o0.min(o), o1.max(o)); + } + if !(x1 - x0 > 1e-6 && o1 - o0 > 1e-6) { + continue; + } + let xm = (x0 + x1) / 2.0; + // Nächste Leibung: links (Öffnung beginnt) oder rechts (Öffnung endet). + let Some((jamb, dir)) = gaps + .iter() + .filter(|g| xm > g.0 - 1e-6 && xm < g.1 + 1e-6) + .map(|g| if xm - g.0 <= g.1 - xm { (g.0, 1.0) } else { (g.1, -1.0) }) + .next() + else { + continue; + }; + let (a, b) = if dir > 0.0 { (x0 - jamb, x1 - jamb) } else { (jamb - x1, jamb - x0) }; + for (li, &(l0, l1)) in bounds.iter().enumerate() { + let (s0, s1) = (o0.max(l0), o1.min(l1)); + if s1 - s0 > 1e-6 { + reveals.extend([jamb, dir, li as f64, 0.0, 1.0, a.max(0.0), b, s0, s1]); + reveals[0] += 1.0; + } + } + } +} + fn bend_prims(u: &Unroll, prims: Vec, out: &mut Vec) { for mut p in prims { match &mut p { @@ -1602,6 +1684,99 @@ pub(crate) mod tests { assert!((g - 2.0 * (0.36f64 - 0.04).sqrt() * 0.16).abs() < 0.003, "{g}"); } + /// [168] Aussenwand Putz 2 · EPS 18 · Backstein 17.5 · Putz 1.5 cm entlang +x, Fenster 1.0..2.2 mit + /// Rahmen 18 cm hinter der Aussenfläche, Anschlag 5 cm (Nase aus Putz + EPS vor dem Rahmen) und + /// Schichteinzug „EPS überdämmt 3 cm". + fn reveal_window_project() -> Project { + let mut p = Project::default(); + let std_h = crate::standards::hatches().into_iter().find(|h| h["id"] == "std-h-daemmstoffe-sia").expect("Standard-Schraffur"); + p.hatches.push(serde_json::from_value(std_h).unwrap()); + for (id, h) in [("putz", ""), ("eps", "std-h-daemmstoffe-sia"), ("bs", "")] { + p.components.push(Component { id: id.into(), hatch_id: h.into(), ..Default::default() }); + } + let l = |c: &str, t: f64| Layer { component_id: c.into(), thickness: t, ..Default::default() }; + p.wall_types.push(WallType { id: "aw".into(), layers: vec![l("putz", 0.02), l("eps", 0.18), l("bs", 0.175), l("putz", 0.015)], ..Default::default() }); + p.drawing_levels.push(DrawingLevel { id: "eg".into(), kind: DrawingLevelKind::Floor, floor_height: Some(2.6), ..Default::default() }); + p.walls.push(Wall { id: "w".into(), floor_id: "eg".into(), wall_type_id: "aw".into(), category_code: "20".into(), start: Vec2 { x: 0.0, y: 0.0 }, end: Vec2 { x: 4.0, y: 0.0 }, height: 2.6, ..Default::default() }); + p.window_types = Some(vec![serde_json::from_value(serde_json::json!({ + "id": "f", "name": "F", "kind": "drehkipp", "wingCount": 1, "frameWidth": 0.08, "frameDepth": 0.08, + "insetFromFace": 0.18, "insetFace": "aussen", "rebateDepth": 0.05, + "layerReveals": [{ "layer": 1, "mode": "ueberdaemmt", "amount": 0.03 }], + })).unwrap()]); + p.openings = Some(vec![Opening { id: "o".into(), host_wall_id: "w".into(), kind: ElementKind::Window, type_id: Some("f".into()), category_code: "20".into(), position: 1.0, width: 1.2, height: 1.4, sill_height: 0.9, ..Default::default() }]); + p + } + + /// [168] Schichteinzug und Anschlag-Nase gehören zur Schicht: im Grundriss (1:20, Schichten) liegt die + /// EPS-Nase vor dem Rahmen in DERSELBEN Fläche wie das EPS-Band (gleiche Schraffur, durchlaufend), + /// keine Linie (Umriss/Fuge) auf der Grenze Schicht ↔ Einzug (Rohbaukante quer durch das EPS), kein + /// eigens umrandetes Stück an der Öffnung; die Aussenkontur (Stirn der Nase) bleibt Umriss. + #[test] + fn schichteinzug_ein_stueck_mit_der_schicht() { + for bulge in [None, Some(0.05)] { + let mut p = reveal_window_project(); + p.walls[0].bulge = bulge; + let t = serde_json::json!({ "floor": "eg", "show": ["20"], "grey": [], "scale": 20.0 }).to_string(); + let prims = super::super::domains::plan_domains(&p, &super::super::domains::PlanArgs::parse(1.0, &t).unwrap()).unwrap().walls; + assert!( + !prims.iter().any(|q| matches!(q, Primitive::Polygon { wall_id: Some(_), opening_id: Some(_), .. })), + "{bulge:?}: Nase als eigenes Element" + ); + if bulge.is_some() { + continue; + } + // Querlage: Aussenfläche y = −0.195, EPS 0.02..0.20 ⇒ y −0.175..0.005; Rohbaukante x = 1.0 (bzw. 0.4..1.6 je nach Lage). + let (js, je) = crate::opening_geom::opening_interval( + &crate::opening_geom::WallRef { start: crate::opening_geom::v(0.0, 0.0), end: crate::opening_geom::v(4.0, 0.0), total: 0.39, ref_off: 0.0 }, + 1.0, + 1.2, + ) + .unwrap(); + let eps_y = -0.195 + 0.1; + let polys: Vec<(&Vec, &HatchRender)> = prims + .iter() + .filter_map(|q| match q { + Primitive::Polygon { pts, hatch, wall_id: Some(_), fill, .. } if fill != "none" => Some((pts, hatch)), + _ => None, + }) + .collect(); + let containing = |x: f64, y: f64| polys.iter().find(|(pts, _)| point_in(pts, x, y)).copied(); + for (jamb, into) in [(js, 1.0), (je, -1.0)] { + let nose = containing(jamb + into * 0.025, eps_y).expect("Nase gefüllt"); + let band = containing(jamb - into * 0.3, eps_y).expect("EPS-Band"); + assert!(nose.1.pattern == HatchPattern::Diagonal && nose.1 == band.1, "Nase in der EPS-Schraffur"); + assert!(std::ptr::eq(nose.0, band.0), "Nase und Band als eine Fläche"); + // Keine Linie auf der Rohbaukante im EPS. + for q in &prims { + if let Primitive::Line { a, b, cls, .. } = q { + let on = (a.x - jamb).abs() < 1e-6 && (b.x - jamb).abs() < 1e-6 && a.y.max(b.y) > eps_y - 0.05 && a.y.min(b.y) < eps_y + 0.05; + assert!(!on, "Linie {cls} auf der Grenze Schicht/Einzug: {a:?} {b:?}"); + } + } + // Stirn der Nase (x = Rohbaukante + 5 cm) ist Umriss. + let face = jamb + into * 0.05; + assert!( + prims.iter().any(|q| matches!(q, Primitive::Line { a, b, cls, .. } if cls == "wall-outline" && (a.x - face).abs() < 1e-6 && (b.x - face).abs() < 1e-6)), + "Stirn der Nase ohne Umriss" + ); + } + } + } + + fn point_in(pts: &[Vec2], x: f64, y: f64) -> bool { + let n = pts.len(); + let mut c = false; + let mut j = n - 1; + for i in 0..n { + let (a, b) = (pts[i], pts[j]); + if (a.y > y) != (b.y > y) && x < (b.x - a.x) * (y - a.y) / (b.y - a.y) + a.x { + c = !c; + } + j = i; + } + c + } + /// [G3][36] Bogen über der Schnitthöhe vorbei (Schräg: links bis 0.5 tief): die Wand bleibt /// geschlossen, wo der Umriss die Schnittebene nicht erreicht; ganz verfehlt (Rund, Schnitt am /// Scheitel) ⇒ Wand geschlossen, Symbol „über/unter Schnitt“. diff --git a/src-tauri/fileio/src/ifc_semantic.rs b/src-tauri/fileio/src/ifc_semantic.rs index 4acebdfe..c94314eb 100644 --- a/src-tauri/fileio/src/ifc_semantic.rs +++ b/src-tauri/fileio/src/ifc_semantic.rs @@ -627,6 +627,57 @@ fn prism(s: &Shape) -> Option<(Vec, Vec>)> { /// Ausdehnung eines Körpers im Rahmen (Ursprung `o`, Richtung `d`, Normale `left(d)`): /// [u0,u1,v0,v1,z0,z1] und Füllgrad (Volumen / Quader). +/// [168] Mitte der Hüllbox eines Netzes. +fn mesh_center(m: &Mesh) -> Option<[f64; 3]> { + let mut lo = [f64::INFINITY; 3]; + let mut hi = [f64::NEG_INFINITY; 3]; + for c in m.positions.chunks_exact(3) { + for k in 0..3 { + lo[k] = lo[k].min(c[k]); + hi[k] = hi[k].max(c[k]); + } + } + let c = [(lo[0] + hi[0]) / 2.0, (lo[1] + hi[1]) / 2.0, (lo[2] + hi[2]) / 2.0]; + c.iter().all(|v| v.is_finite()).then_some(c) +} + +/// [168] Punkt im geschlossenen Netz (Strahl in eine schiefe Richtung, Schnitte zählen). +fn inside_mesh(m: &Mesh, p: [f64; 3]) -> bool { + let dir = [0.577_215_664_9, 0.301_029_995_7, 0.759_134_673_4]; + let sub = |a: [f64; 3], b: [f64; 3]| [a[0] - b[0], a[1] - b[1], a[2] - b[2]]; + let cross = |a: [f64; 3], b: [f64; 3]| [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]; + let dot = |a: [f64; 3], b: [f64; 3]| a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + let at = |i: u32| -> Option<[f64; 3]> { + let j = i as usize * 3; + Some([*m.positions.get(j)?, *m.positions.get(j + 1)?, *m.positions.get(j + 2)?]) + }; + let mut hits = 0usize; + for t in m.indices.chunks_exact(3) { + let (Some(a), Some(b), Some(c)) = (at(t[0]), at(t[1]), at(t[2])) else { continue }; + let (e1, e2) = (sub(b, a), sub(c, a)); + let h = cross(dir, e2); + let det = dot(e1, h); + if det.abs() < 1e-12 { + continue; + } + let f = 1.0 / det; + let s = sub(p, a); + let u = f * dot(s, h); + if !(0.0..=1.0).contains(&u) { + continue; + } + let q = cross(s, e1); + let v = f * dot(dir, q); + if v < 0.0 || u + v > 1.0 { + continue; + } + if f * dot(e2, q) > 1e-9 { + hits += 1; + } + } + hits % 2 == 1 +} + fn box_in_frame(m: &Mesh, o: V2, d: V2) -> Option<([f64; 6], f64)> { let n = left(d); let mut b = [f64::INFINITY, f64::NEG_INFINITY, f64::INFINITY, f64::NEG_INFINITY, f64::INFINITY, f64::NEG_INFINITY]; @@ -904,7 +955,25 @@ impl Ctx<'_, '_> { let vc0 = (v0 + v1) / 2.0; let o = lerp_dir([n[0] * vc0, n[1] * vc0], d, u0); let mut loose_in: Vec = Vec::new(); - if !((0.7..=1.0 + 1e-3).contains(&ratio) && s.top_area >= 0.35 * rect && s.bottom_area >= 0.6 * rect) { + // [168] Wandkörper mit den Löchern schon im Netz (Dossier: Wand mit Schichteinzug-Stücken in der + // Öffnung, Öffnungskörper nur in der Rahmenlage): das fehlende Volumen sind die Öffnungskästen über + // die ganze Wanddicke (Stücke, wenige Prozent, in der Toleranz). + // Erkennung: die Mitte jedes Öffnungskörpers liegt ausserhalb des Wandkörpers (Loch schon im Netz). + let void_ids: Vec = self.rels.voids.get(&id).cloned().unwrap_or_default(); + let mut void_cut = 0.0; + let mut holed = !void_ids.is_empty(); + for &v in &void_ids { + match self.body(v).and_then(|(m, _)| box_in_frame(&m, o, d).map(|x| (x, m))) { + Some(((b, _), m)) => { + void_cut += (b[1].min(len) - b[0].max(0.0)).max(0.0) * t * (b[5].min(s.z1) - b[4].max(s.z0)).max(0.0); + let c = mesh_center(&m); + holed &= c.is_some_and(|c| !inside_mesh(&mesh, c)); + } + None => holed = false, + } + } + let holed = holed && s.top_area >= 0.35 * rect && (0.7..=1.0 + 1e-3).contains(&((s.volume + void_cut) / (rect * h))); + if !(((0.7..=1.0 + 1e-3).contains(&ratio) && s.top_area >= 0.35 * rect && s.bottom_area >= 0.6 * rect) || holed) { // Türen/Fenster ohne Öffnungsbeziehung, deren Löcher schon im Wandkörper sind: das fehlende // Volumen muss genau ihren Kästen über die Wanddicke entsprechen. let mut cut = 0.0; @@ -946,7 +1015,9 @@ impl Ctx<'_, '_> { for &o in self.rels.voids.get(&id).map(Vec::as_slice).unwrap_or(&[]) { let (om, _) = self.body(o).ok_or(R_OPENING)?; let (b, fill) = box_in_frame(&om, start, d).ok_or(R_OPENING)?; - let through = b[2] <= -t / 2.0 + 1e-3 && b[3] >= t / 2.0 - 1e-3; + // [168] Im Körper schon gelocht: der Öffnungskörper darf in der Wanddicke enden (Rahmenlage). + let within = holed && b[2] >= -t / 2.0 - 0.01 && b[3] <= t / 2.0 + 0.01 && b[3] - b[2] > 1e-3; + let through = (b[2] <= -t / 2.0 + 1e-3 && b[3] >= t / 2.0 - 1e-3) || within; let inside = b[0] >= -0.01 && b[1] <= len + 0.01 && b[5] > s.z0 + 0.01 && b[4] < s.z1 - 0.01; // Rund (Dossier `shape: "rund"`, Ellipse im Rechteck): Füllgrad π/4, alle Punkte auf der Ellipse. let round = (0.76..=0.81).contains(&fill) && on_ellipse(&om, start, d, &b); diff --git a/src/export/openingSchedule.test.ts b/src/export/openingSchedule.test.ts index 0bd3d144..00e7f38f 100644 --- a/src/export/openingSchedule.test.ts +++ b/src/export/openingSchedule.test.ts @@ -30,9 +30,11 @@ describe("Fenster- und Türliste", () => { expect(all.some((r) => r[0] === "T-Haus" && r.includes('Eingang; mit "Zusatz"'))).toBe(true); }); it("[106] Leibungsflächen je Schicht als optionale Spalten", () => { - const plain = buildOpeningReport(p); + // Ohne Schichteinzug (auch ohne die [168]-Vorgabe bei Aussendämmung): ausdrücklich leer. + const bare: Project = { ...p, openings: p.openings!.map((o) => ({ ...o, layerReveals: [] })) }; + const plain = buildOpeningReport(bare); const o0 = p.openings![0]!; - const withRev: Project = { ...p, openings: p.openings!.map((o) => (o.id === o0.id ? { ...o, layerReveals: [{ layer: 0, mode: "zurueck" as const }] } : o)) }; + const withRev: Project = { ...bare, openings: bare.openings!.map((o) => (o.id === o0.id ? { ...o, layerReveals: [{ layer: 0, mode: "zurueck" as const }] } : o)) }; const rows = openingSchedule(withRev); const r0 = rows.find((r) => r.id === o0.id)!; expect(r0.revealAreas.length).toBe(1); diff --git a/src/plan/__golden__/komplex-grundriss-dg-50.txt b/src/plan/__golden__/komplex-grundriss-dg-50.txt index a9c86e69..45986980 100644 --- a/src/plan/__golden__/komplex-grundriss-dg-50.txt +++ b/src/plan/__golden__/komplex-grundriss-dg-50.txt @@ -1,12 +1,12 @@ viewBox -12.65 0 37.3 33.3 -bytes 325522 +bytes 324678 circle 14 g 1 line 3206 -polygon 76 +polygon 68 polyline 80 rect 1 svg 1 text 36 tspan 12 -hash c754734e5a61a0df +hash a1ffcd11fb447e54 diff --git a/src/plan/__golden__/komplex-grundriss-eg-50.txt b/src/plan/__golden__/komplex-grundriss-eg-50.txt index ee3a01f4..85a5f54e 100644 --- a/src/plan/__golden__/komplex-grundriss-eg-50.txt +++ b/src/plan/__golden__/komplex-grundriss-eg-50.txt @@ -1,13 +1,13 @@ viewBox -41.5 0 95 63.6 -bytes 131023 +bytes 127667 circle 16 g 1 line 419 path 39 -polygon 252 +polygon 218 polyline 145 rect 1 svg 1 text 121 tspan 32 -hash ff2665a76f5bbb8d +hash 8ec5db0e3cdeadfd diff --git a/src/plan/__golden__/komplex-grundriss-og-50.txt b/src/plan/__golden__/komplex-grundriss-og-50.txt index 2b7eaf46..20ba557c 100644 --- a/src/plan/__golden__/komplex-grundriss-og-50.txt +++ b/src/plan/__golden__/komplex-grundriss-og-50.txt @@ -1,13 +1,13 @@ viewBox -12.65 0 37.3 33.3 -bytes 370588 +bytes 365237 circle 14 g 1 line 3238 path 21 -polygon 213 +polygon 159 polyline 180 rect 1 svg 1 text 91 tspan 24 -hash d968a9e0e5adcdd3 +hash a95192bff1153cc7 diff --git a/src/plan/__golden__/komplex-grundriss-ug-50.txt b/src/plan/__golden__/komplex-grundriss-ug-50.txt index a3c93297..1c1505bb 100644 --- a/src/plan/__golden__/komplex-grundriss-ug-50.txt +++ b/src/plan/__golden__/komplex-grundriss-ug-50.txt @@ -1,13 +1,13 @@ viewBox -12.65 0 37.3 33.3 -bytes 62538 +bytes 61688 circle 14 g 1 line 117 path 15 -polygon 89 +polygon 81 polyline 92 rect 1 svg 1 text 75 tspan 20 -hash 0a0d09cb775a502b +hash 2f6e2da3d161819b diff --git a/src/plan/__golden__/komplex-schnitt-schnitt-a.txt b/src/plan/__golden__/komplex-schnitt-schnitt-a.txt index 8ccd20ed..b595f66a 100644 --- a/src/plan/__golden__/komplex-schnitt-schnitt-a.txt +++ b/src/plan/__golden__/komplex-schnitt-schnitt-a.txt @@ -1,11 +1,11 @@ viewBox 4.457 0 21.343 17.378 -bytes 34158 +bytes 34779 circle 3 g 1 -line 33 -polygon 186 -polyline 16 +line 42 +polygon 183 +polyline 17 rect 1 svg 1 text 3 -hash ab512b19fa3bae7c +hash 0bd932dd39400382 diff --git a/src/plan/__golden__/muster-grundriss-eg-50.txt b/src/plan/__golden__/muster-grundriss-eg-50.txt index 619a8f3f..4006b5d9 100644 --- a/src/plan/__golden__/muster-grundriss-eg-50.txt +++ b/src/plan/__golden__/muster-grundriss-eg-50.txt @@ -1,11 +1,11 @@ viewBox -1.731 0 8.461 7.322 -bytes 10317 +bytes 10157 g 1 line 30 -polygon 48 +polygon 43 polyline 9 rect 1 svg 1 text 7 tspan 3 -hash 4d8c794c3190f4eb +hash 02f3ed4056f36531 diff --git a/src/plan/__golden__/muster-model3d.txt b/src/plan/__golden__/muster-model3d.txt index ca0e1205..033c2b9f 100644 --- a/src/plan/__golden__/muster-model3d.txt +++ b/src/plan/__golden__/muster-model3d.txt @@ -16,16 +16,16 @@ slabs[].color [3] x3 slabs[].cut.lineColor [3] slabs[].outline [4] x3 slabs[].outline[] [2] x12 -walls [47] -walls[].color [3] x47 -walls[].cut.lineColor [3] x11 -walls[].end [2] x47 +walls [59] +walls[].color [3] x59 +walls[].cut.lineColor [3] x23 +walls[].end [2] x59 walls[].endCut [4] x47 walls[].holes [1] x5 walls[].holes [2] x5 -walls[].layers [0] x47 -walls[].start [2] x47 +walls[].layers [0] x59 +walls[].start [2] x59 walls[].startCut [4] x47 walls[].topDrop [2] x6 walls[].topPlane [3] x6 -hash 43431f51d1e44e8b +hash d9b519437e8b0665 diff --git a/src/plan/glPlan/glPlanChunks.test.ts b/src/plan/glPlan/glPlanChunks.test.ts index 2be14575..f7ec48e3 100644 --- a/src/plan/glPlan/glPlanChunks.test.ts +++ b/src/plan/glPlan/glPlanChunks.test.ts @@ -254,7 +254,7 @@ describe('GpuChunkCache: Kern-Abschnitte (Plan-Puffer v2, Inhalts-Hash)', () => }); it('eine verschobene Wand kompiliert nur wenige Chunks neu', () => { - const p = bigSampleProject(8); + const p = bigSampleProject(10); const { gl } = makeGl(); const cache = new GpuChunkCache(gl); // 1:50: Wände mit Schichten (ab 1:100 eine schwarze Fläche je Wand, [140]) → genug Chunks. diff --git a/src/plan/toWalls3d.test.ts b/src/plan/toWalls3d.test.ts index 3a5c0a42..2ac2c854 100644 --- a/src/plan/toWalls3d.test.ts +++ b/src/plan/toWalls3d.test.ts @@ -96,7 +96,8 @@ describe("selectionHighlightLines", () => { // hinzu. Beide stehen unter der Geschossdecke C1, deren Beton-Schicht (100) // den Backstein (50) im z-Band [2.3,2.5] spaltet -> 5 Körper (per-Schicht- // Decken-Dominanz, s. Backstein-Boxen [0,2.3] + [2.5,2.6]). - const noW9: Project = { ...sampleProject, walls: sampleProject.walls.filter((w) => w.id !== "W9") }; + // Ohne Schichteinzug (die [168]-Vorgabe bei Aussendämmung setzt sonst Überdämmungs-Stücke als Körper). + const noW9: Project = { ...sampleProject, walls: sampleProject.walls.filter((w) => w.id !== "W9"), openings: (sampleProject.openings ?? []).map((o) => ({ ...o, layerReveals: [] })) }; const w1 = selectionHighlightLines(noW9, ["W1"], [], RGB); const w2 = selectionHighlightLines(noW9, ["W2"], [], RGB); expect(w1.length).toBe(5 * 12 * VERTICES_PER_EDGE * FLOATS_PER_VERTEX); @@ -291,7 +292,8 @@ describe("Öffnungen als echte Löcher in EINEM Körper (3D-Pfad, layeredWalls:t it("Tür = Loch bis zur Wand-UK (zBottom == baseElevation)", () => { // Eine Tür (D1 auf W1) muss im 3D-Pfad als Loch bis zum Boden erscheinen: // zBottom des Lochs == Wand-UK (0), NICHT ab einer Brüstung. - const p: Project = { ...sampleProject, openings: (sampleProject.openings ?? []).filter((o) => o.id === "D1") }; + // Ohne Schichteinzug ([168]-Vorgabe): nur die Bänder mit dem Loch. + const p: Project = { ...sampleProject, openings: (sampleProject.openings ?? []).filter((o) => o.id === "D1").map((o) => ({ ...o, layerReveals: [] })) }; const w1 = projectToWalls3d(p, true).filter((w) => w.wallId === "W1"); // W1 ist Durchgangswand für W9 (T-Stoss) -> innerste Putzschicht span-cutout- // gebrochen. Zusätzlich spaltet die Decke C1 (Beton 100) den Backstein (50) im