diff --git a/TODO.md b/TODO.md index 96865f7d..b9738ff0 100644 --- a/TODO.md +++ b/TODO.md @@ -2611,13 +2611,13 @@ Reihenfolge = Abhängigkeiten. Neue Geometrie entsteht in Rust ([K]). nicht anwählen und bearbeiten") **Bestand** (Klick im Plan / im 3D, Objekt-Info, Bearbeiten; vorher → jetzt): | Element | Grundriss | Schnitt/Ansicht | 3D | Objekt-Info / Bearbeiten | |---|---|---|---|---| - | Wand, Öffnung, Decke, Dach, Treppe | ✓ (in Situation/mit sichtbarem Gelände: Wand/Decke vom Gelände-Rahmen verdeckt ✗ → ✓) | ✓ (Ansicht: Wand unter Schlagschatten ✗ → ✓) | ✓ | ✓ Felder, Griffe | + | Wand, Öffnung, Decke, Dach, Treppe | ✓ (in Situation/mit sichtbarem Gelände: Wand/Decke vom Gelände-Rahmen verdeckt ✗ → ✓) | ✓ (Ansicht: Wand unter Schlagschatten ✗ → ✓) | ✓ (Dachfenster/Deckenöffnung/Gaubenfenster ✗ → ✓ als Netz; Dach-Pick über den gezeichneten Dachkörper inkl. Gauben, vorher nur Dachflächen) | ✓ Felder, Griffe | | Raum | ✓ | – | – (nicht dargestellt) | ✓ | - | Stütze | ✓ | ✓ | ✗ → ✓ | ✓ | - | Freie Körper (Loft, Rotation, Abzug) | ✓ (Umriss) | ✓ | ✗ (truck-Netze in TS, offen) | ✓ | + | Stütze | ✓ | ✓ | ✗ → ✓ (5.11.: Pick war zur Darstellung gespiegelt, −y → y; Hervorhebung neu) | ✓ | + | Freie Körper (Extrusion, Loft, Rotation, Sweep, B-Rep) | ✓ (Umriss) | ✓ | ✗ → ✓ (truck-Netz, bis es geladen ist Prisma über dem Umriss; Hervorhebung; Abzugskörper nicht, im 3D nicht gezeichnet) | ✓ (keine Griffe, auch nicht im Plan) | | 2D: Bemassung, Koten, Text, Hinweis, Wolke, Nordpfeil-Block, Detail, Kataster, Strasse, Bäume | ✓ (Linien; leere Kreise/Konturen am Rand, leere Konturfläche unter Gelände meint das Gelände) | ✓ eigene | Linien-Spur | ✓ | | Achsraster | ✓ | ✗ (Projektion ohne Id, offen) | Spur (`show3d`) | ✓ | - | Gelände (TerrainMesh) | Rahmen-Band, Objekt-Info nur LV95 → ✓ mit Optionen | ✗ → ✓ (Erdreich-Band, Geländefläche) | ✓ | ✗ → ✓ Sichtbar (Kategorie), Glättung, Äquidistanz, Zähllinie, Erdreich-Band | + | Gelände (TerrainMesh) | Rahmen-Band, Objekt-Info nur LV95 → ✓ mit Optionen | ✗ → ✓ (Erdreich-Band, Geländefläche) | ✓ (ausgeblendete Kategorie/ausgeblendetes Netz fing den Klick ✗ → ✓ nicht mehr) | ✗ → ✓ Sichtbar (Netz einzeln `hidden` + Kategorie), Glättung (Höhenlinien neu bzw. Raster nachglätten), Äquidistanz, Zähllinie, Erdreich-Band | | Höhenlinien-Satz (contourSet) | ✗ → ✓ (Rahmen unter dem Gelände, Cmd/Strg+Klick-Liste) | – | – | Typ, LV95 | | Baugrube, Böschungen, Rühlwand (excavation) | ✗ (Band nur Sohle, unter dem Gelände-Rahmen) → ✓ Wirkbereich zuoberst | über Gelände | ✗ → ✓ (Dreiecke im Wirkbereich) | Typ ohne Übersetzung → ✓ alle Felder, Mengen; Griffe (bestehend) | | Schatten (Sonnenstudie) | ✗ → ✓ Pseudo-Auswahl `site` | – | – (kein Schatten im 3D, [64]) | ✓ Sonnenstand: Schalter, Datum, Uhrzeit (Undo) | @@ -2636,9 +2636,28 @@ Reihenfolge = Abhängigkeiten. Neue Geometrie entsteht in Rust ([K]). vitest `siteSelection.test.ts` (Plan-Pick im Musterhaus komplex, Objekt-Info Baugrube, Neu-Glätten mit Undo), e2e `siteSelect.spec.ts` (Gelände in der Situation wählen, Glättung ändern, Undo; Schatten im EG wählen, Uhrzeit ändern, Undo); Goldens EG (unsichtbare Bänder). Geprüft im Linux-Container (Chromium), 3D-Pick nur als Unit-Test (headless kein - WebGPU), nicht in der Tauri-App. Offen: freie Körper im 3D-Pick; Achsraster in Schnitt/Ansicht; „Gelände sichtbar" - schaltet die ganze Kategorie; Glättung nur mit Höhenlinien-Satz (swissALTI3D-Netze nicht); in der dichten Situation - 1:500 gehen 2D-Elemente (Bemassung) vor — Schatten/Gelände dort per Cmd/Strg+Klick-Liste. · M + WebGPU), nicht in der Tauri-App. + (5.11., 3D und Gelände) **3D-Pick:** Kern `model3d::pick_geometry` liefert zusätzlich `solids` (freie Körper als Prisma, + `pick_solids`) und `openingMeshes` (Öffnungen in Dach/Decke/Gaube aus `emit_opening_meshes`, `pick_hosted_openings`); + Dächer aus `emit_roofs` (Körper mit Gauben und Dachfenster-Löchern) statt nur der Flächen; Stützen/Körper/Dachfenster in + Welt (x, Höhe, y) wie render3d `Extrusion` (Stützen-Pick war gespiegelt). `explode3d` hebt die neuen Teile mit. + TS `pickGeometry` ersetzt das Körper-Prisma durch das geladene truck-Netz (`truckSolidPickTris`); `pickNearest` kennt + `solid` (Auswahl `solids`, Objekt-Info wie im Plan) und Öffnungs-Netze (Rang wie Öffnung). Hervorhebung (`highlight3d`) + für Stützen, Körper, Dachfenster. Ausgeblendete Kategorie bzw. ausgeblendetes Netz liefert keine Pick-Dreiecke mehr. + **Gelände:** `TerrainMesh.hidden` (Rust-Modell) blendet nur dieses Netz aus (Grundriss, Schnitt, Ansicht, 3D, Pick); + Objekt-Info „Dieses Gelände sichtbar" neben dem Kategorie-Schalter (unverändert). Raster-Gelände (swissALTI3D, keine + Höhenlinien): „Glättung" glättet additiv nach (`terrain::resmooth_grid_mesh`: Raster aus den Vertices zurückgewonnen, + `smooth_grid`, nur z ändert sich; Import merkt die Durchgänge in `smooth`); anderes TIN ohne Quelle: Auswahl + ausgegraut mit Hinweis. Tests: Rust (Körper/Explosion, Dachfenster, Gelände einzeln, Raster nachglätten, + Hervorhebung), vitest `toWalls3d.pickSolids.test.ts` (Strahl auf Körper, truck-Netz statt Prisma, Stütze lagerichtig, + Hervorhebung, Gelände ausgeblendet), `siteSelection.test.ts` (Nachglätten mit Undo), e2e `siteSelect.spec.ts` + (Netz ausblenden + Undo). Linux-Container; 3D-Pick nur als Unit-Test (headless kein WebGPU), nicht in der Tauri-App. + Offen: Achsraster in Schnitt/Ansicht; in der dichten Situation 1:500 gehen 2D-Elemente (Bemassung) vor — + Schatten/Gelände dort per Cmd/Strg+Klick-Liste; im 3D nicht anwählbar: Treppengeländer über der Treppen-Hülle + (oberes Podest), 2D-Kreise/Bögen/Texte (Bäume, Symbole: keine Pick-Box), Punktwolken, Baurechts-Hüllkörper und + Schnittbox (Hilfsdarstellung, Klick geht hindurch), Gauben nur als Teil des Dachs (keine eigene Auswahl); + importierte Meshes nur über die Kategorie ausblendbar; Raster-Gelände nur stärker glätten (rohe Höhen nicht + gespeichert). · M ## Priorität 4 — später diff --git a/e2e/siteSelect.spec.ts b/e2e/siteSelect.spec.ts index 05d7cd36..3d3b2e71 100644 --- a/e2e/siteSelect.spec.ts +++ b/e2e/siteSelect.spec.ts @@ -48,6 +48,15 @@ test("Musterhaus komplex: Gelände und Schatten anwählen und bearbeiten (mit Un await blurFocus(page); await page.keyboard.press("ControlOrMeta+z"); await expect(smooth).toHaveValue("2"); + // Nur dieses Netz ausblenden (Kategorie bleibt an), Undo blendet es wieder ein. + const meshVisible = objInfo(page).getByTestId("terrain-mesh-visible"); + await expect(meshVisible).toBeChecked(); + await meshVisible.uncheck(); + await expect(meshVisible).not.toBeChecked(); + await expect(objInfo(page).getByTestId("terrain-visible")).toBeChecked(); + await blurFocus(page); + await page.keyboard.press("ControlOrMeta+z"); + await expect(meshVisible).toBeChecked(); // Schatten: EG 1:100, Klick nördlich des Eingangs (Schlagschatten am 21. Juni, 10 Uhr). await showSnapshot(page, "EG 1:100"); diff --git a/src-tauri/core/src/explode3d.rs b/src-tauri/core/src/explode3d.rs index 7c636206..0e02cb64 100644 --- a/src-tauri/core/src/explode3d.rs +++ b/src-tauri/core/src/explode3d.rs @@ -48,6 +48,10 @@ impl<'a> Explode<'a> { for c in p.columns.as_deref().unwrap_or(&[]) { floor_of.insert(&c.id, &c.floor_id); } + // [137] Freie Körper (Pick, Hervorhebung) folgen ihrem Geschoss. + for s in p.extruded_solids.as_deref().unwrap_or(&[]) { + floor_of.insert(&s.id, &s.level_id); + } for o in p.openings.as_deref().unwrap_or(&[]) { if let Some(f) = floor_of.get(o.host_wall_id.as_str()).copied() { floor_of.insert(&o.id, f); @@ -213,6 +217,18 @@ pub fn pick_geometry(p: &Project, gap: f64) -> Result { v[1] += dz; } } + for o in &mut g.opening_meshes { + let dz = ex.of(&o.opening_id); + for v in o.tris.iter_mut().flatten() { + v[1] += dz; + } + } + for s in &mut g.solids { + let dz = ex.of(&s.solid_id); + for v in s.tris.iter_mut().flatten() { + v[1] += dz; + } + } Ok(g) } diff --git a/src-tauri/core/src/highlight3d.rs b/src-tauri/core/src/highlight3d.rs index 24e61f2b..416b99d0 100644 --- a/src-tauri/core/src/highlight3d.rs +++ b/src-tauri/core/src/highlight3d.rs @@ -23,6 +23,9 @@ pub struct Args { pub stairs: Vec, pub roofs: Vec, pub context: Vec, + /// [137] Stützen und freie Körper (Prisma über dem Grundriss). + pub columns: Vec, + pub solids: Vec, pub rgb: [f64; 3], /// Explosionsabstand ([65], `explode3d.rs`; fehlt/0 = aus): Linien folgen dem auseinandergezogenen Modell. #[serde(default)] @@ -74,6 +77,27 @@ impl Out { } } + /// Achsparalleler Hüllquader um Welt-Punkte (nichts bei leerer Menge). + fn aabb_edges<'a>(&mut self, pts: impl Iterator) { + let (mut lo, mut hi) = ([f64::INFINITY; 3], [f64::NEG_INFINITY; 3]); + for q in pts { + for k in 0..3 { + lo[k] = lo[k].min(q[k]); + hi[k] = hi[k].max(q[k]); + } + } + if !lo[0].is_finite() { + return; + } + let mut c = [[0.0; 3]; 8]; + for (i, v) in c.iter_mut().enumerate() { + *v = [if i & 1 != 0 { hi[0] } else { lo[0] }, if i & 2 != 0 { hi[1] } else { lo[1] }, if i & 4 != 0 { hi[2] } else { lo[2] }]; + } + for (i, j) in BOX_EDGES { + self.edge(c[i], c[j]); + } + } + /// Prisma über dem Grundriss `outline` von `z_bottom` bis `z_top`. fn prism_edges(&mut self, outline: &[[f64; 2]], z_bottom: f64, z_top: f64) { let n = outline.len(); @@ -130,6 +154,16 @@ pub fn selection_highlight_lines(p: &Project, a: &Args) -> Result, Stri } } } + // [137] Öffnungen in Dach/Decke/Gaube: Hüllquader ihrer Teile. + if !openings.is_empty() { + for m in crate::model3d::pick_hosted_openings(p) { + if openings.contains(m.opening_id.as_str()) { + let n = out.v.len(); + out.aabb_edges(m.tris.iter().flatten()); + lift(&mut out, n, &m.opening_id); + } + } + } if !ceilings.is_empty() { for s in emit_slabs(p) { if ceilings.contains(s.ceiling_id.as_str()) { @@ -170,6 +204,25 @@ pub fn selection_highlight_lines(p: &Project, a: &Args) -> Result, Stri lift(&mut out, n, &roof.id); } } + let (columns, solids) = (set(&a.columns), set(&a.solids)); + for col in p.columns.as_deref().unwrap_or(&[]) { + if columns.contains(col.id.as_str()) { + let (z0, z1) = p.column_vertical_extent(col); + let foot: Vec<[f64; 2]> = crate::model3d::column_footprint(col).iter().map(|q| [q.x, q.y]).collect(); + let n = out.v.len(); + out.prism_edges(&foot, z0, z1); + lift(&mut out, n, &col.id); + } + } + for s in p.extruded_solids.as_deref().unwrap_or(&[]) { + if solids.contains(s.id.as_str()) { + let z0 = crate::model3d::solid_base_z(p, s); + let foot: Vec<[f64; 2]> = s.points.iter().map(|q| [q.x, q.y]).collect(); + let n = out.v.len(); + out.prism_edges(&foot, z0, z0 + s.height); + lift(&mut out, n, &s.id); + } + } if !context.is_empty() { for obj in p.context.as_deref().unwrap_or(&[]) { let (pos, id) = match obj { @@ -250,4 +303,21 @@ mod tests { assert_eq!(l.len() % (3 * 12) , 0); assert!(!l.is_empty()); } + + /// [137] Gewählte Stützen und freie Körper bekommen im 3D einen Umriss (Prisma: 3 Kanten je Ecke). + #[test] + fn stuetze_und_freier_koerper() { + let p: Project = serde_json::from_value(serde_json::json!({ + "id": "p", "name": "t", "lineStyles": [], "hatches": [], "components": [], "wallTypes": [], "layers": [], "openings": [], "walls": [], + "drawingLevels": [{"id": "EG", "name": "EG", "kind": "floor", "visible": true, "locked": false, "floorHeight": 3.0, "baseElevation": 0.0}], + "columns": [{"id": "k1", "type": "column", "floorId": "EG", "categoryCode": "25", "position": {"x": 2, "y": 3}, "profile": {"kind": "rect", "width": 0.3, "depth": 0.3}, "rotation": 0, "height": 2.5}], + "extrudedSolids": [{"id": "s1", "type": "extrudedSolid", "levelId": "EG", "points": [{"x": 0, "y": 0}, {"x": 1, "y": 0}, {"x": 1, "y": 1}], "height": 2.0}], + "drawings2d": [] + })) + .unwrap(); + assert_eq!(lines(&p, serde_json::json!({"columns": ["k1"]})).len(), 4 * 3 * 12); + let l = lines(&p, serde_json::json!({"solids": ["s1"]})); + assert_eq!(l.len(), 3 * 3 * 12); + assert!(l.chunks_exact(6).any(|v| (v[1] - 2.0).abs() < 1e-6)); + } } diff --git a/src-tauri/core/src/model/generated.rs b/src-tauri/core/src/model/generated.rs index a78b756f..8b18af08 100644 --- a/src-tauri/core/src/model/generated.rs +++ b/src-tauri/core/src/model/generated.rs @@ -5206,6 +5206,11 @@ pub struct TerrainMesh { #[serde(rename = "sourceId", default, skip_serializing_if = "Option::is_none")] #[ts(optional)] pub source_id: Option, + /// [137] Nur dieses Netz ausblenden (Grundriss, Schnitt, Ansicht, 3D, Pick); die Kategorie bleibt + /// davon unberührt. Fehlt/false = sichtbar. + #[serde(default, skip_serializing_if = "Option::is_none")] + #[ts(optional)] + pub hidden: Option, #[serde(flatten)] #[ts(skip)] pub extra: Extra, diff --git a/src-tauri/core/src/model3d.rs b/src-tauri/core/src/model3d.rs index d1e99c43..23fdae0b 100644 --- a/src-tauri/core/src/model3d.rs +++ b/src-tauri/core/src/model3d.rs @@ -2129,6 +2129,8 @@ pub fn emit_context_meshes(p: &Project) -> Vec { continue; } match obj { + // [137] Einzeln ausgeblendetes Gelände. + ContextObject::TerrainMesh(m) if m.hidden == Some(true) => {} ContextObject::TerrainMesh(m) if m.positions.len() >= 9 && m.indices.len() >= 3 => { // [T6] Baugruben schneiden das Gelände; Höhen im Modellbezug (Luftbild-Farben auf das geänderte Netz übertragen). let (pos, idx, _) = crate::excavation::terrain_model_mesh(p, m); @@ -2339,6 +2341,22 @@ pub struct PickColumn { pub column_id: String, } +/// [137] Öffnung ohne Wand (Dach, Decke, Gaube) für den 3D-Pick: Welt-Dreiecke ihrer Teile. +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct PickOpeningMesh { + pub tris: Vec, + pub opening_id: String, +} + +/// [137] Freier Körper für den 3D-Pick: Welt-Dreiecke. +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct PickSolid { + pub tris: Vec, + pub solid_id: String, +} + #[derive(Debug, Serialize)] pub struct PickGeometry { pub walls: Vec, @@ -2350,6 +2368,11 @@ pub struct PickGeometry { pub context_meshes: Vec, /// [137] Stützen (vorher im 3D nicht anwählbar). pub columns: Vec, + /// [137] Freie Körper (Prisma-Näherung; TS ersetzt sie durch das truck-Netz). + pub solids: Vec, + /// [137] Öffnungen in Dach/Decke/Gaube als Netz. + #[serde(rename = "openingMeshes")] + pub opening_meshes: Vec, pub drawings: Vec, } @@ -2409,8 +2432,10 @@ pub fn pick_geometry(p: &Project) -> Result { for roof in p.roofs.as_deref().unwrap_or(&[]) { let g = crate::roof::roof_geometry(&roof.params(), p.roof_base_elevation(roof)); let to_world = |q: &V3| -> V3 { [q[0], q[2], q[1]] }; - let mut tris: Vec = Vec::new(); - for poly in g.planes.iter().chain(g.gables.iter()) { + // [137] Dachkörper wie gezeichnet (Gauben, Verschneidungen, Löcher der Dachfenster); ohne Körper die Flächen. + let mut tris: Vec = emit_roofs(p, Some(&roof.id)).unwrap_or_default().iter().flat_map(|m| extrusion_tris(&m.positions, &m.indices)).collect(); + let planes: &[Vec] = if tris.is_empty() { &g.planes } else { &[] }; + for poly in planes.iter().chain(g.gables.iter()) { for i in 1..poly.len().saturating_sub(1) { tris.push([to_world(&poly[0]), to_world(&poly[i]), to_world(&poly[i + 1])]); } @@ -2423,7 +2448,17 @@ pub fn pick_geometry(p: &Project) -> Result { let stairs = pick_stairs(p); // Kontext-Meshes: rohe Welt-Dreiecke, Modell (x, y, z) → Welt (x, z, −y). let mut context_meshes = Vec::new(); + // [137] Was im 3D nicht gezeichnet wird (Kategorie aus, Gelände einzeln aus), fängt auch keinen Klick. + let hidden = hidden_category_codes(&p.layers); for obj in p.context.as_deref().unwrap_or(&[]) { + let code = match obj { + ContextObject::TerrainMesh(m) => m.category_code.as_deref(), + ContextObject::ImportedMesh(m) => m.category_code.as_deref(), + _ => None, + }; + if code.is_some_and(|c| hidden.contains(c)) || matches!(obj, ContextObject::TerrainMesh(m) if m.hidden == Some(true)) { + continue; + } let (pos, idx, id) = match obj { ContextObject::TerrainMesh(m) => { let (pos, idx, _) = crate::excavation::terrain_model_mesh(p, m); @@ -2487,10 +2522,68 @@ pub fn pick_geometry(p: &Project) -> Result { roofs, context_meshes, columns: pick_columns(p), + solids: pick_solids(p), + opening_meshes: pick_hosted_openings(p), drawings: pick_drawing_segs(p, &HashMap::new()), }) } +/// [137] Öffnungen in Dach, Decke oder Gaube (Dachfenster, Deckenöffnung, Gaubenfenster): ihre 3D-Teile +/// (Rahmen, Glas, Eindeckrahmen) als Welt-Dreiecke — sie haben keine Wand-Box wie [`pick_openings`]. +pub fn pick_hosted_openings(p: &Project) -> Vec { + let hosted: Vec<&Opening> = p.openings.as_deref().unwrap_or(&[]).iter().filter(|o| o.host_roof_id.is_some() || o.host_ceiling_id.is_some() || o.host_dormer_id.is_some()).collect(); + if hosted.is_empty() { + return Vec::new(); + } + let mut q = p.clone(); + q.context = None; + q.drawings2d.clear(); + let mut out = Vec::new(); + for o in hosted { + q.openings = Some(vec![o.clone()]); + let tris: Vec = emit_opening_meshes(&q, 1.0).iter().flat_map(|m| extrusion_tris(&m.positions, &m.indices)).collect(); + if !tris.is_empty() { + out.push(PickOpeningMesh { tris, opening_id: o.id.clone() }); + } + } + out +} + +/// [137] Freie Körper (`extrudedSolids`, ohne Abzugskörper) als Prisma über dem Grundriss-Umriss: UK = +/// Geschoss-UK + `baseOffset`, OK = UK + `height`. Näherung für Loft/Rotation/Abzug/Verjüngung — die Hülle +/// (`pickGeometry` in `plan/toWalls3d.ts`) ersetzt die Dreiecke durch das truck-Netz, sobald es geladen ist. +pub fn pick_solids(p: &Project) -> Vec { + let mut out = Vec::new(); + for s in p.extruded_solids.as_deref().unwrap_or(&[]) { + if s.operation.as_deref() == Some("subtract") || !(s.height > 0.0) || s.points.len() < 3 { + continue; + } + let z0 = solid_base_z(p, s); + let foot: Vec<[f64; 2]> = s.points.iter().map(|q| [q.x, q.y]).collect(); + if !(z0.is_finite() && foot.iter().all(|q| q[0].is_finite() && q[1].is_finite())) { + continue; + } + let (pos, idx) = crate::columns3d::prism(&foot, z0, z0 + s.height); + let tris = extrusion_tris(&pos, &idx); + if !tris.is_empty() { + out.push(PickSolid { tris, solid_id: s.id.clone() }); + } + } + out +} + +/// UK eines freien Körpers (Geschoss-UK + `baseOffset`), wie `emitExtrudedSolids`. +pub fn solid_base_z(p: &Project, s: &ExtrudedSolid) -> f64 { + p.floor(&s.level_id).map_or(0.0, |f| f.base_elevation.unwrap_or(0.0)) + s.base_offset.unwrap_or(0.0) +} + +/// Modell-Netz (x, y, z = Höhe) eines plan-abgeleiteten Körpers (render3d `MeshKind::Extrusion`) als +/// Welt-Dreiecke (x, Höhe, y) — ohne Vorzeichenwechsel, anders als Gelände/Import (x, Höhe, −y). +fn extrusion_tris(pos: &[f64], idx: &[u32]) -> Vec { + let at = |i: u32| -> V3 { let i = i as usize * 3; [pos[i], pos[i + 2], pos[i + 1]] }; + idx.chunks_exact(3).filter(|t| t.iter().all(|&i| (i as usize) * 3 + 2 < pos.len())).map(|t| [at(t[0]), at(t[1]), at(t[2])]).collect() +} + /// [137] Stützen als Welt-Dreiecke (Prisma aus Querschnitt und Höhenlage, wie [`emit_columns`]). fn pick_columns(p: &Project) -> Vec { let mut out = Vec::new(); @@ -2504,8 +2597,7 @@ fn pick_columns(p: &Project) -> Vec { continue; } let (pos, idx) = crate::columns3d::prism(&foot, z0, z1); - let at = |i: u32| -> V3 { let i = i as usize * 3; [pos[i], pos[i + 2], -pos[i + 1]] }; - let tris: Vec = idx.chunks_exact(3).filter(|t| t.iter().all(|&i| (i as usize) * 3 + 2 < pos.len())).map(|t| [at(t[0]), at(t[1]), at(t[2])]).collect(); + let tris = extrusion_tris(&pos, &idx); if !tris.is_empty() { out.push(PickColumn { tris, column_id: col.id.clone() }); } @@ -2590,7 +2682,8 @@ mod tests { assert!(bg.iter().any(|tri| tri.iter().all(|q| (q[1] - 1.0).abs() < 1e-6))); } - /// [137] Stützen sind im 3D anwählbar: ihr Prisma kommt mit Id in die Pick-Geometrie (Welt: x, Höhe, −y). + /// [137] Stützen sind im 3D anwählbar: ihr Prisma kommt mit Id in die Pick-Geometrie (Welt: x, Höhe, y — + /// wie render3d `Extrusion`; vorher −y, d. h. gespiegelt zur Darstellung). #[test] fn pick_stuetzen_im_3d() { let p: Project = serde_json::from_value(serde_json::json!({ @@ -2604,10 +2697,86 @@ mod tests { assert_eq!(g.columns.len(), 1); assert_eq!(g.columns[0].column_id, "k1"); let v: Vec<&V3> = g.columns[0].tris.iter().flatten().collect(); - assert!(v.iter().all(|q| (q[0] - 2.0).abs() <= 0.15 + 1e-9 && (q[2] + 3.0).abs() <= 0.15 + 1e-9 && q[1] >= -1e-9 && q[1] <= 2.5 + 1e-9)); + assert!(v.iter().all(|q| (q[0] - 2.0).abs() <= 0.15 + 1e-9 && (q[2] - 3.0).abs() <= 0.15 + 1e-9 && q[1] >= -1e-9 && q[1] <= 2.5 + 1e-9)); assert!(v.iter().any(|q| (q[1] - 2.5).abs() < 1e-9)); } + fn solid_project() -> Project { + serde_json::from_value(serde_json::json!({ + "id": "p", "name": "t", "lineStyles": [], "hatches": [], "components": [], "wallTypes": [], "layers": [], "openings": [], "walls": [], + "drawingLevels": [ + {"id": "EG", "name": "EG", "kind": "floor", "visible": true, "locked": false, "floorHeight": 3.0, "baseElevation": 0.0}, + {"id": "OG", "name": "OG", "kind": "floor", "visible": true, "locked": false, "floorHeight": 3.0, "baseElevation": 3.0}], + "extrudedSolids": [ + {"id": "s1", "type": "extrudedSolid", "levelId": "OG", "points": [{"x": 1, "y": 2}, {"x": 3, "y": 2}, {"x": 3, "y": 5}, {"x": 1, "y": 5}], "height": 1.5, "baseOffset": 0.5}, + {"id": "v1", "type": "extrudedSolid", "levelId": "EG", "points": [{"x": 0, "y": 0}, {"x": 1, "y": 0}, {"x": 1, "y": 1}], "height": 1.0, "operation": "subtract"}], + "drawings2d": [] + })) + .unwrap() + } + + /// [137] Freie Körper sind im 3D anwählbar: Prisma über dem Umriss (Welt x, Höhe, y), UK = Geschoss + Versatz; + /// Abzugskörper (nur Umriss) nicht. Mit Explosion wandern sie mit ihrem Geschoss. + #[test] + fn pick_freie_koerper_im_3d() { + let p = solid_project(); + let g = pick_geometry(&p).unwrap(); + assert_eq!(g.solids.len(), 1); + assert_eq!(g.solids[0].solid_id, "s1"); + let v: Vec<&V3> = g.solids[0].tris.iter().flatten().collect(); + assert!(v.iter().all(|q| (1.0 - 1e-9..=3.0 + 1e-9).contains(&q[0]) && (2.0 - 1e-9..=5.0 + 1e-9).contains(&q[2]) && (3.5 - 1e-9..=5.0 + 1e-9).contains(&q[1]))); + assert!(v.iter().any(|q| (q[1] - 5.0).abs() < 1e-9) && v.iter().any(|q| (q[1] - 3.5).abs() < 1e-9)); + let e = crate::explode3d::pick_geometry(&p, 2.0).unwrap(); + let top = e.solids[0].tris.iter().flatten().map(|q| q[1]).fold(f64::NEG_INFINITY, f64::max); + assert!((top - 7.0).abs() < 1e-9, "{top}"); + } + + /// [137] Dachfenster sind im 3D anwählbar (Netz mit Id); das Dach hat dort ein Loch statt der vollen Fläche. + #[test] + fn pick_dachfenster_im_3d() { + let mut p = sample(); + p.openings.as_mut().unwrap().push(Opening { + id: "DF".into(), + kind: ElementKind::Window, + width: 0.78, + height: 1.18, + host_roof_id: Some("RF1".into()), + host_point: Some(Vec2 { x: 2.5, y: 1.0 }), + ..Default::default() + }); + let g = pick_geometry(&p).unwrap(); + let df = g.opening_meshes.iter().find(|m| m.opening_id == "DF").expect("Dachfenster in der Pick-Geometrie"); + assert!(df.tris.len() > 12); + // Welt (x, Höhe, y): um den Wirtpunkt (2.5, 1.0). + let (cx, cz) = df.tris.iter().flatten().fold((0.0, 0.0), |a, q| (a.0 + q[0], a.1 + q[2])); + let n = (df.tris.len() * 3) as f64; + assert!((cx / n - 2.5).abs() < 1.0 && (cz / n - 1.0).abs() < 1.5, "{} {}", cx / n, cz / n); + assert!(g.roofs.iter().any(|r| r.roof_id == "RF1" && !r.tris.is_empty())); + } + + /// [137] Einzeln ausgeblendetes Gelände (`hidden`) und Gelände einer ausgeblendeten Kategorie fehlen im 3D + /// und in der Pick-Geometrie; ein zweites Netz bleibt. + #[test] + fn gelaende_einzeln_ausblenden() { + let mk = |id: &str, hidden: Option, code: Option<&str>| { + ContextObject::TerrainMesh(TerrainMesh { + id: id.into(), + positions: vec![0.0, 0.0, 0.0, 10.0, 0.0, 0.0, 10.0, 10.0, 1.0], + indices: vec![0.0, 1.0, 2.0], + hidden, + category_code: code.map(Into::into), + ..Default::default() + }) + }; + let mut p = Project { context: Some(vec![mk("a", Some(true), None), mk("b", None, None), mk("c", Some(false), Some("02"))]), ..Default::default() }; + let ids = |p: &Project| pick_geometry(p).unwrap().context_meshes.iter().map(|m| m.context_object_id.clone()).collect::>(); + assert_eq!(ids(&p), vec!["b", "c"]); + assert_eq!(emit_context_meshes(&p).len(), 2); + p.layers = serde_json::from_value(serde_json::json!([{"code": "02", "name": "Gelände", "color": "#000000", "visible": false}])).unwrap(); + assert_eq!(ids(&p), vec!["b"]); + assert_eq!(emit_context_meshes(&p).len(), 1); + } + /// [T4] Import-Mesh glatt: Knickwinkel geht ans 3D (Vorgabe 30°), kantig ohne; JSON `creaseAngle`. #[test] fn import_mesh_glatt_mit_knickwinkel() { diff --git a/src-tauri/core/src/plan/context.rs b/src-tauri/core/src/plan/context.rs index 515fd692..a81318ac 100644 --- a/src-tauri/core/src/plan/context.rs +++ b/src-tauri/core/src/plan/context.rs @@ -73,6 +73,10 @@ pub fn plan_context(c: &Ctx, out: &mut Vec) { if code.is_some_and(|k| !c.shown(k)) { continue; } + // [137] Einzeln ausgeblendetes Gelände (Kategorie bleibt sichtbar). + if matches!(obj, ContextObject::TerrainMesh(t) if t.hidden == Some(true)) { + continue; + } match obj { ContextObject::ContourSet(s) => { // [137] Rahmen als Pick-Fläche (unter dem daraus erzeugten Gelände; Cmd+Klick schaltet durch). diff --git a/src-tauri/core/src/plan/elevation.rs b/src-tauri/core/src/plan/elevation.rs index d9376145..19ccc709 100644 --- a/src-tauri/core/src/plan/elevation.rs +++ b/src-tauri/core/src/plan/elevation.rs @@ -1515,7 +1515,7 @@ pub fn elevation_primitives(p: &Project, level: &LevelSpec, shadows: bool, mono: if acc.min_x.is_finite() && depth_max.is_finite() && !crate::excavation::terrains(p).is_empty() { let terrain_shown = |c: Option<&str>| c.is_none_or(|c| vis.visible(c) && vis.render(c)); for t in crate::excavation::terrains(p) { - if !terrain_shown(t.category_code.as_deref()) { + if !terrain_shown(t.category_code.as_deref()) || t.hidden == Some(true) { continue; } for l in terrain_silhouette(p, t, &frame, (acc.min_x - 6.0, acc.max_x + 6.0), depth_max) { diff --git a/src-tauri/core/src/plan/section.rs b/src-tauri/core/src/plan/section.rs index cd567347..a463bf51 100644 --- a/src-tauri/core/src/plan/section.rs +++ b/src-tauri/core/src/plan/section.rs @@ -1838,7 +1838,8 @@ fn append_terrain_profiles(out: &mut Output, p: &Project, base: (f64, f64), u: ( } let range = lo.is_finite().then_some((lo, hi)); for t in terrains { - if t.positions.len() < 9 { + // [137] Einzeln ausgeblendetes Gelände. + if t.positions.len() < 9 || t.hidden == Some(true) { continue; } out.terrain_id.get_or_insert_with(|| t.id.clone()); diff --git a/src-tauri/core/src/terrain.rs b/src-tauri/core/src/terrain.rs index 013b098f..40fd34ea 100644 --- a/src-tauri/core/src/terrain.rs +++ b/src-tauri/core/src/terrain.rs @@ -1003,10 +1003,78 @@ pub fn smooth_grid(z: &[f64], nx: usize, ny: usize, passes: u32) -> Vec { cur } +/// [137] Höhen eines Raster-Geländes (swissALTI3D: ein Vertex je Rasterpunkt, s. `terrainMeshFromGrid`) mit +/// `passes` weiteren Durchgängen von [`smooth_grid`] glätten. Das Raster wird aus den Vertices selbst +/// zurückgewonnen (eindeutige x- und y-Werte); Vertex-Reihenfolge, Dreiecke und Lage bleiben, nur z ändert sich. +/// `None`, wenn das Netz kein Raster ist (TIN aus Höhenlinien, doppelte Punkte, zu dünn besetzt). +/// Durchgänge sind additiv: k und danach m Durchgänge = k + m Durchgänge. +pub fn resmooth_grid_mesh(positions: &[f64], passes: u32) -> Option> { + if positions.len() < 12 || positions.len() % 3 != 0 || positions.iter().any(|v| !v.is_finite()) { + return None; + } + let n = positions.len() / 3; + let axis = |k: usize| -> Vec { + let mut v: Vec = (0..n).map(|i| positions[i * 3 + k]).collect(); + v.sort_by(|a, b| a.total_cmp(b)); + v.dedup_by(|a, b| (*a - *b).abs() <= 1e-6); + v + }; + let (xs, ys) = (axis(0), axis(1)); + let (nx, ny) = (xs.len(), ys.len()); + // Ein Raster ist mindestens zur Hälfte besetzt (Lücken nur am Rand / ohne Messwert). + if nx < 2 || ny < 2 || nx.saturating_mul(ny) > 2 * n || nx * ny > 50_000_000 { + return None; + } + let find = |v: &[f64], q: f64| -> Option { + let i = v.partition_point(|a| *a < q - 1e-6); + (i < v.len() && (v[i] - q).abs() <= 1e-6).then_some(i) + }; + let mut z = vec![f64::NAN; nx * ny]; + let mut cell = Vec::with_capacity(n); + for i in 0..n { + let (ix, iy) = (find(&xs, positions[i * 3])?, find(&ys, positions[i * 3 + 1])?); + let c = iy * nx + ix; + if !z[c].is_nan() { + return None; + } + z[c] = positions[i * 3 + 2]; + cell.push(c); + } + let sm = smooth_grid(&z, nx, ny, passes); + let mut out = positions.to_vec(); + for (i, c) in cell.into_iter().enumerate() { + out[i * 3 + 2] = sm[c]; + } + Some(out) +} + #[cfg(test)] mod tests { use super::*; + /// [137] Raster-Gelände neu glätten: Raster erkannt, nur z ändert sich, Spitze wird flacher; additiv + /// (1 + 1 = 2 Durchgänge); ein TIN ohne Raster wird abgelehnt. + #[test] + fn raster_gelaende_nachglaetten() { + let mut pos = Vec::new(); + for j in 0..5 { + for i in 0..5 { + pos.extend([i as f64 * 2.0, j as f64 * 2.0, if i == 2 && j == 2 { 10.0 } else { 0.0 }]); + } + } + let one = resmooth_grid_mesh(&pos, 1).unwrap(); + assert!(one[12 * 3 + 2] < 10.0 && one[12 * 3 + 2] > 0.0); + assert!(pos.chunks_exact(3).zip(one.chunks_exact(3)).all(|(a, b)| a[0] == b[0] && a[1] == b[1])); + let two = resmooth_grid_mesh(&pos, 2).unwrap(); + let one_one = resmooth_grid_mesh(&one, 1).unwrap(); + assert!(two.iter().zip(&one_one).all(|(a, b)| (a - b).abs() < 1e-12)); + assert_eq!(resmooth_grid_mesh(&pos, 0).unwrap(), pos); + // Unregelmässige Punkte (TIN aus Höhenlinien): kein Raster. + let tin = vec![0.0, 0.0, 0.0, 1.3, 0.2, 1.0, 0.4, 2.1, 2.0, 3.7, 1.9, 0.5, 2.2, 3.3, 1.0]; + assert!(resmooth_grid_mesh(&tin, 1).is_none()); + assert!(resmooth_grid_mesh(&[f64::NAN; 12], 1).is_none()); + } + fn ring(cx: f64, cy: f64, r: f64, n: usize) -> Vec { (0..n).map(|i| { let a = i as f64 / n as f64 * std::f64::consts::TAU; diff --git a/src-tauri/core/src/web/cmd_create.rs b/src-tauri/core/src/web/cmd_create.rs index 911d3cae..192917a3 100644 --- a/src-tauri/core/src/web/cmd_create.rs +++ b/src-tauri/core/src/web/cmd_create.rs @@ -92,6 +92,14 @@ pub fn terrain_from_contours_opts_json(contours_json: &str, id: &str, smooth: f6 crate::cmd_solid::terrain_from_contours_with(c.as_array().map(Vec::as_slice).unwrap_or(&[]), id, o).to_string() } +/// [137] Raster-Gelände (swissALTI3D) um `passes` Durchgänge nachglätten (`crate::terrain::resmooth_grid_mesh`): +/// neue `positions` (nur z geändert), leer, wenn das Netz kein Raster ist (`passes` 0 = nur prüfen). +#[wasm_bindgen] +pub fn terrain_resmooth_grid(positions: &[f64], passes: f64) -> Vec { + let passes = if passes.is_finite() && passes > 0.0 { passes.min(20.0) as u32 } else { 0 }; + crate::terrain::resmooth_grid_mesh(positions, passes).unwrap_or_default() +} + /// Höhenraster glätten ([T6], `crate::terrain::smooth_grid`): `z` zeilenweise (`nx` Spalten, NaN = kein Wert). #[wasm_bindgen] pub fn terrain_smooth_grid(z: &[f64], nx: f64, ny: f64, passes: f64) -> Vec { diff --git a/src/core/index.ts b/src/core/index.ts index c55fba58..48569e3f 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -162,6 +162,8 @@ export { DRAWING_PICK_TOLERANCE, type PickContextMesh, type PickColumnMesh, + type PickSolidMesh, + type PickOpeningMesh, type PickDrawingSeg, type PickOpening, type PickRoof, diff --git a/src/i18n/de.ts b/src/i18n/de.ts index 2c115e2a..4a7ce582 100644 --- a/src/i18n/de.ts +++ b/src/i18n/de.ts @@ -2099,6 +2099,13 @@ export const de = { "site.terrain.smooth.hint": "Gelände aus den Höhenlinien neu erzeugen (Bruchkanten bleiben, ein Undo-Schritt)", "site.terrain.smooth.raw": "roh (ohne Glättung)", "site.terrain.smooth.level": "Stufe {n}", + "site.terrain.meshVisible": "Dieses Gelände sichtbar", + "site.terrain.meshVisible.hint": "Blendet nur dieses Geländenetz aus (Grundriss, Schnitt, Ansicht, 3D); die Kategorie bleibt eingeschaltet", + "site.terrain.resmooth.hint": "Raster-Gelände (swissALTI3D) zusätzlich glätten — wirkt auf die Höhen des Rasters, ein Undo-Schritt", + "site.terrain.resmooth.unavailable": "Nicht verfügbar: weder Höhenlinien-Satz noch Höhenraster als Quelle (z. B. importiertes TIN)", + "site.terrain.resmooth.current": "{n} Durchgänge", + "site.terrain.resmooth.none": "ungeglättet", + "site.terrain.resmooth.more": "+{n} Durchgänge glätten", "site.type.image": "Luftbild", "site.group.image": "Luftbild", "site.dwgHint": "DWG? Zuerst mit dem gratis ODA File Converter in DXF umwandeln.", diff --git a/src/i18n/en.ts b/src/i18n/en.ts index ab633a60..851a5927 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -2085,6 +2085,13 @@ export const en: Record = { "site.terrain.smooth.hint": "Regenerate the terrain from its contour lines (breaklines kept, one undo step)", "site.terrain.smooth.raw": "raw (no smoothing)", "site.terrain.smooth.level": "Level {n}", + "site.terrain.meshVisible": "This terrain visible", + "site.terrain.meshVisible.hint": "Hides only this terrain mesh (plan, section, elevation, 3D); the category stays on", + "site.terrain.resmooth.hint": "Smooth grid terrain (swissALTI3D) further — acts on the grid heights, one undo step", + "site.terrain.resmooth.unavailable": "Not available: neither a contour set nor a height grid as source (e.g. imported TIN)", + "site.terrain.resmooth.current": "{n} passes", + "site.terrain.resmooth.none": "unsmoothed", + "site.terrain.resmooth.more": "Smooth +{n} passes", "site.excavation.qty": "Cut {cut} m³ · Fill {fill} m³ · Backfill {backfill} m³", "site.excavation.noTerrain": "No terrain below the excavation", "site.type.image": "Aerial", diff --git a/src/model/terrain.ts b/src/model/terrain.ts index 9d5d580c..44c1cf89 100644 --- a/src/model/terrain.ts +++ b/src/model/terrain.ts @@ -75,6 +75,16 @@ export function smoothTerrainGrid(grid: TerrainGrid, passes: number): TerrainGri return { ...grid, z }; } +/** + * [137] Raster-Gelände (swissALTI3D, ein Vertex je Rasterpunkt) um `passes` weitere Durchgänge glätten + * (Rust `terrain.rs::resmooth_grid_mesh`): neue `positions` (nur z geändert), `null`, wenn das Netz kein + * Raster ist (TIN aus Höhenlinien). `passes` 0 prüft nur. + */ +export function resmoothGridTerrain(positions: readonly number[], passes: number): number[] | null { + const out = core().terrain_resmooth_grid(Float64Array.from(positions), passes); + return out.length === positions.length && out.length > 0 ? Array.from(out) : null; +} + /** * Baut ein Terrain-Mesh aus einem regulären Höhenraster (Quad-Gitter → zwei * Dreiecke je Zelle). Fehlende Zellen (`null`) werden ausgelassen; eine Zelle diff --git a/src/model/types.generated.ts b/src/model/types.generated.ts index cc9088b5..054d72d0 100644 --- a/src/model/types.generated.ts +++ b/src/model/types.generated.ts @@ -3119,6 +3119,11 @@ export type TerrainMesh = { smooth?: number; /** [137] Quelle: Id des Höhenlinien-Satzes (`contourSet`), aus dem das Netz erzeugt wurde. */ sourceId?: string; + /** + * [137] Nur dieses Netz ausblenden (Grundriss, Schnitt, Ansicht, 3D, Pick); die Kategorie bleibt + * davon unberührt. Fehlt/false = sichtbar. + */ + hidden?: boolean; }; /** Ein zusammenhängender Textabschnitt mit einheitlicher Formatierung. */ diff --git a/src/panels/ContextObjectProps.tsx b/src/panels/ContextObjectProps.tsx index bc164c0d..f87b1efd 100644 --- a/src/panels/ContextObjectProps.tsx +++ b/src/panels/ContextObjectProps.tsx @@ -1,7 +1,8 @@ // Einstellungen eines Kontext-Objekts (importiertes Mesh, Gelände, Baugrube) — gemeinsam für die Liste im // Panel „Gelände & Kontext" und die Objekt-Info ([137]: ein angeklicktes Gelände bzw. eine Baugrube zeigt // dort dieselben Felder). Gelände zusätzlich: Sichtbarkeit seiner Kategorie und Glättung (aus den -// Höhenlinien neu erzeugt, ein Undo-Schritt). +// Höhenlinien neu erzeugt, ein Undo-Schritt). [137] Dazu: dieses Netz einzeln ausblenden (`hidden`) und +// Raster-Gelände (swissALTI3D, ohne Höhenlinien) additiv nachglätten. // // Bezeichner englisch, UI-Text/Kommentare deutsch. Alle sichtbaren Texte über t(...). @@ -10,6 +11,8 @@ import { usePanelHost } from "./host"; import { useStore } from "../state/appStore"; import type { ContextObject } from "../model/types"; import { flattenCategories } from "../model/types"; +import { resmoothGridTerrain } from "../model/terrain"; +import { useMemo } from "react"; import type { ExcavationQuantity } from "../core"; /** Zahl-Eingabe für ein Feld eines Kontext-Objekts (leer = Standard, ungültig = keine Änderung). */ @@ -54,12 +57,18 @@ function ExcavationQty({ q }: { q: ExcavationQuantity | undefined }) { /** Glättungsstufen der Gelände-Erzeugung (`terrain.rs`, 0 = roh). */ const SMOOTH_LEVELS = [0, 1, 2, 3] as const; +/** [137] Zusätzliche Glättungs-Durchgänge für Raster-Gelände. */ +const RESMOOTH_PASSES = [1, 2, 4] as const; /** Felder eines Kontext-Objekts; `null` für Arten ohne eigene Einstellungen (Höhenlinien, Luftbild). */ export function ContextObjectProps({ obj, quantities }: { obj: ContextObject; quantities: readonly ExcavationQuantity[] }) { const host = usePanelHost(); const notify = useStore((s) => s.notify); const regenerateTerrain = useStore((s) => s.regenerateTerrain); + const resmoothTerrain = useStore((s) => s.resmoothTerrain); + // [137] Raster-Gelände (swissALTI3D) lässt sich ohne Höhenlinien nachglätten; Prüfung nur bei Netz-Wechsel. + const terrainPositions = obj.type === "terrainMesh" ? obj.positions : null; + const isGrid = useMemo(() => (terrainPositions ? resmoothGridTerrain(terrainPositions, 0) !== null : false), [terrainPositions]); const patch = (field: string) => (v: number | undefined) => host.onPatchContextObject(obj.id, { [field]: v }, `site-${obj.id}-${field}`); if (obj.type === "importedMesh") { @@ -86,6 +95,15 @@ export function ContextObjectProps({ obj, quantities }: { obj: ContextObject; qu const hasSource = (host.project.context ?? []).some((o) => o.type === "contourSet"); return (
+ {cat && ( )} + {!hasSource && ( + + )} diff --git a/src/plan/pickTypes.ts b/src/plan/pickTypes.ts index c50e1e46..8232f852 100644 --- a/src/plan/pickTypes.ts +++ b/src/plan/pickTypes.ts @@ -97,8 +97,25 @@ export interface PickContextMesh { contextObjectId: string; } -/** [137] Stütze für den Raycast: WORLD-Dreiecke ihres Prismas (Konvention wie {@link PickContextMesh}). */ +/** [137] Stütze für den Raycast: WORLD-Dreiecke ihres Prismas (x, Höhe, y — wie Wände/Dächer, ohne die + * Nord-Negation der Kontext-Meshes). */ export interface PickColumnMesh { tris: ReadonlyArray; columnId: string; } + +/** + * [137] Freier Körper (`extrudedSolids`, Loft/Rotation/Abzug/B-Rep) für den Raycast: WORLD-Dreiecke + * (x, Höhe, y). Der Kern liefert das Prisma über dem Umriss; sobald das truck-Netz geladen ist, ersetzt + * `pickGeometry` (plan/toWalls3d.ts) es durch dessen Dreiecke. + */ +export interface PickSolidMesh { + tris: ReadonlyArray; + solidId: string; +} + +/** [137] Öffnung ohne Wand (Dachfenster, Deckenöffnung, Gaubenfenster): WORLD-Dreiecke ihrer 3D-Teile. */ +export interface PickOpeningMesh { + tris: ReadonlyArray; + openingId: string; +} diff --git a/src/plan/toWalls3d.pickSolids.test.ts b/src/plan/toWalls3d.pickSolids.test.ts new file mode 100644 index 00000000..82d6da7a --- /dev/null +++ b/src/plan/toWalls3d.pickSolids.test.ts @@ -0,0 +1,81 @@ +// [137] Alles Sichtbare anwählbar im 3D: freie Körper (Prisma aus dem Kern, truck-Netz sobald geladen), +// Stützen lagerichtig (x, Höhe, y wie die Darstellung), Hervorhebung beider, Gelände einzeln ausgeblendet. + +import { describe, expect, it, afterEach } from "vitest"; +import type { Project, TerrainMesh } from "../model/types"; +import { sampleProject } from "../model/sampleProject"; +import { pickGeometry, selectionHighlightLines } from "./toWalls3d"; +import { __setTruckMeshForTest } from "./toWalls3d/extrusions"; +import { pickNearest, type Ray } from "../viewport/raycast3d"; + +const base: Project = { + ...sampleProject, + walls: [], + openings: [], + ceilings: [], + roofs: [], + stairs: [], + context: [], + columns: [ + { id: "k1", type: "column", floorId: "eg", categoryCode: "25", position: { x: 20, y: 3 }, profile: { kind: "rect", width: 0.4, depth: 0.4 }, rotation: 0, height: 2.5 }, + ], + extrudedSolids: [ + { id: "s1", type: "extrudedSolid", levelId: "og", points: [{ x: 30, y: 2 }, { x: 32, y: 2 }, { x: 32, y: 5 }, { x: 30, y: 5 }], height: 1.5, baseOffset: 0.5 }, + { id: "v1", type: "extrudedSolid", levelId: "eg", points: [{ x: 40, y: 0 }, { x: 41, y: 0 }, { x: 41, y: 1 }], height: 1, operation: "subtract" }, + ], +} as Project; + +/** Senkrechter Strahl von oben auf Welt (x, z) — Welt-z = Modell-y bei Bauteilen. */ +const down = (x: number, z: number): Ray => ({ origin: [x, 50, z], dir: [0, -1, 0] }); +const pick = (p: Project, ray: Ray) => { + const g = pickGeometry(p); + return pickNearest(ray, g.walls, g.slabs, g.openings, g.stairs, g.roofs, g.contextMeshes, g.drawings, g.columns, g.solids); +}; + +afterEach(() => __setTruckMeshForTest("s1", null)); + +describe("[137] 3D-Pick freie Körper und Stützen", () => { + it("freier Körper: Prisma über dem Umriss, Abzugskörper nicht; Treffer von oben auf OK", () => { + const g = pickGeometry(base); + expect(g.solids.map((s) => s.solidId)).toEqual(["s1"]); + const hit = pick(base, down(31, 3.5)); + expect(hit?.kind).toBe("solid"); + expect(hit?.id).toBe("s1"); + // OK = OG 2.6 + 0.5 + 1.5 = 4.6 → t = 50 − 4.6. + expect(hit!.t).toBeCloseTo(50 - 4.6, 6); + expect(pick(base, down(40.5, 0.3))).toBeNull(); + }); + + it("geladenes truck-Netz ersetzt die Prisma-Näherung (z. B. Pyramide statt Quader)", () => { + // Pyramide über demselben Umriss, Spitze bei (31, 3.5) auf 4.6 m (Modell x, y, z). + __setTruckMeshForTest("s1", { + positions: [30, 2, 3.1, 32, 2, 3.1, 32, 5, 3.1, 30, 5, 3.1, 31, 3.5, 4.6], + indices: [0, 1, 4, 1, 2, 4, 2, 3, 4, 3, 0, 4, 0, 2, 1, 0, 3, 2], + kind: "extrusion", + color: [1, 1, 1], + } as never); + const hit = pick(base, down(30.1, 2.1)); + expect(hit?.id).toBe("s1"); + // Am Rand der Pyramide nahe der UK statt auf der Prisma-OK. + expect(50 - hit!.t).toBeLessThan(3.3); + }); + + it("Stütze lagerichtig: Welt-z = +y (wie gezeichnet), nicht gespiegelt", () => { + expect(pick(base, down(20, 3))?.kind).toBe("column"); + expect(pick(base, down(20, -3))).toBeNull(); + }); + + it("Hervorhebung für gewählte Stütze und freien Körper", () => { + const rgb: [number, number, number] = [1, 0, 0]; + expect(selectionHighlightLines(base, [], [], rgb, [], [], [], [], 0, ["k1"]).length).toBe(4 * 3 * 12); + expect(selectionHighlightLines(base, [], [], rgb, [], [], [], [], 0, [], ["s1"]).length).toBe(4 * 3 * 12); + }); + + it("einzeln ausgeblendetes Gelände fängt im 3D keinen Klick", () => { + const terrain: TerrainMesh = { id: "t1", type: "terrainMesh", name: "G", positions: [0, 0, 0, 10, 0, 0, 10, 10, 0], indices: [0, 1, 2] }; + const shown = { ...base, context: [{ ...terrain }] } as Project; + expect(pickGeometry(shown).contextMeshes.map((m) => m.contextObjectId)).toEqual(["t1"]); + const hidden = { ...base, context: [{ ...terrain, hidden: true }] } as Project; + expect(pickGeometry(hidden).contextMeshes).toEqual([]); + }); +}); diff --git a/src/plan/toWalls3d.test.ts b/src/plan/toWalls3d.test.ts index cc3ffc99..fcdf7226 100644 --- a/src/plan/toWalls3d.test.ts +++ b/src/plan/toWalls3d.test.ts @@ -2499,8 +2499,9 @@ describe("pickGeometry — Dächer (Ray-Dreieck-Pick)", () => { // sampleProject trägt das Demo-Satteldach RF1. expect(roofs.length).toBe(1); expect(roofs[0].roofId).toBe("RF1"); - // Sattel: 2 Flächen (je 4 Ecken → 2 Dreiecke) + 2 Giebel (je 1 Dreieck) = 6. - expect(roofs[0].tris.length).toBe(6); + // [137] Dachkörper wie gezeichnet (Schichten mit Dicke, Gauben, Löcher der Dachfenster) + 2 Giebel — + // vorher nur die 2 Flächen (4 Dreiecke) + 2 Giebel = 6. + expect(roofs[0].tris.length).toBeGreaterThan(6); // Höhe liegt in der WORLD-Y-Komponente (Index 1) — alle über der Traufe > 0. for (const tri of roofs[0].tris) for (const p of tri) expect(p[1]).toBeGreaterThan(0); }); diff --git a/src/plan/toWalls3d.ts b/src/plan/toWalls3d.ts index 37436933..074a766c 100644 --- a/src/plan/toWalls3d.ts +++ b/src/plan/toWalls3d.ts @@ -44,7 +44,7 @@ import type { Project, Vec2 } from "../model/types"; import type { DetailLevel } from "../model/viewTypes"; import { documentFor } from "../core/document"; import { coreEpoch } from "../engine/coreWasm"; -import type { PickOpening, PickRoof, PickStair, PickContextMesh, PickColumnMesh, PickDrawingSeg } from "./pickTypes"; +import type { PickOpening, PickRoof, PickStair, PickContextMesh, PickColumnMesh, PickSolidMesh, PickOpeningMesh, PickDrawingSeg } from "./pickTypes"; import { type RMesh, type RModel3d, @@ -53,7 +53,7 @@ import { type RVec2, type RWall, } from "./toWalls3d/shared"; -import { emitExtrudedSolids, TRUCK_MESH_READY_EVENT } from "./toWalls3d/extrusions"; +import { emitExtrudedSolids, truckSolidPickTris, TRUCK_MESH_READY_EVENT } from "./toWalls3d/extrusions"; import { applyVoids3d, type VoidCuts } from "./toWalls3d/voids3d"; // Re-Export des gemeinsamen Vokabulars — externe Konsumenten (viewport/, @@ -329,9 +329,20 @@ export function pickGeometry( roofs: PickRoof[]; contextMeshes: PickContextMesh[]; columns: PickColumnMesh[]; + solids: PickSolidMesh[]; + openingMeshes: PickOpeningMesh[]; drawings: PickDrawingSeg[]; } { - return documentFor(project).query("pickGeometry", [explodeGap(explode)]); + const g = documentFor(project).query("pickGeometry", [explodeGap(explode)]) as ReturnType; + // [137] Freie Körper: das geladene truck-Netz (Loft, Rotation, Verjüngung, Rundung) statt der Prisma-Näherung des Kerns. + const gap = explodeGap(explode); + const offsets = gap > 0 ? explodeFloorOffsets(project, gap) : undefined; + const levelOf = new Map((project.extrudedSolids ?? []).map((s) => [s.id, s.levelId])); + g.solids = (g.solids ?? []).map((s) => { + const tris = truckSolidPickTris(s.solidId, offsets?.[levelOf.get(s.solidId) ?? ""] ?? 0); + return tris ? { ...s, tris } : s; + }); + return g; } /** @@ -373,8 +384,11 @@ export function selectionHighlightLines( contextObjectIds: string[] = [], /** Explosionsabstand ([65]); 0 = aus. */ explode = 0, + /** [137] Stützen und freie Körper (Prisma-Umriss). */ + columnIds: string[] = [], + solidIds: string[] = [], ): Float32Array { - const sel = { walls: wallIds, ceilings: ceilingIds, openings: openingIds, stairs: stairIds, roofs: roofIds, context: contextObjectIds }; + const sel = { walls: wallIds, ceilings: ceilingIds, openings: openingIds, stairs: stairIds, roofs: roofIds, context: contextObjectIds, columns: columnIds, solids: solidIds }; if (Object.values(sel).every((l) => l.length === 0)) return new Float32Array(0); // Gerechnet im Kern (`highlight3d.rs`); Antwort f32-LE. const b = documentFor(project).queryBin("selectionHighlight", [], JSON.stringify({ ...sel, rgb, explode: explodeGap(explode) })); diff --git a/src/plan/toWalls3d/extrusions.ts b/src/plan/toWalls3d/extrusions.ts index 0980b505..f04ef614 100644 --- a/src/plan/toWalls3d/extrusions.ts +++ b/src/plan/toWalls3d/extrusions.ts @@ -7,6 +7,7 @@ import { getFloor } from "../../model/types"; import { buildSolidMesh, extrudeCircle, extrudePolygon } from "../../engine/truckSolid"; import { extrudedSolidSpec, needsBrepPath } from "../extrudedSolidSpec"; import type { RMesh, RRgb } from "./shared"; +import type { Vec3 } from "../pickTypes"; /** Warmes Orange für truck-Profil-Extrusionen (hebt sie klar von Wand/Decke/Kontext ab). */ const EXTRUSION_RGB: RRgb = [0.85, 0.55, 0.25]; @@ -104,3 +105,27 @@ export function emitExtrudedSolids( } return out; } + +/** + * [137] Dreiecke des geladenen truck-Netzes eines freien Körpers in WORLD-Koordinaten (x, Höhe, y — wie + * render3d `Extrusion`), um `dz` (Explosion) angehoben; `null`, solange das Netz nicht geladen ist. + */ +export function truckSolidPickTris(solidId: string, dz = 0): [Vec3, Vec3, Vec3][] | null { + const mesh = truckMeshCache.get(solidId)?.mesh; + if (!mesh || mesh.indices.length < 3) return null; + const pos = mesh.positions; + const n = pos.length / 3; + const at = (i: number): Vec3 => [pos[i * 3], pos[i * 3 + 2] + dz, pos[i * 3 + 1]]; + const tris: [Vec3, Vec3, Vec3][] = []; + for (let k = 0; k + 2 < mesh.indices.length; k += 3) { + const [a, b, c] = [mesh.indices[k], mesh.indices[k + 1], mesh.indices[k + 2]]; + if (a < n && b < n && c < n) tris.push([at(a), at(b), at(c)]); + } + return tris.length ? tris : null; +} + +/** Nur für Tests: ein truck-Netz für einen Körper in den Cache legen. */ +export function __setTruckMeshForTest(solidId: string, mesh: RMesh | null): void { + if (mesh) truckMeshCache.set(solidId, { signature: "test", mesh }); + else truckMeshCache.delete(solidId); +} diff --git a/src/state/siteSelection.test.ts b/src/state/siteSelection.test.ts index 91d7d2b2..589424a8 100644 --- a/src/state/siteSelection.test.ts +++ b/src/state/siteSelection.test.ts @@ -78,3 +78,33 @@ describe("[137] Gelände neu glätten", () => { expect(terrain().smooth).toBe(2); }); }); + +describe("[137] Raster-Gelände (swissALTI3D) nachglätten", () => { + it("additive Durchgänge, nur z ändert sich, Undo; TIN aus Höhenlinien wird abgelehnt", () => { + const positions: number[] = []; + for (let j = 0; j < 6; j++) for (let i = 0; i < 6; i++) positions.push(i * 2, j * 2, i === 3 && j === 3 ? 10 : 0); + const indices: number[] = []; + for (let j = 0; j < 5; j++) + for (let i = 0; i < 5; i++) { + const a = j * 6 + i; + indices.push(a, a + 1, a + 7, a, a + 7, a + 6); + } + const grid: TerrainMesh = { id: "alti", type: "terrainMesh", name: "swissALTI3D", positions, indices, smooth: 1 }; + setState({ project: { ...p, context: [grid] }, undoDepth: 0, redoDepth: 0, canUndo: false, canRedo: false }); + getState().clearHistory(); + const cur = () => getState().project.context!.find((c) => c.id === "alti") as TerrainMesh; + expect(getState().resmoothTerrain("alti", 2)).toBe(true); + expect(cur().smooth).toBe(3); + const peak = cur().positions[(3 * 6 + 3) * 3 + 2]; + expect(peak).toBeLessThan(10); + expect(peak).toBeGreaterThan(0); + expect(cur().positions.filter((_, k) => k % 3 !== 2)).toEqual(positions.filter((_, k) => k % 3 !== 2)); + expect(cur().indices).toEqual(indices); + getState().undo(); + expect(cur().positions).toEqual(positions); + expect(cur().smooth).toBe(1); + // Musterhaus-Gelände (TIN aus Höhenlinien) ist kein Raster. + setState({ project: p }); + expect(getState().resmoothTerrain(terrainId, 1)).toBe(false); + }); +}); diff --git a/src/state/siteSlice.ts b/src/state/siteSlice.ts index 3cb12c2f..7a1700a9 100644 --- a/src/state/siteSlice.ts +++ b/src/state/siteSlice.ts @@ -9,7 +9,7 @@ // // Bezeichner englisch, Kommentare deutsch (CONVENTIONS.md). -import { generateTerrainFromContours, type TerrainOptions } from "../model/terrain"; +import { generateTerrainFromContours, resmoothGridTerrain, type TerrainOptions } from "../model/terrain"; import type { ContextObject, Project } from "../model/types"; import { addItems, fieldOps, patchItem, removeItems } from "../core/opsBuild"; import type { CoreOp } from "../core/ops"; @@ -41,6 +41,11 @@ export interface SiteSlice { * `false`, wenn es keine Quelle gibt oder kein Netz entsteht. */ regenerateTerrain: (terrainId: string, smooth: number) => boolean; + /** + * [137] Raster-Gelände (swissALTI3D, ohne Höhenlinien-Quelle) um `passes` Durchgänge nachglätten: + * gleiche Id, nur z geändert, `smooth` zählt die Durchgänge; ein Undo-Schritt. false = kein Raster. + */ + resmoothTerrain: (terrainId: string, passes: number) => boolean; /** Leert die gesamte Kontext-Schicht. */ clearContext: () => void; } @@ -119,6 +124,16 @@ export function createSiteSlice( return true; }, + resmoothTerrain: (terrainId, passes) => { + const terrain = (get().project.context ?? []).find((o) => o.id === terrainId && o.type === "terrainMesh"); + if (!terrain || terrain.type !== "terrainMesh" || !(passes > 0)) return false; + const positions = resmoothGridTerrain(terrain.positions, passes); + if (!positions) return false; + const smooth = (terrain.smooth ?? 0) + passes; + get().applyChange((p) => patchItem(p, "context", terrainId, (o) => ({ ...o, positions, smooth }) as ContextObject)); + return true; + }, + clearContext: () => get().applyChange((p) => fieldOps(p, "context", [])), }; } diff --git a/src/state/useMouseSelectionHandlers.ts b/src/state/useMouseSelectionHandlers.ts index a73e6089..39b708c9 100644 --- a/src/state/useMouseSelectionHandlers.ts +++ b/src/state/useMouseSelectionHandlers.ts @@ -387,6 +387,11 @@ export function useMouseSelectionHandlers(opts: { setSelection({ ...clearKinds(), columns: [hit.id] }); return; } + // [137] Freier Körper (Loft, Rotation, Extrusion): Objekt-Info wie im Grundriss. + if (hit.kind === "solid") { + setSelection({ ...clearKinds(), solids: [hit.id] }); + return; + } if (hit.kind === "roof") { // Schnittlinien bleiben hier (wie bisher) gewählt. setSelection({ ...clearKinds(...ELEMENT_KINDS.filter((k) => k !== "sectionLines")), roofs: [hit.id] }); diff --git a/src/ui/ContextImportDialog.tsx b/src/ui/ContextImportDialog.tsx index 55feefa6..d08ae518 100644 --- a/src/ui/ContextImportDialog.tsx +++ b/src/ui/ContextImportDialog.tsx @@ -280,7 +280,8 @@ export function ContextImportDialog({ let terrain: TerrainMesh | null = null; if (terrainResult?.grid) { const mesh = terrainMeshFromGrid(smoothTerrainGrid(terrainResult.grid, terrainSmooth)); - if (mesh.positions.length >= 9) terrain = mesh; + // [137] Glättung (Durchgänge) merken: die Objekt-Info glättet Raster-Gelände additiv nach. + if (mesh.positions.length >= 9) terrain = { ...mesh, smooth: terrainSmooth }; } // SWISSIMAGE-Luftbild (WMS) → georeferenziertes Rasterbild (EIN ContextImage). diff --git a/src/viewport/Wasm3DViewport.tsx b/src/viewport/Wasm3DViewport.tsx index d366cd19..0616a37b 100644 --- a/src/viewport/Wasm3DViewport.tsx +++ b/src/viewport/Wasm3DViewport.tsx @@ -81,7 +81,7 @@ import { /** Ein per 3D-Klick getroffenes Bauteil, oder null (Leerraum). */ export type Pick3dHit = - | { kind: "wall" | "ceiling" | "opening" | "stair" | "roof" | "contextObject" | "drawing" | "column"; id: string } + | { kind: "wall" | "ceiling" | "opening" | "stair" | "roof" | "contextObject" | "drawing" | "column" | "solid"; id: string } | null; /** Klick-vs-Drag-Schwelle (Pixel): bleibt die Maus zwischen pointerdown und @@ -1406,7 +1406,7 @@ export function Wasm3DViewport({ const ndc = toNdc(clientX, clientY); if (!cb || !o || !ndc) return; const ray = cameraRay(orbitCamera(o), ndc.ndcX, ndc.ndcY, ndc.aspect); - const { walls, slabs, openings, stairs, roofs, contextMeshes, drawings, columns } = pickGeometry( + const { walls, slabs, openings, stairs, roofs, contextMeshes, drawings, columns, solids, openingMeshes } = pickGeometry( projectRef.current, explodeRef.current, ); @@ -1414,7 +1414,7 @@ export function Wasm3DViewport({ // Meshes + freie 2D-Zeichnungen (Linie/Polylinie/Rechteck, s. // `pickDrawingSegs`) — sonst wären im WASM-Viewport 2D-Elemente NIE // anwählbar gewesen (Nutzer-Report). - const hit = pickNearest(ray, walls, slabs, openings, stairs, roofs, contextMeshes, drawings, columns); + const hit = pickNearest(ray, walls, slabs, openings, stairs, roofs, contextMeshes, drawings, columns, solids, openingMeshes); cb(hit ? { kind: hit.kind, id: hit.id } : null, additive); }; diff --git a/src/viewport/raycast3d.ts b/src/viewport/raycast3d.ts index bda0df8f..2f8c2ab0 100644 --- a/src/viewport/raycast3d.ts +++ b/src/viewport/raycast3d.ts @@ -18,7 +18,7 @@ import { DRAWING_PICK_TOLERANCE } from "../core"; -import type { Vec3, PickWall, PickOpening, PickDrawingSeg, PickSlab, PickStair, PickRoof, PickContextMesh, PickColumnMesh } from "../core"; +import type { Vec3, PickWall, PickOpening, PickDrawingSeg, PickSlab, PickStair, PickRoof, PickContextMesh, PickColumnMesh, PickSolidMesh, PickOpeningMesh } from "../core"; /** Kamera-Parameter für den Pick-Strahl (Teilmenge von Camera3d). */ export interface RayCamera { @@ -42,7 +42,7 @@ export interface Ray { /** Ergebnis eines Picks: getroffenes Bauteil + Distanz entlang des Strahls. */ export interface PickHit { - kind: "wall" | "ceiling" | "opening" | "stair" | "roof" | "contextObject" | "drawing" | "column"; + kind: "wall" | "ceiling" | "opening" | "stair" | "roof" | "contextObject" | "drawing" | "column" | "solid"; id: string; t: number; /** Bei `kind:"opening"` dieselbe Id wie `id` (ausdrucksstärkerer Zugriff). */ @@ -358,6 +358,8 @@ export function pickNearest( contextMeshes?: readonly PickContextMesh[], drawings?: readonly PickDrawingSeg[], columns?: readonly PickColumnMesh[], + solids?: readonly PickSolidMesh[], + openingMeshes?: readonly PickOpeningMesh[], ): PickHit | null; /** * Nächstes getroffenes Bauteil (kleinstes t) über Wände, Decken, Öffnungen und @@ -378,6 +380,8 @@ export function pickNearest( contextMeshes: readonly PickContextMesh[] = [], drawings: readonly PickDrawingSeg[] = [], columns: readonly PickColumnMesh[] = [], + solids: readonly PickSolidMesh[] = [], + openingMeshes: readonly PickOpeningMesh[] = [], ): PickHit | null { const TIE_EPS = 1e-6; let hit: PickHit | null = null; @@ -433,6 +437,16 @@ export function pickNearest( const t = rayContextMeshTris(ray, { tris: c.tris, contextObjectId: c.columnId }); if (t !== null) consider({ kind: "column", id: c.columnId, t }, 1); } + // [137] Freie Körper (truck-Netz bzw. Prisma-Näherung), Rang wie Wand/Decke. + for (const s of solids) { + const t = rayContextMeshTris(ray, { tris: s.tris, contextObjectId: s.solidId }); + if (t !== null) consider({ kind: "solid", id: s.solidId, t }, 1); + } + // [137] Dachfenster/Deckenöffnungen (Netz): Rang wie Öffnungen in Wänden. + for (const o of openingMeshes) { + const t = rayContextMeshTris(ray, { tris: o.tris, contextObjectId: o.openingId }); + if (t !== null) consider({ kind: "opening", id: o.openingId, t, openingId: o.openingId }, 0); + } return hit; } diff --git a/src/views/viewportContent.tsx b/src/views/viewportContent.tsx index a74eccfa..da423c35 100644 --- a/src/views/viewportContent.tsx +++ b/src/views/viewportContent.tsx @@ -279,7 +279,7 @@ export const Content = memo(function Content({ () => (explode > 0 ? (explodeFloorOffsets(project, explode)[level.id] ?? 0) : 0), [project, explode, level.id], ); - const { walls, ceilings, openings, stairs, roofs, contextObjects } = selection; + const { walls, ceilings, openings, stairs, roofs, contextObjects, columns, solids } = selection; const selectionLines = useMemo( () => walls.length === 0 && @@ -287,10 +287,12 @@ export const Content = memo(function Content({ openings.length === 0 && stairs.length === 0 && roofs.length === 0 && - contextObjects.length === 0 + contextObjects.length === 0 && + columns.length === 0 && + solids.length === 0 ? null - : selectionHighlightLines(project, walls, ceilings, HIGHLIGHT_RGB, openings, stairs, roofs, contextObjects, explode), - [project, explode, walls, ceilings, openings, stairs, roofs, contextObjects], + : selectionHighlightLines(project, walls, ceilings, HIGHLIGHT_RGB, openings, stairs, roofs, contextObjects, explode, columns, solids), + [project, explode, walls, ceilings, openings, stairs, roofs, contextObjects, columns, solids], ); // Kollisionen der letzten Prüfung: rote Hüllquader zusätzlich zur Auswahl-Hervorhebung. const highlightLines = useMemo(() => {