[171] Plan-Review Runde 2: Schatten nur im Ansichtsbereich, Flächenzeile nach Rundungsschritt, Rundfenster in Schnitt und Ansicht, Wand unter Rohdecke, OG-Ecken in der Ansicht, Höhenkoten neben dem Gebauten
Tests je Fix (sun.rs, domains.rs, section/tests.rs, elevation/tests.rs, viewportPlan.test.ts), Goldens Plan/CLI neu (OG/DG Schatten, Schnitt A, Ansicht Süd). TODO.md [171] mit offenen Befunden.
This commit is contained in:
24 files changed
+334
-59
No files matched your search
@@ -105,7 +105,23 @@ 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; kleiner Strich rechts am Rundfenster
|
||||
(Ansicht West); Ansicht Ost: Schatten-Keile neben dem Erker mit Lücken je Geschoss, Strichreste am Erker;
|
||||
1:500: Kürzung „Wohnen/Essen.“ unterschlägt „Küche“; Holzwand-Ecke DG 1:50: Dämmschlaufen überlappen in der
|
||||
Ecke, Dämm-Polylinien mit ~60 000 Punkten (DG 1:50 SVG 14 MB); Raumstempel ohne Maske über Schnittlinie (einfaches
|
||||
Musterhaus); 1:100-Schnitt: Schichtfugen als graue Linien in der schwarzen Fläche. 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
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
@@ -2701,7 +2704,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");
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -132,6 +132,14 @@ 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
|
||||
}
|
||||
|
||||
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 +231,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 +276,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 +348,23 @@ 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])]);
|
||||
// Das Loch kann um den Einzug der Dämmung über den Rahmen ([168]) grösser sein als die Öffnung.
|
||||
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]));
|
||||
!(side && inside(e.a) && inside(e.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 +477,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,6 +368,34 @@ fn formoeffnung_und_dachfenster_in_der_ansicht() {
|
||||
assert!(first_df > last_roof, "Dachfenster vor der Dachfläche gezeichnet");
|
||||
}
|
||||
|
||||
/// [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:?}");
|
||||
}
|
||||
|
||||
/// [105] Umfassungszarge in der Ansicht: Spiegel über die Rohbaukante hinaus (Rahmen breiter als
|
||||
/// die Öffnung), Blatt um die Zarge eingerückt.
|
||||
#[test]
|
||||
@@ -756,3 +784,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:?}");
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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> {
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
<polygon points="5.8275,7.08564 6.1725,7.08564 6.1725,4.48564 5.8275,4.48564" fill="#ffffff" stroke="none" stroke-width="0"/>
|
||||
<polygon points="1.1725,7.08564 1.1725,4.48564 0.8275,4.48564 0.8275,7.08564" fill="#ffffff" stroke="none" stroke-width="0"/>
|
||||
<polygon points="3.325,7.08564 3.475,7.08564 3.475,4.48564 3.325,4.48564" fill="#8c5544" stroke="none" stroke-width="0"/>
|
||||
<polygon points="1,4.48564 6,4.48564 6,2.05885 1,2.05885" fill="#ffffff" stroke="none" stroke-width="0"/>
|
||||
<polygon points="0.8275,4.48564 6.1725,4.48564 6.1725,2.05885 0.8275,2.05885" fill="#ffffff" stroke="none" stroke-width="0"/>
|
||||
<polygon points="5.8275,4.48564 6.1725,4.48564 6.1725,1.88564 5.8275,1.88564" fill="#ffffff" stroke="none" stroke-width="0"/>
|
||||
<polygon points="1.1725,4.48564 1.1725,1.88564 0.8275,1.88564 0.8275,4.48564" fill="#ffffff" stroke="none" stroke-width="0"/>
|
||||
<polygon points="1,2.45885 6,2.45885 6,2.05885 1,2.05885" fill="#8f959e" stroke="none" stroke-width="0"/>
|
||||
<polygon points="0.8275,2.28635 1,2.45885 6.1725,2.45885 6.1725,2.05885 0.8275,2.05885" fill="#8f959e" stroke="none" stroke-width="0"/>
|
||||
<polygon points="5.8275,2.45885 6.1725,2.45885 6.1725,1.88564 5.8275,1.88564" fill="#8f959e" stroke="none" stroke-width="0"/>
|
||||
<polygon points="0.8275,2.28635 1,2.45885 1.1725,2.45885 1.1725,1.88564 0.8275,1.88564" fill="#8f959e" stroke="none" stroke-width="0"/>
|
||||
<polygon points="0.8275,7.08564 1.8,7.08564 1.8,4.48564 0.8275,4.48564" fill="#ffffff" stroke="none" stroke-width="0"/>
|
||||
@@ -44,8 +44,8 @@
|
||||
<polygon points="4,7.08564 5,7.08564 5,6.18564 4,6.18564" fill="#ffffff" stroke="none" stroke-width="0"/>
|
||||
<polygon points="4,4.98564 5,4.98564 5,4.48564 4,4.48564" fill="#ffffff" stroke="none" stroke-width="0"/>
|
||||
<polygon points="5,7.08564 6.1725,7.08564 6.1725,4.48564 5,4.48564" fill="#ffffff" stroke="none" stroke-width="0"/>
|
||||
<polygon points="1,4.48564 6,4.48564 6,2.05885 1,2.05885" fill="#ffffff" stroke="none" stroke-width="0"/>
|
||||
<polygon points="1,2.28635 6,2.28635 6,2.05885 1,2.05885" fill="#8f959e" stroke="none" stroke-width="0"/>
|
||||
<polygon points="0.8275,4.48564 6.1725,4.48564 6.1725,2.05885 0.8275,2.05885" fill="#ffffff" stroke="none" stroke-width="0"/>
|
||||
<polygon points="0.8275,2.28635 6.1725,2.28635 6.1725,2.05885 0.8275,2.05885" fill="#8f959e" stroke="none" stroke-width="0"/>
|
||||
<polygon points="1.8,7.08564 2.7,7.08564 2.7,4.98564 1.8,4.98564" fill="#dcdcdc" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<polygon points="1.836,7.08564 2.664,7.08564 2.664,5.04864 1.836,5.04864" fill="#ececec" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<polygon points="1.8,5.06564 2.7,5.06564 2.7,4.98564 1.8,4.98564" fill="#a7adb5" stroke="none" stroke-width="0"/>
|
||||
@@ -64,8 +64,6 @@
|
||||
<polygon points="0.6,1.88564 6.4,1.88564 6.4,2.05885 0.6,2.05885" fill="#b8735c" stroke="none" stroke-width="0"/>
|
||||
<polyline points="1.8,7.08564 1.8,4.98564 2.7,4.98564 2.7,7.08564" fill="none" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<polygon points="5,6.18564 4,6.18564 4,4.98564 5,4.98564" fill="none" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<polyline points="6.1725,4.48564 6,4.48564 6,2.05885" fill="none" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<polyline points="1,2.05885 1,4.48564 0.8275,4.48564" fill="none" stroke="#2b3039" stroke-width="0.013"/>
|
||||
<polyline points="2.7,7.08564 4,7.08564 5,7.08564 6.1725,7.08564 6.1725,4.48564 6.1725,2.05885" fill="none" stroke="#2b3039" stroke-width="0.018"/>
|
||||
<polyline points="0.8275,2.05885 0.8275,4.48564 0.8275,7.08564 1.8,7.08564" fill="none" stroke="#2b3039" stroke-width="0.018"/>
|
||||
<line x1="0.6" y1="1.88564" x2="6.4" y2="1.88564" stroke="#2b3039" stroke-width="0.013"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.3 KiB |
@@ -18,18 +18,15 @@
|
||||
<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="1.1575,4.48564 5.8425,4.48564 5.8425,4.54564 1.1575,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.1575,4.54564 5.8425,4.54564 5.8425,4.58564 1.1575,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"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 6.6 KiB |
@@ -1,11 +1,11 @@
|
||||
viewBox -4.2 0 37.045 17.378
|
||||
bytes 193364
|
||||
bytes 195265
|
||||
circle 4
|
||||
g 1
|
||||
line 556
|
||||
polygon 1026
|
||||
polyline 44
|
||||
line 447
|
||||
polygon 1025
|
||||
polyline 154
|
||||
rect 1
|
||||
svg 1
|
||||
text 4
|
||||
hash 32b9045a8708e6ad
|
||||
hash d0400a1b0daa1e56
|
||||
@@ -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 b98be8a32c279efc
|
||||
@@ -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
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -12.8 0 37.6 33.6
|
||||
bytes 47861
|
||||
bytes 47692
|
||||
circle 14
|
||||
g 1
|
||||
line 142
|
||||
path 8
|
||||
polygon 45
|
||||
polygon 44
|
||||
polyline 106
|
||||
rect 1
|
||||
svg 1
|
||||
text 86
|
||||
tspan 19
|
||||
hash b6f8babd12e53947
|
||||
hash 7557aa5041a40ed1
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -12.65 0 37.3 33.3
|
||||
bytes 359467
|
||||
bytes 359299
|
||||
circle 14
|
||||
g 1
|
||||
line 3238
|
||||
path 36
|
||||
polygon 145
|
||||
polygon 144
|
||||
polyline 175
|
||||
rect 1
|
||||
svg 1
|
||||
text 89
|
||||
tspan 24
|
||||
hash 169dd2e0a69081af
|
||||
hash 101818006ae26a68
|
||||
@@ -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 0ac408ec72d00b90
|
||||
@@ -1,9 +1,9 @@
|
||||
viewBox 0.1 0 6.8 7.586
|
||||
bytes 7959
|
||||
bytes 7833
|
||||
g 1
|
||||
line 7
|
||||
polygon 57
|
||||
polyline 6
|
||||
polyline 4
|
||||
rect 1
|
||||
svg 1
|
||||
hash 2b77ecb148e762fe
|
||||
hash 1a97bd708a69f1c8
|
||||
@@ -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 ab081d72649b8b18
|
||||
@@ -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;
|
||||
}
|
||||
@@ -16,6 +16,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);
|
||||
|
||||
@@ -66,7 +66,7 @@ export async function viewportLevelPlan(
|
||||
}
|
||||
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);
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
Reference in new issue
Block a user