diff --git a/src-tauri/core/src/explode3d.rs b/src-tauri/core/src/explode3d.rs index 7c636206..16b15e28 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,12 @@ pub fn pick_geometry(p: &Project, gap: f64) -> Result { 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..6aa4219f 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)] @@ -170,6 +173,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 +272,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..52497b88 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,14 @@ pub struct PickColumn { pub column_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 +2360,8 @@ 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, pub drawings: Vec, } @@ -2423,7 +2435,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 +2509,46 @@ pub fn pick_geometry(p: &Project) -> Result { roofs, context_meshes, columns: pick_columns(p), + solids: pick_solids(p), drawings: pick_drawing_segs(p, &HashMap::new()), }) } +/// [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 +2562,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 +2647,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 +2662,63 @@ 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] 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/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. */