[141] Merge: Wandecken im Grundriss verbunden
This commit is contained in:
26 files changed
+741
-260
No files matched your search
@@ -95,6 +95,27 @@ pub fn poche_fill(p: HatchPattern) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
/// [141] Drehung einer wandbezogenen Schraffur. Kreuzschraffur und Diagonale unter 45° zur Achse sehen
|
||||
/// um 90° gedreht gleichwertig aus (45° zur Achse bleibt 45° zur Achse); sie drehen nur um den Rest der
|
||||
/// Wandrichtung modulo 90° mit — so laufen sie an rechtwinkligen Ecken, T- und Kreuzstössen (und zwischen
|
||||
/// gleich schräg gestellten Wänden) ohne Fischgrat-Knick durch. Gerichtete Muster (Dämmung, Holz …)
|
||||
/// und Linien längs/quer zur Achse (Dämmung, Putz als Längsstriche) folgen weiter der vollen Wandrichtung.
|
||||
pub fn wall_turn(pattern: HatchPattern, base_angle_deg: f64, wall_angle_deg: f64) -> f64 {
|
||||
let diagonal = ((base_angle_deg.rem_euclid(90.0)) - 45.0).abs() < 1e-6;
|
||||
match pattern {
|
||||
HatchPattern::Crosshatch | HatchPattern::Diagonal if wall_angle_deg.is_finite() && (diagonal || pattern == HatchPattern::Crosshatch) => {
|
||||
let r = wall_angle_deg.rem_euclid(90.0);
|
||||
// Rundungsrest knapp unter 90° (z. B. 89.9999999) zählt als 0.
|
||||
if 90.0 - r < 1e-9 {
|
||||
0.0
|
||||
} else {
|
||||
r
|
||||
}
|
||||
}
|
||||
_ => wall_angle_deg,
|
||||
}
|
||||
}
|
||||
|
||||
/// `resolveHatch`: `None`, wenn die Schraffur fehlt. Ein hängender Linienstil der Schraffur
|
||||
/// (Datei/Import) zählt wie keiner (Vorgabe-Strichstärke 0.13, durchgezogen).
|
||||
pub fn resolve_hatch(p: &Project, hatch_id: &str, wall_angle_deg: Option<f64>, foreground: Option<&str>, placement: Option<(Option<f64>, Option<f64>, Option<Vec2>)>) -> Option<HatchRender> {
|
||||
@@ -103,7 +124,7 @@ pub fn resolve_hatch(p: &Project, hatch_id: &str, wall_angle_deg: Option<f64>, f
|
||||
let (p_angle, p_scale, p_origin) = placement.unwrap_or((None, None, None));
|
||||
let base_angle = p_angle.unwrap_or(h.angle);
|
||||
let angle = match wall_angle_deg {
|
||||
Some(w) if h.relative_to_wall == Some(true) => base_angle - w,
|
||||
Some(w) if h.relative_to_wall == Some(true) => base_angle - wall_turn(h.pattern, base_angle, w),
|
||||
_ => base_angle,
|
||||
};
|
||||
Some(HatchRender {
|
||||
@@ -173,6 +194,20 @@ pub fn resolve_stroke_weight(override_: Option<f64>, source: Option<AttributeSou
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
#[test]
|
||||
fn diagonale_dreht_modulo_90_daemmung_voll() {
|
||||
assert_eq!(wall_turn(HatchPattern::Diagonal, 45.0, 90.0), 0.0);
|
||||
assert_eq!(wall_turn(HatchPattern::Diagonal, 45.0, -90.0), 0.0);
|
||||
assert_eq!(wall_turn(HatchPattern::Diagonal, -45.0, 180.0), 0.0);
|
||||
assert!((wall_turn(HatchPattern::Crosshatch, 0.0, 120.0) - 30.0).abs() < 1e-12);
|
||||
assert!((wall_turn(HatchPattern::Diagonal, 45.0, 89.99999999999) - 0.0).abs() < 1e-12);
|
||||
// Längsstriche (Dämmung als Linien längs der Wand) und gerichtete Muster: volle Drehung.
|
||||
assert_eq!(wall_turn(HatchPattern::Diagonal, 0.0, 90.0), 90.0);
|
||||
assert_eq!(wall_turn(HatchPattern::Insulation, 45.0, 90.0), 90.0);
|
||||
assert_eq!(wall_turn(HatchPattern::Timber, 0.0, -90.0), -90.0);
|
||||
}
|
||||
|
||||
use super::*;
|
||||
use serde_json::json;
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ pub fn plan_svg(parts: &mut [Part], o: &SvgOptions) -> Option<String> {
|
||||
out.push(format!("<polygon points=\"{pl}\" fill=\"{fill}\" stroke=\"none\"{}/>", op(greyed, opacity(4))));
|
||||
if !d.is_empty() {
|
||||
out.push(format!(
|
||||
"<path d=\"{d}\" fill=\"none\" stroke=\"{stroke}\" stroke-width=\"{}\" stroke-linejoin=\"round\"{}/>",
|
||||
"<path d=\"{d}\" fill=\"none\" stroke=\"{stroke}\" stroke-width=\"{}\" stroke-linejoin=\"round\" stroke-linecap=\"round\"{}/>",
|
||||
num(f[2] * mm_to_m),
|
||||
op(greyed, opacity(4))
|
||||
));
|
||||
@@ -196,7 +196,12 @@ pub fn plan_svg(parts: &mut [Part], o: &SvgOptions) -> Option<String> {
|
||||
}
|
||||
T_LINE => {
|
||||
let color = if fl & F_COLOR != 0 { esc(part.str(f[1]).unwrap_or("")) } else { "#000".into() };
|
||||
let dash = dash_attr(part)?;
|
||||
let mut dash = dash_attr(part)?;
|
||||
// [141] Volle Linien mit runder Kappe wie Bildschirm (render2d) und Druck: Wand-Umrisse
|
||||
// zweier Wände treffen sich an der Ecke ohne Kerbe (Stumpf-Kappe liess sie offen).
|
||||
if dash.is_empty() {
|
||||
dash = " stroke-linecap=\"round\"".into();
|
||||
}
|
||||
out.push(format!(
|
||||
"<line x1=\"{}\" y1=\"{}\" x2=\"{}\" y2=\"{}\" stroke=\"{color}\" stroke-width=\"{}\"{dash}{}/>",
|
||||
xs(f[4]),
|
||||
@@ -349,4 +354,48 @@ mod tests {
|
||||
assert_eq!(op(true, Some(0.5)), " opacity=\"0.35\"");
|
||||
assert_eq!(op(false, Some(1.0)), "");
|
||||
}
|
||||
|
||||
/// [141] Wand-Umrisse als volle Linien bzw. offene Kantenläufe (Stossfugen nicht gestrichen) tragen
|
||||
/// runde Kappen: an der Ecke zweier Wände bleibt keine Kerbe (Stumpf-Kappe, halbe Strichbreite).
|
||||
#[test]
|
||||
fn umriss_mit_runder_kappe() {
|
||||
use crate::model::Vec2;
|
||||
use crate::plan::buf::{View, Writer};
|
||||
use crate::plan::prim::Primitive;
|
||||
let v = |x: f64, y: f64| Vec2 { x, y };
|
||||
let mut w = Writer::new(false);
|
||||
let g = w.begin_group();
|
||||
w.push(&Primitive::Polygon {
|
||||
pts: vec![v(0.0, 0.0), v(4.0, 0.0), v(3.7, 0.3), v(0.3, 0.3)],
|
||||
fill: "#fff".into(),
|
||||
stroke: "#000".into(),
|
||||
stroke_width_mm: 0.5,
|
||||
hatch: crate::plan::style::no_hatch(),
|
||||
greyed: None,
|
||||
opacity: None,
|
||||
no_stroke_edges: Some(vec![1.0, 3.0]),
|
||||
wall_id: None,
|
||||
drawing_id: None,
|
||||
ceiling_id: None,
|
||||
opening_id: None,
|
||||
stair_id: None,
|
||||
room_id: None,
|
||||
extruded_solid_id: None,
|
||||
context_object_id: None,
|
||||
column_id: None,
|
||||
roof_id: None,
|
||||
section_line_id: None,
|
||||
});
|
||||
w.push(&Primitive::Line { a: v(0.0, 0.0), b: v(0.0, 4.0), cls: "wall-outline".into(), weight_mm: 0.5, dash: None, zigzag: None, motif: None, color: Some("#000".into()), drawing_id: None, opening_id: None, stair_id: None, greyed: None, opacity: None });
|
||||
w.end_group(g);
|
||||
let bytes = w.finish();
|
||||
let view = View::parse(&bytes).unwrap();
|
||||
let n = view.len();
|
||||
let mut parts = vec![Part::new(view, 0, n).unwrap()];
|
||||
let svg = plan_svg(&mut parts, &SvgOptions { scale_denominator: 50.0, margin_m: 0.5, min_x: 0.0, min_y: 0.0, max_x: 4.0, max_y: 4.0, hatch: false }).unwrap();
|
||||
let path = svg.lines().find(|l| l.starts_with("<path")).unwrap();
|
||||
assert!(path.contains("stroke-linecap=\"round\""), "{path}");
|
||||
let line = svg.lines().find(|l| l.starts_with("<line")).unwrap();
|
||||
assert!(line.contains("stroke-linecap=\"round\""), "{line}");
|
||||
}
|
||||
}
|
||||
@@ -317,10 +317,27 @@ fn subtract_holes(s: f64, e: f64, holes: &[Hole], s_cut: Option<Line>, e_cut: Op
|
||||
s_cut = Some(h.lb);
|
||||
}
|
||||
}
|
||||
let mut clipped: Vec<Hole> = holes.iter().map(|h| Hole { a: max(s, h.a), b: min(e, h.b), ..*h }).filter(|h| h.b > h.a + CUTOUT_EPS).collect();
|
||||
// [141] Reichweite des Bands über die Endschnitte hinaus (Gehrung verlängert die Fläche über das
|
||||
// Achsende): ein Loch nahe der Ecke darf das Reststück zwischen Loch und Gehrung nicht schlucken
|
||||
// (vorher fehlte dort die Umrisslinie, z. B. Innenwand-Stoss an einer Aussenwand-Ecke).
|
||||
let reach = |cut: Option<Line>, base: f64, far: bool| {
|
||||
let mut r = base;
|
||||
if let Some(l) = cut {
|
||||
for off in [lo, hi] {
|
||||
if let Some(p) = f.pos(&l, off) {
|
||||
r = if far { max(r, p) } else { min(r, p) };
|
||||
}
|
||||
}
|
||||
}
|
||||
r
|
||||
};
|
||||
let (s_reach, e_reach) = (reach(s_cut, s, false), reach(e_cut, e, true));
|
||||
let mut clipped: Vec<Hole> = holes.iter().map(|h| Hole { a: max(s_reach, h.a), b: min(e_reach, h.b), ..*h }).filter(|h| h.b > h.a + CUTOUT_EPS).collect();
|
||||
clipped.sort_by(|p, q| p.a.partial_cmp(&q.a).unwrap_or(std::cmp::Ordering::Equal));
|
||||
let mut parts = Vec::new();
|
||||
let (mut cursor, mut cursor_line) = (s, s_cut);
|
||||
// Loch vor dem Achsanfang (in der Gehrungs-Verlängerung): das Stück davor beginnt an der Gehrung.
|
||||
let first_before = clipped.first().is_some_and(|h| h.a < s - CUTOUT_EPS);
|
||||
let (mut cursor, mut cursor_line) = (if first_before { s_reach } else { s }, s_cut);
|
||||
for h in clipped {
|
||||
if h.a > cursor + CUTOUT_EPS {
|
||||
parts.push((cursor, h.a, cursor_line, Some(h.la)));
|
||||
@@ -332,6 +349,8 @@ fn subtract_holes(s: f64, e: f64, holes: &[Hole], s_cut: Option<Line>, e_cut: Op
|
||||
}
|
||||
if cursor < e - CUTOUT_EPS {
|
||||
parts.push((cursor, e, cursor_line, e_cut));
|
||||
} else if cursor < e_reach - CUTOUT_EPS {
|
||||
parts.push((cursor, e_reach, cursor_line, e_cut));
|
||||
}
|
||||
if !holes.is_empty() {
|
||||
parts.retain(|&(a, b, sc, ec)| {
|
||||
@@ -647,9 +666,27 @@ fn adjusted_segment(o: &mut Out, g: &Seg, thick: &[f64], off0: f64, layer_cuts:
|
||||
offs.push(last + t);
|
||||
}
|
||||
let (off_lo, off_hi) = (off0, offs[n_layers]);
|
||||
// [141] Ragt eine Aussparung über ein Wandende mit Gehrung hinaus, rechnet das Raster ab der
|
||||
// Gehrungs-Spitze (die Bänder werden an den Schnittlinien beschnitten), sonst fehlt das Stück
|
||||
// zwischen Gehrung und Aussparung samt Umriss.
|
||||
let u_w = normalize(sub(g.wend, g.wstart));
|
||||
let fr = Frame { o: g.wstart, u: u_w, n: left_normal(u_w) };
|
||||
let ends_at = |cut: Option<Line>, base: f64, far: bool| {
|
||||
let mut r = base;
|
||||
if let Some(l) = cut {
|
||||
for off in [off_lo, off_hi] {
|
||||
if let Some(p) = fr.pos(&l, off) {
|
||||
r = if far { max(r, p) } else { min(r, p) };
|
||||
}
|
||||
}
|
||||
}
|
||||
r
|
||||
};
|
||||
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();
|
||||
for li in 0..n_layers {
|
||||
let (mut a, mut b) = (s, e);
|
||||
let (mut a, mut b) = (x_lo, x_hi);
|
||||
for ad in adj.iter().filter(|ad| ad.layer == li) {
|
||||
if ad.dir > 0.0 {
|
||||
b = min(b, e - ad.shift);
|
||||
@@ -697,7 +734,7 @@ fn adjusted_segment(o: &mut Out, g: &Seg, thick: &[f64], off0: f64, layer_cuts:
|
||||
}
|
||||
}
|
||||
// Raster der Teilflächen.
|
||||
let mut xs: Vec<f64> = vec![s, e];
|
||||
let mut xs: Vec<f64> = vec![x_lo, x_hi];
|
||||
let mut ys: Vec<f64> = offs.clone();
|
||||
for r in &rects {
|
||||
xs.extend([r.0, r.1]);
|
||||
@@ -778,7 +815,10 @@ fn adjusted_segment(o: &mut Out, g: &Seg, thick: &[f64], off0: f64, layer_cuts:
|
||||
while j1 < ny && kind(at(i as i64 - 1, j1 as i64), at(i as i64, j1 as i64)) == k {
|
||||
j1 += 1;
|
||||
}
|
||||
if k != 0 {
|
||||
// [141] Verschnittenes Wandende (Gehrung, Stoss): dort läuft die Nachbarwand weiter —
|
||||
// keine Umriss-Linie quer über die Ecke (wie die nicht gestrichenen Kanten im Normalfall).
|
||||
let joined_end = (i == 0 && g.sc.is_some()) || (i == nx && g.ec.is_some());
|
||||
if k != 0 && !(k == 1 && joined_end) {
|
||||
let (y0, y1) = (ys[j], ys[j1]);
|
||||
if (x - s).abs() < CUTOUT_EPS && g.sc.is_some() {
|
||||
let q = clipped_band(g.p1, g.p2, y0, y1, g.sc, None);
|
||||
@@ -1057,6 +1097,65 @@ mod tests {
|
||||
assert_eq!(count(&wall_poche(&wall(4.0, false, &[(1.0, 2.0)])), 1.0), 6);
|
||||
}
|
||||
|
||||
/// [141] Schichteinzug an einer Wand mit Gehrung an beiden Enden: keine Umriss-Linie auf den
|
||||
/// Gehrungen (vorher ein Strich quer über jede Ecke, deren Wand ein Fenster mit Einzug hat).
|
||||
#[test]
|
||||
fn schichteinzug_ohne_umriss_auf_der_gehrung() {
|
||||
let mut b = vec![0.0, 0.0, 4.0, 0.0, 0.3, 0.0, 0.0, 0.0, 2.0, 0.1, 0.2];
|
||||
// Gehrung 45° am Start (durch (0,0), Richtung (1,1)), am Ende (durch (4,0), Richtung (-1,1)).
|
||||
b.extend([1.0, 0.0, 0.0, 1.0, 1.0]);
|
||||
b.extend([1.0, 4.0, 0.0, -1.0, 1.0]);
|
||||
b.extend([0.0, 0.0, 1.0, 1.0, 2.0]);
|
||||
b.extend([2.0, 1.0, 1.0, 1.0, 0.05, 0.0, 2.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.03, 0.0, 0.1]);
|
||||
let o = wall_poche(&b);
|
||||
let sm = |a: V| (a.x - a.y).abs() < 1e-9;
|
||||
let em = |a: V| (4.0 - a.x - a.y).abs() < 1e-9;
|
||||
let mut outlines = 0;
|
||||
for p in parse(&o) {
|
||||
if let Prim::Line(art, a, c) = p {
|
||||
if art == LINE_OUTLINE {
|
||||
outlines += 1;
|
||||
assert!(!(sm(a) && sm(c)) && !(em(a) && em(c)), "Umriss auf der Gehrung: {a:?} {c:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
assert!(outlines >= 4);
|
||||
}
|
||||
|
||||
/// [141] Innenwand stösst nahe einer Aussenwand-Ecke an (Anbau-Knoten): die Aussparung im Umriss
|
||||
/// der Eckwand reicht über deren Achsende hinaus, die Gehrung verlängert die Fläche bis zur
|
||||
/// Innenecke — das Reststück zwischen Aussparung und Innenecke wird gezeichnet (vorher Lücke).
|
||||
#[test]
|
||||
fn umriss_zwischen_aussparung_und_gehrung() {
|
||||
use crate::joins::{compute_joins, JoinLayer, JoinWall, Reference};
|
||||
let l = |t: f64, c: u32, p: f64| JoinLayer { thickness: t, component: Some(c), priority: p };
|
||||
let ext = || Some(vec![l(0.02, 3, 10.0), l(0.18, 2, 22.0), l(0.175, 1, 50.0), l(0.015, 0, 10.0)]);
|
||||
let iw = || Some(vec![l(0.01, 0, 10.0), l(0.125, 1, 50.0), l(0.01, 0, 10.0)]);
|
||||
let w = |s: (f64, f64), e: (f64, f64), layers| JoinWall { start: kernel2d::Vec2::new(s.0, s.1), end: kernel2d::Vec2::new(e.0, e.1), reference: Reference::Center, layers, bulge: None };
|
||||
let walls = vec![w((5.0, 10.0), (0.0, 10.0), ext()), w((5.0, 15.0), (5.0, 10.0), ext()), w((10.0, 10.0), (5.0, 10.0), iw())];
|
||||
let c = compute_joins(&walls).unwrap();
|
||||
assert!(!c[1].span_cutouts.is_empty(), "{:?}", c[1]);
|
||||
let out = wall_poche(&poche_of(&walls[1], &c[1]));
|
||||
let corner = super::v(5.195, 9.805);
|
||||
let near = |p: V| hypot2(p.x - corner.x, p.y - corner.y) < 1e-9;
|
||||
let hit = parse(&out).into_iter().any(|p| matches!(p, Prim::Line(art, a, b) if art == LINE_OUTLINE && (near(a) || near(b))));
|
||||
assert!(hit, "keine Umrisslinie bis zur Innenecke");
|
||||
// Gleich am Wandanfang (Loch vor dem Achsanfang): Eckwand beginnt im Knoten.
|
||||
let walls = vec![w((5.0, 10.0), (0.0, 10.0), ext()), w((5.0, 10.0), (5.0, 15.0), ext()), w((10.0, 10.0), (5.0, 10.0), iw())];
|
||||
let c = compute_joins(&walls).unwrap();
|
||||
let out = wall_poche(&poche_of(&walls[1], &c[1]));
|
||||
let hit = parse(&out).into_iter().any(|p| matches!(p, Prim::Line(art, a, b) if art == LINE_OUTLINE && (near(a) || near(b))));
|
||||
assert!(hit, "keine Umrisslinie bis zur Innenecke (Wandanfang)");
|
||||
// Dasselbe mit Fenster samt Schichteinzug im ersten Stück (Raster-Pfad `adjusted_segment`).
|
||||
let mut b = poche_of(&walls[1], &c[1]);
|
||||
b.pop();
|
||||
b.extend([1.0, 2.0, 3.0]);
|
||||
b.extend([1.0, 2.0, 1.0, 3.0, 0.05, 0.0]);
|
||||
let out = wall_poche(&b);
|
||||
let hit = parse(&out).into_iter().any(|p| matches!(p, Prim::Line(art, a, b) if art == LINE_OUTLINE && (near(a) || near(b))));
|
||||
assert!(hit, "keine Umrisslinie bis zur Innenecke (Schichteinzug)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unsinn_ohne_panic() {
|
||||
assert!(wall_poche(&[1.0, 2.0]).is_empty());
|
||||
|
||||
@@ -75,6 +75,39 @@ fn plan_joins(p: &Project, walls: &[EffWall]) -> Result<Vec<WallCuts>, String> {
|
||||
Ok(joins::compute_joins(&jw).unwrap_or_else(|_| vec![WallCuts::default(); walls.len()]))
|
||||
}
|
||||
|
||||
/// [141] Verschneidung nach Ansichtsbereich: geschnittene Wände verschneiden nur untereinander — eine
|
||||
/// Wand ganz unter oder über der Schnittebene (Fundament, Brüstung, Wand im Ansichtsbereich) spart
|
||||
/// keine Schichten der geschnittenen Wand aus (vorher Lücke in Dämmung/Putz über einem Fundament-
|
||||
/// Anschluss). Die nicht geschnittenen Wände verschneiden mit allen sichtbaren (sie enden an den
|
||||
/// Flächen der geschnittenen). Ausgeblendete Wände nehmen nicht teil.
|
||||
fn plan_joins_by_zone(p: &Project, walls: &[EffWall], range: &super::view_range::ViewRange) -> Result<Vec<WallCuts>, String> {
|
||||
use super::view_range::Zone;
|
||||
let zones: Vec<Zone> = walls.iter().map(|e| {
|
||||
let (zb, zt) = p.wall_vertical_extent(e.w);
|
||||
range.classify(zb, zt)
|
||||
}).collect();
|
||||
if zones.iter().all(|z| *z == Zone::Cut) {
|
||||
return plan_joins(p, walls);
|
||||
}
|
||||
let pick = |keep: &dyn Fn(Zone) -> bool| -> (Vec<usize>, Vec<EffWall>) {
|
||||
let idx: Vec<usize> = (0..walls.len()).filter(|&i| keep(zones[i])).collect();
|
||||
let sub = idx.iter().map(|&i| EffWall { w: walls[i].w, color: walls[i].color.clone(), stroke_weight: walls[i].stroke_weight }).collect();
|
||||
(idx, sub)
|
||||
};
|
||||
let mut out = vec![WallCuts::default(); walls.len()];
|
||||
let (vis_idx, vis) = pick(&|z| z != Zone::Hidden);
|
||||
for (k, c) in vis_idx.into_iter().zip(plan_joins(p, &vis)?) {
|
||||
if zones[k] != Zone::Cut {
|
||||
out[k] = c;
|
||||
}
|
||||
}
|
||||
let (cut_idx, cut) = pick(&|z| z == Zone::Cut);
|
||||
for (k, c) in cut_idx.into_iter().zip(plan_joins(p, &cut)?) {
|
||||
out[k] = c;
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// Wand mit angewandten Override-Regeln (Farbe → Umriss/Fugen, Strichstärke).
|
||||
struct EffWall<'a> {
|
||||
w: &'a Wall,
|
||||
@@ -679,10 +712,10 @@ pub fn plan_walls(c: &Ctx, reference_lines: bool, out: &mut Vec<Primitive>, boun
|
||||
EffWall { w, color: ov.color.or_else(|| w.color.clone()), stroke_weight: ov.lineweight.or(w.stroke_weight) }
|
||||
})
|
||||
.collect();
|
||||
let cuts = plan_joins(p, &walls)?;
|
||||
let floor = p.floor(&c.a.floor);
|
||||
let cut_z = floor.and_then(|f| f.base_elevation).unwrap_or(0.0) + floor.and_then(|f| f.cut_height).unwrap_or(1.0);
|
||||
let range = super::view_range::ViewRange::of(p, &c.a.floor);
|
||||
let cuts = plan_joins_by_zone(p, &walls, &range)?;
|
||||
// Bei doppelten Wand-ids gewinnt in TS (Map) die letzte Verschneidung.
|
||||
let mut cut_by_id: HashMap<&str, &WallCuts> = HashMap::new();
|
||||
for (e, k) in walls.iter().zip(&cuts) {
|
||||
@@ -1221,6 +1254,26 @@ pub(crate) mod tests {
|
||||
(polys.iter().map(|q| area(q)).sum(), polys)
|
||||
}
|
||||
|
||||
/// [141] Eine Wand unter der Schnittebene (Fundament, Brüstungsmauer) stösst an eine geschnittene
|
||||
/// Wand: deren Putz bleibt ganz (vorher Nah-Putz-Aussparung wie bei einem geschnittenen Abzweig).
|
||||
#[test]
|
||||
fn niedrige_wand_spart_geschnittene_nicht_aus() {
|
||||
let mut p = pocket_project(DoorTypeKind::Schiebe, None, 1.0);
|
||||
p.openings = None;
|
||||
p.components[0].join_priority = 10.0;
|
||||
p.components[1].join_priority = 50.0;
|
||||
let full = 4.0 * 0.16;
|
||||
let low = Wall { id: "f".into(), floor_id: "eg".into(), wall_type_id: "iw".into(), category_code: "20".into(), start: Vec2 { x: 2.0, y: 0.0 }, end: Vec2 { x: 2.0, y: -2.0 }, height: 0.5, ..Default::default() };
|
||||
p.walls.push(low.clone());
|
||||
let (a, _) = hatched(&wall_prims(&p));
|
||||
assert!((a - full).abs() < 1e-9, "{a} {full}");
|
||||
// Gegenprobe: geschnittener Abzweig spart den Nah-Putz über die Kernbreite aus.
|
||||
p.walls[1].height = 2.6;
|
||||
let (a, _) = hatched(&wall_prims(&p));
|
||||
let branch = 2.0 * 0.16 - 0.08 * 0.16;
|
||||
assert!((a - (full - 0.12 * 0.02 + branch + 0.12 * 0.02)).abs() < 1e-3, "{a}");
|
||||
}
|
||||
|
||||
/// [95] Taschen-Schiebetür: die Tasche (Blattbreite + 5 cm × 7 cm) fehlt in der Schraffur, auf der
|
||||
/// Bandseite; die Fugen laufen nicht durch die Tasche.
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user