[297] Deckenloch auch für Wendel-/Teilhöhen-Treppen, Innenhöfe ohne Dach nicht mehr im GV-Dachraum
Treppe: Loch aus Umriss (Wendel: Kreisstück samt Auge), Teilhöhe nur über Tritten mit Kopfhöhe < 2.1 m; 'nach unten' kehrt nur den Pfeil um. GV: Löcher >= 1 m² im Geschossgrundriss mit Räumen bleiben Aussparung.
This commit is contained in:
6 files changed
+242
-41
No files matched your search
@@ -402,6 +402,64 @@ mod tests {
|
||||
assert!(t.gv.is_finite());
|
||||
}
|
||||
|
||||
/// [297] O-Grundriss (Aussenwände 20 × 16, Hofwände 6 × 6 in der Mitte, Räume dazwischen) mit EINEM Dach über der
|
||||
/// ganzen Aussenflucht, ohne Hof im Dach: der unüberbaute Innenhof (kein Raum, nach oben offen) bekommt keinen
|
||||
/// Dachraum. Gleich viel wie ein Dach, dessen Hof ausdrücklich ausgespart ist; und kleiner als der Hof wäre gefüllt.
|
||||
fn o_haus(roof_holes: bool, with_rooms: bool) -> Project {
|
||||
let json = r#"{"drawingLevels":[{"id":"eg","name":"EG","kind":"floor","visible":true,"locked":false,"baseElevation":0,"floorHeight":2.6}],
|
||||
"wallTypes":[{"id":"wt","name":"W","layers":[{"componentId":"c","thickness":0.3}]}],"walls":[],"rooms":[]}"#;
|
||||
let mut p: Project = serde_json::from_str(json).unwrap();
|
||||
let v = |x: f64, y: f64| serde_json::json!({"x": x, "y": y});
|
||||
let mut walls = vec![];
|
||||
for (k, (x0, y0, x1, y1)) in [(0.0, 0.0, 20.0, 16.0), (7.0, 5.0, 13.0, 11.0)].into_iter().enumerate() {
|
||||
let pts = [(x0, y0), (x1, y0), (x1, y1), (x0, y1)];
|
||||
for i in 0..4 {
|
||||
let (a, b) = (pts[i], pts[(i + 1) % 4]);
|
||||
walls.push(serde_json::json!({"id":format!("w{k}{i}"),"type":"wall","floorId":"eg","categoryCode":"x","start":v(a.0,a.1),"end":v(b.0,b.1),"wallTypeId":"wt","height":2.6}));
|
||||
}
|
||||
}
|
||||
let room = |id: &str, x0: f64, y0: f64, x1: f64, y1: f64| {
|
||||
serde_json::json!({"id":id,"type":"room","floorId":"eg","categoryCode":"x","siaCategory":"HNF","name":id,"color":"#fff",
|
||||
"boundary":[v(x0,y0),v(x1,y0),v(x1,y1),v(x0,y1)]})
|
||||
};
|
||||
let rooms = if with_rooms {
|
||||
vec![room("l", 0.15, 0.15, 6.85, 15.85), room("r", 13.15, 0.15, 19.85, 15.85), room("u", 6.85, 0.15, 13.15, 4.85), room("o", 6.85, 11.15, 13.15, 15.85)]
|
||||
} else {
|
||||
vec![]
|
||||
};
|
||||
p.walls = serde_json::from_value(serde_json::Value::Array(walls)).unwrap();
|
||||
p.rooms = Some(serde_json::from_value(serde_json::Value::Array(rooms)).unwrap());
|
||||
let mut r = roof("sattel", 30.0, 0.5, serde_json::json!({"floorId":"eg"}));
|
||||
r["outline"] = serde_json::json!([{"x":-0.15,"y":-0.15},{"x":20.15,"y":-0.15},{"x":20.15,"y":16.15},{"x":-0.15,"y":16.15}]);
|
||||
if roof_holes {
|
||||
r["holes"] = serde_json::json!([[{"x":7.15,"y":5.15},{"x":12.85,"y":5.15},{"x":12.85,"y":10.85},{"x":7.15,"y":10.85}]]);
|
||||
}
|
||||
p.roofs = Some(serde_json::from_value(serde_json::json!([r])).unwrap());
|
||||
p
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn innenhof_ohne_dach_wird_nicht_gefuellt() {
|
||||
let t = area_table(&o_haus(false, true));
|
||||
assert!(!t.notes.iter().any(|n| n == "gvRoofFailed"), "{:?}", t.notes);
|
||||
// Von Hand: Satteldach 30° (Traufe y = −0.65 / 16.65 bei Überstand 0.5, First y = 8) über 20.3 × 16.3 (Aussenflucht)
|
||||
// abzüglich Hof 5.7 × 5.7 (y 5.15 … 10.85); Höhe über OK Geschoss = (Abstand von der Traufe) · tan30.
|
||||
let ganz = 20.3 * 2.0 * (8.65_f64 * 8.65 - 0.5 * 0.5) / 2.0;
|
||||
let hof = 5.7 * 2.0 * (8.65_f64 * 8.65 - 5.8 * 5.8) / 2.0;
|
||||
let dach = (ganz - hof) * T30;
|
||||
assert!(close(t.levels[0].roof_gv, dach, 1e-2), "Dachraum {} statt {dach} (Hof gefüllt wären {})", t.levels[0].roof_gv, ganz * T30);
|
||||
// Geschoss selbst: nur die Fläche GF × Höhe, der Hof kommt nicht dazu.
|
||||
assert!(close(t.levels[0].gv - t.levels[0].roof_gv, t.levels[0].gf * 2.6, TOL));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wandring_ohne_raeume_bleibt_ein_ganzes_geschoss() {
|
||||
// Ohne Räume ist jeder Ring ein ganzes Geschoss (auch der Hofring): nichts wird ausgespart.
|
||||
let t = area_table(&o_haus(false, false));
|
||||
let h = area_table(&o_haus(true, false));
|
||||
assert!(t.levels[0].roof_gv > h.levels[0].roof_gv + 50.0, "{} / {}", t.levels[0].roof_gv, h.levels[0].roof_gv);
|
||||
}
|
||||
|
||||
/// Musterhaus komplex (Auszug von `buildComplexSampleProject`: Geschosse, Wände, Räume, Dächer, Körper).
|
||||
/// Von Hand: Geschosse Σ GF × Höhe = 175.52·2.7 + 193.63·2.9 + 193.63·2.8 + 159.90·2.6 ≈ 1993 m³.
|
||||
/// Hauptdach auf dem DG (Sattel 38°, Traufe 7.3, Umriss = Aussenflucht 15.39 × 10.39, Überstand 0.6):
|
||||
|
||||
@@ -1844,10 +1844,47 @@ mod tests {
|
||||
let (x, y) = (q["x"].as_f64().unwrap(), q["y"].as_f64().unwrap());
|
||||
assert!((0.9..=5.1).contains(&x) && (1.4..=2.6).contains(&y), "{x},{y}");
|
||||
}
|
||||
// abwärts, Teilhöhe, ausserhalb der Decke → nur die Treppe
|
||||
assert_eq!(stair([1.0, 2.0], [5.0, 2.0], false, Value::Null).len(), 1);
|
||||
assert_eq!(stair([1.0, 2.0], [5.0, 2.0], true, json!(1.5)).len(), 1);
|
||||
// ausserhalb der Decke → nur die Treppe
|
||||
assert_eq!(stair([7.0, 2.0], [11.0, 2.0], true, Value::Null).len(), 1);
|
||||
// [297] „nach unten“ kehrt nur den Pfeil um: gleiches Loch in der Decke des eigenen Geschosses
|
||||
let d = stair([1.0, 2.0], [5.0, 2.0], false, Value::Null);
|
||||
assert_eq!(d.len(), 2);
|
||||
assert_eq!(d[1].to_json()["entity"]["openings"], o[1].to_json()["entity"]["openings"]);
|
||||
// Teilhöhe (Geschoss 3 m): Kopfhöhe < 2.1 m nur über den oberen Tritten (Tritt-Oberkante > 0.9 m)
|
||||
let t = stair([1.0, 2.0], [5.0, 2.0], true, json!(1.5));
|
||||
assert_eq!(t.len(), 2);
|
||||
let xs: Vec<f64> = t[1].to_json()["entity"]["openings"][0].as_array().unwrap().iter().map(|q| q["x"].as_f64().unwrap()).collect();
|
||||
let (lo, hi) = xs.iter().fold((f64::MAX, f64::MIN), |(a, b), x| (a.min(*x), b.max(*x)));
|
||||
assert!(lo > 2.5 && (hi - 5.0).abs() < 0.1, "Teilloch nur im oberen Teil: {lo}..{hi}");
|
||||
// so niedrig, dass überall Kopfhöhe bleibt (3 − 0.8 ≥ 2.1) → kein Loch
|
||||
assert_eq!(stair([1.0, 2.0], [5.0, 2.0], true, json!(0.8)).len(), 1);
|
||||
}
|
||||
|
||||
/// [297] Wendeltreppe: Loch = Kreisstück des Laufs samt Auge, die ganze Treppe liegt darin.
|
||||
#[test]
|
||||
fn wendeltreppe_legt_deckenloch_an() {
|
||||
let ceil = json!({"id": "C1", "type": "ceiling", "floorId": "F1", "outline": [{"x": 0, "y": 0}, {"x": 8, "y": 0}, {"x": 8, "y": 6}, {"x": 0, "y": 6}]});
|
||||
let r = root(json!({"ceilings": [ceil]}));
|
||||
let t = crate::model::lenient::typed_for_test(&r);
|
||||
let v = json!({"cmd": "stair", "shape": "spiral", "up": true, "width": 0.9, "referenz": "mitte", "treadMode": "without",
|
||||
"auftritt": 0.28, "steps": null, "rise": null, "start": {"x": 3.0, "y": 3.0}, "cursor": {"x": 4.0, "y": 3.0}});
|
||||
let o = ops(&r, &t, &req(v)).unwrap();
|
||||
assert_eq!(o.len(), 2, "Wendeltreppe + Aussparung");
|
||||
let ring: Vec<(f64, f64)> = o[1].to_json()["entity"]["openings"][0].as_array().unwrap().iter().map(|q| (q["x"].as_f64().unwrap(), q["y"].as_f64().unwrap())).collect();
|
||||
assert!(ring.len() > 20, "Bogen ist ein feines Vieleck");
|
||||
let inside = |q: (f64, f64)| crate::cmd_solid::point_in_polygon(q, &ring);
|
||||
for q in &ring {
|
||||
assert!(hypot2(q.0 - 3.0, q.1 - 3.0) <= 1.45 * 1.002 + 1e-6, "{q:?}");
|
||||
}
|
||||
// Auge und der Lauf (0°–270° gegen den Uhrzeigersinn, bis zum Aussenrand) liegen im Loch, die Lücke (315°) nicht
|
||||
assert!(inside((3.0, 3.0)));
|
||||
for deg in [2.0_f64, 90.0, 180.0, 268.0] {
|
||||
let (c, sn) = (deg.to_radians().cos(), deg.to_radians().sin());
|
||||
for r in [0.1, 1.0, 1.44] {
|
||||
assert!(inside((3.0 + r * c, 3.0 + r * sn)), "{deg}° r={r}");
|
||||
}
|
||||
}
|
||||
assert!(!inside((3.0 + 1.0 * 0.7071, 3.0 - 1.0 * 0.7071)));
|
||||
}
|
||||
|
||||
fn pos_or(p: &Preview) -> f64 {
|
||||
|
||||
+117
-32
@@ -337,7 +337,7 @@ fn solid_preview(v: &Value, pts: &[V], out: &mut Shapes) {
|
||||
}
|
||||
|
||||
/// Punkt im Polygon (Strahl-Test, `|| 1e-12` gegen waagrechte Kanten).
|
||||
fn point_in_polygon(p: V, poly: &[V]) -> bool {
|
||||
pub(crate) fn point_in_polygon(p: V, poly: &[V]) -> bool {
|
||||
let mut inside = false;
|
||||
let n = poly.len();
|
||||
let mut j = n.wrapping_sub(1);
|
||||
@@ -684,43 +684,128 @@ fn ceiling_opening_ops(root: &Map<String, Value>, v: &Value, ctx: &Ctx) -> Vec<O
|
||||
vec![Op::Replace { collection: "ceilings".into(), entity: with(host, "openings", Value::Array(openings)) }]
|
||||
}
|
||||
|
||||
/// [266] Deckenloch einer neuen Treppe: steigt sie über die ganze Geschosshöhe nach oben, wird in die Decke des
|
||||
/// Geschosses (die den ganzen Treppengrundriss enthält) eine Aussparung in der Form des Treppenumrisses gelegt.
|
||||
/// Keine solche Decke, Treppe nach unten oder nicht über die volle Höhe, oder schon ein Loch darüber → keine Op.
|
||||
/// Die Ops laufen mit der Treppe im selben Commit (ein Undo-Schritt).
|
||||
pub(crate) fn stair_hole_ops(root: &Map<String, Value>, params: &[f64], rise: f64, up: bool, ctx: &Ctx) -> Vec<Op> {
|
||||
let floor_h = ctx.floor_height.unwrap_or(f64::NAN);
|
||||
if !up || !(floor_h.is_finite() && rise >= floor_h - 0.05) {
|
||||
/// Lichte Kopfhöhe über dem Lauf (m): wo die Tritte näher als das an der Deckenunterkante liegen, braucht es ein Loch.
|
||||
const STAIR_HEADROOM: f64 = 2.1;
|
||||
|
||||
/// [297] Umrisse (Grundriss) des Deckenlochs einer Treppe der Höhe `rise` unter einer Decke mit Unterkante bei
|
||||
/// `floor_h` über der Treppenbasis. Läuft sie über die ganze Geschosshöhe, ist es der Treppenumriss: Polygon (gerade, L, U,
|
||||
/// Podest) oder bei der Wendeltreppe der Kreis bzw. das Kreisstück des Laufs samt Auge. Endet sie tiefer (Teilhöhe),
|
||||
/// nur die Tritte (und anschliessende Podeste), deren Oberkante weniger als [`STAIR_HEADROOM`] unter der Decke liegt;
|
||||
/// bleibt der Abstand überall grösser, gibt es kein Loch. Die Laufrichtung (`up`) ändert nichts: sie kehrt nur den Pfeil um.
|
||||
fn stair_hole_rings(params: &[f64], rise: f64, floor_h: f64) -> Vec<Vec<V>> {
|
||||
if !(floor_h.is_finite() && floor_h > 0.0 && rise.is_finite() && rise > 0.0) {
|
||||
return Vec::new();
|
||||
}
|
||||
let o = crate::stair::outline(params);
|
||||
let ring: Vec<V> = match o.first() {
|
||||
Some(&k) if k == 0.0 && o.len() >= 2 => {
|
||||
let n = o[1] as usize;
|
||||
(0..n).filter_map(|i| Some((*o.get(2 + 2 * i)?, *o.get(3 + 2 * i)?))).collect()
|
||||
let Some(sp) = crate::stair::decode_params(params) else { return Vec::new() };
|
||||
let full = rise >= floor_h - 0.05;
|
||||
if !full && floor_h - rise >= STAIR_HEADROOM {
|
||||
return Vec::new();
|
||||
}
|
||||
let pt = |q: &kernel2d::Vec2| [q.x, q.y];
|
||||
if full {
|
||||
let o = crate::stair::outline(params);
|
||||
match o.first() {
|
||||
Some(&k) if k == 0.0 && o.len() >= 2 => {
|
||||
let n = o[1] as usize;
|
||||
return vec![(0..n).filter_map(|i| Some((*o.get(2 + 2 * i)?, *o.get(3 + 2 * i)?))).collect()];
|
||||
}
|
||||
// Wendel: Linien (4 Zahlen je 2), dann ein Bogen je 5 Zahlen (Mitte, r, a0, a1); Aussenbogen = der zweite.
|
||||
Some(&k) if k == 1.0 && o.len() >= 1 + 8 + 10 => {
|
||||
return vec![spiral_hole_ring((o[14], o[15]), o[16], o[17], o[18])];
|
||||
}
|
||||
_ => return Vec::new(),
|
||||
}
|
||||
// Wendeltreppen (Linien + Bögen statt Polygon): Loch weiter von Hand (`deckenloch`).
|
||||
_ => return Vec::new(),
|
||||
}
|
||||
let geo = kernel2d::stair_geometry(&sp, rise);
|
||||
let limit = floor_h - STAIR_HEADROOM;
|
||||
let sel: Vec<Vec<[f64; 2]>> = geo.treads.iter().filter(|t| t.top_rise > limit + 1e-9 && t.pts.len() >= 3).map(|t| t.pts.iter().map(pt).collect()).collect();
|
||||
if sel.is_empty() {
|
||||
return Vec::new();
|
||||
}
|
||||
let mut polys: Vec<crate::flat::Polygon> = sel.iter().cloned().map(|r| vec![r]).collect();
|
||||
// Podeste, die an einen gewählten Tritt anschliessen (Hülle der Rechtecke + Spielraum), kommen dazu.
|
||||
let bb = |r: &[[f64; 2]]| {
|
||||
r.iter().fold([f64::MAX, f64::MAX, f64::MIN, f64::MIN], |b, q| [b[0].min(q[0]), b[1].min(q[1]), b[2].max(q[0]), b[3].max(q[1])])
|
||||
};
|
||||
if ring.len() < 3 || ring.iter().any(|q| !(q.0.is_finite() && q.1.is_finite())) {
|
||||
return Vec::new();
|
||||
let sel_bb: Vec<[f64; 4]> = sel.iter().map(|r| bb(r)).collect();
|
||||
for l in [&geo.landing, &geo.landing2].into_iter().flatten() {
|
||||
let r: Vec<[f64; 2]> = l.iter().map(pt).collect();
|
||||
if r.len() < 3 {
|
||||
continue;
|
||||
}
|
||||
let b = bb(&r);
|
||||
const E: f64 = 0.05;
|
||||
if sel_bb.iter().any(|s| s[0] <= b[2] + E && s[2] >= b[0] - E && s[1] <= b[3] + E && s[3] >= b[1] - E) {
|
||||
polys.push(vec![r]);
|
||||
}
|
||||
}
|
||||
let host = arr(root.get("ceilings")).iter().find(|c| {
|
||||
let outline = ring_of(c);
|
||||
crate::cmd_create::floor_of(c) == Some(ctx.level) && outline.len() >= 3 && ring.iter().all(|q| point_in_polygon(*q, &outline))
|
||||
});
|
||||
let Some(host) = host else { return Vec::new() };
|
||||
let mut openings = arr(field(host, "openings")).to_vec();
|
||||
// Ein bestehendes Loch, das den Umriss schon enthält, genügt.
|
||||
let covered = openings.iter().any(|h| {
|
||||
let hr: Vec<V> = arr(Some(h)).iter().map(xy).collect();
|
||||
hr.len() >= 3 && ring.iter().all(|q| point_in_polygon(*q, &hr))
|
||||
});
|
||||
if covered {
|
||||
return Vec::new();
|
||||
crate::polygon_bool::union(&polys).into_iter().filter_map(|p| p.into_iter().next()).map(|r| r.into_iter().map(|q| (q[0], q[1])).collect()).collect()
|
||||
}
|
||||
|
||||
/// Kreis (Vollkreis ab 359°) oder Kreisstück samt Mitte (Auge) um `c` mit Radius `r` von `a0` nach `a1`, als Vieleck,
|
||||
/// dessen Ecken ausserhalb des Bogens liegen (Sehnen berühren ihn), damit die Treppe ganz im Loch liegt.
|
||||
fn spiral_hole_ring(c: (f64, f64), r: f64, a0: f64, a1: f64) -> Vec<V> {
|
||||
let sweep = a1 - a0;
|
||||
let full = sweep.abs() >= 359.0_f64.to_radians();
|
||||
let n = ((sweep.abs() / 5.0_f64.to_radians()).ceil() as usize).clamp(8, 720);
|
||||
let da = sweep / n as f64;
|
||||
let rr = r / (da.abs() / 2.0).cos();
|
||||
let mut ring: Vec<V> = Vec::new();
|
||||
if !full {
|
||||
ring.push(c);
|
||||
ring.push((c.0 + r * a0.cos(), c.1 + r * a0.sin()));
|
||||
}
|
||||
openings.push(pvs(&ring));
|
||||
vec![Op::Replace { collection: "ceilings".into(), entity: with(host, "openings", Value::Array(openings)) }]
|
||||
for i in 0..n {
|
||||
let a = a0 + da * (i as f64 + 0.5);
|
||||
ring.push((c.0 + rr * a.cos(), c.1 + rr * a.sin()));
|
||||
}
|
||||
if !full {
|
||||
ring.push((c.0 + r * a1.cos(), c.1 + r * a1.sin()));
|
||||
}
|
||||
ring
|
||||
}
|
||||
|
||||
/// [266] Deckenloch einer neuen Treppe: erreicht sie die Decke ihres Geschosses (ganze Höhe, Wendel, Teilhöhe mit zu
|
||||
/// geringer Kopfhöhe, [297]), wird in diese Decke eine Aussparung in der Form des Treppenumrisses ([`stair_hole_rings`])
|
||||
/// gelegt; die Decke muss den ganzen Umriss enthalten. Keine solche Decke oder schon ein Loch darüber → keine Op.
|
||||
/// Die Ops laufen mit der Treppe im selben Commit (ein Undo-Schritt).
|
||||
pub(crate) fn stair_hole_ops(root: &Map<String, Value>, params: &[f64], rise: f64, _up: bool, ctx: &Ctx) -> Vec<Op> {
|
||||
let rings = stair_hole_rings(params, rise, ctx.floor_height.unwrap_or(f64::NAN));
|
||||
let ceilings = arr(root.get("ceilings"));
|
||||
let mut hosts: Vec<(Value, Vec<Value>)> = Vec::new();
|
||||
for ring in rings {
|
||||
if ring.len() < 3 || ring.iter().any(|q| !(q.0.is_finite() && q.1.is_finite())) {
|
||||
continue;
|
||||
}
|
||||
let Some(host) = ceilings.iter().find(|c| {
|
||||
let outline = ring_of(c);
|
||||
crate::cmd_create::floor_of(c) == Some(ctx.level) && outline.len() >= 3 && ring.iter().all(|q| point_in_polygon(*q, &outline))
|
||||
}) else {
|
||||
continue;
|
||||
};
|
||||
let id = id_of(host).unwrap_or("").to_string();
|
||||
let slot = match hosts.iter().position(|(h, _)| id_of(h).unwrap_or("") == id) {
|
||||
Some(i) => i,
|
||||
None => {
|
||||
hosts.push((host.clone(), arr(field(host, "openings")).to_vec()));
|
||||
hosts.len() - 1
|
||||
}
|
||||
};
|
||||
let openings = &mut hosts[slot].1;
|
||||
// Ein bestehendes Loch, das den Umriss schon enthält, genügt.
|
||||
let covered = openings.iter().any(|h| {
|
||||
let hr: Vec<V> = arr(Some(h)).iter().map(xy).collect();
|
||||
hr.len() >= 3 && ring.iter().all(|q| point_in_polygon(*q, &hr))
|
||||
});
|
||||
if !covered {
|
||||
openings.push(pvs(&ring));
|
||||
}
|
||||
}
|
||||
hosts
|
||||
.into_iter()
|
||||
.filter(|(h, o)| o.len() != arr(field(h, "openings")).len())
|
||||
.map(|(h, o)| Op::Replace { collection: "ceilings".into(), entity: with(&h, "openings", Value::Array(o)) })
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Dachfenster / Deckenöffnung mit Oberlicht ([103]): ein Klick setzt die Öffnung (Mitte im Grundriss) in das
|
||||
|
||||
@@ -226,15 +226,35 @@ fn wall_polygons(p: &Project, level_id: &str) -> Vec<Polygon> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// [266] Grundriss eines Geschosses für das GV: Vereinigung der Wand- und Raumgrundrisse (ohne AGF), Löcher
|
||||
/// gefüllt (Wandring ohne Räume = ganzes Geschoss); leer ohne Wände/Räume.
|
||||
/// Kleinste Fläche (m²) eines unbebauten Lochs im Geschossgrundriss, das als Innenhof gilt ([297]); kleinere
|
||||
/// Durchbrüche (Schächte, Lücken zwischen Wänden) bleiben im Volumen.
|
||||
const COURTYARD_MIN_AREA: f64 = 1.0;
|
||||
|
||||
/// [266] Grundriss eines Geschosses für das GV: Vereinigung der Wand- und Raumgrundrisse (ohne AGF); leer ohne
|
||||
/// Wände/Räume. Ein Wandring ohne Räume ist ein ganzes Geschoss (Löcher gefüllt). [297] Hat das Geschoss Räume, ist
|
||||
/// ein Loch ab [`COURTYARD_MIN_AREA`], das weder Wand noch Raum deckt, ein Innenhof: nach oben offen, ausserhalb
|
||||
/// der Begrenzung (SIA 416), also bleibt es als Aussparung im Grundriss und bekommt weder Geschossquader noch Dachraum.
|
||||
fn footprint(p: &Project, level_id: &str) -> Vec<Polygon> {
|
||||
let mut parts = wall_polygons(p, level_id);
|
||||
parts.extend(room_polygons(p, level_id, |c| c < CATEGORIES && c != AGF));
|
||||
let rooms = room_polygons(p, level_id, |c| c < CATEGORIES && c != AGF);
|
||||
let has_rooms = !rooms.is_empty();
|
||||
parts.extend(rooms);
|
||||
if parts.is_empty() {
|
||||
return Vec::new();
|
||||
}
|
||||
let outers: Vec<Polygon> = polygon_bool::union(&parts).into_iter().filter_map(|poly| poly.into_iter().next()).map(|r| vec![r]).collect();
|
||||
let merged = polygon_bool::union(&parts);
|
||||
if has_rooms {
|
||||
return merged
|
||||
.into_iter()
|
||||
.map(|mut poly| {
|
||||
let outer = poly.remove(0);
|
||||
let mut out = vec![outer];
|
||||
out.extend(poly.into_iter().filter(|h| signed_area(h).abs() >= COURTYARD_MIN_AREA));
|
||||
out
|
||||
})
|
||||
.collect();
|
||||
}
|
||||
let outers: Vec<Polygon> = merged.into_iter().filter_map(|poly| poly.into_iter().next()).map(|r| vec![r]).collect();
|
||||
polygon_bool::union(&outers)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user