Merge [171] Reste

This commit is contained in:
Claude committed 2026-11-10 11:40:07 +00:00
commit 0ab11b2350
29 files changed
+476 -99

No files matched your search

+20 -1
View File
@@ -116,7 +116,26 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `*
- ◐ **[157]** Plan-Review Musterhaus komplex (Schweizer Praxis). Offene Befunde: Marken von Ansichten Nord/West bzw.
Süd/Ost treffen sich im 1:500 an den Ecken; „B-B“ steht bis 2.5 m neben seiner Marke; „Detail und Situation“ auf
Masskette/Höhenkote; Raumstempel verlieren beim Ausweichen die Nutzungszeile; Achsblasen ab 1:200 über Höhenkoten;
Bogenwand-Fenster im Schnitt 1:50 nur Umriss; Höhenkoten im CLI-Schnitt zu weit links. · M
Bogenwand-Fenster im Schnitt 1:50 nur Umriss; Höhenkoten im CLI-Schnitt zu weit links (10.11. [171]: neben dem
Gebauten statt links vom Gelände, Carport/Körper zählen weiter mit). · M
- ◐ **[171]** Plan-Review Runde 2 (10.11., beide Musterhäuser, CLI-SVG `--hatch` in Chromium, nur Linux). Behoben (Kern,
Test je Fix): Sonnenschatten auf Flächen unter dem Ansichtsbereich (grauer Fleck über dem Carport im OG/DG,
`sun::shadow_polygons_plan_in`); Flächenzeile nach Rundungsschritt („16.0 m²“ statt „16 m²“); Schnitt genau am Rand
eines Rundfensters ohne Rechteck-Loch (B-B, DG West); Wand von unten ohne Wand darüber endet unter der Rohdecke,
Bodenaufbau läuft durch (`bands::end_below_floor_buildup`; einfaches Musterhaus W9, komplex OG/UG-Innenwände);
Rundfenster in der Ansicht ohne Quadrat, Fassadenmuster bis an den Rahmen; OG-Ecken unter dem Dach in der Ansicht
verlängert (keine Eckstreifen mit Fuge/Schatten, einfaches Musterhaus); Höhenkoten im Schnitt/in der Ansicht neben
dem Gebauten (`levelMarkerPrimitives` mit Primitiven). Offen: Raumstempel „Wohnen“ (einfaches Musterhaus) liegt auf
Zwischenwand W9 und Schnittlinie A (Anker/Raumumriss in den Daten); Revisionswolken-Text und „▽-2.71“ auf der
Bemassung Süd (Daten); Höhenlinien-Beschriftung („-2.7“) knapp an Masszahlen; Raumstempel ohne Maske über
Schnittlinie (einfaches Musterhaus). Nachtrag 10.11. (Reste): Dämm-Polylinien mit Sehnenfehler ≤ 0.5 mm Modell
(≙ 0.05 mm Papier ab 1:10) statt festen 5° (DG 1:50 komplex 14 MB → 2.6 MB); Haarstrich gegen Fugen
`SEAM_MM` 0.05 → 0.12 (graue Schichtfugen in der schwarzen Schnittfläche 1:100 bei Zoom ≥ 12 px/mm); Stempel-Kürzung
nach Wörtern („Wo./Ess./Küc.“ statt „Wohnen/Essen.“); Reststrich rechts am Rundfenster (Ansicht West) — Lochkanten im
Band um den Rahmen entfallen (`drop_hole_edges`). Weiter offen: Holzwand-Ecke DG 1:50: die Dämmschlaufen beider
Wände treffen sich an der Gehrung versetzt (Schenkel-Knicke, keine Spiegelung; Phase/Gehrung `anchor_band_pattern`);
Ansicht Ost: Schatten-Keile neben dem Erker mit Lücken je Geschoss und Strichreste am Erker. Nicht in der Tauri-App/auf dem Mac
angesehen. · M
- ◐ **[142]** Schatten in zwei Richtungen. Schatten nur im Geschoss nächst ±0.00; Decken/Dächer werfen keinen eigenen
Schatten (Auskragungen, Balkone); Wandöffnungen lassen kein Licht durch; Dach-/Kronenschatten als konvexe Hülle
(`sun.rs`, Kern `plan/`). · M
+55 -7
View File
@@ -737,7 +737,10 @@ pub fn format_stamp_area(area: f64, step: Option<f64>) -> String {
match step {
Some(st) if st > 0.0 => {
let rounded = round(area / st) * st;
js_number(round(rounded * 100.0) / 100.0)
// [171] So viele Stellen wie der Schritt (0.1 → 1, 0.25 → 2, 1 → 0; höchstens 2): gleich breite
// Flächenzeilen im Plan („16.0 m²“ statt „16 m²“ neben „3.9 m²“).
let decimals = [1.0, 10.0].iter().position(|&k: &f64| (st * k - round(st * k)).abs() < 1e-9).unwrap_or(2);
to_fixed(round(rounded * 100.0) / 100.0, decimals)
}
_ => to_fixed(area, 2),
}
@@ -879,12 +882,46 @@ fn ring_bounds(ring: &[[f64; 2]]) -> [f64; 4] {
ring.iter().fold([f64::INFINITY, f64::INFINITY, f64::NEG_INFINITY, f64::NEG_INFINITY], |b, q| [b[0].min(q[0]), b[1].min(q[1]), b[2].max(q[0]), b[3].max(q[1])])
}
/// Namenszeilen auf `n` Zeichen kürzen (n − 1 Zeichen und Punkt), Leerzeichen am Schnitt weg.
/// Namenszeilen auf höchstens `n` Zeichen kürzen. Einzelne Wörter: `n − 1` Zeichen und Punkt, Leerzeichen am
/// Schnitt weg. Zeilen aus mehreren Wörtern (Trenner Leerzeichen, `/`, `-`) kürzen die Wörter der Reihe nach
/// (jeweils das längste um ein Zeichen, mit Punkt, nicht unter 3 Zeichen; kurze Wörter von höchstens 4 Zeichen
/// bleiben) — „Wohnen/Essen/Küche" wird „Wohn./Ess./Küc." statt „Wohnen/Essen." ([171]: kein Wort fällt weg).
fn abbreviate(text: &str, n: usize) -> String {
text.split('\n')
.map(|l| if l.chars().count() <= n { l.to_string() } else { format!("{}.", l.chars().take(n.saturating_sub(1).max(1)).collect::<String>().trim_end()) })
.collect::<Vec<_>>()
.join("\n")
text.split('\n').map(|l| abbreviate_line(l, n)).collect::<Vec<_>>().join("\n")
}
fn abbreviate_line(l: &str, n: usize) -> String {
if l.chars().count() <= n {
return l.to_string();
}
let chop = |l: &str| format!("{}.", l.chars().take(n.saturating_sub(1).max(1)).collect::<String>().trim_end());
// Wörter und Trenner abwechselnd: (Text, ist_Trenner).
let mut parts: Vec<(String, bool)> = Vec::new();
for ch in l.chars() {
let sep = matches!(ch, ' ' | '/' | '-');
match parts.last_mut() {
Some((t, s)) if *s == sep && !sep => t.push(ch),
_ => parts.push((ch.to_string(), sep)),
}
}
let words: Vec<usize> = (0..parts.len()).filter(|&i| !parts[i].1).collect();
if words.len() < 2 {
return chop(l);
}
// Behaltene Zeichen je Wort; ein gekürztes Wort zeigt `keep` Zeichen und einen Punkt.
let full: Vec<usize> = parts.iter().map(|(t, _)| t.chars().count()).collect();
let mut keep = full.clone();
let shown = |i: usize, keep: &[usize]| if keep[i] == full[i] { full[i] } else { keep[i] + 1 };
let total = |keep: &[usize]| (0..parts.len()).map(|i| if parts[i].1 { full[i] } else { shown(i, keep) }).sum::<usize>();
while total(&keep) > n {
let Some(&i) = words.iter().filter(|&&i| full[i] > 4 && shown(i, &keep) > 3).max_by_key(|&&i| (shown(i, &keep), keep[i] == full[i], std::cmp::Reverse(i))) else { return chop(l) };
keep[i] = if keep[i] == full[i] { full[i] - 2 } else { keep[i] - 1 };
}
parts
.iter()
.enumerate()
.map(|(i, (t, sep))| if *sep || keep[i] == full[i] { t.clone() } else { format!("{}.", t.chars().take(keep[i]).collect::<String>()) })
.collect()
}
/// [140] Hindernisse für Raumstempel aus den schon erzeugten Domänen: Treppen (alle Striche), Türschwenk-Bögen,
@@ -1684,6 +1721,13 @@ mod tests {
let (e, pt, _, at) = fit_room_stamp(&name, extra(), ROOM_STAMP_PT, 100.0, &narrow(0.0));
assert_eq!((e.len(), pt, at), (2, ROOM_STAMP_PT, Some(pole)), "nirgends frei: ganzer Stempel mit Überdeckung");
assert_eq!(abbreviate("Bad", 5), "Bad");
// [171] Mehrere Wörter: alle bleiben sichtbar, die Wörter werden gekürzt (nicht der Schluss abgeschnitten).
let a = abbreviate("Wohnen/Essen/Küche", 13);
let w: Vec<&str> = a.split('/').collect();
assert!(a.chars().count() <= 13 && w.len() == 3 && w[0].starts_with("Wo") && w[1].starts_with("Es") && w[2].starts_with("Kü"), "{a}");
assert!(abbreviate("Wohnen/Essen/Küche", 16).starts_with("Wohn."), "genug Platz: längere Wörter");
assert!(abbreviate("E.03 Wohnen/Essen/Küche", 17).starts_with("E.03 "));
assert_eq!(abbreviate("Abstellraum Keller", 40), "Abstellraum Keller");
}
/// [140] L-förmiger Raum ohne eigenen Anker: Stempel im Raum (Pol der Unzugänglichkeit), nicht am
@@ -2701,7 +2745,11 @@ mod tests {
assert_eq!(o[0].align, Align::Center);
assert_eq!(format_stamp_area(12.345, None), "12.35");
assert_eq!(format_stamp_area(12.0, None), "12.00");
assert_eq!(format_stamp_area(12.24, Some(0.5)), "12");
// [171] Stellen nach dem Rundungsschritt: „16.0 m²" neben „3.9 m²", nicht „16 m²".
assert_eq!(format_stamp_area(12.24, Some(0.5)), "12.0");
assert_eq!(format_stamp_area(16.02, Some(0.1)), "16.0");
assert_eq!(format_stamp_area(16.02, Some(0.25)), "16.00");
assert_eq!(format_stamp_area(16.02, Some(0.05)), "16.00");
assert_eq!(format_stamp_area(12.26, Some(0.5)), "12.5");
assert_eq!(format_stamp_area(12.3, Some(0.1)), "12.3");
assert_eq!(format_stamp_area(12.34, Some(1.0)), "12");
+11 -3
View File
@@ -294,7 +294,12 @@ pub(super) fn extend_wall_corners(p: &Project, rwalls: &mut [RWall], u: (f64, f6
for (i, id) in ids.iter().enumerate() {
by_wall.entry(id.as_str()).or_default().push(i);
}
let close = |a: [f64; 2], v: Vec2| (a[0] - v.x).abs() < 1e-6 && (a[1] - v.y).abs() < 1e-6;
// [171] Teilkörper einer Wand (unter dem Dach je Schichtlage quer versetzt) beginnen auf der Querlinie durch
// den Wandanfang, nicht genau in ihm: alle verlängern, die dort liegen.
let close = |a: [f64; 2], v: Vec2, ax: (f64, f64), ht: f64| {
let (rx, ry) = (a[0] - v.x, a[1] - v.y);
(rx * ax.0 + ry * ax.1).abs() < 1e-6 && (rx * -ax.1 + ry * ax.0).abs() <= ht + 1e-6
};
for (k, w) in p.walls.iter().enumerate() {
let e_start = ext[1 + 2 * k];
let e_end = ext[2 + 2 * k];
@@ -311,9 +316,11 @@ pub(super) fn extend_wall_corners(p: &Project, rwalls: &mut [RWall], u: (f64, f6
if (ux * u.0 + uz * u.1).abs() < 0.35 {
continue;
}
let ht = p.wall_type(w).map_or(0.2, |t| t.layers.iter().fold(0.0, |s, l| s + l.thickness)) / 2.0;
if e_start > EPS {
// [141] Kollineare Stossfuge (`joint`): die Nachbarwand setzt fort, nicht verlängern.
if let Some(&i) = pieces.iter().find(|&&i| close(rwalls[i].start, w.start) && !rwalls[i].joint[0]) {
let hit: Vec<usize> = pieces.iter().copied().filter(|&i| close(rwalls[i].start, w.start, (ux, uz), ht) && !rwalls[i].joint[0]).collect();
for i in hit {
let s = rwalls[i].start;
rwalls[i].start = [s[0] - ux * e_start, s[1] - uz * e_start];
// Ebene Oberkante bezieht sich auf den Anfang ([G2]).
@@ -323,7 +330,8 @@ pub(super) fn extend_wall_corners(p: &Project, rwalls: &mut [RWall], u: (f64, f6
}
}
if e_end > EPS {
if let Some(&i) = pieces.iter().find(|&&i| close(rwalls[i].end, w.end) && !rwalls[i].joint[1]) {
let hit: Vec<usize> = pieces.iter().copied().filter(|&i| close(rwalls[i].end, w.end, (ux, uz), ht) && !rwalls[i].joint[1]).collect();
for i in hit {
let e = rwalls[i].end;
rwalls[i].end = [e[0] + ux * e_end, e[1] + uz * e_end];
}
+76 -5
View File
@@ -132,6 +132,36 @@ enum Pending {
Item { depth: f64, rank: Option<f64>, prim: Primitive },
}
/// [171] Reicht das umgebende Rechteck der Fläche bis auf 0.3 m an `c` (die Wandfläche um ein Loch kommt in
/// Stücken, keines muss die Mitte des Lochs umschliessen)?
fn face_contains_bbox(f: &Face, c: Pt) -> bool {
const NEAR: f64 = 0.3;
let (lo, hi) = f.pts.iter().fold(([f64::INFINITY; 2], [f64::NEG_INFINITY; 2]), |(l, h), q| ([l[0].min(q[0]), l[1].min(q[1])], [h[0].max(q[0]), h[1].max(q[1])]));
c[0] >= lo[0] - NEAR && c[0] <= hi[0] + NEAR && c[1] >= lo[1] - NEAR && c[1] <= hi[1] + NEAR
}
/// [171] Kanten des Rechteck-Lochs einer Formöffnung (`b` = Umriss `[x0, y0, x1, y1]` des Rahmens) entfernen: die
/// Seiten auf dem Rand des Umrisses (Quadrat um ein Rundfenster) und Reststücke im Band um den Umriss (das Loch
/// ist um den Einzug der Dämmung ([168]) grösser als die Öffnung; die Füllstücke decken nur bis an den Umriss —
/// dort blieb ein kurzer Strich rechts am Rundfenster stehen).
fn drop_hole_edges(edges: &mut Vec<silhouette::EdgeSeg>, b: [f64; 4]) {
const TOL: f64 = 1e-3;
const REVEAL: f64 = 0.12;
let near = |a: f64, b: f64| (a - b).abs() < TOL;
let inside = |q: Pt| q[0] > b[0] - REVEAL && q[0] < b[2] + REVEAL && q[1] > b[1] - REVEAL && q[1] < b[3] + REVEAL;
let rim_u = |x: f64| x <= b[0] + TOL || x >= b[2] - TOL;
let rim_v = |y: f64| y <= b[1] + TOL || y >= b[3] - TOL;
edges.retain(|e| {
let side = (near(e.a[0], e.b[0]) && rim_u(e.a[0])) || (near(e.a[1], e.b[1]) && rim_v(e.a[1]));
// Ganz im Band ausserhalb einer Seite des Umrisses.
let band = (e.a[0] >= b[2] - TOL && e.b[0] >= b[2] - TOL)
|| (e.a[0] <= b[0] + TOL && e.b[0] <= b[0] + TOL)
|| (e.a[1] >= b[3] - TOL && e.b[1] >= b[3] - TOL)
|| (e.a[1] <= b[1] + TOL && e.b[1] <= b[1] + TOL);
!((side || band) && inside(e.a) && inside(e.b))
});
}
fn outline_line(a: Pt, b: Pt) -> Primitive {
line(v2(a[0], a[1]), v2(b[0], b[1]), "elevation-outline", EDGE_MM, EDGE_INK)
}
@@ -223,8 +253,32 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool,
faces.retain(|f| !f.ov.as_ref().is_some_and(|o| o.hide));
// Ansichtsfarbe und -schraffur ([100]) der sichtbaren Bauteilseite.
let (pattern_lines, pattern_styles) = surface_patterns(p, &mut faces, &frame, scale, mono);
let (mut pattern_lines, mut pattern_styles) = surface_patterns(p, &mut faces, &frame, scale, mono);
let mut openings = collect_openings(p, &frame);
// [171] Formöffnung: Fassaden-Schraffur auch auf den Füllstücken zwischen Umriss und Rechteck-Loch der Wand
// (sonst bleibt um ein Rundfenster ein ungemustertes Quadrat).
{
let mut extra: Vec<Face> = Vec::new();
for op in &openings {
let Some((_, _, fills, wid)) = &op.shape else { continue };
let host = faces.iter().filter(|f| f.role == Role::Wall && f.id == *wid && !f.ov.as_ref().is_some_and(|o| o.hide)).filter(|f| op.pts.iter().any(|q| face_contains_bbox(f, *q))).min_by(|a, b| a.depth_min.total_cmp(&b.depth_min));
let Some(host) = host else { continue };
// Dazu ein Band um die Öffnung: das Loch ist um den Einzug der Dämmung ([168]) grösser als der Umriss.
const BAND: f64 = 0.06;
let b = op.pts.iter().fold([f64::INFINITY, f64::INFINITY, f64::NEG_INFINITY, f64::NEG_INFINITY], |b, q| [b[0].min(q[0]), b[1].min(q[1]), b[2].max(q[0]), b[3].max(q[1])]);
let rect = |x0: f64, y0: f64, x1: f64, y1: f64| vec![[x0, y0], [x1, y0], [x1, y1], [x0, y1]];
let band = [rect(b[0] - BAND, b[1] - BAND, b[2] + BAND, b[1]), rect(b[0] - BAND, b[3], b[2] + BAND, b[3] + BAND), rect(b[0] - BAND, b[1], b[0], b[3]), rect(b[2], b[1], b[2] + BAND, b[3])];
for q in fills.iter().filter(|q| q.len() >= 3).chain(band.iter()) {
extra.push(Face { pts: q.clone(), pd: vec![host.depth; q.len()], depth: host.depth, depth_min: host.depth_min, depth_max: host.depth_max, role: Role::Wall, id: host.id.clone(), fill: host.fill, normal: host.normal, ov: host.ov.clone(), two_sided: false, curved_slab: false });
}
}
if !extra.is_empty() {
let (lines, styles) = surface_patterns(p, &mut extra, &frame, scale, mono);
let k0 = pattern_styles.len();
pattern_styles.extend(styles);
pattern_lines.extend(lines.into_iter().map(|(a, b, d, paint, k)| (a, b, d, paint, k + k0)));
}
}
if !hidden_walls.is_empty() {
let host = |id: &str| p.openings.as_deref().unwrap_or(&[]).iter().find(|o| o.id == id).map(|o| o.host_wall_id.as_str());
openings.retain(|op| !host(&op.id).is_some_and(|w| hidden_walls.contains(w)));
@@ -244,8 +298,10 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool,
}
}
for op in &openings {
occ.extend([op.depth, 4.0]);
for q in &op.pts {
// [171] Formöffnung verdeckt nur in ihrem Umriss (Fassaden-Schraffur bis an den Rahmen des Rundfensters).
let pts: &[Pt] = op.shape.as_ref().map_or(&op.pts[..], |(o, _, _, _)| &o[..]);
occ.extend([op.depth, pts.len() as f64]);
for q in pts {
occ.extend(q);
}
}
@@ -314,7 +370,13 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool,
}
// Kanten exakt ([G4]): Umriss, Knicke und Silhouetten der Flächen, verdeckt durch Flächen und
// Öffnungen davor; Facetten-Fugen der Bogenwände ([T2]) fallen über die Glättungsgruppe weg.
let edges = elevation_edges(p, &faces, &openings, &frame, level.hidden_lines);
let mut edges = elevation_edges(p, &faces, &openings, &frame, level.hidden_lines);
// [171] Formöffnung: die Wand trägt im Modell das Rechteck-Loch; seine Kanten (Quadrat um ein Rundfenster)
// entfallen, den Umriss zeichnet der Rahmen (wie `section::shaped_projection` im Schnitt).
for op in openings.iter().filter(|op| op.shape.is_some()) {
let b = op.pts.iter().fold([f64::INFINITY, f64::INFINITY, f64::NEG_INFINITY, f64::NEG_INFINITY], |b, q| [b[0].min(q[0]), b[1].min(q[1]), b[2].max(q[0]), b[3].max(q[1])]);
drop_hole_edges(&mut edges, b);
}
for (a, b, depth, paint, k) in pattern_lines {
pending.push(Pending::Line { a, b, depth, style: Some(k), paint: Some(paint) });
}
@@ -427,9 +489,18 @@ pub fn elevation_primitives_with(p: &Project, level: &LevelSpec, shadows: bool,
// Formöffnung: das Rechteck-Loch der Wand ausserhalb des Umrisses in Wandfarbe schliessen.
if let Some((_, _, fills, wid)) = &op.shape {
let wall_fill = faces.iter().find(|f| f.role == Role::Wall && f.id == *wid).map_or("#ffffff".to_string(), face_fill);
// [171] Knapp hinter der Wandfläche: die Fassaden-Schraffur der Wand (Musterlinien knapp vor ihr) läuft
// über die Füllung bis an den Rahmen, statt im Rechteck des Lochs auszusetzen.
let face_depth = faces
.iter()
.filter(|f| f.role == Role::Wall && f.id == *wid)
.filter(|f| op.pts.iter().any(|q| face_contains_bbox(f, *q)))
.map(|f| f.depth_min)
.fold(f64::INFINITY, f64::min);
let fill_depth = if face_depth.is_finite() { (face_depth + EPS * 10.0).min(d + EPS * 10.0).max(face_depth + EPS) } else { d + EPS * 10.0 };
for q in fills {
let pts = to_vec(q);
items.push(Item { depth: d + EPS * 10.0, seq, rank: None, prim: polygon(pts, &wall_fill, "none", 0.0, no_hatch()) });
items.push(Item { depth: fill_depth, seq, rank: None, prim: polygon(pts, &wall_fill, "none", 0.0, no_hatch()) });
seq += 1;
}
}
@@ -409,6 +409,66 @@ fn schraeges_rundbogenfenster_als_ellipse() {
assert!(oblique.iter().all(|(rx, ry)| (rx / ry - a.cos()).abs() < 1e-6), "{oblique:?}");
}
/// [171] Rundfenster (Ochsenauge, Musterhaus komplex West/Ost): kein Quadrat um den Kreis — die Kanten des
/// Rechteck-Lochs der Wand entfallen, die Fassaden-Schraffur reicht bis an den Rahmen.
#[test]
fn rundfenster_ohne_rechteck_in_der_ansicht() {
let mut p = sample();
for o in p.openings.iter_mut().flatten().filter(|o| o.id == "O1") {
o.shape = Some(OpeningShape::Rund);
o.height = o.width;
}
let l = p.drawing_levels.iter().find(|l| l.id == "ansicht-sued").unwrap();
let level = LevelSpec::from_json(&serde_json::to_value(l).unwrap());
let (prims, _) = elevation_primitives(&p, &level, false, false, &Visibility::default(), 100.0).unwrap().unwrap();
let bb = prims.iter().filter_map(|pr| if let Primitive::Polygon { pts, opening_id: Some(o), .. } = pr { (o == "O1").then_some(pts) } else { None }).fold([f64::INFINITY, f64::INFINITY, f64::NEG_INFINITY, f64::NEG_INFINITY], |b, pts| pts.iter().fold(b, |b, q| [b[0].min(q.x), b[1].min(q.y), b[2].max(q.x), b[3].max(q.y)]));
assert!(bb[2] > bb[0]);
let tol = 0.02;
let near = |a: f64, b: f64| (a - b).abs() < tol;
let square: Vec<_> = prims
.iter()
.filter_map(|pr| if let Primitive::Line { a, b, cls, .. } = pr { (cls == "elevation-outline").then_some((a, b)) } else { None })
.filter(|(a, b)| {
let inside = |q: &Vec2| q.x > bb[0] - tol && q.x < bb[2] + tol && q.y > bb[1] - tol && q.y < bb[3] + tol;
let side = (near(a.x, b.x) && (near(a.x, bb[0]) || near(a.x, bb[2]))) || (near(a.y, b.y) && (near(a.y, bb[1]) || near(a.y, bb[3])));
inside(a) && inside(b) && side && (a.x - b.x).abs() + (a.y - b.y).abs() > 0.05
})
.collect();
assert!(square.is_empty(), "Rechteck um das Rundfenster: {square:?}");
// [171] Auch kurze Reststücke der Lochkanten (Strich neben dem Rahmen): im Band von 0.12 m um das Fenster
// liegt keine Umrisslinie, ausser dem Rahmen selbst.
let band = 0.12;
let stubs: Vec<_> = prims
.iter()
.filter_map(|pr| if let Primitive::Line { a, b, cls, .. } = pr { (cls == "elevation-outline").then_some((a, b)) } else { None })
.filter(|(a, b)| {
let inside = |q: &Vec2| q.x > bb[0] - band && q.x < bb[2] + band && q.y > bb[1] - band && q.y < bb[3] + band;
inside(a) && inside(b)
})
.collect();
assert!(stubs.is_empty(), "Reststrich am Rundfenster: {stubs:?}");
}
/// [171] Strich rechts am Rundfenster (Ansicht West): ein Reststück der Lochkante im Band (Einzug der Dämmung)
/// ausserhalb des Umrisses entfällt, Kanten der Wand weiter weg bleiben.
#[test]
fn lochkanten_im_band_der_formoeffnung() {
use super::silhouette::EdgeSeg;
let e = |a: Pt, b: Pt| EdgeSeg { a, b, hidden: false, owner: 1 };
let b = [14.45, 6.75, 15.55, 7.9];
let mut edges = vec![
e([15.55, 7.7], [15.6, 7.7]), // Strich im Band rechts: weg
e([15.6, 6.8], [15.6, 7.8]), // Lochkante im Band: weg
e([14.45, 6.75], [15.55, 6.75]), // Seite auf dem Umriss: weg
e([15.55, 7.7], [16.5, 7.7]), // Wandkante, reicht weit hinaus: bleibt
e([10.0, 7.7], [11.0, 7.7]), // woanders: bleibt
e([15.0, 7.0], [15.2, 7.1]), // im Umriss, quer: bleibt (Rahmen/Verdecker entscheiden)
];
drop_hole_edges(&mut edges, b);
let left: Vec<_> = edges.iter().map(|e| (e.a, e.b)).collect();
assert_eq!(left, vec![([15.55, 7.7], [16.5, 7.7]), ([10.0, 7.7], [11.0, 7.7]), ([15.0, 7.0], [15.2, 7.1])]);
}
/// [105] Umfassungszarge in der Ansicht: Spiegel über die Rohbaukante hinaus (Rahmen breiter als
/// die Öffnung), Blatt um die Zarge eingerückt.
#[test]
@@ -839,3 +899,21 @@ fn baustein_ansicht_ohne_materialschraffur() {
assert!(super::super::overrides::effective_layer(p.override_rules.as_deref(), &s, rv.view("section")).fill_color.is_none());
assert!(super::super::overrides::effective_layer(p.override_rules.as_deref(), &s, rv.view("plan")).fill_color.is_none());
}
/// [171] Einfaches Musterhaus, Ansicht Süd: die OG-Wände unter dem Satteldach (Teilkörper je Schichtlage, quer
/// versetzt) werden an den Ecken verlängert wie im EG — keine zurückspringenden Eckstreifen mit Fuge und Schatten.
#[test]
fn ecken_der_wand_unter_dem_dach_ohne_fuge() {
let p = sample();
let l = p.drawing_levels.iter().find(|l| l.id == "ansicht-sued").unwrap();
let level = LevelSpec::from_json(&serde_json::to_value(l).unwrap());
let (prims, _) = elevation_primitives(&p, &level, false, true, &Visibility::default(), 100.0).unwrap().unwrap();
// u = x + 1 (Ansichtslinie ab x = −1): Wandachse der Ecken bei u = 1 bzw. 6, Aussenfläche bei 0.8275 / 6.1725.
let seams: Vec<_> = prims
.iter()
.filter_map(|q| if let Primitive::Line { a, b, cls, .. } = q { (cls == "elevation-outline").then_some((a, b)) } else { None })
.filter(|(a, b)| (a.x - b.x).abs() < 1e-6 && ((a.x - 1.0).abs() < 1e-3 || (a.x - 6.0).abs() < 1e-3) && a.y.min(b.y) >= 2.6 - 1e-6)
.collect();
assert!(seams.is_empty(), "Fugen an den OG-Ecken: {seams:?}");
}
+5 -1
View File
@@ -102,7 +102,11 @@ pub fn sun_shadow(p: &Project, floor: &str, when_ms: Option<f64>, out: &mut Vec<
let (lat, lon) = project_lat_lon(p);
let sun = crate::sun::sun_position(lat, lon, t);
let with_ground = ground_floor_id(p) == Some(floor);
for poly in crate::sun::shadow_polygons_plan(p, sun, cut_z(p, floor), with_ground) {
// [171] Flächen unter der Unterkante des Ansichtsbereichs (samt „darunter sichtbar bis“) zeigt der
// Grundriss nicht — auch ihren Schatten nicht.
let range = super::view_range::ViewRange::of(p, floor);
let min_top = range.bottom.map_or(f64::NEG_INFINITY, |b| b - range.depth);
for poly in crate::sun::shadow_polygons_plan_in(p, sun, cut_z(p, floor), min_top, with_ground) {
for r in crate::sun::without_holes(&poly) {
let mut q = flat_polygon(ring_pts(&r), SUN_SHADOW_FILL, SUN_SHADOW_OPACITY);
if let Primitive::Polygon { context_object_id, .. } = &mut q {
+1 -1
View File
@@ -719,7 +719,7 @@ mod tests {
fn schwarze_flaeche_mit_haarstrich() {
// [157] Dunkle deckende Fläche ohne Strich: Haarstrich in der Füllfarbe (keine helle Fuge im PDF).
let a = poly_node(&[("points", "0,0 1,0 1,1".to_string())], "#0f0f0f", "none", 0.0);
assert!(a.contains(&("stroke", "#0f0f0f".to_string())) && a.contains(&("stroke-width", "0.05".to_string())), "{a:?}");
assert!(a.contains(&("stroke", "#0f0f0f".to_string())) && a.contains(&("stroke-width", "0.12".to_string())), "{a:?}");
let b = poly_node(&[("points", "0,0 1,0 1,1".to_string())], "#ffffff", "none", 0.0);
assert!(b.contains(&("stroke", "none".to_string())), "{b:?}");
let c = poly_node(&[("points", "0,0 1,0 1,1".to_string())], "#0f0f0f", "#222", 0.35);
+33 -1
View File
@@ -671,6 +671,8 @@ pub(super) fn apply_wall_termination(bands: Vec<Cut>, walls: &[Option<&Wall>]) -
if slab_bands.is_empty() {
return bands;
}
// [171] Lage aller Platten- und Wandbänder (für Wände ohne `sliceTermination`, s. `end_below_floor_buildup`).
let bands_meta: Vec<(Kind, [f64; 4], Option<f64>, Option<String>)> = bands.iter().map(|b| (b.kind, bbox(&b.pts), b.join_priority, b.source_id.clone())).collect();
let mut out = Vec::with_capacity(bands.len());
for b in bands {
if b.kind != Kind::Wall {
@@ -679,7 +681,7 @@ pub(super) fn apply_wall_termination(bands: Vec<Cut>, walls: &[Option<&Wall>]) -
}
let term = walls.get(b.index).copied().flatten().and_then(|w| w.slice_termination);
let (Some(term @ (SliceTermination::Below | SliceTermination::Above)), Some(jp)) = (term, b.join_priority) else {
out.push(b);
out.extend(end_below_floor_buildup(b, &bands_meta));
continue;
};
let wb = bbox(&b.pts);
@@ -711,6 +713,36 @@ pub(super) fn apply_wall_termination(bands: Vec<Cut>, walls: &[Option<&Wall>]) -
out
}
/// [171] Wand von unten ohne Wand darüber (einfaches Musterhaus: Innenwand EG bis OK Fertigboden OG): sie endet
/// unter der tragenden Platte, die sie dominiert, statt mit ihrem Rest durch Trittschalldämmung und Unterlagsboden
/// zu stechen. Nur wenn der Rest über der Platte (< 0.5 m) ganz im Plattenaufbau liegt und keine andere Wand darauf
/// steht (sonst bleibt der Stoss wie bisher: Wand darüber, Aufbau stösst an).
fn end_below_floor_buildup(b: Cut, meta: &[(Kind, [f64; 4], Option<f64>, Option<String>)]) -> Vec<Cut> {
const EPS: f64 = 1e-6;
let (Some(jp), true) = (b.join_priority, b.pts.len() >= 3) else { return vec![b] };
let wb = bbox(&b.pts);
let covers_u = |r: &[f64; 4]| r[0] <= wb[0] + EPS && r[1] >= wb[1] - EPS;
// Unterste dominierende Platte, die die Wand ganz quert und knapp unter der Wandkrone endet (bei dünnen
// Putzschichten dominiert auch der Unterlagsboden; die Wand endet trotzdem unter der Rohdecke).
let Some(slab) = meta
.iter()
.filter(|(k, r, p, _)| *k == Kind::Slab && p.is_some_and(|q| q > jp) && covers_u(r) && r[2] > wb[2] + EPS && r[3] < wb[3] - EPS && wb[3] - r[3] < 0.5)
.map(|m| m.1)
.min_by(|a, b| a[2].total_cmp(&b[2]))
else {
return vec![b];
};
let stack_top = meta.iter().filter(|(k, r, _, _)| *k == Kind::Slab && covers_u(r) && r[2] >= slab[3] - 1e-4 && r[2] < wb[3]).map(|m| m.1[3]).fold(slab[3], f64::max);
if wb[3] > stack_top + 1e-4 {
return vec![b];
}
let wall_above = meta.iter().any(|(k, r, _, src)| *k == Kind::Wall && *src != b.source_id && r[0] < wb[1] - EPS && r[1] > wb[0] + EPS && r[2] >= slab[3] - 1e-4 && r[2] <= wb[3] + 1e-4);
if wall_above {
return vec![b];
}
clip_band(b, [wb[0], wb[1], wb[2], slab[2]])
}
/// Band auf das Rechteck `[u0, u1, v0, v1]` beschnitten; ein Band mit Anschlag-Nase ([94], kein
/// Rechteck) behält seine Form.
fn clip_band(b: Cut, r: [f64; 4]) -> Vec<Cut> {
+3 -1
View File
@@ -30,9 +30,11 @@ pub(super) fn shaped_wall_cuts(cuts: &mut [Cut], p: &Project, walls_r: &[RWall],
}
let (rx, ry) = (base.0 - wall.start.x, base.1 - wall.start.y);
let along = (rx * u.1 - ry * u.0) / den;
if along <= from + 1e-4 || along >= to - 1e-4 {
// [171] Auch genau am Rand des Rechtecks (Sehne fast 0): sonst bliebe dort das Rechteck-Loch ohne Fenster.
if along < from - 1e-4 || along > to + 1e-4 {
continue;
}
let along = along.clamp(from, to);
let (zb, zt) = opening_extent(p, wall, o);
let Some(poly) = crate::opening_shape::opening_outline(o, to - from, zt - zb) else { continue };
let Some((lo, hi)) = crate::opening_shape::v_range(&poly, along - from) else { continue };
+50
View File
@@ -561,6 +561,55 @@ fn rundbogen_im_schnitt() {
assert!(!ys.is_empty() && ys.iter().all(|y| *y < want + 5e-3), "kein Sturz/Kasten über dem Bogen: {ys:?}");
}
/// [171] Rundfenster, Schnitt genau am Rand seines Rechtecks (Musterhaus komplex, Schnitt B-B im DG): die Wand
/// ist dort ganz (Sehne 0), statt eines leeren Rechteck-Lochs ohne Fenster.
#[test]
fn rundfenster_schnitt_am_rand_ohne_loch() {
let mut p = sample_flush();
for o in p.openings.iter_mut().flatten().filter(|o| o.id == "O1") {
o.shape = Some(OpeningShape::Rund);
o.height = o.width;
}
let o1 = p.openings.as_deref().unwrap().iter().find(|o| o.id == "O1").unwrap().clone();
let w1 = p.walls.iter().find(|w| w.id == o1.host_wall_id).unwrap().clone();
let (u, n) = axis_frame(&w1);
let (zb, zt) = opening_extent(&p, &w1, &o1);
for m in [o1.position, o1.position + o1.width, o1.position + 1e-5] {
let c = (w1.start.x + u.0 * m, w1.start.y + u.1 * m);
let l = LevelSpec { kind: "section".into(), line: Some([Vec2 { x: c.0 - n.0 * 3.0, y: c.1 - n.1 * 3.0 }, Vec2 { x: c.0 + n.0 * 3.0, y: c.1 + n.1 * 3.0 }]), ..Default::default() };
let out = compute_section(&p, &l, &[]).unwrap().unwrap();
let mut iv: Vec<(f64, f64)> = out.cuts.iter().filter(|c| c.kind == Kind::Wall && c.source_id.as_deref() == Some("W1")).map(|c| c.pts.iter().fold((f64::INFINITY, f64::NEG_INFINITY), |(l, h), q| (l.min(q[1]), h.max(q[1])))).collect();
iv.sort_by(|a, b| a.0.total_cmp(&b.0));
// Die Wandbänder decken die ganze Fensterhöhe ohne Lücke.
let mut reach = zb;
for (lo, hi) in &iv {
if *lo <= reach + 1e-3 {
reach = reach.max(*hi);
}
}
assert!(reach >= zt, "Wand bei {m}: Lücke über {reach} ({zb}..{zt}) {iv:?}");
}
}
/// [171] Innenwand des EG ohne Wand darüber (einfaches Musterhaus, W9): sie endet unter der tragenden Platte und
/// sticht nicht durch Trittschalldämmung und Unterlagsboden des OG.
#[test]
fn wand_von_unten_sticht_nicht_durch_den_bodenaufbau() {
let p = sample();
let out = compute_section(&p, &level(&p, "schnitt-a"), &[]).unwrap().unwrap();
let w9_top = out.cuts.iter().filter(|c| c.kind == Kind::Wall && c.source_id.as_deref() == Some("W9")).flat_map(|c| c.pts.iter().map(|q| q[1])).fold(f64::NEG_INFINITY, f64::max);
let slab_bottom = out.cuts.iter().filter(|c| c.kind == Kind::Slab && c.component_id.as_deref() == Some("concrete")).flat_map(|c| c.pts.iter().map(|q| q[1])).fold(f64::INFINITY, f64::min);
assert!(w9_top.is_finite() && slab_bottom.is_finite());
assert!(w9_top <= slab_bottom + 1e-6, "W9 bis {w9_top}, Platte ab {slab_bottom}");
// Der Bodenaufbau über W9 bleibt durchgehend (ein Band je Schicht über die Wand hinweg).
let (u0, u1) = out.cuts.iter().filter(|c| c.kind == Kind::Wall && c.source_id.as_deref() == Some("W9")).flat_map(|c| c.pts.iter().map(|q| q[0])).fold((f64::INFINITY, f64::NEG_INFINITY), |(l, h), x| (l.min(x), h.max(x)));
let over = out.cuts.iter().filter(|c| c.kind == Kind::Slab && c.component_id.as_deref() == Some("screed")).any(|c| {
let (l, h) = c.pts.iter().fold((f64::INFINITY, f64::NEG_INFINITY), |(l, h), q| (l.min(q[0]), h.max(q[0])));
l < u0 - 0.01 && h > u1 + 0.01
});
assert!(over, "Unterlagsboden ohne Unterbruch über W9");
}
/// [T2]/[G3]/[106] Bogenwand: Rundbogen-Fenster im Schnitt (Wand bis an den Bogen) und Schichteinzug
/// am Sturz (Sehne zwischen den Laibungen).
#[test]
@@ -907,3 +956,4 @@ fn puffer_hat_zwei_gruppen() {
let none = section_plan_buf(&p, &[0.0, 0.0], r#"{"level":{"kind":"section"}}"#).unwrap();
assert!(crate::plan::buf::decode(&none).unwrap().1.is_empty());
}
+6 -4
View File
@@ -159,8 +159,10 @@ fn op_json(v: &Value) -> String {
op(greyed, v.get("opacity").map(|o| o.as_f64().unwrap_or(f64::NAN)))
}
/// [157] Haarstrich (Papier-mm) gegen die Fuge zwischen aneinanderstossenden dunklen Flächen.
pub(crate) const SEAM_MM: f64 = 0.05;
/// [157] Haarstrich (Papier-mm) gegen die Fuge zwischen aneinanderstossenden dunklen Flächen. [171] 0.12 statt
/// 0.05: ab etwa 12 px/mm (Zoom in Chromium, Vorschau) blieb bei 0.05 mm (0.6 px) eine helle Haarlinie zwischen den
/// Schichten der schwarzen Schnittfläche (1:100); 0.12 mm deckt sie, die Fläche wächst nur um 0.06 mm.
pub(crate) const SEAM_MM: f64 = 0.12;
/// [157] Deckend dunkle Füllfarbe (`#rgb`, `#rrggbb`, `#rrggbbff`; jeder Kanal ≤ 0x40), die zwischen zwei
/// Flächen eine helle Haarfuge zeigt (Chromium/PDF glätten aneinanderstossende Flächen einzeln): solche
@@ -602,8 +604,8 @@ mod tests {
let svg = plan_svg(&mut parts, &o).unwrap();
let polys: Vec<&str> = svg.lines().filter(|l| l.starts_with("<polygon")).collect();
assert_eq!(polys.len(), 4, "{svg}");
assert!(polys[0].contains("fill=\"#0f0f0f\" stroke=\"#0f0f0f\" stroke-width=\"0.005\""), "{}", polys[0]);
assert!(polys[1].contains("fill=\"#111111\" stroke=\"#111111\" stroke-width=\"0.005\""), "Kantenlauf-Fläche: {}", polys[1]);
assert!(polys[0].contains("fill=\"#0f0f0f\" stroke=\"#0f0f0f\" stroke-width=\"0.012\""), "{}", polys[0]);
assert!(polys[1].contains("fill=\"#111111\" stroke=\"#111111\" stroke-width=\"0.012\""), "Kantenlauf-Fläche: {}", polys[1]);
assert!(polys[2].contains("stroke=\"none\""), "weiss: {}", polys[2]);
assert!(polys[3].contains("stroke=\"none\""), "durchscheinend: {}", polys[3]);
assert!(seam_fill("#000") && seam_fill("#1a1a1aff") && !seam_fill("#6e6e6e") && !seam_fill("none") && !seam_fill("#00000080"));
+26 -4
View File
@@ -946,7 +946,7 @@ fn collect(p: &Project, k: [f64; 2], cut: Option<f64>, ground: Option<&Ground>)
/// Vereinigter Boden-Schatten aller Wände, Körper, Stützen, Decken, Dächer und Bäume des Projekts
/// (leer bei Nacht); mit `cut` wie [`shadow_polygons_plan`] im Geschoss am Gelände.
pub fn shadow_polygons_project(p: &Project, sun: SunPosition, cut: Option<f64>) -> Vec<Polygon> {
shadow_plan(p, sun, cut, true)
shadow_plan(p, sun, cut, f64::NEG_INFINITY, true)
}
/// [142] Schatten im Grundriss mit Schnitthöhe `cut`: auf den sichtbaren Flächen im Freien — Decken,
@@ -954,15 +954,24 @@ pub fn shadow_polygons_project(p: &Project, sun: SunPosition, cut: Option<f64>)
/// am Gelände) auf dem Gelände bzw. ±0.00. Flächen unter einer höheren Decke oder einem Dach (Innenräume,
/// unter Balkonen) und unter einer höheren sichtbaren Fläche zeigen keinen Schatten.
pub fn shadow_polygons_plan(p: &Project, sun: SunPosition, cut: f64, with_ground: bool) -> Vec<Polygon> {
shadow_plan(p, sun, Some(cut), with_ground)
shadow_plan(p, sun, Some(cut), f64::NEG_INFINITY, with_ground)
}
fn shadow_plan(p: &Project, sun: SunPosition, cut: Option<f64>, with_ground: bool) -> Vec<Polygon> {
/// Wie [`shadow_polygons_plan`], Empfänger nur mit Oberkante ab `min_top` ([171]: Unterkante des
/// Ansichtsbereichs; tiefere Flächen zeigt der Grundriss nicht, ihr Schatten schwebte ohne Fläche).
pub fn shadow_polygons_plan_in(p: &Project, sun: SunPosition, cut: f64, min_top: f64, with_ground: bool) -> Vec<Polygon> {
shadow_plan(p, sun, Some(cut), min_top, with_ground)
}
fn shadow_plan(p: &Project, sun: SunPosition, cut: Option<f64>, min_top: f64, with_ground: bool) -> Vec<Polygon> {
let Some(k) = shadow_shift(sun) else { return vec![] };
// [142] Mit Geländenetz fällt der Schatten aufs Gelände (inkl. Baugruben), sonst auf ±0.00.
let site = shadow_terrain(p);
let ground = site.as_deref().map(Ground::of_site);
let (casters, covers, recvs) = collect(p, k, cut, ground.as_ref());
let (casters, covers, mut recvs) = collect(p, k, cut, ground.as_ref());
if !min_top.is_nan() {
recvs.retain(|r| r.top >= min_top - 0.05);
}
let mask = |above: f64| -> Vec<Polygon> {
covers.iter().filter(|c| c.bottom > above + LEVEL_EPS).map(|c| c.region.clone()).chain(recvs.iter().filter(|r| r.top > above + LEVEL_EPS).map(|r| r.region.clone())).collect()
};
@@ -1341,6 +1350,19 @@ mod terrain_tests {
assert!(shadow_polygons_plan(&p, sun, 1.0, false).is_empty());
}
/// [171] Empfänger unter der Unterkante des Ansichtsbereichs (der Grundriss zeigt sie nicht, z. B. das
/// Carport-Dach im OG des Musterhauses komplex) tragen keinen Schatten: sonst schwebt ein grauer Fleck.
#[test]
fn schatten_nicht_auf_flaechen_unter_dem_ansichtsbereich() {
let sun = SunPosition { azimuth: 180.0, elevation: 45.0 };
let solid = serde_json::json!([{"id": "s", "type": "extrudedSolid", "levelId": "eg", "points": rect(0.0, 0.0, 2.0, 2.0), "height": 6.0}]);
let p = project_json(serde_json::json!({ "drawingLevels": levels(), "extrudedSolids": solid, "ceilings": [slab("t", "eg", rect(0.0, 2.0, 2.0, 4.0))] }));
// Terrasse OK 3.0: mit Unterkante 3.0 sichtbar, mit Unterkante 3.5 nicht.
assert!((area(&shadow_polygons_plan_in(&p, sun, 4.0, 3.0, false)) - 4.0).abs() < 1e-6);
assert!(shadow_polygons_plan_in(&p, sun, 4.0, 3.5, false).is_empty());
assert!((area(&shadow_polygons_plan_in(&p, sun, 4.0, f64::NEG_INFINITY, false)) - 4.0).abs() < 1e-6);
}
/// Nicht endliche Werte und Nacht: leer, ohne Panik.
#[test]
fn plan_unsinn_ohne_panik() {
+17 -7
View File
@@ -608,7 +608,7 @@ fn band_curve(poly: &[V2], b: &Band, vc: f64, margin: f64, dx: f64, f: impl Fn(f
/// äussere Tangente verbinden. Obere Bögen sitzen bei `k·P`, untere bei `(k+½)·P`, alle im gleichen
/// Drehsinn durchlaufen: benachbarte Bögen berühren sich, die Schenkel laufen schräg zurück und kreuzen
/// sich kurz über der Unterkante (Spiralfeder von der Seite; Vorlage des Maintainers).
/// Teilung `P` = [`INSULATION_PITCH`] · Dicke · scale. Bögen in Schritten ≤ 5° (so auch DXF-Polylinien).
/// Teilung `P` = [`INSULATION_PITCH`] · Dicke · scale. Bögen mit Sehnenfehler ≤ [`ARC_SAGITTA_M`] (so auch DXF-Polylinien).
fn insulation_runs(poly: &[V2], hatch: &Hatch, scale: f64) -> Vec<Run> {
let Some(b) = band_frame(poly, hatch, scale) else { return Vec::new() };
let mut runs = Vec::new();
@@ -644,8 +644,15 @@ pub fn band_period(pattern: Pattern, t: f64, scale: f64) -> Option<f64> {
pub const INSULATION_PITCH: f64 = 0.22;
/// Abstand der Bögen von den Schichtkanten, Anteil der Dicke (≈ halbe Musterlinie in 1:50).
const INSULATION_INSET: f64 = 0.008;
/// Grösster Winkelschritt der Bögen.
const ARC_STEP_RAD: f64 = 5.0 * PI / 180.0;
/// [171] Grösster Sehnenfehler der Bögen (Modell-m): 0.5 mm ≙ 0.05 mm Papier bei 1:10, bei 1:50 nur 0.01 mm.
/// Die kleinen Schlaufen (Radius meist < 3 cm) brauchen so nur 8–12 Punkte je Bogen statt 36 bei festen 5°.
const ARC_SAGITTA_M: f64 = 0.0005;
/// Winkelschritt eines Bogens vom Radius `r` mit Sehnenfehler ≤ [`ARC_SAGITTA_M`] (höchstens 60°).
fn arc_step(r: f64) -> f64 {
let c = (1.0 - ARC_SAGITTA_M / r).clamp(-1.0, 1.0);
(2.0 * c.acos()).clamp(1e-3, PI / 3.0)
}
/// Eine Dämmschlange im Band (Mitte `vc`, halbe Höhe `h`, Teilung `p`), geclippt. Läuft in −u:
/// oberer Bogen k im Uhrzeigersinn (links → über die Kante → rechts), Schenkel „/" hinab zum unteren
@@ -661,8 +668,9 @@ fn insulation_snake(poly: &[V2], b: &Band, vc: f64, h: f64, p: f64) -> Vec<Run>
let g = jsnum::atan2(p / 2.0, vt - vb);
let (top_from, top_sweep) = (PI + g, PI + 2.0 * g);
let (bot_from, bot_sweep) = (-g, PI - 2.0 * g);
let n_top = (top_sweep / ARC_STEP_RAD).ceil().max(1.0) as usize;
let n_bot = (bot_sweep / ARC_STEP_RAD).ceil().max(1.0) as usize;
let step = arc_step(r);
let n_top = (top_sweep / step).ceil().max(1.0) as usize;
let n_bot = (bot_sweep / step).ceil().max(1.0) as usize;
let k0 = ((b.u0 - b.ua) / p).floor() - 1.0;
let mut k = ((b.u1 - b.ua) / p).ceil() + 1.0;
let mut pts = Vec::new();
@@ -1258,8 +1266,10 @@ mod tests {
// Bogen liegt an der Kante (knapp innen).
let (lo, hi) = extent(&runs, |q| q.y);
assert!(lo > 0.0 && lo < 0.003 && hi < t && hi > t - 0.003, "{lo}..{hi}");
// Segmente: Bogenschritte (Sehne ≤ 2r·sin 2.5°) oder lange Schenkel; Schenkel laufen zurück.
let chord = 2.0 * r * (2.5f64).to_radians().sin() * 1.001;
// Segmente: Bogenschritte (Sehnenfehler ≤ ARC_SAGITTA_M) oder lange Schenkel; Schenkel laufen zurück.
let chord = 2.0 * r * (arc_step(r) / 2.0).sin() * 1.001;
let per_arc = (PI / arc_step(r)).ceil() as usize;
assert!(pts.len() <= (2.0 / p).ceil() as usize * (2 * per_arc + 6), "zu viele Punkte: {}", pts.len());
let mut legs: usize = 0;
for w in pts.windows(2) {
let len = ((w[1].x - w[0].x).powi(2) + (w[1].y - w[0].y).powi(2)).sqrt();
+7 -7
View File
@@ -7,16 +7,16 @@
<text x="0.98291" y="2.31972" font-family="Inter, sans-serif" text-anchor="start"><tspan font-size="0.3528" fill="#111111">Wohnen</tspan></text>
<text x="2.5" y="2.77833" font-family="Inter, sans-serif" text-anchor="middle"><tspan font-size="0.28222" fill="#111111">17.01 m²</tspan></text>
<text x="2.5" y="3.23694" font-family="Inter, sans-serif" text-anchor="middle"><tspan font-size="0.28222" fill="#111111">HNF · Hauptnutzfläche</tspan></text>
<polygon points="-0.1725,4.845 0.8,4.845 0.8,4.5 0.1725,4.5" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="-0.1725,4.845 0.8,4.845 0.8,4.5 0.1725,4.5" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="1.7,4.845 3,4.845 3,4.5 1.7,4.5" fill="#0f0f0f" stroke="#1a1a1a" stroke-width="0.025"/>
<polygon points="4,4.845 5.1725,4.845 4.8275,4.5 4,4.5" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="5.1725,4.845 5.1725,0.5 4.8275,0.845 4.8275,4.5" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="5.1725,0.5 4.4,0.5 4.4,0.845 4.8275,0.845" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="4,4.845 5.1725,4.845 4.8275,4.5 4,4.5" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="5.1725,4.845 5.1725,0.5 4.8275,0.845 4.8275,4.5" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="5.1725,0.5 4.4,0.5 4.4,0.845 4.8275,0.845" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="4.8275,0.845 4.8275,4.5 4,4.5 4,4.845 5.1725,4.845 5.1725,0.5 4.4,0.5 4.4,0.845" fill="none" stroke="#1a1a1a" stroke-width="0.025"/>
<polygon points="3,0.5 -0.1725,0.5 0.1725,0.845 3,0.845" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="-0.1725,0.5 -0.1725,4.845 0.1725,4.5 0.1725,0.845" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="3,0.5 -0.1725,0.5 0.1725,0.845 3,0.845" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="-0.1725,0.5 -0.1725,4.845 0.1725,4.5 0.1725,0.845" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="0.1725,0.845 3,0.845 3,0.5 -0.1725,0.5 -0.1725,4.845 0.8,4.845 0.8,4.5 0.1725,4.5" fill="none" stroke="#1a1a1a" stroke-width="0.025"/>
<polygon points="2.475,4.5 2.475,0.845 2.325,0.845 2.325,4.5" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="2.475,4.5 2.475,0.845 2.325,0.845 2.325,4.5" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<line x1="2.475" y1="4.5" x2="2.475" y2="0.845" stroke="#1a1a1a" stroke-width="0.025"/>
<line x1="2.325" y1="0.845" x2="2.325" y2="4.5" stroke="#1a1a1a" stroke-width="0.025"/>
<polygon points="3.2,4.2725 4.2,4.2725 4.2,1.0725 3.2,1.0725" fill="none" stroke="none" stroke-width="0"/>

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

+28 -31
View File
@@ -2,37 +2,34 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0.1 0 6.8 7.58564" width="68mm" height="75.85641mm">
<rect x="0.1" y="0" width="6.8" height="7.58564" fill="#ffffff"/>
<g stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="4">
<polygon points="5.8275,4.78564 5.8425,4.78564 5.8425,7.08564 5.8275,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="5.8425,4.78564 5.9925,4.78564 5.9925,7.08564 5.8425,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="5.8425,1.88564 5.9925,1.88564 5.9925,4.58564 5.8425,4.58564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="6,4.48564 6.1525,4.48564 6.1525,7.08564 6,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="5.9925,4.78564 6,4.78564 6,7.08564 5.9925,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="5.9925,4.54564 6,4.54564 6,4.58564 5.9925,4.58564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="6.1525,1.88564 6.1725,1.88564 6.1725,7.08564 6.1525,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="0.8275,1.88564 0.8475,1.88564 0.8475,7.08564 0.8275,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="0.8475,4.48564 1,4.48564 1,7.08564 0.8475,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="1,4.78564 1.0075,4.78564 1.0075,7.08564 1,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="1,4.54564 1.0075,4.54564 1.0075,4.58564 1,4.58564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="1.0075,4.78564 1.1575,4.78564 1.1575,7.08564 1.0075,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="1.0075,1.88564 1.1575,1.88564 1.1575,4.58564 1.0075,4.58564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="1.1575,4.78564 1.1725,4.78564 1.1725,7.08564 1.1575,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="3.325,4.78564 3.34,4.78564 3.34,7.08564 3.325,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="3.34,4.78564 3.46,4.78564 3.46,7.08564 3.34,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="3.34,4.48564 3.46,4.48564 3.46,4.58564 3.34,4.58564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="3.46,4.78564 3.475,4.78564 3.475,7.08564 3.46,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="5.8275,1.88564 5.8425,1.88564 5.8425,4.48564 5.8275,4.48564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="5.9925,1.88564 6.1525,1.88564 6.1525,4.48564 5.9925,4.48564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="0.8475,1.88564 1.0075,1.88564 1.0075,4.48564 0.8475,4.48564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="1.1575,1.88564 1.1725,1.88564 1.1725,4.48564 1.1575,4.48564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="1,4.48564 1.0075,4.48564 1.0075,4.54564 1,4.54564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="1.1575,4.48564 3.34,4.48564 3.34,4.54564 1.1575,4.54564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="3.46,4.48564 5.8425,4.48564 5.8425,4.54564 3.46,4.54564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="5.9925,4.48564 6,4.48564 6,4.54564 5.9925,4.54564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="1.1575,4.54564 3.34,4.54564 3.34,4.58564 1.1575,4.58564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="3.46,4.54564 5.8425,4.54564 5.8425,4.58564 3.46,4.58564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="1,4.58564 6,4.58564 6,4.78564 1,4.78564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="0.6,0.5 6.4,0.5 6.4,0.73094 0.6,0.73094" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="4.2,5.69897 4.2,5.99364 5.2,5.99364 5.2,5.69897" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.005"/>
<polygon points="5.8275,4.78564 5.8425,4.78564 5.8425,7.08564 5.8275,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="5.8425,4.78564 5.9925,4.78564 5.9925,7.08564 5.8425,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="5.8425,1.88564 5.9925,1.88564 5.9925,4.58564 5.8425,4.58564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="6,4.48564 6.1525,4.48564 6.1525,7.08564 6,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="5.9925,4.78564 6,4.78564 6,7.08564 5.9925,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="5.9925,4.54564 6,4.54564 6,4.58564 5.9925,4.58564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="6.1525,1.88564 6.1725,1.88564 6.1725,7.08564 6.1525,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="0.8275,1.88564 0.8475,1.88564 0.8475,7.08564 0.8275,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="0.8475,4.48564 1,4.48564 1,7.08564 0.8475,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="1,4.78564 1.0075,4.78564 1.0075,7.08564 1,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="1,4.54564 1.0075,4.54564 1.0075,4.58564 1,4.58564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="1.0075,4.78564 1.1575,4.78564 1.1575,7.08564 1.0075,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="1.0075,1.88564 1.1575,1.88564 1.1575,4.58564 1.0075,4.58564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="1.1575,4.78564 1.1725,4.78564 1.1725,7.08564 1.1575,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="3.325,4.78564 3.34,4.78564 3.34,7.08564 3.325,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="3.34,4.78564 3.46,4.78564 3.46,7.08564 3.34,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="3.46,4.78564 3.475,4.78564 3.475,7.08564 3.46,7.08564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="5.8275,1.88564 5.8425,1.88564 5.8425,4.48564 5.8275,4.48564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="5.9925,1.88564 6.1525,1.88564 6.1525,4.48564 5.9925,4.48564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="0.8475,1.88564 1.0075,1.88564 1.0075,4.48564 0.8475,4.48564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="1.1575,1.88564 1.1725,1.88564 1.1725,4.48564 1.1575,4.48564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="1,4.48564 1.0075,4.48564 1.0075,4.54564 1,4.54564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="1.1575,4.48564 5.8425,4.48564 5.8425,4.54564 1.1575,4.54564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="5.9925,4.48564 6,4.48564 6,4.54564 5.9925,4.54564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="1.1575,4.54564 5.8425,4.54564 5.8425,4.58564 1.1575,4.58564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="1,4.58564 6,4.58564 6,4.78564 1,4.78564" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="0.6,0.5 6.4,0.5 6.4,0.73094 0.6,0.73094" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="4.2,5.69897 4.2,5.99364 5.2,5.99364 5.2,5.69897" fill="#0f0f0f" stroke="#0f0f0f" stroke-width="0.012"/>
<polygon points="0.6,0.5 0.6,0.73094 6.4,0.73094 6.4,0.5" fill="none" stroke="#1f242c" stroke-width="0.025"/>
<polygon points="0.8275,1.88564 0.8275,7.08564 1.1725,7.08564 1.1725,4.78564 3.325,4.78564 3.325,7.08564 3.475,7.08564 3.475,4.78564 5.8275,4.78564 5.8275,7.08564 6.1725,7.08564 6.1725,1.88564 5.8275,1.88564 5.8275,4.48564 1.1725,4.48564 1.1725,1.88564" fill="none" stroke="#1f242c" stroke-width="0.025"/>
<polygon points="4.2,5.69897 4.2,5.99364 5.2,5.99364 5.2,5.69897" fill="none" stroke="#1f242c" stroke-width="0.025"/>

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

@@ -1,12 +1,12 @@
viewBox -12.8 0 37.6 33.6
bytes 23004
bytes 22835
circle 14
g 1
line 91
polygon 22
polygon 21
polyline 22
rect 1
svg 1
text 34
tspan 9
hash f0bc37741422757a
hash 487fdee19e8a1bb9
@@ -1,12 +1,12 @@
viewBox -12.65 0 37.3 33.3
bytes 324678
bytes 324510
circle 14
g 1
line 3206
polygon 68
polygon 67
polyline 80
rect 1
svg 1
text 36
tspan 12
hash a1ffcd11fb447e54
hash 9f01cf4af3bc2c65
@@ -10,4 +10,4 @@ rect 1
svg 1
text 114
tspan 24
hash b03f624a6a74041e
hash 205916044d15e651
@@ -1,13 +1,13 @@
viewBox -12.8 0 37.6 33.6
bytes 47516
bytes 47347
circle 14
g 1
line 142
path 9
polygon 45
polygon 44
polyline 105
rect 1
svg 1
text 86
tspan 19
hash 4a8e5e39c1a4bc6c
hash 56539e8b37286122
@@ -1,13 +1,13 @@
viewBox -12.65 0 37.3 33.3
bytes 359120
bytes 358952
circle 14
g 1
line 3238
path 37
polygon 145
polygon 144
polyline 174
rect 1
svg 1
text 89
tspan 24
hash 413befddae90a6a1
hash c58c6f21f02cb3a3
@@ -10,4 +10,4 @@ rect 1
svg 1
text 72
tspan 18
hash 508caf15ae8254f8
hash 10120a432e658967
@@ -1,11 +1,11 @@
viewBox 4.457 0 21.343 17.378
bytes 34204
bytes 33634
circle 4
g 1
line 42
polygon 182
line 44
polygon 176
polyline 17
rect 1
svg 1
text 3
hash bd6c402b78964222
hash c94d4102e772735b
@@ -8,4 +8,4 @@ rect 1
svg 1
text 7
tspan 3
hash 743dc1fed14a7c7e
hash dffe9704c9cbff9f
@@ -7,4 +7,4 @@ polyline 5
rect 1
svg 1
text 4
hash db4a60e9ca0aace2
hash a6fce59be19864a8
@@ -1,9 +1,9 @@
viewBox 0.1 0 6.8 7.586
bytes 6668
bytes 6317
g 1
line 21
polygon 34
polygon 31
polyline 4
rect 1
svg 1
hash 405920d4c0d4ea97
hash 3ad55e8289524c3b
+20 -1
View File
@@ -22,7 +22,26 @@ export function levelMarksEnabled(level: DrawingLevel): boolean {
export function levelMarkerPrimitives(
project: Project,
bounds: { minX: number; minY: number; maxX: number; maxY: number },
primitives?: readonly Primitive[],
): Primitive[] {
if (!(bounds.maxX > bounds.minX) || !(bounds.maxY > bounds.minY)) return [];
return decodePlanBuf(documentFor(project).queryBin("levelMarkers", [bounds.minX, bounds.minY, bounds.maxX, bounds.maxY])).prims;
const minX = primitives ? Math.max(bounds.minX, builtMinX(project, primitives)) : bounds.minX;
return decodePlanBuf(documentFor(project).queryBin("levelMarkers", [minX < bounds.maxX ? minX : bounds.minX, bounds.minY, bounds.maxX, bounds.maxY])).prims;
}
// [171] Gelände (Schnittfläche, Profil- und Grundlinie) zählt nicht zur Lage der Koten: sie stehen neben dem
// Gebauten (Haus, Carport, Körper), nicht links vom ganzen Geländeschnitt (Musterhaus komplex: ~15 m weiter).
const TERRAIN_CLS = new Set(["section-terrain", "elevation-terrain", "section-ground", "elevation-ground"]);
function builtMinX(project: Project, primitives: readonly Primitive[]): number {
const site = new Set((project.context ?? []).filter((c) => c.type === "terrainMesh" || c.type === "excavation" || c.type === "contourSet").map((c) => c.id));
let minX = Infinity;
for (const q of primitives) {
if (q.kind === "line") {
if (!TERRAIN_CLS.has(q.cls)) minX = Math.min(minX, q.a.x, q.b.x);
} else if (q.kind === "polygon") {
if (!(q.contextObjectId && site.has(q.contextObjectId))) for (const v of q.pts) minX = Math.min(minX, v.x);
}
}
return minX;
}
+15
View File
@@ -17,6 +17,21 @@ describe("viewportLevelPlan", () => {
expect(plan.bounds.maxY - plan.bounds.minY).toBeGreaterThan(8);
});
// [171] Höhenkoten neben dem Gebäude, nicht links vom ganzen Geländeschnitt (Musterhaus komplex: ~15 m weiter).
it("Schnitt: Höhenkoten nahe beim Gebäude, nicht links vom Gelände", async () => {
const plan = await viewportLevelPlan(p, "schnitt-a", codes, "mittel", 100);
const xsOf = (q: (typeof plan.primitives)[number]): number[] =>
q.kind === "polygon" ? q.pts.map((v) => v.x) : q.kind === "line" ? [q.a.x, q.b.x] : [];
const terrainX = Math.min(...plan.primitives.filter((q) => q.kind === "line" && q.cls === "section-terrain").flatMap(xsOf));
const wallX = Math.min(...plan.primitives.filter((q) => q.kind === "polygon" && q.wallId).flatMap(xsOf));
const leaders = plan.primitives.filter((q) => q.kind === "line" && q.cls === "section-level-leader");
expect(leaders.length).toBeGreaterThan(2);
const markX = Math.min(...leaders.flatMap(xsOf));
expect(terrainX).toBeLessThan(wallX - 8);
expect(markX).toBeGreaterThan(terrainX + 2);
expect(markX).toBeLessThan(wallX);
});
it("Ansicht: Fassade", async () => {
const plan = await viewportLevelPlan(p, "ansicht-sued", codes, "mittel", 100);
expect(plan.primitives.length).toBeGreaterThan(100);
+1 -1
View File
@@ -94,7 +94,7 @@ async function levelPlan(
}
if (!raw || raw.primitives.length === 0) return EMPTY;
const own = generatePlan(project, level.id, visibleCodes, undefined, detail, false, mono, false, scaleDenominator, forPrint, false, overrideRuleIds);
const marks = levelMarksEnabled(level) ? levelMarkerPrimitives(project, raw.bounds) : [];
const marks = levelMarksEnabled(level) ? levelMarkerPrimitives(project, raw.bounds, raw.primitives) : [];
const b = { ...raw.bounds };
const grow = (x: number, y: number) => {
b.minX = Math.min(b.minX, x);
+1 -1
View File
@@ -1138,7 +1138,7 @@ function SectionPlanView({
// Automatische Höhenkoten links neben der Zeichnung (abschaltbar je Ebene).
const marks = useMemo(
() =>
rawPlan && levelMarksEnabled(level) ? levelMarkerPrimitives(project, rawPlan.bounds) : [],
rawPlan && levelMarksEnabled(level) ? levelMarkerPrimitives(project, rawPlan.bounds, rawPlan.primitives) : [],
[rawPlan, level, project],
);
const withOverlay = useMemo(() => {