[68] Verbau im 3D und in der Ansicht, Einbindetiefe als Feld, Erdreich-Band ohne Loch bei ausgeblendeter Klasse
This commit is contained in:
17 files changed
+277
-24
No files matched your search
@@ -277,7 +277,7 @@ fn append_shoring(out: &mut Output, p: &Project, base: (f64, f64), u: (f64, f64)
|
||||
let hatch_id = crate::excavation::shoring_hatch_id(spec.shore_kind);
|
||||
let hatch = crate::plan::style::resolve_hatch(p, hatch_id, None, None, None)
|
||||
.unwrap_or(HatchRender { pattern: HatchPattern::Diagonal, scale: 1.0, angle: 45.0, color: HATCH_INK.into(), line_weight: 0.1, ..no_hatch_base() });
|
||||
let z_bottom = e.bottom - crate::excavation::SHORING_EMBED;
|
||||
let z_bottom = e.bottom - crate::excavation::shoring_embed(e);
|
||||
for (_, quad) in quads {
|
||||
// Schnitt der Geraden base + s·u mit dem Viereck: erster und letzter Durchgang.
|
||||
let mut ss: Vec<f64> = Vec::new();
|
||||
@@ -360,11 +360,7 @@ fn append_earth(out: &mut Output, p: &Project, base: (f64, f64), u: (f64, f64))
|
||||
return;
|
||||
}
|
||||
let mut band = crate::polygon_bool::union(&band);
|
||||
// [68] Verbauwände stehen im Erdreich: das Band lässt sie aus.
|
||||
if !out.shoring.is_empty() {
|
||||
let walls: Vec<crate::flat::Polygon> = out.shoring.iter().map(|w| vec![w.ring.clone()]).collect();
|
||||
band = crate::polygon_bool::difference(&band, &walls);
|
||||
}
|
||||
// [68] Die Verbauwände lässt erst `section_primitives` aus, und nur die sichtbaren (ausgeblendete Klasse = kein Loch).
|
||||
// Gebäude-Inneres: Abschnitte der Schnittlinie in der Grundfläche.
|
||||
let mut holes: Vec<crate::flat::Polygon> = Vec::new();
|
||||
for poly in crate::site_rules::building_footprint(p) {
|
||||
|
||||
@@ -432,7 +432,18 @@ pub fn section_primitives_mv(out: &Output, mono: bool, hidden_lines: bool, vis:
|
||||
let tov = rules.terrain.as_ref();
|
||||
let terrain_shown = out.profiles.iter().all(|pr| pr.category.as_deref().is_none_or(shown)) && !tov.is_some_and(|(a, _)| a.hidden());
|
||||
if terrain_shown {
|
||||
for (ring, hatch) in &out.earth {
|
||||
// [68] Sichtbare Verbauwände stehen im Erdreich: das Band lässt sie aus.
|
||||
let walls: Vec<crate::flat::Polygon> = out.shoring.iter().filter(|w| shown(&w.category)).map(|w| vec![w.ring.clone()]).collect();
|
||||
let earth: Vec<(Vec<[f64; 2]>, &HatchRender)> = if walls.is_empty() {
|
||||
out.earth.iter().map(|(r, h)| (r.clone(), h)).collect()
|
||||
} else {
|
||||
out.earth
|
||||
.iter()
|
||||
.flat_map(|(r, h)| crate::polygon_bool::difference(&[vec![r.clone()]], &walls).into_iter().filter_map(move |poly| poly.into_iter().next().filter(|o| o.len() >= 3).map(|o| (o, h))))
|
||||
.collect()
|
||||
};
|
||||
for (ring, hatch) in &earth {
|
||||
let hatch: &HatchRender = hatch;
|
||||
let hatch = match tov.and_then(|(_, l)| l.hatch.as_deref()) {
|
||||
Some("none") => no_hatch(),
|
||||
Some("material") | None => hatch.clone(),
|
||||
|
||||
@@ -900,8 +900,79 @@ fn verbauwand_im_schnitt() {
|
||||
assert!(wall_area > 1.0);
|
||||
// Klasse aus: keine Wand.
|
||||
let vis = Visibility { has_vis: true, invisible: ["07".to_string()].into_iter().collect(), ..Default::default() };
|
||||
let (prims, _) = section_primitives(&out, false, false, &vis);
|
||||
assert!(!prims.iter().any(|q| matches!(q, Primitive::Polygon { context_object_id: Some(id), .. } if id == "bg")));
|
||||
let (prims2, _) = section_primitives(&out, false, false, &vis);
|
||||
assert!(!prims2.iter().any(|q| matches!(q, Primitive::Polygon { context_object_id: Some(id), .. } if id == "bg")));
|
||||
// Ohne die Wand kein Loch im Erdreich-Band: die Fläche wächst um (mindestens) die Wandfläche.
|
||||
let earth_area = |pr: &[Primitive]| -> f64 {
|
||||
pr.iter()
|
||||
.filter_map(|q| match q {
|
||||
Primitive::Polygon { pts, hatch, .. } if hatch.pattern == HatchPattern::Earth => Some((0..pts.len()).map(|i| pts[i].x * pts[(i + 1) % pts.len()].y - pts[(i + 1) % pts.len()].x * pts[i].y).sum::<f64>().abs() / 2.0),
|
||||
_ => None,
|
||||
})
|
||||
.sum()
|
||||
};
|
||||
assert!(earth_area(&prims2) > earth_area(&prims) + 0.5, "{} {} {wall_area}", earth_area(&prims2), earth_area(&prims));
|
||||
}
|
||||
|
||||
/// [68] Verbau in der Ansicht: Wandflächen der Baugrube (Pick = Baugrube), Klasse steuert sie.
|
||||
#[test]
|
||||
fn verbauwand_in_der_ansicht() {
|
||||
let (p, _) = shoring_site();
|
||||
let lv = level(&p, "ansicht-sued");
|
||||
let run = |vis: &Visibility| super::super::elevation::elevation_primitives(&p, &lv, false, false, vis, 100.0).unwrap().unwrap().0;
|
||||
let has = |ep: &[Primitive]| ep.iter().any(|q| matches!(q, Primitive::Polygon { context_object_id: Some(id), .. } if id == "bg"));
|
||||
assert!(has(&run(&Visibility::default())), "Verbau in der Ansicht");
|
||||
let vis = Visibility { has_vis: true, invisible: ["07".to_string()].into_iter().collect(), ..Default::default() };
|
||||
assert!(!has(&run(&vis)), "Klasse aus: kein Verbau");
|
||||
}
|
||||
|
||||
fn shoring_site() -> (Project, Excavation) {
|
||||
let mut p = sample();
|
||||
let flat = TerrainMesh {
|
||||
id: "t".into(),
|
||||
positions: vec![-50.0, -50.0, 0.0, 50.0, -50.0, 0.0, 50.0, 50.0, 0.0, -50.0, 50.0, 0.0],
|
||||
indices: vec![0.0, 1.0, 2.0, 0.0, 2.0, 3.0],
|
||||
category_code: "02".into(),
|
||||
..Default::default()
|
||||
};
|
||||
let pit = Excavation {
|
||||
id: "bg".into(),
|
||||
category_code: "07".into(),
|
||||
outline: vec![Vec2 { x: -1.0, y: -1.0 }, Vec2 { x: 6.0, y: -1.0 }, Vec2 { x: 6.0, y: 5.0 }, Vec2 { x: -1.0, y: 5.0 }],
|
||||
bottom: -2.0,
|
||||
edge_shoring: Some(vec![true; 4]),
|
||||
..Default::default()
|
||||
};
|
||||
p.context = Some(vec![ContextObject::TerrainMesh(flat), ContextObject::Excavation(pit.clone())]);
|
||||
(p, pit)
|
||||
}
|
||||
|
||||
/// [68] Einbindetiefe als Feld: `shoringEmbed` ersetzt die Vorgabe von 1 m.
|
||||
#[test]
|
||||
fn verbauwand_einbindetiefe_feld() {
|
||||
let mut p = sample();
|
||||
let flat = TerrainMesh {
|
||||
id: "t".into(),
|
||||
positions: vec![-50.0, -50.0, 0.0, 50.0, -50.0, 0.0, 50.0, 50.0, 0.0, -50.0, 50.0, 0.0],
|
||||
indices: vec![0.0, 1.0, 2.0, 0.0, 2.0, 3.0],
|
||||
category_code: "02".into(),
|
||||
..Default::default()
|
||||
};
|
||||
let pit = Excavation {
|
||||
id: "bg".into(),
|
||||
outline: vec![Vec2 { x: -1.0, y: -1.0 }, Vec2 { x: 6.0, y: -1.0 }, Vec2 { x: 6.0, y: 5.0 }, Vec2 { x: -1.0, y: 5.0 }],
|
||||
bottom: -2.0,
|
||||
edge_shoring: Some(vec![true; 4]),
|
||||
shoring_embed: Some(2.5),
|
||||
..Default::default()
|
||||
};
|
||||
p.context = Some(vec![ContextObject::TerrainMesh(flat), ContextObject::Excavation(pit)]);
|
||||
let out = compute_section(&p, &level(&p, "schnitt-a"), &[]).unwrap().unwrap();
|
||||
assert!(!out.shoring.is_empty());
|
||||
for w in &out.shoring {
|
||||
let lo = w.ring.iter().map(|q| q[1]).fold(f64::INFINITY, f64::min);
|
||||
assert!((lo + 4.5).abs() < 1e-6, "{lo}");
|
||||
}
|
||||
}
|
||||
|
||||
fn ov_rule(conds: serde_json::Value, actions: serde_json::Value) -> OverrideRule {
|
||||
|
||||
Reference in new issue
Block a user