[292] Wand: OK bis Decke (folgt der Deckenunterkante, auch geneigt; Deckenloch = Krone), Objekt-Info und Befehl wand
This commit is contained in:
16 files changed
+249
-37
No files matched your search
@@ -406,6 +406,10 @@ fn wall_ops(root: &Map<String, Value>, p: &Project, v: &Value, ctx: &Ctx, ids: &
|
||||
if let Some(e) = external {
|
||||
f.push(("isExternal", Value::Bool(e)));
|
||||
}
|
||||
// [292] OK bis Decke (Option des Befehls, Vorgabe aus).
|
||||
if matches!(v.get("ceilingAttach"), Some(Value::Bool(true))) {
|
||||
f.push(("ceilingAttach", Value::Bool(true)));
|
||||
}
|
||||
walls.push(obj(f));
|
||||
}
|
||||
if walls.is_empty() {
|
||||
|
||||
@@ -3499,6 +3499,12 @@ pub struct Wall {
|
||||
#[serde(rename = "roofAttach", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub roof_attach: Option<bool>,
|
||||
/// OK bis Decke ([292]): `true` = die Wand endet an der Unterkante der Decke ihres Geschosses (waagrecht: Decken-UK;
|
||||
/// geneigt: schräge Oberkante; im Deckenloch/ausserhalb der Decke bleibt die Krone); `undefined`/`false` = Wandkrone
|
||||
/// (Geschosshöhe bzw. `top`).
|
||||
#[serde(rename = "ceilingAttach", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub ceiling_attach: Option<bool>,
|
||||
/// Ansichtsschraffur ([100]): Drehung (Grad) des Oberflächenmusters dieses Elements gegenüber der
|
||||
/// Ausrichtung am Element (Default 0).
|
||||
#[serde(rename = "surfacePatternAngle", default, skip_serializing_if = "Option::is_none")]
|
||||
|
||||
@@ -1209,3 +1209,64 @@ fn entourage_pick_im_3d() {
|
||||
assert!((top - (base + 1.75)).abs() < 1e-9, "{top}");
|
||||
assert!(mine[0].tris.iter().flatten().all(|q| (q[0] - 4.0).abs() < 1.0 && (q[2] + 3.0).abs() < 1.0));
|
||||
}
|
||||
|
||||
/// [292] Wand W2 (x = 5, y 0…4) mit `ceilingAttach` unter einer Decke, die weit über die Wand reicht; `slope`: Gefälle
|
||||
/// der Decke (`rise` über die Länge 4 in +y, `None` = waagrecht), `hole`: Aussparung im Deckenumriss.
|
||||
fn wall_under_ceiling(attach: bool, with_ceiling: bool, slope: Option<f64>, hole: Option<[f64; 4]>) -> (Project, Vec<RWall>, f64, f64) {
|
||||
let mut p = sample();
|
||||
p.walls.retain(|w| w.id == "W2");
|
||||
p.openings = Some(vec![]);
|
||||
p.walls[0].ceiling_attach = attach.then_some(true);
|
||||
let mut c = p.ceilings.as_ref().unwrap()[0].clone();
|
||||
c.outline = [(0.0, -1.0), (8.0, -1.0), (8.0, 5.0), (0.0, 5.0)].iter().map(|&(x, y)| Vec2 { x, y }).collect();
|
||||
c.slope = slope.map(|r| CeilingSlope { from: Vec2 { x: 5.0, y: 0.0 }, to: Vec2 { x: 5.0, y: 4.0 }, rise: r, ramp: None, extra: Default::default() });
|
||||
c.openings = hole.map(|h| vec![[(h[0], h[1]), (h[2], h[1]), (h[2], h[3]), (h[0], h[3])].iter().map(|&(x, y)| Vec2 { x, y }).collect()]);
|
||||
p.ceilings = Some(if with_ceiling { vec![c] } else { vec![] });
|
||||
let uk = p.ceilings.as_ref().and_then(|cs| cs.first()).map_or(0.0, |c| p.ceiling_vertical_extent(c).0);
|
||||
let (_, crown) = p.wall_vertical_extent(&p.walls[0]);
|
||||
let mut out = emit_walls(&p, false).unwrap();
|
||||
out.extend(emit_walls(&p, true).unwrap());
|
||||
(p, out, uk, crown)
|
||||
}
|
||||
|
||||
/// Höchste Oberkante aller Stücke an einer Stelle der Achse (x = 5, y).
|
||||
fn top_at_y(ws: &[RWall], y: f64) -> f64 {
|
||||
ws.iter()
|
||||
.filter(|w| (w.start[1].min(w.end[1]) - 1e-6..=w.start[1].max(w.end[1]) + 1e-6).contains(&y))
|
||||
.map(|w| wall_top_at(w, [5.0, y]))
|
||||
.fold(f64::NEG_INFINITY, f64::max)
|
||||
}
|
||||
|
||||
/// [292] Unter einer waagrechten Decke endet die Wand an der Decken-UK; ohne Option bleibt die Krone; ohne Decke
|
||||
/// Rückfall auf die Geschosshöhe.
|
||||
#[test]
|
||||
fn wand_ok_bis_decke_waagrecht_und_rueckfall() {
|
||||
let (_, ws, uk, crown) = wall_under_ceiling(true, true, None, None);
|
||||
assert!(uk < crown - 0.05, "UK {uk} unter Krone {crown}");
|
||||
for y in [0.5, 2.0, 3.5] {
|
||||
assert!((top_at_y(&ws, y) - uk).abs() < 1e-6, "y {y}: {} soll {uk}", top_at_y(&ws, y));
|
||||
}
|
||||
let (_, ws, _, crown) = wall_under_ceiling(false, true, None, None);
|
||||
assert!((top_at_y(&ws, 2.0) - crown).abs() < 1e-6, "ohne Option: Krone");
|
||||
let (_, ws, _, crown) = wall_under_ceiling(true, false, None, None);
|
||||
assert!((top_at_y(&ws, 2.0) - crown).abs() < 1e-6, "ohne Decke: Geschosshöhe");
|
||||
}
|
||||
|
||||
/// [292] Unter einer geneigten Decke folgt die Oberkante der Neigung (Gefälle −0.5 m auf 4 m).
|
||||
#[test]
|
||||
fn wand_ok_bis_decke_geneigt_folgt_der_neigung() {
|
||||
let (_, ws, uk, _) = wall_under_ceiling(true, true, Some(-0.5), None);
|
||||
for y in [0.5, 2.0, 3.5] {
|
||||
let soll = uk - 0.5 * y / 4.0;
|
||||
assert!((top_at_y(&ws, y) - soll).abs() < 1e-3, "y {y}: {} soll {soll}", top_at_y(&ws, y));
|
||||
}
|
||||
assert!(ws.iter().any(|w| w.top_plane.is_some()), "schräge Oberkante");
|
||||
}
|
||||
|
||||
/// [292] Deckenloch (y 1…3): dort bleibt die Krone, daneben endet die Wand an der UK.
|
||||
#[test]
|
||||
fn wand_ok_bis_decke_mit_deckenloch() {
|
||||
let (_, ws, uk, crown) = wall_under_ceiling(true, true, None, Some([4.0, 1.0, 6.0, 3.0]));
|
||||
assert!((top_at_y(&ws, 0.5) - uk).abs() < 1e-6 && (top_at_y(&ws, 3.5) - uk).abs() < 1e-6);
|
||||
assert!((top_at_y(&ws, 2.0) - crown).abs() < 1e-6, "im Loch: Krone, {}", top_at_y(&ws, 2.0));
|
||||
}
|
||||
@@ -616,9 +616,11 @@ pub(crate) fn floor_context(p: &Project, floor_id: &str, with_ceilings: bool) ->
|
||||
|
||||
/// Wie [`floor_context`]; `joins`: schon gerechnete Schnittlinien je Wand-id (für den Deckenrand [178]).
|
||||
pub(crate) fn floor_context_with(p: &Project, floor_id: &str, with_ceilings: bool, joins: Option<&HashMap<String, WallCuts>>) -> FloorContext {
|
||||
let only = |c: &Ceiling| with_ceilings && c.floor_id == floor_id && c.outline.len() >= 3;
|
||||
// [292] Wände mit `ceilingAttach` brauchen die Platten-Umrisse auch ohne Decken im Kontext (Schnitt).
|
||||
let needs = with_ceilings || p.walls.iter().any(|w| w.floor_id == floor_id && w.ceiling_attach == Some(true));
|
||||
let only = |c: &Ceiling| needs && c.floor_id == floor_id && c.outline.len() >= 3;
|
||||
// [178] Platte bis Aussenkante Kern: die Aussenschicht-Bänder der Aussenwand liegen ausserhalb und laufen durch.
|
||||
let bearing = if with_ceilings { super::bearing::bearing_outlines(p, only, joins) } else { Vec::new() };
|
||||
let bearing = if needs { super::bearing::bearing_outlines(p, only, joins) } else { Vec::new() };
|
||||
floor_context_from(p, floor_id, with_ceilings, &bearing)
|
||||
}
|
||||
|
||||
@@ -664,7 +666,40 @@ pub(crate) fn floor_context_from(p: &Project, floor_id: &str, with_ceilings: boo
|
||||
ri
|
||||
})
|
||||
.collect();
|
||||
FloorContext::new(ceilings, roofs)
|
||||
FloorContext::new(ceilings, roofs).with_ceiling_undersides(ceiling_undersides(p, floor_id, bearing))
|
||||
}
|
||||
|
||||
/// [292] Unterkanten der Decken des Geschosses für Wände mit `ceilingAttach` (waagrecht und geneigt, auch ohne
|
||||
/// `with_ceilings`: der Schnitt rechnet die Decken selbst). Nur gebaut, wenn eine Wand des Geschosses sie braucht.
|
||||
/// Umriss = Platte bis Aussenkante der tragenden Schicht ([178], wie die Schnitt-Decken), Löcher = Aussparungen.
|
||||
fn ceiling_undersides(p: &Project, floor_id: &str, bearing: &[Option<Vec<crate::flat::Polygon>>]) -> Vec<crate::wall_bands::RoofFacet> {
|
||||
if !p.walls.iter().any(|w| w.floor_id == floor_id && w.ceiling_attach == Some(true)) {
|
||||
return Vec::new();
|
||||
}
|
||||
let mut out = Vec::new();
|
||||
for (ci, c) in p.ceilings.as_deref().unwrap_or(&[]).iter().enumerate() {
|
||||
if c.floor_id != floor_id || c.outline.len() < 3 {
|
||||
continue;
|
||||
}
|
||||
let (zb, _) = p.ceiling_vertical_extent(c);
|
||||
// z = zb + gx (x − ox) + gy (y − oy)
|
||||
let plane = match c.slope_plane() {
|
||||
Some(g) => [zb - g[2] * g[0] - g[3] * g[1], g[2], g[3]],
|
||||
None => [zb, 0.0, 0.0],
|
||||
};
|
||||
let rings: Vec<Vec<[f64; 2]>> = match bearing.get(ci).cloned().flatten() {
|
||||
Some(polys) => polys.iter().map(|poly| poly[0].iter().map(|q| [q[0], q[1]]).collect()).collect(),
|
||||
None => vec![c.ring().iter().map(|v| [v.x, v.y]).collect()],
|
||||
};
|
||||
let holes: Vec<Vec<[f64; 2]>> = c.openings.iter().flatten().filter(|h| h.len() >= 3).map(|h| h.iter().map(|v| [v.x, v.y]).collect()).collect();
|
||||
for ring in rings {
|
||||
if let Some(mut f) = crate::wall_bands::RoofFacet::new(ring, plane) {
|
||||
f.holes = holes.clone();
|
||||
out.push(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Liegt der Achspunkt `p` eines Bogen-Teilkörpers an einer inneren Stossfuge (nicht an Anfang, Ende
|
||||
@@ -748,6 +783,7 @@ fn wall_pieces_with(p: &Project, maps: &[String], wall: &Wall, ctx: &FloorContex
|
||||
openings: wall_openings(p, wall, openings, true),
|
||||
cuts,
|
||||
roof_attach: wall.roof_attach,
|
||||
ceiling_attach: wall.ceiling_attach == Some(true),
|
||||
reveals: if layered && stacked { wall_reveals(p, wall, openings, bands.len()) } else { Vec::new() },
|
||||
keep_holes: plain,
|
||||
// [216] Sehnen-Zonen (über deckungsgleiche Bogenwände der Geschosse vereinigt, `arc_zones`): Wand und Loch liegen
|
||||
|
||||
@@ -507,6 +507,8 @@ fn wall_selection(root: &Map<String, Value>, w: &Value) -> Result<J, String> {
|
||||
.v("sliceTermination", nn(field(w, "sliceTermination")).cloned().unwrap_or_else(|| "both".into()))
|
||||
// An Dach anschliessen ([G2]): fehlt = automatisch.
|
||||
.v("roofAttach", Value::String(match field(w, "roofAttach").and_then(|v| v.as_bool()) { Some(true) => "on", Some(false) => "off", None => "auto" }.into()))
|
||||
// OK bis Decke ([292]): fehlt = aus.
|
||||
.v("ceilingAttach", Value::Bool(field(w, "ceilingAttach").and_then(Value::as_bool).unwrap_or(false)))
|
||||
.raw("wallTypeId", w, "wallTypeId")
|
||||
// Aussenbauteil / tragend ([97]/[98]: Listen, IFC-Pset).
|
||||
.v("isExternal", Value::Bool(field(w, "isExternal").and_then(Value::as_bool).unwrap_or(false)))
|
||||
|
||||
@@ -91,6 +91,8 @@ impl RoofIn {
|
||||
pub struct RoofFacet {
|
||||
pub ring: Vec<[f64; 2]>,
|
||||
pub plane: [f64; 3],
|
||||
/// Aussparungen (Deckenlöcher, [292]); leer bei Dachflächen.
|
||||
pub holes: Vec<Vec<[f64; 2]>>,
|
||||
bounds: [f64; 4],
|
||||
}
|
||||
|
||||
@@ -101,7 +103,7 @@ impl RoofFacet {
|
||||
return None;
|
||||
}
|
||||
let b = outline_bounds(ring.iter().map(|q| (q[0], q[1])));
|
||||
Some(RoofFacet { ring, plane, bounds: [b.min_x, b.min_y, b.max_x, b.max_y] })
|
||||
Some(RoofFacet { ring, plane, holes: Vec::new(), bounds: [b.min_x, b.min_y, b.max_x, b.max_y] })
|
||||
}
|
||||
pub(crate) fn z(&self, x: f64, y: f64) -> f64 {
|
||||
self.plane[0] + self.plane[1] * x + self.plane[2] * y
|
||||
@@ -111,17 +113,7 @@ impl RoofFacet {
|
||||
if x < b[0] || x > b[2] || y < b[1] || y > b[3] {
|
||||
return false;
|
||||
}
|
||||
let mut inside = false;
|
||||
let n = self.ring.len();
|
||||
let mut j = n - 1;
|
||||
for i in 0..n {
|
||||
let (a, c) = (self.ring[i], self.ring[j]);
|
||||
if (a[1] > y) != (c[1] > y) && x < (c[0] - a[0]) * (y - a[1]) / (c[1] - a[1]) + a[0] {
|
||||
inside = !inside;
|
||||
}
|
||||
j = i;
|
||||
}
|
||||
inside
|
||||
ring_has(&self.ring, x, y) && !self.holes.iter().any(|h| ring_has(h, x, y))
|
||||
}
|
||||
/// Höchster Wert über den Ecken.
|
||||
fn z_max(&self) -> f64 {
|
||||
@@ -129,6 +121,24 @@ impl RoofFacet {
|
||||
}
|
||||
}
|
||||
|
||||
/// Punkt im Ring (gerade-ungerade-Regel).
|
||||
fn ring_has(ring: &[[f64; 2]], x: f64, y: f64) -> bool {
|
||||
let mut inside = false;
|
||||
let n = ring.len();
|
||||
if n < 3 {
|
||||
return false;
|
||||
}
|
||||
let mut j = n - 1;
|
||||
for i in 0..n {
|
||||
let (a, c) = (ring[i], ring[j]);
|
||||
if (a[1] > y) != (c[1] > y) && x < (c[0] - a[0]) * (y - a[1]) / (c[1] - a[1]) + a[0] {
|
||||
inside = !inside;
|
||||
}
|
||||
j = i;
|
||||
}
|
||||
inside
|
||||
}
|
||||
|
||||
/// Unterkanten-Facetten der Dachflächen: Oberfläche um `total` senkrecht zur Fläche gesenkt (wie die
|
||||
/// 3D-Schichten); senkrechte Flächen entfallen.
|
||||
pub fn plane_facets(planes: &[Vec<[f64; 3]>], total: f64) -> Vec<RoofFacet> {
|
||||
@@ -190,6 +200,9 @@ pub struct WallIn {
|
||||
/// Dach-Unterkante, wo ihre Krone darüber liegt), `Some(true)` = zusätzlich bis unter das Dach
|
||||
/// verlängert, `Some(false)` = Dächer schneiden die Wand nicht.
|
||||
pub roof_attach: Option<bool>,
|
||||
/// OK bis Decke ([292], `Wall.ceilingAttach`): die Wand endet an der Unterkante der Decken ihres Geschosses
|
||||
/// (`FloorContext::under`), auch geneigt.
|
||||
pub ceiling_attach: bool,
|
||||
/// [231] Unter einer Dachfläche die Löcher im Stück behalten, statt es in Pfeiler/Brüstung/Sturz mit je
|
||||
/// eigener Oberkante zu teilen — für den Wandkörper per Boolean (`model3d/wall_body.rs`), der die Löcher
|
||||
/// selbst ausschneidet. Sonst `false`.
|
||||
@@ -207,9 +220,23 @@ pub struct WallIn {
|
||||
pub struct FloorContext {
|
||||
ceilings: Vec<(CeilingIn, Bounds)>,
|
||||
roofs: Vec<(RoofIn, Bounds)>,
|
||||
/// Unterkanten der Decken ([292]) — nur für Wände mit `ceiling_attach`; gilt die tiefste.
|
||||
under: Vec<(RoofFacet, Bounds)>,
|
||||
}
|
||||
|
||||
impl FloorContext {
|
||||
/// Decken-Unterkanten ([292]) ergänzen (`RoofFacet::plane` = UK, `holes` = Aussparungen).
|
||||
pub fn with_ceiling_undersides(mut self, facets: Vec<RoofFacet>) -> Self {
|
||||
self.under = facets
|
||||
.into_iter()
|
||||
.map(|f| {
|
||||
let b = Bounds { min_x: f.bounds[0], min_y: f.bounds[1], max_x: f.bounds[2], max_y: f.bounds[3] };
|
||||
(f, b)
|
||||
})
|
||||
.collect();
|
||||
self
|
||||
}
|
||||
|
||||
/// Die Decken (Eingabe) — der 3D-Cache ([58]) vergleicht sie: der Deckenrand [178] hängt von den Wänden ab.
|
||||
pub fn ceiling_inputs(&self) -> Vec<CeilingIn> {
|
||||
self.ceilings.iter().map(|c| c.0.clone()).collect()
|
||||
@@ -219,6 +246,8 @@ impl FloorContext {
|
||||
pub fn same_input(&self, o: &FloorContext) -> bool {
|
||||
self.ceilings.len() == o.ceilings.len()
|
||||
&& self.roofs.len() == o.roofs.len()
|
||||
&& self.under.len() == o.under.len()
|
||||
&& self.under.iter().zip(&o.under).all(|(a, b)| a.0 == b.0)
|
||||
&& self.ceilings.iter().zip(&o.ceilings).all(|(a, b)| a.0 == b.0)
|
||||
&& self.roofs.iter().zip(&o.roofs).all(|(a, b)| a.0 == b.0)
|
||||
}
|
||||
@@ -239,6 +268,7 @@ impl FloorContext {
|
||||
(r, b)
|
||||
})
|
||||
.collect(),
|
||||
under: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -621,7 +651,11 @@ enum Fac {
|
||||
}
|
||||
|
||||
struct Tops<'a> {
|
||||
/// Dachfacetten (je Punkt gilt die höchste), danach ab `n_roof` die Decken-UK (tiefste, [292]).
|
||||
facets: Vec<&'a RoofFacet>,
|
||||
n_roof: usize,
|
||||
/// Fuss der ganzen Wand (nicht des Stücks): Decken darunter zählen nicht.
|
||||
foot: f64,
|
||||
zb: f64,
|
||||
zt_free: f64,
|
||||
zt_cap: f64,
|
||||
@@ -630,7 +664,7 @@ struct Tops<'a> {
|
||||
impl Tops<'_> {
|
||||
fn at(&self, p: Vec2) -> Fac {
|
||||
let mut best: Option<(f64, usize)> = None;
|
||||
for (k, f) in self.facets.iter().enumerate() {
|
||||
for (k, f) in self.facets.iter().enumerate().take(self.n_roof) {
|
||||
if f.contains(p.x, p.y) {
|
||||
let z = f.z(p.x, p.y);
|
||||
if best.is_none_or(|b| z > b.0) {
|
||||
@@ -638,6 +672,21 @@ impl Tops<'_> {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Decke darüber: tiefste Unterkante über dem Wandfuss (Stücke darüber entfallen); eine Decke unter dem Fuss zählt nicht.
|
||||
let mut under: Option<(f64, usize)> = None;
|
||||
for (k, f) in self.facets.iter().enumerate().skip(self.n_roof) {
|
||||
if f.contains(p.x, p.y) {
|
||||
let z = f.z(p.x, p.y);
|
||||
if z > self.foot + 1e-9 && under.is_none_or(|b| z < b.0) {
|
||||
under = Some((z, k));
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(u) = under {
|
||||
if best.is_none_or(|b| u.0 < b.0) {
|
||||
best = Some(u);
|
||||
}
|
||||
}
|
||||
match best {
|
||||
None => Fac::Free,
|
||||
Some((z, _)) if z >= self.zt_cap - 1e-9 => {
|
||||
@@ -678,23 +727,32 @@ struct TopPiece {
|
||||
|
||||
/// Dächer, die eine Wand im Höhenbereich `[zb, zt]` betreffen; `None` = keine (unverändert).
|
||||
fn roof_tops_ctx<'a>(w: &WallIn, ctx: &'a FloorContext, zb: f64, zt: f64) -> Option<Tops<'a>> {
|
||||
if w.roof_attach == Some(false) || ctx.roofs.is_empty() {
|
||||
let roofs_on = w.roof_attach != Some(false) && !ctx.roofs.is_empty();
|
||||
let under_on = w.ceiling_attach && !ctx.under.is_empty();
|
||||
if !roofs_on && !under_on {
|
||||
return None;
|
||||
}
|
||||
let wb = wall_bounds(w, w.thickness_safe.max(0.0) + 0.01);
|
||||
let facets: Vec<&RoofFacet> = ctx
|
||||
.roofs
|
||||
.iter()
|
||||
.filter(|(r, rb)| r.eaves_z + 50.0 >= zb && bounds_overlap(wb, *rb))
|
||||
.flat_map(|(r, _)| r.facets.iter())
|
||||
.filter(|f| bounds_overlap(wb, Bounds { min_x: f.bounds[0], min_y: f.bounds[1], max_x: f.bounds[2], max_y: f.bounds[3] }))
|
||||
.collect();
|
||||
let mut facets: Vec<&RoofFacet> = if roofs_on {
|
||||
ctx.roofs
|
||||
.iter()
|
||||
.filter(|(r, rb)| r.eaves_z + 50.0 >= zb && bounds_overlap(wb, *rb))
|
||||
.flat_map(|(r, _)| r.facets.iter())
|
||||
.filter(|f| bounds_overlap(wb, Bounds { min_x: f.bounds[0], min_y: f.bounds[1], max_x: f.bounds[2], max_y: f.bounds[3] }))
|
||||
.collect()
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
let n_roof = facets.len();
|
||||
if under_on {
|
||||
facets.extend(ctx.under.iter().filter(|(_, b)| bounds_overlap(wb, *b)).map(|(f, _)| f));
|
||||
}
|
||||
if facets.is_empty() {
|
||||
return None;
|
||||
}
|
||||
// Verlängern nur, wo der Höhenbereich bis zur Wandkrone reicht (nicht unter einer Decke).
|
||||
let zt_cap = if w.roof_attach == Some(true) && (zt - w.z_top).abs() < EPS { facets.iter().map(|f| f.z_max()).fold(zt, f64::max) } else { zt };
|
||||
Some(Tops { facets, zb, zt_free: zt, zt_cap })
|
||||
let zt_cap = if w.roof_attach == Some(true) && (zt - w.z_top).abs() < EPS { facets[..n_roof].iter().map(|f| f.z_max()).fold(zt, f64::max) } else { zt };
|
||||
Some(Tops { facets, n_roof, foot: w.z_bottom, zb, zt_free: zt, zt_cap })
|
||||
}
|
||||
|
||||
/// Ecken der Grundfläche eines Bandstücks (aussen +n, innen −n) an den Schnittlinien.
|
||||
@@ -808,6 +866,7 @@ fn strip_tops(w: &WallIn, t: &Tops, u: Vec2, n: Vec2, off: f64, th: f64, a: f64,
|
||||
Fac::Floor => continue,
|
||||
Fac::Free => (None, t.zt_free),
|
||||
Fac::Cap => (None, t.zt_cap),
|
||||
Fac::Roof(k) if k >= t.n_roof && t.coef(f)[1] == 0.0 && t.coef(f)[2] == 0.0 => (None, t.coef(f)[0].clamp_safe(t.zb, t.zt_cap)),
|
||||
Fac::Roof(_) => {
|
||||
let c = t.coef(f);
|
||||
let zmax = strip_corners(w, u, n, off, th, s0, s1, c0, c1).iter().map(|q| c[0] + c[1] * q.x + c[2] * q.y).fold(f64::NEG_INFINITY, f64::max);
|
||||
@@ -1249,6 +1308,7 @@ mod tests {
|
||||
cuts: WallCuts::default(),
|
||||
reveals: vec![],
|
||||
roof_attach: None,
|
||||
ceiling_attach: false,
|
||||
keep_holes: false,
|
||||
chord_zones: vec![],
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user