[94] Fenster/Türen: Leibung mittig, Anschlag, Sturz, Fensterbänke, Storenkasten im Sturz
Neue optionale Typ-Felder (ohne sie bleibt alles wie bisher): insetFace "mitte", rebateDepth (Wandnase je Schicht im Grundriss, 3D-Teil, kleinere Ansicht von der Anschlag-Seite), lintelHeight (Schnitt), Fensterbank nach sillBoard (Grundriss fein, Schnitt bei ausdrücklicher Wahl), shading.mount "sturz" (verdeckter Storenkasten, Führungsschienen, Schnitt mit Lamellenpaket). UI im Dialog „Fenster bearbeiten“.
This commit is contained in:
16 files changed
+703
-60
No files matched your search
@@ -1378,6 +1378,17 @@ Reihenfolge = Abhängigkeiten. Neue Geometrie entsteht in Rust ([K]).
|
||||
Zuständigkeitsbereich); Kanten-/Hof-Griffe im Grundriss; Mansarde mit Hof UND verschieden geneigten
|
||||
Kanten: zweite Dachschicht (Versatz > Knickbreite) nicht geschlossen; Schattenwurf (`sun.rs`) nimmt
|
||||
weiter die Hülle der Dachpunkte (Hof wirft Schatten).
|
||||
- ◐ **[94] Fenster/Türen: Konstruktionsdetails.** (29.10., Wunsch Maintainer vor den Lukarnen) Neue Typ-Felder (Fenster- und
|
||||
Türtyp, optional, ohne sie bleibt alles wie bisher): Leibung `insetFace: "mitte"` (neben aussen/innen + `insetFromFace`
|
||||
= Mass), Anschlag `rebateDepth` (Wandnase zwischen Anschlag-Fläche und Rahmen-Vorderkante; Grundriss je Wandschicht in
|
||||
deren Schraffur, 3D Teil „Anschlag", Ansicht von der Anschlag-Seite mit kleinerer Rahmenfläche), Sturz `lintelHeight`
|
||||
(Schnitt: eigener Querschnitt, neben einem Storenkasten nur über die Restdicke), Fensterbank nach `sillBoard` (Grundriss
|
||||
fein: aussen bis 4 cm vor die Fassade, innen bis 2 cm vor die Innenfläche; Schnitt nur bei ausdrücklicher Wahl, aussen
|
||||
mit Gefälle), Storenkasten `shading.mount: "sturz"` (Schweizer Lamellenstoren: Kasten im Sturz verdeckt — Grundriss
|
||||
Überkopf-Rechteck ab Aussenfläche, fein Führungsschienen neben dem Anschlag; Schnitt Kasten + Lamellenpaket, vorgesetzter
|
||||
Kasten jetzt auch im Schnitt; 3D nur Schienen). UI: „Fenster bearbeiten" (Rahmen/Sonnenschutz). Geprüft: Rust-Tests,
|
||||
CLI-Grundriss/-Schnitt/-Ansicht als PNG angesehen (Linux). Offen: Anschlag im Schnitt (Sturz-Nase), Brüstung als
|
||||
eigenes Bauteil, Anschlag/Leibung in den Ressourcen-Tabs (nur im Bearbeiten-Dialog).
|
||||
|
||||
## Priorität 4 — später
|
||||
|
||||
|
||||
@@ -638,6 +638,9 @@ pub enum DoorTypeInsetFace {
|
||||
Aussen,
|
||||
#[serde(rename = "innen")]
|
||||
Innen,
|
||||
/// Rahmen mittig in der Wand (Leibung beidseitig gleich tief); `insetFromFace` wirkt nicht.
|
||||
#[serde(rename = "mitte")]
|
||||
Mitte,
|
||||
#[serde(other)]
|
||||
#[ts(skip)]
|
||||
Unknown,
|
||||
@@ -729,6 +732,17 @@ pub struct DoorType {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub threshold: Option<bool>,
|
||||
/// Anschlag (Maueranschlag): so weit (Meter, je Seite und oben) springt die Wand zwischen
|
||||
/// der Fläche aus {@link insetFace} und der Rahmen-Vorderkante in die Öffnung vor. Wirkt nur
|
||||
/// mit Leibung (`insetFromFace` > 0 bzw. `insetFace: "mitte"`). 0/fehlt ⇒ stumpf (bisher).
|
||||
#[serde(rename = "rebateDepth", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub rebate_depth: Option<f64>,
|
||||
/// Sturz: Höhe des Sturzes über der Öffnung (Meter), im Schnitt als eigener Querschnitt
|
||||
/// gezeichnet. 0/fehlt ⇒ kein eigener Sturz (bisher).
|
||||
#[serde(rename = "lintelHeight", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub lintel_height: Option<f64>,
|
||||
#[serde(flatten)]
|
||||
#[ts(skip)]
|
||||
pub extra: Extra,
|
||||
@@ -830,6 +844,19 @@ pub enum WindowShadingKind {
|
||||
Unknown,
|
||||
}
|
||||
|
||||
/// Einbau des Sonnenschutzkastens ({@link WindowShading.mount}).
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize, TS)]
|
||||
pub enum WindowShadingMount {
|
||||
#[default]
|
||||
#[serde(rename = "vorgesetzt")]
|
||||
Vorgesetzt,
|
||||
#[serde(rename = "sturz")]
|
||||
Sturz,
|
||||
#[serde(other)]
|
||||
#[ts(skip)]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize, TS)]
|
||||
#[serde(default)]
|
||||
pub struct WindowShadingBox {
|
||||
@@ -851,6 +878,11 @@ pub struct WindowShading {
|
||||
/// Kastenmasse (Meter): Breite (quer, meist = Öffnung), Höhe, Tiefe.
|
||||
#[ts(inline)]
|
||||
pub r#box: WindowShadingBox,
|
||||
/// Einbau des Kastens: "vorgesetzt" (vor der Rahmenebene, bisher) oder "sturz" (Storenkasten
|
||||
/// im Sturz, in der Wand verdeckt — in der Schweiz üblich bei Lamellenstoren). Fehlt ⇒ vorgesetzt.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub mount: Option<WindowShadingMount>,
|
||||
#[serde(flatten)]
|
||||
#[ts(skip)]
|
||||
pub extra: Extra,
|
||||
@@ -877,6 +909,9 @@ pub enum WindowTypeInsetFace {
|
||||
Aussen,
|
||||
#[serde(rename = "innen")]
|
||||
Innen,
|
||||
/// Rahmen mittig in der Wand (Leibung beidseitig gleich tief); `insetFromFace` wirkt nicht.
|
||||
#[serde(rename = "mitte")]
|
||||
Mitte,
|
||||
#[serde(other)]
|
||||
#[ts(skip)]
|
||||
Unknown,
|
||||
@@ -1042,6 +1077,17 @@ pub struct WindowType {
|
||||
#[serde(rename = "sillBoard", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional, inline)]
|
||||
pub sill_board: Option<WindowTypeSillBoard>,
|
||||
/// Anschlag (Maueranschlag): so weit (Meter, je Seite und oben) springt die Wand zwischen
|
||||
/// der Fläche aus {@link insetFace} und der Rahmen-Vorderkante in die Öffnung vor. Wirkt nur
|
||||
/// mit Leibung (`insetFromFace` > 0 bzw. `insetFace: "mitte"`). 0/fehlt ⇒ stumpf (bisher).
|
||||
#[serde(rename = "rebateDepth", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub rebate_depth: Option<f64>,
|
||||
/// Sturz: Höhe des Sturzes über der Öffnung (Meter), im Schnitt als eigener Querschnitt
|
||||
/// gezeichnet. 0/fehlt ⇒ kein eigener Sturz (bisher).
|
||||
#[serde(rename = "lintelHeight", default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub lintel_height: Option<f64>,
|
||||
#[serde(flatten)]
|
||||
#[ts(skip)]
|
||||
pub extra: Extra,
|
||||
|
||||
@@ -570,13 +570,14 @@ pub fn emit_walls(p: &Project, layered: bool) -> Result<Vec<RWall>, String> {
|
||||
// ── Öffnungs-Einbauteile (Glas, Rahmen, Sprossen, Bank, Kasten) ─────────────
|
||||
|
||||
/// Farbe je Bauteil-Klasse (Index = `Part` in `openings3d.rs`).
|
||||
const PART_RGB: [Rgb; 6] = [
|
||||
const PART_RGB: [Rgb; 7] = [
|
||||
[0.62, 0.76, 0.85],
|
||||
[0.85, 0.85, 0.83],
|
||||
[0.88, 0.88, 0.9],
|
||||
[0.8, 0.8, 0.78],
|
||||
[0.25, 0.27, 0.3],
|
||||
[0.93, 0.9, 0.85],
|
||||
[0.9, 0.89, 0.86],
|
||||
];
|
||||
|
||||
/// Dreiecke eines Öffnungs-Quaders (Ecken-Bits: bit0 = Achse, bit1 = Höhe, bit2 = quer).
|
||||
@@ -614,8 +615,9 @@ fn opening_kind_code(k: Option<OpeningKind>) -> f64 {
|
||||
}
|
||||
}
|
||||
|
||||
fn write_common(w: &mut FlatWriter, frame_depth: Option<f64>, inset: Option<f64>, inner: bool, join: Option<FrameCornerJoin>, frame_width: Option<f64>, transom: Option<f64>) {
|
||||
w.nums(&[opt(frame_depth), opt(inset), flag(inner), join_code(join), opt(frame_width), opt(transom)]);
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn write_common(w: &mut FlatWriter, frame_depth: Option<f64>, inset: Option<f64>, side: f64, join: Option<FrameCornerJoin>, frame_width: Option<f64>, transom: Option<f64>, rebate: Option<f64>) {
|
||||
w.nums(&[opt(frame_depth), opt(inset), side, join_code(join), opt(frame_width), opt(transom), opt(rebate)]);
|
||||
}
|
||||
|
||||
fn glazing_panes_of(wt: &WindowType) -> f64 {
|
||||
@@ -636,7 +638,14 @@ fn write_opening(w: &mut FlatWriter, p: &Project, op: &Opening) {
|
||||
return;
|
||||
};
|
||||
w.num(1.0);
|
||||
write_common(w, wt.frame_depth, wt.inset_from_face, wt.inset_face == Some(WindowTypeInsetFace::Innen), wt.frame_corner_join, wt.frame_width, wt.transom_height);
|
||||
let side = match wt.inset_face {
|
||||
Some(WindowTypeInsetFace::Innen) => 1.0,
|
||||
Some(WindowTypeInsetFace::Mitte) => 2.0,
|
||||
_ => 0.0,
|
||||
};
|
||||
write_common(w, wt.frame_depth, wt.inset_from_face, side, wt.frame_corner_join, wt.frame_width, wt.transom_height, wt.rebate_depth);
|
||||
let sturz = wt.shading.as_ref().is_some_and(|s| s.mount == Some(WindowShadingMount::Sturz));
|
||||
let rails = sturz && wt.shading.as_ref().is_some_and(|s| s.kind != WindowShadingKind::Markise);
|
||||
let shading = wt.shading.as_ref().filter(|s| s.create).map(|s| &s.r#box);
|
||||
w.nums(&[
|
||||
glazing_panes_of(wt),
|
||||
@@ -652,6 +661,8 @@ fn write_opening(w: &mut FlatWriter, p: &Project, op: &Opening) {
|
||||
shading.map_or(0.0, |b| b.width),
|
||||
shading.map_or(0.0, |b| b.height),
|
||||
shading.map_or(0.0, |b| b.depth),
|
||||
flag(sturz),
|
||||
flag(rails),
|
||||
op.wing_count.unwrap_or(wt.wing_count),
|
||||
opening_kind_code(Some(wt.kind)),
|
||||
]);
|
||||
@@ -674,7 +685,12 @@ fn write_opening(w: &mut FlatWriter, p: &Project, op: &Opening) {
|
||||
return;
|
||||
};
|
||||
w.num(1.0);
|
||||
write_common(w, dt.frame_depth, dt.inset_from_face, dt.inset_face == Some(DoorTypeInsetFace::Innen), dt.frame_corner_join, dt.frame_width, dt.transom_height);
|
||||
let side = match dt.inset_face {
|
||||
Some(DoorTypeInsetFace::Innen) => 1.0,
|
||||
Some(DoorTypeInsetFace::Mitte) => 2.0,
|
||||
_ => 0.0,
|
||||
};
|
||||
write_common(w, dt.frame_depth, dt.inset_from_face, side, dt.frame_corner_join, dt.frame_width, dt.transom_height, dt.rebate_depth);
|
||||
w.nums(&[
|
||||
flag(dt.threshold == Some(true)),
|
||||
dt.leaf_count,
|
||||
|
||||
@@ -145,6 +145,8 @@ pub struct WindowSpec {
|
||||
/// NaN = nicht gesetzt
|
||||
pub inset_from_face: f64,
|
||||
pub inset_inner: bool,
|
||||
/// Rahmen mittig in der Wand (`insetFace: "mitte"`); hat Vorrang vor `inset_inner`/Einzug.
|
||||
pub inset_mid: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
@@ -230,8 +232,7 @@ pub fn window_symbol(
|
||||
let inset = max(0.0, or_zero(spec.inset_from_face));
|
||||
let half_t = total / 2.0;
|
||||
let sign = if spec.inset_inner { 1.0 } else { -1.0 };
|
||||
let mut front_rel = sign * (half_t - inset);
|
||||
let mut back_rel = front_rel - sign * depth;
|
||||
let (mut front_rel, mut back_rel) = if spec.inset_mid { (-depth / 2.0, depth / 2.0) } else { (sign * (half_t - inset), sign * (half_t - inset) - sign * depth) };
|
||||
front_rel = max(-half_t, min(half_t, front_rel));
|
||||
back_rel = max(-half_t, min(half_t, back_rel));
|
||||
let frame_outer_n = ref_off + max(front_rel, back_rel);
|
||||
|
||||
@@ -44,6 +44,8 @@ pub enum Part {
|
||||
Sill = 3,
|
||||
Symbol = 4,
|
||||
DoorLeaf = 5,
|
||||
/// Maueranschlag (Wandnase in der Leibung, [94]).
|
||||
Rebate = 6,
|
||||
}
|
||||
|
||||
/// Ein Quader: Bauteil-Klasse und 8 Ecken (x, y, z), Ecken-Bits wie `OPENING_BOX_TRIS`.
|
||||
@@ -151,6 +153,10 @@ pub struct WindowTypeIn {
|
||||
pub default_opening: SashOpening,
|
||||
/// Rollladenkasten (Breite, Höhe, Tiefe), nur bei `shading.create`.
|
||||
pub shading: Option<[f64; 3]>,
|
||||
/// Kasten im Sturz (verdeckt, kein Quader) statt vorgesetzt.
|
||||
pub shading_sturz: bool,
|
||||
/// Führungsschienen in der Leibung (Kasten im Sturz, nicht Markise).
|
||||
pub shading_rails: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
@@ -166,6 +172,10 @@ pub struct TypeIn {
|
||||
pub inset_from_face: f64,
|
||||
/// `(insetFace ?? "aussen") === "innen"`.
|
||||
pub inset_inner: bool,
|
||||
/// `insetFace === "mitte"`: Rahmen symmetrisch um die Wandmitte.
|
||||
pub inset_mid: bool,
|
||||
/// Maueranschlag je Seite und oben (Meter), NaN/0 = keiner.
|
||||
pub rebate_depth: f64,
|
||||
pub corner_join: CornerJoin,
|
||||
pub frame_width: f64,
|
||||
pub transom_height: f64,
|
||||
@@ -408,10 +418,9 @@ fn across_wall_depth(frame_depth: f64, wall_thickness: f64) -> f64 {
|
||||
|
||||
/// Quer-Versatz `[n_min, n_max]` des Rahmenkörpers: Vorderkante bündig mit der gewählten
|
||||
/// Wandfläche (minus Schichteinzug), `depth` zur Wandmitte hin, auf die halbe Dicke geklemmt.
|
||||
fn frame_normal_range(half: f64, depth: f64, inset: f64, inner: bool) -> (f64, f64) {
|
||||
fn frame_normal_range(half: f64, depth: f64, inset: f64, inner: bool, mid: bool) -> (f64, f64) {
|
||||
let sign = if inner { -1.0 } else { 1.0 };
|
||||
let front = sign * (half - inset);
|
||||
let back = front - sign * depth;
|
||||
let (front, back) = if mid { (depth / 2.0, -depth / 2.0) } else { (sign * (half - inset), sign * (half - inset) - sign * depth) };
|
||||
let a = clamp_range(front, -half, half);
|
||||
let b = clamp_range(back, -half, half);
|
||||
(jmin(a, b), jmax(a, b))
|
||||
@@ -421,7 +430,7 @@ fn resolve_frame(o: &OpeningIn) -> Option<FrameParams<'_>> {
|
||||
let ty = o.ty.as_ref()?;
|
||||
let half = o.wall_thickness / 2.0;
|
||||
let depth = across_wall_depth(ty.frame_depth, o.wall_thickness);
|
||||
let (n_min, n_max) = frame_normal_range(half, depth, or(ty.inset_from_face, 0.0), ty.inset_inner);
|
||||
let (n_min, n_max) = frame_normal_range(half, depth, or(ty.inset_from_face, 0.0), ty.inset_inner, ty.inset_mid);
|
||||
let frame_width = or(ty.frame_width, DEFAULT_FRAME_WIDTH);
|
||||
let transom_height = jmax(0.0, or(ty.transom_height, 0.0));
|
||||
Some(match &ty.kind {
|
||||
@@ -497,6 +506,23 @@ fn resolve_frame(o: &OpeningIn) -> Option<FrameParams<'_>> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Maueranschlag: Wandnasen links, rechts und oben in der Zone zwischen der Anschlag-Fläche und
|
||||
/// der Rahmen-Vorderkante (aussen bzw. bei `insetFace: "innen"` innen; mittig: aussen).
|
||||
fn rebate_boxes(em: &mut Emitter, o: &OpeningIn, ty: &TypeIn, p: &FrameParams) {
|
||||
let rd = jmin(or(ty.rebate_depth, 0.0), (o.to - o.from) / 2.0 - 0.01);
|
||||
if !(rd > EPS) {
|
||||
return;
|
||||
}
|
||||
let half = p.half_thickness;
|
||||
let (n0, n1) = if ty.inset_inner && !ty.inset_mid { (-half, p.n_min) } else { (p.n_max, half) };
|
||||
if n1 - n0 <= EPS {
|
||||
return;
|
||||
}
|
||||
em.axis_box(o.from, o.from + rd, o.z_bottom, o.z_top, n0, n1, Part::Rebate);
|
||||
em.axis_box(o.to - rd, o.to, o.z_bottom, o.z_top, n0, n1, Part::Rebate);
|
||||
em.axis_box(o.from + rd, o.to - rd, o.z_top - rd, o.z_top, n0, n1, Part::Rebate);
|
||||
}
|
||||
|
||||
/// Flügeleinteilung auf `[from, to]`: feste Breiten exakt, der Rest gleichmässig.
|
||||
fn sash_spans(sashes: &[SashIn], from: f64, to: f64) -> Vec<(SashIn, f64, f64)> {
|
||||
let width = jmax(0.0, to - from);
|
||||
@@ -822,6 +848,9 @@ pub fn opening_meshes(walls: &[WallIn], detail: Detail) -> Vec<BoxMesh> {
|
||||
door_leaf(&mut em, o, &p);
|
||||
glass_panes(&mut em, o, &p);
|
||||
}
|
||||
if let (Some(ty), Some(p)) = (&o.ty, resolve_frame(o)) {
|
||||
rebate_boxes(&mut em, o, ty, &p);
|
||||
}
|
||||
}
|
||||
}
|
||||
if detail == Detail::Coarse {
|
||||
@@ -841,6 +870,18 @@ pub fn opening_meshes(walls: &[WallIn], detail: Detail) -> Vec<BoxMesh> {
|
||||
let Some(TypeIn { kind: KindIn::Window(wt), .. }) = &o.ty else { continue };
|
||||
let Some([bw, bh, bd]) = wt.shading else { continue };
|
||||
let Some(p) = resolve_frame(o) else { continue };
|
||||
if wt.shading_sturz {
|
||||
// Storenkasten im Sturz: verdeckt; sichtbar sind nur die Führungsschienen vor dem Rahmen.
|
||||
if wt.shading_rails {
|
||||
let (rail_u, rail_n) = (0.03, 0.04);
|
||||
let (n0, n1) = if o.ty.as_ref().is_some_and(|t| t.inset_inner) { (p.n_min - 0.005 - rail_n, p.n_min - 0.005) } else { (p.n_max + 0.005, p.n_max + 0.005 + rail_n) };
|
||||
// Neben dem Anschlag (Wandnase) in der Leibung.
|
||||
let rd = o.ty.as_ref().map_or(0.0, |t| jmax(0.0, jmin(or(t.rebate_depth, 0.0), (o.to - o.from) / 2.0 - 0.01)));
|
||||
em.axis_box(o.from + rd, o.from + rd + rail_u, o.z_bottom, o.z_top, n0, n1, Part::Shading);
|
||||
em.axis_box(o.to - rd - rail_u, o.to - rd, o.z_bottom, o.z_top, n0, n1, Part::Shading);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let h = jmax(0.0, bh);
|
||||
let d = jmax(0.0, bd);
|
||||
if h <= EPS || d <= EPS {
|
||||
@@ -862,12 +903,12 @@ pub fn opening_meshes(walls: &[WallIn], detail: Detail) -> Vec<BoxMesh> {
|
||||
// Eingabe: `[detail (0 grob, 1 mittel, 2 fein, sonst andere), nWände, Wand…]`
|
||||
// Wand = `sx, sy, ex, ey, nÖffnungen, Öffnung…`
|
||||
// Öffnung = `from, to, zBottom, zTop, istTür, Wanddicke, typisiert (0/1)[, Typ]`
|
||||
// Typ = `frameDepth, insetFromFace, insetInnen, Eckstoss (0 vertikal, 1 horizontal, 2 Gehrung),
|
||||
// frameWidth, transomHeight,` dann
|
||||
// Typ = `frameDepth, insetFromFace, einzugSeite (0 aussen, 1 innen, 2 mitte), Eckstoss (0 vertikal,
|
||||
// 1 horizontal, 2 Gehrung), frameWidth, transomHeight, Anschlag,` dann
|
||||
// Tür: `threshold, leafCount, leafStyle (0 glatt, 1 glas, 2 kassette), glazingRatio, zarge,
|
||||
// panelCols, panelRows`
|
||||
// Fenster: `glazingPanes, mullionRows, mullionCols, sillBoard (0 aussen/fehlt, 1 keine,
|
||||
// 2 innen, 3 beide), Rollladen (0/1), Breite, Höhe, Tiefe, Flügelzahl-Default,
|
||||
// 2 innen, 3 beide), Rollladen (0/1), Breite, Höhe, Tiefe, imSturz, Schienen, Flügelzahl-Default,
|
||||
// Öffnungsart-Default, nFlügel, Flügel…`
|
||||
// Flügel = `Art (0 Flügel, 1 Pfosten, 2 andere), festeBreite, width, postWidth, Öffnungsart,
|
||||
// BandLinks`
|
||||
@@ -894,7 +935,8 @@ fn flag(r: &mut Reader) -> Option<bool> {
|
||||
fn decode_type(r: &mut Reader, door: bool) -> Option<TypeIn> {
|
||||
let frame_depth = r.num()?;
|
||||
let inset_from_face = r.num()?;
|
||||
let inset_inner = flag(r)?;
|
||||
let inset_side = r.num()?;
|
||||
let (inset_inner, inset_mid) = (inset_side == 1.0, inset_side == 2.0);
|
||||
let corner_join = match r.num()? as i64 {
|
||||
1 => CornerJoin::Horizontal,
|
||||
2 => CornerJoin::Mitre,
|
||||
@@ -902,6 +944,7 @@ fn decode_type(r: &mut Reader, door: bool) -> Option<TypeIn> {
|
||||
};
|
||||
let frame_width = r.num()?;
|
||||
let transom_height = r.num()?;
|
||||
let rebate_depth = r.num()?;
|
||||
let kind = if door {
|
||||
KindIn::Door(DoorTypeIn {
|
||||
threshold: flag(r)?,
|
||||
@@ -928,6 +971,8 @@ fn decode_type(r: &mut Reader, door: bool) -> Option<TypeIn> {
|
||||
};
|
||||
let create = flag(r)?;
|
||||
let shading_box = [r.num()?, r.num()?, r.num()?];
|
||||
let shading_sturz = flag(r)?;
|
||||
let shading_rails = flag(r)?;
|
||||
let default_wing_count = r.num()?;
|
||||
let default_opening = opening_kind(r.num()?);
|
||||
let n = r.count()?;
|
||||
@@ -955,9 +1000,11 @@ fn decode_type(r: &mut Reader, door: bool) -> Option<TypeIn> {
|
||||
default_wing_count,
|
||||
default_opening,
|
||||
shading: if create { Some(shading_box) } else { None },
|
||||
shading_sturz,
|
||||
shading_rails,
|
||||
})
|
||||
};
|
||||
Some(TypeIn { frame_depth, inset_from_face, inset_inner, corner_join, frame_width, transom_height, kind })
|
||||
Some(TypeIn { frame_depth, inset_from_face, inset_inner, inset_mid, rebate_depth, corner_join, frame_width, transom_height, kind })
|
||||
}
|
||||
|
||||
fn decode(buf: &[f64]) -> Option<(Vec<WallIn>, Detail)> {
|
||||
@@ -1019,6 +1066,8 @@ mod tests {
|
||||
frame_depth: f64::NAN,
|
||||
inset_from_face: f64::NAN,
|
||||
inset_inner: false,
|
||||
inset_mid: false,
|
||||
rebate_depth: f64::NAN,
|
||||
corner_join: CornerJoin::Vertical,
|
||||
frame_width: f64::NAN,
|
||||
transom_height: f64::NAN,
|
||||
@@ -1031,6 +1080,8 @@ mod tests {
|
||||
default_wing_count: 1.0,
|
||||
default_opening: SashOpening::TurnTilt,
|
||||
shading: None,
|
||||
shading_sturz: false,
|
||||
shading_rails: false,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@@ -1040,6 +1091,8 @@ mod tests {
|
||||
frame_depth: f64::NAN,
|
||||
inset_from_face: f64::NAN,
|
||||
inset_inner: false,
|
||||
inset_mid: false,
|
||||
rebate_depth: f64::NAN,
|
||||
corner_join: CornerJoin::Vertical,
|
||||
frame_width: f64::NAN,
|
||||
transom_height: f64::NAN,
|
||||
@@ -1189,9 +1242,13 @@ mod tests {
|
||||
assert!(jmin(0.0, -0.0).is_sign_negative());
|
||||
assert!(jmax(1.0, f64::NAN).is_nan());
|
||||
assert_eq!(clamp_range(5.0, 0.0, 1.0), 1.0);
|
||||
let (a, b) = frame_normal_range(0.15, 0.07, 0.0, false);
|
||||
let (a, b) = frame_normal_range(0.15, 0.07, 0.0, false, false);
|
||||
assert!(close(a, 0.08) && close(b, 0.15));
|
||||
let (a, b) = frame_normal_range(0.15, 0.07, 0.0, true);
|
||||
let (a, b) = frame_normal_range(0.15, 0.07, 0.0, true, false);
|
||||
assert!(close(a, -0.15) && close(b, -0.08));
|
||||
let (a, b) = frame_normal_range(0.15, 0.08, 0.1, true, true);
|
||||
assert!(close(a, -0.04) && close(b, 0.04));
|
||||
let (a, b) = frame_normal_range(0.15, 0.07, 0.0, true, false);
|
||||
assert!(close(a, -0.15) && close(b, -0.08));
|
||||
}
|
||||
|
||||
@@ -1226,4 +1283,30 @@ mod tests {
|
||||
assert!(opening_meshes_flat(&big)[0] >= 0.0);
|
||||
let _ = frame_ring_quads(f64::NAN, f64::INFINITY, -1.0, 1.0, -3.0, CornerJoin::Mitre, false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn anschlag_und_storenschienen() {
|
||||
let mut ty = window_type(SillBoard::None);
|
||||
ty.inset_from_face = 0.12;
|
||||
ty.frame_depth = 0.08;
|
||||
ty.rebate_depth = 0.05;
|
||||
let parts = |ty: &TypeIn, d: Detail| -> Vec<Part> { opening_meshes(&[wall(op(false, Some(ty.clone())))], d).into_iter().map(|m| m.part).collect() };
|
||||
let n = |v: &[Part], p: Part| v.iter().filter(|x| **x == p).count();
|
||||
assert_eq!(n(&parts(&ty, Detail::Coarse), Part::Rebate), 3);
|
||||
// Mittig: Anschlag-Zone aussen bis zur Rahmen-Vorderkante.
|
||||
ty.inset_mid = true;
|
||||
assert_eq!(n(&parts(&ty, Detail::Fine), Part::Rebate), 3);
|
||||
ty.inset_mid = false;
|
||||
ty.rebate_depth = f64::NAN;
|
||||
assert_eq!(n(&parts(&ty, Detail::Fine), Part::Rebate), 0);
|
||||
if let KindIn::Window(w) = &mut ty.kind {
|
||||
w.shading = Some([0.0, 0.25, 0.2]);
|
||||
}
|
||||
assert_eq!(n(&parts(&ty, Detail::Fine), Part::Shading), 1);
|
||||
if let KindIn::Window(w) = &mut ty.kind {
|
||||
w.shading_sturz = true;
|
||||
w.shading_rails = true;
|
||||
}
|
||||
assert_eq!(n(&parts(&ty, Detail::Fine), Part::Shading), 2, "im Sturz: nur zwei Führungsschienen");
|
||||
}
|
||||
}
|
||||
@@ -272,6 +272,13 @@ fn collect_openings(p: &Project, frame: &[f64; 9]) -> Vec<ProjOpening> {
|
||||
wt.and_then(|t| t.mullion_cols).unwrap_or(f64::NAN),
|
||||
if matches!(wt.and_then(|t| t.sill_board), Some(WindowTypeSillBoard::Keine | WindowTypeSillBoard::Innen)) { 0.0 } else { 1.0 },
|
||||
wt.map_or(0.0, |t| sash_kind(t.kind)),
|
||||
// Anschlag nur mit Leibung (Einzug > 0 oder mittig), sonst gibt es keine Wandnase.
|
||||
match (dt, wt) {
|
||||
(Some(t), _) if t.inset_face == Some(DoorTypeInsetFace::Mitte) || t.inset_from_face.unwrap_or(0.0) > 1e-4 => t.rebate_depth.unwrap_or(0.0),
|
||||
(_, Some(t)) if t.inset_face == Some(WindowTypeInsetFace::Mitte) || t.inset_from_face.unwrap_or(0.0) > 1e-4 => t.rebate_depth.unwrap_or(0.0),
|
||||
_ => 0.0,
|
||||
},
|
||||
if (door && dt.and_then(|t| t.inset_face) == Some(DoorTypeInsetFace::Innen)) || (!door && wt.and_then(|t| t.inset_face) == Some(WindowTypeInsetFace::Innen)) { -1.0 } else { 1.0 },
|
||||
]);
|
||||
// Flügel: (pfosten, postWidth, autoWidth, width, opening, hingeLeft).
|
||||
let mut sashes: Vec<[f64; 6]> = Vec::new();
|
||||
|
||||
@@ -1321,6 +1321,8 @@ const DEFAULT_FRAME_DEPTH: f64 = 0.07;
|
||||
const DEFAULT_FRAME_WIDTH: f64 = 0.06;
|
||||
const DOOR_LEAF_THICKNESS: f64 = 0.04;
|
||||
const MIN_CROSS: f64 = 0.15;
|
||||
const LINTEL_FILL: &str = "#d4d7db";
|
||||
const SHADING_PACK_FILL: &str = "#e6e8eb";
|
||||
|
||||
fn rect(u0: f64, u1: f64, v0: f64, v1: f64) -> Vec<Vec2> {
|
||||
vec![v2(min(u0, u1), v0), v2(max(u0, u1), v0), v2(max(u0, u1), v1), v2(min(u0, u1), v1)]
|
||||
@@ -1418,6 +1420,7 @@ fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection) -> Result
|
||||
frame_depth: t.frame_depth.unwrap_or(f64::NAN),
|
||||
inset_from_face: t.inset_from_face.unwrap_or(f64::NAN),
|
||||
inset_inner: t.inset_face == Some(WindowTypeInsetFace::Innen),
|
||||
inset_mid: t.inset_face == Some(WindowTypeInsetFace::Mitte),
|
||||
});
|
||||
let finite = [wall.start.x, wall.start.y, wall.end.x, wall.end.y, total, ref_off, o.position, o.width].iter().all(|x| x.is_finite());
|
||||
let sym = if finite {
|
||||
@@ -1463,11 +1466,63 @@ fn window_cut(p: &Project, wall: &Wall, o: &Opening, c: &CrossSection) -> Result
|
||||
}
|
||||
out.push(l);
|
||||
}
|
||||
if let Some(t) = wt {
|
||||
let shading = t.shading.as_ref().filter(|s| s.create);
|
||||
let sturz_box = shading.filter(|s| s.mount == Some(WindowShadingMount::Sturz)).map_or(0.0, |s| max(0.0, s.r#box.depth));
|
||||
lintel_cut(&mut out, o, c, t.lintel_height, sturz_box);
|
||||
// Fensterbänke nur bei ausdrücklicher Wahl (bisherige Schnitte bleiben gleich).
|
||||
let zb = c.z_bottom;
|
||||
if matches!(t.sill_board, Some(WindowTypeSillBoard::Aussen | WindowTypeSillBoard::Beide)) {
|
||||
// Aussen: mit Gefälle, bis 4 cm vor die Aussenfläche.
|
||||
let out_s = min(f_min, c.face_min) - 0.04;
|
||||
let pts = vec![v2(c.u_at(f_min), zb), v2(c.u_at(out_s), zb - 0.015), v2(c.u_at(out_s), zb - 0.045), v2(c.u_at(f_min), zb - 0.03)];
|
||||
out.push(opening_poly(pts, true, &o.id));
|
||||
}
|
||||
if matches!(t.sill_board, Some(WindowTypeSillBoard::Innen | WindowTypeSillBoard::Beide)) {
|
||||
let in_s = max(f_max, c.face_max) + 0.02;
|
||||
out.push(opening_poly(rect(c.u_at(f_max), c.u_at(in_s), zb - 0.025, zb), true, &o.id));
|
||||
}
|
||||
if let Some(sh) = shading {
|
||||
let h = max(0.0, sh.r#box.height);
|
||||
let d = max(0.0, sh.r#box.depth);
|
||||
if h > 1e-4 && d > 1e-4 {
|
||||
// Im Sturz: ab der Aussenfläche in die Wand; vorgesetzt: vor der Rahmen-Vorderkante.
|
||||
let (s0, s1) = if sturz_box > 0.0 { (c.face_min, c.face_min + d) } else { (f_min - d, f_min) };
|
||||
out.push(opening_poly(rect(c.u_at(s0), c.u_at(s1), c.z_top, c.z_top + h), true, &o.id));
|
||||
// Lamellen-/Rollpaket im Kasten.
|
||||
let m = min(0.02, d / 4.0);
|
||||
let mut pack = polygon(rect(c.u_at(s0 + m), c.u_at(s1 - m), c.z_top + m, c.z_top + h * 0.6), SHADING_PACK_FILL, OPENING_INK, GLASS_MM, no_hatch_base());
|
||||
if let Primitive::Polygon { opening_id, .. } = &mut pack {
|
||||
*opening_id = Some(o.id.clone());
|
||||
}
|
||||
out.push(pack);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
fn door_cut(o: &Opening, c: &CrossSection) -> Vec<Primitive> {
|
||||
/// Sturz im Schnitt ([94]): eigener Querschnitt über der Öffnung (Beton grau), neben einem
|
||||
/// Storenkasten im Sturz (`box_depth` ab der Aussenfläche) nur über den Rest der Wanddicke.
|
||||
fn lintel_cut(out: &mut Vec<Primitive>, o: &Opening, c: &CrossSection, height: Option<f64>, box_depth: f64) {
|
||||
let h = height.unwrap_or(0.0);
|
||||
if !(h > 1e-4) {
|
||||
return;
|
||||
}
|
||||
let s0 = min(c.face_max, c.face_min + box_depth);
|
||||
if c.face_max - s0 <= 1e-4 {
|
||||
return;
|
||||
}
|
||||
let mut pr = polygon(rect(c.u_at(s0), c.u_at(c.face_max), c.z_top, c.z_top + h), LINTEL_FILL, OPENING_INK, FRAME_MM, no_hatch_base());
|
||||
if let Primitive::Polygon { opening_id, .. } = &mut pr {
|
||||
*opening_id = Some(o.id.clone());
|
||||
}
|
||||
out.push(pr);
|
||||
}
|
||||
|
||||
fn door_cut(p: &Project, o: &Opening, c: &CrossSection) -> Vec<Primitive> {
|
||||
let mut out = vec![opening_poly(rect(c.u_at(c.face_min), c.u_at(c.face_max), c.z_bottom, c.z_top), false, &o.id)];
|
||||
lintel_cut(&mut out, o, c, p.door_type(o).and_then(|t| t.lintel_height), 0.0);
|
||||
if o.door_type == Some(OpeningDoorType::Wandoeffnung) {
|
||||
return out;
|
||||
}
|
||||
@@ -1503,7 +1558,7 @@ pub fn section_opening_primitives(p: &Project, level: &LevelSpec, vis: &Visibili
|
||||
continue;
|
||||
}
|
||||
let Some(c) = cross_section(p, wall, o, p0, u)? else { continue };
|
||||
let prims = if o.kind == ElementKind::Window { window_cut(p, wall, o, &c)? } else { door_cut(o, &c) };
|
||||
let prims = if o.kind == ElementKind::Window { window_cut(p, wall, o, &c)? } else { door_cut(p, o, &c) };
|
||||
let greyed = vis.greyed(&o.category_code);
|
||||
for pr in prims {
|
||||
out.push(if greyed { pr.with_greyed(true) } else { pr });
|
||||
@@ -1644,6 +1699,36 @@ mod tests {
|
||||
assert!(!serde_json::to_string(&hidden).unwrap().contains("\"roofId\""));
|
||||
}
|
||||
|
||||
/// [94] Sturz, Fensterbänke und Storenkasten im Sturz erscheinen im Schnitt nur, wenn gesetzt.
|
||||
#[test]
|
||||
fn sturz_baenke_und_storenkasten_im_schnitt() {
|
||||
let mut p = sample();
|
||||
// Schnittlinie quer durch die Mitte von O1 (Wand W1).
|
||||
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 m = o1.position + o1.width / 2.0;
|
||||
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 vis = Visibility::default();
|
||||
let base = section_opening_primitives(&p, &l, &vis).unwrap();
|
||||
assert!(!base.is_empty());
|
||||
let typed = p.openings.as_deref().unwrap_or(&[]).iter().filter(|o| o.type_id.is_some()).count();
|
||||
assert!(typed > 0);
|
||||
for t in p.window_types.iter_mut().flatten() {
|
||||
t.lintel_height = Some(0.2);
|
||||
t.sill_board = Some(WindowTypeSillBoard::Beide);
|
||||
t.shading = Some(WindowShading { create: true, kind: WindowShadingKind::Raffstore, r#box: WindowShadingBox { width: 0.0, height: 0.3, depth: 0.18, ..Default::default() }, mount: Some(WindowShadingMount::Sturz), ..Default::default() });
|
||||
}
|
||||
for t in p.door_types.iter_mut().flatten() {
|
||||
t.lintel_height = Some(0.2);
|
||||
}
|
||||
let more = section_opening_primitives(&p, &l, &vis).unwrap();
|
||||
assert!(more.len() > base.len(), "{} {}", more.len(), base.len());
|
||||
let json = serde_json::to_string(&more).unwrap();
|
||||
assert!(json.contains(LINTEL_FILL) && json.contains(SHADING_PACK_FILL), "{json}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn beschnittene_baender_behalten_ihre_ebene() {
|
||||
// Von der Dominanz beschnittene Wand-/Deckenstücke tragen ihre Kategorie weiter: Ebene aus → weg.
|
||||
|
||||
@@ -184,12 +184,7 @@ fn wall_poche(c: &Ctx, out: &mut Vec<Primitive>, e: &EffWall, gaps: &[(f64, f64)
|
||||
if let Some(s) = styles.get(&li) {
|
||||
return Ok(s.clone());
|
||||
}
|
||||
let layer = wt.layers.get(li).ok_or("Schicht fehlt")?;
|
||||
let comp = p.component_or_fallback(&layer.component_id);
|
||||
let hid = resolve_hatch_id(w.hatch_id.as_deref(), w.hatch_source, category, Some(&comp.hatch_id)).unwrap_or(&comp.hatch_id);
|
||||
let hatch = super::domains::resolve_hatch_or_none(p, hid, Some(angle), resolve_foreground(comp, w.foreground.as_deref(), category, w.foreground_source));
|
||||
let bg = resolve_background(comp, w.background.as_deref(), category, w.background_source);
|
||||
let fill = bg.unwrap_or(if hatch.pattern == HatchPattern::Solid { HATCH_INK } else { HATCH_PAPER }).to_string();
|
||||
let (hatch, fill) = layer_style(p, w, wt, li, category, angle)?;
|
||||
styles.insert(li, (hatch.clone(), fill.clone()));
|
||||
Ok((hatch, fill))
|
||||
};
|
||||
@@ -249,6 +244,17 @@ fn wall_poche(c: &Ctx, out: &mut Vec<Primitive>, e: &EffWall, gaps: &[(f64, f64)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Schraffur und Füllung der Schicht `li` im Wandschnitt (Bauteil, Wand- und Kategorie-Übersteuerung).
|
||||
fn layer_style(p: &Project, w: &Wall, wt: &WallType, li: usize, category: Option<&LayerCategory>, angle: f64) -> Result<(HatchRender, String), String> {
|
||||
let layer = wt.layers.get(li).ok_or("Schicht fehlt")?;
|
||||
let comp = p.component_or_fallback(&layer.component_id);
|
||||
let hid = resolve_hatch_id(w.hatch_id.as_deref(), w.hatch_source, category, Some(&comp.hatch_id)).unwrap_or(&comp.hatch_id);
|
||||
let hatch = super::domains::resolve_hatch_or_none(p, hid, Some(angle), resolve_foreground(comp, w.foreground.as_deref(), category, w.foreground_source));
|
||||
let bg = resolve_background(comp, w.background.as_deref(), category, w.background_source);
|
||||
let fill = bg.unwrap_or(if hatch.pattern == HatchPattern::Solid { HATCH_INK } else { HATCH_PAPER }).to_string();
|
||||
Ok((hatch, fill))
|
||||
}
|
||||
|
||||
/// Sashes eines Fenstertyps (`sashesOfWindowType`): fehlend → aus `wingCount` gleichmässig.
|
||||
fn sashes(wt: &WindowType) -> Vec<SashDef> {
|
||||
if let Some(s) = wt.sashes.as_ref().filter(|s| !s.is_empty()) {
|
||||
@@ -272,7 +278,7 @@ fn window_type<'a>(p: &'a Project, o: &Opening) -> Option<&'a WindowType> {
|
||||
|
||||
/// Öffnungs-Symbol (`addOpeningSymbol`).
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, color: Option<&str>, greyed: bool, detail: Detail, lw: f64) -> Result<(), String> {
|
||||
fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, color: Option<&str>, greyed: bool, detail: Detail, lw: f64, wall_line: (&str, f64)) -> Result<(), String> {
|
||||
let p = c.p;
|
||||
let total = thickness(&wall_type(p, w)?.layers);
|
||||
let ref_off = joins::reference_offset(crate::model3d::wall_reference(w), total);
|
||||
@@ -321,7 +327,11 @@ fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, colo
|
||||
t.frame_width.unwrap_or(0.06),
|
||||
b01(t.frame_kind == Some(DoorTypeFrameKind::Blockrahmen)),
|
||||
t.inset_from_face.unwrap_or(0.0),
|
||||
b01(t.inset_face == Some(DoorTypeInsetFace::Innen)),
|
||||
match t.inset_face {
|
||||
Some(DoorTypeInsetFace::Innen) => 1.0,
|
||||
Some(DoorTypeInsetFace::Mitte) => 2.0,
|
||||
_ => 0.0,
|
||||
},
|
||||
]),
|
||||
None => b.extend([0.0, 0.0, 0.0, 0.0, 0.0]),
|
||||
}
|
||||
@@ -330,7 +340,11 @@ fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, colo
|
||||
b.push(wt.map_or(0.0, |t| t.frame_width.unwrap_or(0.06)));
|
||||
b.push(wt.and_then(|t| t.frame_depth).unwrap_or(f64::NAN));
|
||||
b.push(wt.and_then(|t| t.inset_from_face).unwrap_or(f64::NAN));
|
||||
b.push(b01(wt.and_then(|t| t.inset_face) == Some(WindowTypeInsetFace::Innen)));
|
||||
b.push(match wt.and_then(|t| t.inset_face) {
|
||||
Some(WindowTypeInsetFace::Innen) => 1.0,
|
||||
Some(WindowTypeInsetFace::Mitte) => 2.0,
|
||||
_ => 0.0,
|
||||
});
|
||||
b.push(o.wing_count.unwrap_or(f64::NAN));
|
||||
b.push(if detail == Detail::Fein { 2.0 } else { 1.0 });
|
||||
let sill = wt.and_then(|t| t.sill_line.as_ref());
|
||||
@@ -351,6 +365,22 @@ fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, colo
|
||||
b.push(frame_view_weight);
|
||||
b.push(o.sash_line.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_HAIRLINE_MM));
|
||||
b.push(o.sill_line_style.as_ref().and_then(|l| l.weight).unwrap_or(SYMBOL_HAIRLINE_MM));
|
||||
// Details ([94]): Anschlag, Fensterbank, Storenkasten.
|
||||
b.push(if door { dt.and_then(|t| t.rebate_depth) } else { wt.and_then(|t| t.rebate_depth) }.unwrap_or(0.0));
|
||||
b.push(match wt.and_then(|t| t.sill_board) {
|
||||
Some(WindowTypeSillBoard::Keine) => 1.0,
|
||||
Some(WindowTypeSillBoard::Innen) => 2.0,
|
||||
Some(WindowTypeSillBoard::Beide) => 3.0,
|
||||
Some(WindowTypeSillBoard::Aussen) => 4.0,
|
||||
_ => 0.0,
|
||||
});
|
||||
b.push(b01(shading.is_some_and(|s| s.mount == Some(WindowShadingMount::Sturz))));
|
||||
b.push(shading.map_or(0.0, |s| s.r#box.depth));
|
||||
b.push(match shading.map(|s| s.kind) {
|
||||
Some(WindowShadingKind::Raffstore) => 1.0,
|
||||
Some(WindowShadingKind::Markise) => 2.0,
|
||||
_ => 0.0,
|
||||
});
|
||||
b.push(sash_list.len() as f64);
|
||||
for s in &sash_list {
|
||||
b.extend([
|
||||
@@ -374,6 +404,34 @@ fn opening_symbol(c: &Ctx, out: &mut Vec<Primitive>, w: &Wall, o: &Opening, colo
|
||||
let count = f[i + 4] as usize;
|
||||
let pts: Vec<Vec2> = (0..count).map(|j| v2(f[i + 5 + 2 * j], f[i + 6 + 2 * j])).collect();
|
||||
let frame = f[i + 1] == 1.0;
|
||||
if f[i + 1] == 2.0 {
|
||||
// Anschlag: Wandnase, je Wandschicht (aussen → innen) in deren Schnitt-Darstellung.
|
||||
i += 5 + 2 * count;
|
||||
if pts.len() != 4 {
|
||||
continue;
|
||||
}
|
||||
let wtype = wall_type(p, w)?;
|
||||
let category = c.cat(&w.category_code);
|
||||
let angle = atan2(w.end.y - w.start.y, w.end.x - w.start.x) * 180.0 / std::f64::consts::PI;
|
||||
let (_, n) = crate::opening_geom::WallRef { start: crate::opening_geom::v(w.start.x, w.start.y), end: crate::opening_geom::v(w.end.x, w.end.y), total, ref_off }.frame();
|
||||
let off = |q: &Vec2| (q.x - w.start.x) * n.x + (q.y - w.start.y) * n.y;
|
||||
let (lo, hi) = (off(&pts[0]), off(&pts[2]));
|
||||
let a = v2(pts[0].x - n.x * lo, pts[0].y - n.y * lo);
|
||||
let bq = v2(pts[1].x - n.x * lo, pts[1].y - n.y * lo);
|
||||
let at = |q: Vec2, d: f64| v2(q.x + n.x * d, q.y + n.y * d);
|
||||
let mut l0 = ref_off - total / 2.0;
|
||||
for (li, layer) in wtype.layers.iter().enumerate() {
|
||||
let l1 = l0 + layer.thickness;
|
||||
let (s0, s1) = (lo.max(l0), hi.min(l1));
|
||||
l0 = l1;
|
||||
if s1 - s0 <= 1e-6 {
|
||||
continue;
|
||||
}
|
||||
let (hatch, fill) = layer_style(p, w, wtype, li, category, angle)?;
|
||||
out.push(wall_polygon(vec![at(a, s0), at(bq, s0), at(bq, s1), at(a, s1)], &fill, wall_line.0, wall_line.1, hatch, greyed, None, Some(&w.id), id));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
out.push(wall_polygon(pts, "none", if frame { slot(f[i + 3]) } else { "none" }, f[i + 2], no_hatch(), greyed, None, None, id));
|
||||
i += 5 + 2 * count;
|
||||
} else if f[i] == 2.0 {
|
||||
@@ -460,7 +518,8 @@ pub fn plan_walls(c: &Ctx, reference_lines: bool, out: &mut Vec<Primitive>, boun
|
||||
Some(DetailLevel::Fein) => Detail::Fein,
|
||||
_ => c.a.detail,
|
||||
};
|
||||
opening_symbol(c, out, w, o, color, c.greyed(&o.category_code), detail, olw)?;
|
||||
let wall_line = (e.color.as_deref().unwrap_or(POCHE_STROKE), lw * c.a.detail.outline_factor());
|
||||
opening_symbol(c, out, w, o, color, c.greyed(&o.category_code), detail, olw, wall_line)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
//! istTuer, glasBlatt, glasAnteil (NaN = 1),
|
||||
//! rahmenbreite, kaempferHoehe, sprossenZeilen (NaN = 1), sprossenSpalten (NaN = 1),
|
||||
//! bankAn, typArt (0 fest, 1 dreh, 2 kipp, 3 drehkipp, 4 schiebe),
|
||||
//! anschlag (Meter, 0 keiner), anschlagSeite (1 aussen | −1 innen; [94]),
|
||||
//! nFluegel, (pfosten, pfostenBreite (NaN), autoBreite (0/1), breite (NaN), art (-1 = typArt), bandLinks) × nFluegel
|
||||
//! ```
|
||||
//! → `[n, (ok, tiefe, istTuer, 8 Ecken, Listen) × n]`; `ok` 0 = nicht sichtbar (sonst nichts mehr).
|
||||
@@ -825,8 +826,16 @@ fn rect(q: &Quad, fa0: f64, fa1: f64, fz0: f64, fz1: f64) -> Quad {
|
||||
[quad_at(q, fa0, fz0), quad_at(q, fa1, fz0), quad_at(q, fa1, fz1), quad_at(q, fa0, fz1)]
|
||||
}
|
||||
|
||||
/// Feste Werte je Öffnung vor der Flügelliste (der letzte = Flügelzahl).
|
||||
const REC: usize = 21;
|
||||
|
||||
/// Projiziert die zum Betrachter zeigende Wand-Langseite der Öffnung; `None` ohne sichtbare Seite.
|
||||
fn project_opening_rect(f: &Frame, o: &[f64]) -> Option<(Quad, f64)> {
|
||||
project_opening_side(f, o).map(|(q, d, _)| (q, d))
|
||||
}
|
||||
|
||||
/// Wie [`project_opening_rect`], dazu die Seite (+1 = Seite +n, die Aussenseite; −1 = innen).
|
||||
fn project_opening_side(f: &Frame, o: &[f64]) -> Option<(Quad, f64, f64)> {
|
||||
let (sx, sz) = (o[0], o[1]);
|
||||
let ax = o[2] - o[0];
|
||||
let az = o[3] - o[1];
|
||||
@@ -859,7 +868,7 @@ fn project_opening_rect(f: &Frame, o: &[f64]) -> Option<(Quad, f64)> {
|
||||
if depth <= EPS {
|
||||
continue;
|
||||
}
|
||||
return Some((pts, depth));
|
||||
return Some((pts, depth, if side > 0.0 { 1.0 } else { -1.0 }));
|
||||
}
|
||||
None
|
||||
}
|
||||
@@ -1038,21 +1047,32 @@ pub fn openings(frame: &[f64], inp: &[f64]) -> Vec<f64> {
|
||||
let mut f = vec![n as f64];
|
||||
let mut i = 1;
|
||||
for _ in 0..n {
|
||||
if i + 19 > inp.len() {
|
||||
if i + REC > inp.len() {
|
||||
return Vec::new();
|
||||
}
|
||||
let o = &inp[i..i + 19];
|
||||
let ns = o[18];
|
||||
if !(ns >= 0.0) || ns.fract() != 0.0 || i + 19 + 6 * ns as usize > inp.len() {
|
||||
let o = &inp[i..i + REC];
|
||||
let ns = o[REC - 1];
|
||||
if !(ns >= 0.0) || ns.fract() != 0.0 || i + REC + 6 * ns as usize > inp.len() {
|
||||
return Vec::new();
|
||||
}
|
||||
let ns = ns as usize;
|
||||
let sashes = &inp[i + 19..i + 19 + 6 * ns];
|
||||
i += 19 + 6 * ns;
|
||||
let sashes = &inp[i + REC..i + REC + 6 * ns];
|
||||
i += REC + 6 * ns;
|
||||
let geo = &o[..9];
|
||||
if geo.iter().any(|v| !v.is_finite()) {
|
||||
return Vec::new();
|
||||
}
|
||||
// Anschlag ([94]): von der Anschlag-Seite aus deckt die Wandnase Rahmen links, rechts und oben ab.
|
||||
let mut oo = o.to_vec();
|
||||
if let Some((_, _, side)) = project_opening_side(&fr, o) {
|
||||
let rd = min(if o[18].is_nan() { 0.0 } else { o[18] }, (o[6] - o[5]) / 2.0 - 0.01);
|
||||
if rd > 1e-4 && side * o[19] > 0.0 && o[8] - o[7] > 2.0 * rd {
|
||||
oo[5] += rd;
|
||||
oo[6] -= rd;
|
||||
oo[8] -= rd;
|
||||
}
|
||||
}
|
||||
let o = &oo[..];
|
||||
match project_opening_rect(&fr, o) {
|
||||
None => f.push(0.0),
|
||||
Some((pts, depth)) => {
|
||||
@@ -1163,4 +1183,24 @@ mod tests_ts {
|
||||
let f = occluded_points(&occ, &[3.0, 10.5, 0.5, 5.0, 10.5, 0.5, 0.5, 99.0, 0.5, 5.0]);
|
||||
assert_eq!(f, vec![3.0, 1.0, 0.0, 0.0]);
|
||||
}
|
||||
|
||||
/// [94] Anschlag: von der Anschlag-Seite aus ist die sichtbare Öffnung um die Wandnasen kleiner.
|
||||
#[test]
|
||||
fn anschlag_verkleinert_die_ansicht_nur_von_seiner_seite() {
|
||||
let frame = [0.0, 0.0, -3.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0];
|
||||
let rec = |rebate: f64, side: f64| {
|
||||
let mut b = vec![1.0, 0.0, 0.0, 5.0, 0.0, 0.3, 1.0, 2.2, 0.9, 2.3, 0.0, 0.0, f64::NAN, 0.06, 0.0, f64::NAN, f64::NAN, 1.0, 1.0, rebate, side, 0.0];
|
||||
b.truncate(1 + REC);
|
||||
b
|
||||
};
|
||||
let width = |f: &[f64]| {
|
||||
assert_eq!(f[1], 1.0);
|
||||
let xs = [f[4], f[6], f[8], f[10]];
|
||||
xs.iter().cloned().fold(f64::NEG_INFINITY, f64::max) - xs.iter().cloned().fold(f64::INFINITY, f64::min)
|
||||
};
|
||||
let w0 = width(&openings(&frame, &rec(0.0, 1.0)));
|
||||
let w1 = width(&openings(&frame, &rec(0.05, 1.0)));
|
||||
let w2 = width(&openings(&frame, &rec(0.05, -1.0)));
|
||||
assert!((w0 - 1.2).abs() < 1e-9 && (w1 - 1.1).abs() < 1e-9 && (w2 - 1.2).abs() < 1e-9, "{w0} {w1} {w2}");
|
||||
}
|
||||
}
|
||||
@@ -7,16 +7,19 @@
|
||||
//! detail (0 grob | 1 mittel | 2 fein),
|
||||
//! Tür: schwenkRechts, ausen, anschlagEnde, schwenkwinkel (NaN = 90), wandoeffnung, fluegel,
|
||||
//! sturz (0 keine | 1 aussen | 2 innen | 3 beide),
|
||||
//! Rahmen: hat, breite, art (0 Zarge | 1 Blockrahmen), einzug, einzugInnen,
|
||||
//! Fenster: hatTyp, profilbreite, rahmentiefe (NaN), einzug (NaN), einzugInnen, altFluegel (NaN = 1),
|
||||
//! Rahmen: hat, breite, art (0 Zarge | 1 Blockrahmen), einzug, einzugSeite (0 aussen | 1 innen | 2 mitte),
|
||||
//! Fenster: hatTyp, profilbreite, rahmentiefe (NaN), einzug (NaN), einzugSeite (0 | 1 | 2), altFluegel (NaN = 1),
|
||||
//! glasAlt, sims (0 keine | 1 aussen | 2 innen | 3 beide), simsUnter (0|1), kasten (0|1),
|
||||
//! kastenBreite, kastenHoehe,
|
||||
//! Stärken: haar, rahmenHaar, rahmenAufsicht, fluegel, sims,
|
||||
//! Details ([94]): anschlag (Meter, 0 keiner), bank (0 fehlt | 1 keine | 2 innen | 3 beide | 4 aussen),
|
||||
//! kastenSturz (0 vorgesetzt | 1 im Sturz), kastenTiefe, kastenArt (0 Rollladen | 1 Raffstore | 2 Markise),
|
||||
//! nFluegel, (pfosten, auto, breite, pfostenbreite, oeffenbar) × n]`.
|
||||
//!
|
||||
//! Ausgabe `[n, Eintrag × n]` in Zeichenreihenfolge:
|
||||
//! ```text
|
||||
//! 1 polygon [1, art (0 Pick-Fläche | 1 Rahmen-Aufsicht), weightMm, farbSlot, nPts, x, y …]
|
||||
//! 1 polygon [1, art (0 Pick-Fläche | 1 Rahmen-Aufsicht | 2 Anschlag, Wandschnitt der Fläche
|
||||
//! `einzugSeite`), weightMm, farbSlot, nPts, x, y …]
|
||||
//! 2 line [2, cls, weightMm, farbSlot, strich, ax, ay, bx, by]
|
||||
//! 3 arc [3, weightMm, cx, cy, fromX, fromY, toX, toY, r] (cls door-swing)
|
||||
//! cls 0 door-leaf · 1 door-frame · 2 door-lintel · 3 opening-frame · 4 window-glass ·
|
||||
@@ -95,12 +98,12 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
|
||||
let frame_width = r.num()?;
|
||||
let frame_block = r.num()? != 0.0;
|
||||
let frame_inset = r.num()?;
|
||||
let frame_inset_inner = r.num()? != 0.0;
|
||||
let frame_inset_side = r.num()?;
|
||||
let has_type = r.num()? != 0.0;
|
||||
let win_frame_width = r.num()?;
|
||||
let win_frame_depth = r.num()?;
|
||||
let win_inset = r.num()?;
|
||||
let win_inset_inner = r.num()? != 0.0;
|
||||
let win_inset_side = r.num()?;
|
||||
let wing_count = r.num()?;
|
||||
let glass_alt = r.num()?;
|
||||
let sill_faces = r.num()? as i64;
|
||||
@@ -109,6 +112,11 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
|
||||
let shading_width = r.num()?;
|
||||
let shading_height = r.num()?;
|
||||
let (hair, frame_hair, frame_view_w, sash_w, sill_w) = (r.num()?, r.num()?, r.num()?, r.num()?, r.num()?);
|
||||
let rebate = r.num()?;
|
||||
let sill_board = r.num()? as i64;
|
||||
let shading_sturz = r.num()? != 0.0;
|
||||
let shading_depth = r.num()?;
|
||||
let shading_kind = r.num()? as i64;
|
||||
let n_sash = r.count()?;
|
||||
let mut sashes = Vec::with_capacity(n_sash);
|
||||
for _ in 0..n_sash {
|
||||
@@ -148,7 +156,8 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
|
||||
}
|
||||
}
|
||||
if has_frame {
|
||||
frame_band(&mut o, &w, position, width, frame_width, frame_block, frame_inset, frame_inset_inner, hair);
|
||||
let zone = frame_band(&mut o, &w, position, width, frame_width, frame_block, frame_inset, frame_inset_side, hair);
|
||||
rebate_nibs(&mut o, &w, position, width, rebate, zone);
|
||||
}
|
||||
if lintel != 0 {
|
||||
let half_d = total / 2.0;
|
||||
@@ -174,7 +183,8 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
|
||||
frame_width: win_frame_width,
|
||||
frame_depth: win_frame_depth,
|
||||
inset_from_face: win_inset,
|
||||
inset_inner: win_inset_inner,
|
||||
inset_inner: win_inset_side == 1.0,
|
||||
inset_mid: win_inset_side == 2.0,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
@@ -183,6 +193,19 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
|
||||
if let Some(gap) = opening_gap_quad(&w, position, width) {
|
||||
o.polygon(0.0, 0.0, 0.0, &gap);
|
||||
}
|
||||
// Rahmenlage quer zur Wand (absolut entlang der linken Normalen).
|
||||
let (f_lo, f_hi) = match opening_jambs(&w, position, width) {
|
||||
Some((js, _)) => {
|
||||
let a = dot(sub(sym.frame[0], js), wn);
|
||||
let b = dot(sub(sym.frame[2], js), wn);
|
||||
(min(a, b), max(a, b))
|
||||
}
|
||||
None => (ref_off - total / 2.0, ref_off + total / 2.0),
|
||||
};
|
||||
if has_type {
|
||||
let zone = if win_inset_side == 1.0 { (f_hi, ref_off + total / 2.0) } else { (ref_off - total / 2.0, f_lo) };
|
||||
rebate_nibs(&mut o, &w, position, width, rebate, Some(zone));
|
||||
}
|
||||
if detail == Detail::Grob {
|
||||
let idx = sym.glass_lines.len() / 2;
|
||||
if let Some(g) = sym.glass_lines.get(idx).or_else(|| sym.glass_lines.first()) {
|
||||
@@ -209,16 +232,31 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
|
||||
}
|
||||
if detail == Detail::Fein {
|
||||
if let Some((js, je)) = opening_jambs(&w, position, width) {
|
||||
let outer_n = min(dot(sub(sym.frame[0], js), wn), dot(sub(sym.frame[2], js), wn));
|
||||
let outer_n = f_lo;
|
||||
let (ov, proj) = (0.03, 0.04);
|
||||
let s0 = along(js, je, -ov);
|
||||
let s1 = along(je, js, -ov);
|
||||
let b0 = add(s0, scale(wn, outer_n));
|
||||
let b1 = add(s1, scale(wn, outer_n));
|
||||
let b2 = add(s1, scale(wn, outer_n - proj));
|
||||
let b3 = add(s0, scale(wn, outer_n - proj));
|
||||
for (a, b) in [(b0, b1), (b1, b2), (b2, b3), (b3, b0)] {
|
||||
o.line(C_SILL, hair, 1.0, 0.0, a, b);
|
||||
// Fensterbank aussen (fehlt/aussen/beide): von der Rahmen-Vorderkante bis vor die Aussenfläche.
|
||||
if sill_board == 0 || sill_board == 3 || sill_board == 4 {
|
||||
let far = min(outer_n, ref_off - total / 2.0) - proj;
|
||||
let b0 = add(s0, scale(wn, outer_n));
|
||||
let b1 = add(s1, scale(wn, outer_n));
|
||||
let b2 = add(s1, scale(wn, far));
|
||||
let b3 = add(s0, scale(wn, far));
|
||||
for (a, b) in [(b0, b1), (b1, b2), (b2, b3), (b3, b0)] {
|
||||
o.line(C_SILL, hair, 1.0, 0.0, a, b);
|
||||
}
|
||||
}
|
||||
// Fensterbank innen (innen/beide): von der Rahmen-Hinterkante bis vor die Innenfläche.
|
||||
if sill_board == 2 || sill_board == 3 {
|
||||
let far = max(f_hi, ref_off + total / 2.0) + 0.02;
|
||||
let b0 = add(s0, scale(wn, f_hi));
|
||||
let b1 = add(s1, scale(wn, f_hi));
|
||||
let b2 = add(s1, scale(wn, far));
|
||||
let b3 = add(s0, scale(wn, far));
|
||||
for (a, b) in [(b0, b1), (b1, b2), (b2, b3), (b3, b0)] {
|
||||
o.line(C_SILL, hair, 1.0, 0.0, a, b);
|
||||
}
|
||||
}
|
||||
let reveal = 0.06;
|
||||
for jamb in [js, je] {
|
||||
@@ -248,7 +286,8 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
|
||||
let outer_face = ref_off - total / 2.0;
|
||||
let axis_width = hypot2(je.x - js.x, je.y - js.y);
|
||||
let box_width = if shading_width > 0.0 { shading_width } else { axis_width };
|
||||
let box_height = max(0.0, shading_height);
|
||||
// Im Sturz: Kasten verdeckt in der Wand, Tiefe quer zur Wand ab der Aussenfläche.
|
||||
let box_height = max(0.0, if shading_sturz { shading_depth } else { shading_height });
|
||||
let center = add(js, scale(u, axis_width / 2.0));
|
||||
let half = box_width / 2.0;
|
||||
let c1 = add(center, scale(u, -half));
|
||||
@@ -260,6 +299,21 @@ fn plan_opening_inner(buf: &[f64]) -> Option<Vec<f64>> {
|
||||
for (a, b) in [(p1, p2), (p2, p3), (p3, p4), (p4, p1)] {
|
||||
o.line(C_SHADING, hair, 1.0, 2.0, a, b);
|
||||
}
|
||||
// Führungsschienen der Storen (fein, Kasten im Sturz, nicht bei Markise) vor dem Rahmen.
|
||||
if shading_sturz && detail == Detail::Fein && shading_kind != 2 {
|
||||
let (rail_u, rail_n) = (0.03, 0.04);
|
||||
let front = if win_inset_side == 1.0 { f_hi } else { f_lo };
|
||||
let dir = if win_inset_side == 1.0 { 1.0 } else { -1.0 };
|
||||
// Neben dem Anschlag (Wandnase) in der Leibung.
|
||||
let rd = if has_type && rebate > 1e-4 { min(rebate, axis_width / 2.0 - 0.01) } else { 0.0 };
|
||||
for (u0, u1) in [(rd, rd + rail_u), (axis_width - rd - rail_u, axis_width - rd)] {
|
||||
let a = along(js, je, u0);
|
||||
let b = along(js, je, u1);
|
||||
let n0 = front + dir * 0.005;
|
||||
let n1 = front + dir * (0.005 + rail_n);
|
||||
o.ring(C_SHADING, hair, 1.0, &[add(a, scale(nrm, n0)), add(b, scale(nrm, n0)), add(b, scale(nrm, n1)), add(a, scale(nrm, n1))]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(finish(o))
|
||||
@@ -274,15 +328,21 @@ fn finish(o: Out) -> Vec<f64> {
|
||||
|
||||
/// Rahmenband einer Tür (Zarge/Blockrahmen) aus dem Typ der Tür.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn frame_band(o: &mut Out, w: &WallRef, position: f64, width: f64, frame_width: f64, block: bool, inset_from_face: f64, inset_inner: bool, hair: f64) {
|
||||
let Some((js, je)) = opening_jambs(w, position, width) else { return };
|
||||
fn frame_band(o: &mut Out, w: &WallRef, position: f64, width: f64, frame_width: f64, block: bool, inset_from_face: f64, inset_side: f64, hair: f64) -> Option<(f64, f64)> {
|
||||
let (js, je) = opening_jambs(w, position, width)?;
|
||||
let inset_inner = inset_side == 1.0;
|
||||
let mid = inset_side == 2.0;
|
||||
let n = w.frame().1;
|
||||
let total = w.total;
|
||||
let outer_face = w.ref_off - total / 2.0;
|
||||
let inner_face = w.ref_off + total / 2.0;
|
||||
let clamped_inset = max(0.0, min(inset_from_face, total));
|
||||
let near_is_aussen = !inset_inner;
|
||||
let face_near = if near_is_aussen { outer_face + clamped_inset } else { inner_face - clamped_inset };
|
||||
let mut face_near = if near_is_aussen { outer_face + clamped_inset } else { inner_face - clamped_inset };
|
||||
if mid {
|
||||
// Mittig: Blockrahmen symmetrisch um die Wandmitte (Anschlag-Zone aussen bis zum Rahmen).
|
||||
face_near = w.ref_off - max(0.0, min(frame_width, total)) / 2.0;
|
||||
}
|
||||
let face_far = if near_is_aussen { inner_face } else { outer_face };
|
||||
let lo = min(face_near, face_far);
|
||||
let hi = max(face_near, face_far);
|
||||
@@ -312,6 +372,25 @@ fn frame_band(o: &mut Out, w: &WallRef, position: f64, width: f64, frame_width:
|
||||
for (a, b) in [(p1, p2), (p2, p3), (p3, p4), (p4, p1)] {
|
||||
o.line(C_OPENING_FRAME, weight, 1.0, 0.0, a, b);
|
||||
}
|
||||
// Anschlag-Zone: zwischen der gewählten Fläche und der Rahmen-Vorderkante.
|
||||
Some(if near_is_aussen { (outer_face, lo) } else { (hi, inner_face) })
|
||||
}
|
||||
|
||||
/// Anschlag (Maueranschlag): Wand-Nasen an beiden Leibungen über die Zone `zone` (absolut quer zur
|
||||
/// Wand), je `rebate` tief in die Öffnung. Keine bei fehlender Zone/Tiefe.
|
||||
fn rebate_nibs(o: &mut Out, w: &WallRef, position: f64, width: f64, rebate: f64, zone: Option<(f64, f64)>) {
|
||||
let (Some((lo, hi)), Some((js, je))) = (zone, opening_jambs(w, position, width)) else { return };
|
||||
let axis_width = hypot2(je.x - js.x, je.y - js.y);
|
||||
let rd = min(rebate, axis_width / 2.0 - 0.01);
|
||||
if !(rd > 1e-4) || !(hi - lo > 1e-4) {
|
||||
return;
|
||||
}
|
||||
let n = w.frame().1;
|
||||
for (u0, u1) in [(0.0, rd), (axis_width - rd, axis_width)] {
|
||||
let a = along(js, je, u0);
|
||||
let b = along(js, je, u1);
|
||||
o.polygon(2.0, 0.0, 1.0, &[add(a, scale(n, lo)), add(b, scale(n, lo)), add(b, scale(n, hi)), add(a, scale(n, hi))]);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Fenster-Symbol als Einzelaufruf (für die Fassade `windowSymbol`, z. B. im Schnitt) ──────────
|
||||
@@ -330,6 +409,7 @@ mod tests {
|
||||
b.extend([0.0, 0.06, 0.0, 0.0, 0.0]); // kein Rahmenband
|
||||
b.extend([has_type as u8 as f64, 0.06, NAN, NAN, 0.0, NAN, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0]); // Fenster
|
||||
b.extend([0.02, 0.02, 0.02, 0.02, 0.02]); // Strichstärken
|
||||
b.extend([0.0, 0.0, 0.0, 0.0, 0.0]); // Details: kein Anschlag, Bank fehlt, Kasten vorgesetzt
|
||||
b.push(sashes.len() as f64);
|
||||
for s in sashes {
|
||||
b.extend(s);
|
||||
@@ -388,4 +468,110 @@ mod tests {
|
||||
let g = plan_opening(&input(false, 1.0, true, &sashes));
|
||||
assert!(a[0] > g[0]);
|
||||
}
|
||||
|
||||
/// Index des ersten Werts der Detail-Felder ([94]) in `input`.
|
||||
const DETAILS: usize = 10 + 7 + 5 + 12 + 5;
|
||||
|
||||
fn polygons(buf: &[f64], art: f64) -> Vec<Vec<(f64, f64)>> {
|
||||
let (mut i, mut out) = (1, Vec::new());
|
||||
for _ in 0..buf[0] as usize {
|
||||
if buf[i] == 1.0 {
|
||||
let n = buf[i + 4] as usize;
|
||||
if buf[i + 1] == art {
|
||||
out.push((0..n).map(|k| (buf[i + 5 + 2 * k], buf[i + 6 + 2 * k])).collect());
|
||||
}
|
||||
i += 5 + 2 * n;
|
||||
} else {
|
||||
i += 9;
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
fn count_cls(buf: &[f64], cls: f64) -> usize {
|
||||
let (mut i, mut c) = (1, 0);
|
||||
for _ in 0..buf[0] as usize {
|
||||
match buf[i] as i64 {
|
||||
1 => i += 5 + 2 * buf[i + 4] as usize,
|
||||
2 => {
|
||||
if buf[i + 1] == cls {
|
||||
c += 1;
|
||||
}
|
||||
i += 9
|
||||
}
|
||||
_ => i += 9,
|
||||
}
|
||||
}
|
||||
c
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fenster_mitte_sitzt_symmetrisch_in_der_wand() {
|
||||
let sashes = [[0.0, 1.0, NAN, NAN, 1.0]];
|
||||
let mut b = input(false, 1.0, true, &sashes);
|
||||
b[24] = 0.08; // Rahmentiefe
|
||||
b[26] = 2.0; // einzugSeite mitte
|
||||
let f = plan_opening(&b);
|
||||
let frame = &polygons(&f, 1.0)[0];
|
||||
let ys: Vec<f64> = frame.iter().map(|p| p.1).collect();
|
||||
let (lo, hi) = (ys.iter().cloned().fold(f64::INFINITY, f64::min), ys.iter().cloned().fold(f64::NEG_INFINITY, f64::max));
|
||||
assert!((lo + 0.04).abs() < 1e-9 && (hi - 0.04).abs() < 1e-9, "{lo} {hi}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn anschlag_ergibt_zwei_wandnasen_vor_dem_rahmen() {
|
||||
let sashes = [[0.0, 1.0, NAN, NAN, 1.0]];
|
||||
let mut b = input(false, 1.0, true, &sashes);
|
||||
assert!(polygons(&plan_opening(&b), 2.0).is_empty());
|
||||
b[24] = 0.08;
|
||||
b[25] = 0.12; // Einzug 12 cm von aussen
|
||||
b[DETAILS] = 0.05;
|
||||
let nibs = polygons(&plan_opening(&b), 2.0);
|
||||
assert_eq!(nibs.len(), 2);
|
||||
// Wand 0.3 dick um die Achse: Aussenfläche bei y = -0.15, Rahmen-Vorderkante bei -0.03.
|
||||
let ys: Vec<f64> = nibs[0].iter().map(|p| p.1).collect();
|
||||
assert!(ys.iter().any(|y| (y + 0.15).abs() < 1e-9) && ys.iter().any(|y| (y + 0.03).abs() < 1e-9), "{ys:?}");
|
||||
let xs: Vec<f64> = nibs[0].iter().map(|p| p.0).collect();
|
||||
assert!(xs.iter().all(|x| *x >= 1.0 - 1e-9 && *x <= 1.05 + 1e-9), "{xs:?}");
|
||||
// Bündig (ohne Einzug): keine Anschlag-Zone.
|
||||
b[25] = NAN;
|
||||
assert!(polygons(&plan_opening(&b), 2.0).is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fensterbank_folgt_der_wahl() {
|
||||
let sashes = [[0.0, 1.0, NAN, NAN, 1.0]];
|
||||
let mut b = input(false, 2.0, true, &sashes);
|
||||
let base = count_cls(&plan_opening(&b), C_SILL);
|
||||
assert_eq!(base, 4, "fehlt: Bank aussen wie bisher");
|
||||
b[DETAILS + 1] = 1.0;
|
||||
assert_eq!(count_cls(&plan_opening(&b), C_SILL), 0);
|
||||
b[DETAILS + 1] = 3.0;
|
||||
assert_eq!(count_cls(&plan_opening(&b), C_SILL), 8);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn storenkasten_im_sturz_mit_fuehrungsschienen() {
|
||||
let sashes = [[0.0, 1.0, NAN, NAN, 1.0]];
|
||||
let mut b = input(false, 2.0, true, &sashes);
|
||||
b[31] = 1.0; // Kasten
|
||||
b[33] = 0.25; // Höhe
|
||||
let vorgesetzt = count_cls(&plan_opening(&b), C_SHADING);
|
||||
assert_eq!(vorgesetzt, 4);
|
||||
b[DETAILS + 2] = 1.0;
|
||||
b[DETAILS + 3] = 0.18;
|
||||
b[DETAILS + 4] = 1.0; // Raffstore
|
||||
assert_eq!(count_cls(&plan_opening(&b), C_SHADING), 4 + 8);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tuer_blockrahmen_mit_anschlag() {
|
||||
let mut b = input(true, 1.0, false, &[]);
|
||||
b[17] = 1.0; // Rahmen
|
||||
b[18] = 0.06;
|
||||
b[19] = 1.0; // Blockrahmen
|
||||
b[20] = 0.1; // Einzug aussen
|
||||
b[DETAILS] = 0.04;
|
||||
assert_eq!(polygons(&plan_opening(&b), 2.0).len(), 2);
|
||||
}
|
||||
}
|
||||
@@ -575,6 +575,9 @@ export const de = {
|
||||
"oed.f.frameDepth": "Rahmentiefe (m)",
|
||||
"oed.f.frameWidth": "Rahmenbreite Ansicht (m)",
|
||||
"oed.f.cornerJoin": "Rahmen-Ecken",
|
||||
"oed.f.rebateDepth": "Anschlag (m)",
|
||||
"oed.f.lintelHeight": "Sturzhöhe (m)",
|
||||
"oed.f.sillBoard": "Fensterbank",
|
||||
"oed.cornerJoin.vertikal": "Pfosten durchlaufend",
|
||||
"oed.cornerJoin.horizontal": "Riegel durchlaufend",
|
||||
"oed.cornerJoin.gehrung": "Gehrung",
|
||||
@@ -597,6 +600,7 @@ export const de = {
|
||||
"oed.glazing.3": "Dreifach",
|
||||
"oed.insetFace.aussen": "Aussenfläche",
|
||||
"oed.insetFace.innen": "Innenfläche",
|
||||
"oed.insetFace.mitte": "Mitte (Leibung beidseitig)",
|
||||
"oed.fluegel.hint": "Flügel und Pfosten von links nach rechts. Öffnungsart und Anschlag je Flügel.",
|
||||
"oed.fluegel.col.kind": "Typ",
|
||||
"oed.fluegel.col.opening": "Öffnung",
|
||||
@@ -612,6 +616,9 @@ export const de = {
|
||||
"oed.shading.raffstore": "Raffstore",
|
||||
"oed.shading.markise": "Markise",
|
||||
"oed.shading.boxHeight": "Kastenhöhe (m)",
|
||||
"oed.shading.mount": "Kasten",
|
||||
"oed.shading.vorgesetzt": "Vorgesetzt",
|
||||
"oed.shading.sturz": "Im Sturz (Storenkasten)",
|
||||
"oed.shading.boxDepth": "Kastentiefe (m)",
|
||||
"oed.door.leafCount": "Türblätter",
|
||||
"oed.door.leaf1": "Einflüglig",
|
||||
@@ -1036,6 +1043,7 @@ export const de = {
|
||||
"resources.frameKind.blockrahmen": "Blockrahmen",
|
||||
"resources.insetFace.aussen": "Aussen",
|
||||
"resources.insetFace.innen": "Innen",
|
||||
"resources.insetFace.mitte": "Mitte",
|
||||
"resources.field.windowKind": "Öffnungsart",
|
||||
"resources.field.wingCount": "Flügelzahl",
|
||||
"resources.field.glazing": "Verglasung",
|
||||
|
||||
@@ -574,6 +574,9 @@ export const en: Record<TranslationKey, string> = {
|
||||
"oed.f.frameDepth": "Frame depth (m)",
|
||||
"oed.f.frameWidth": "Frame face width (m)",
|
||||
"oed.f.cornerJoin": "Frame corners",
|
||||
"oed.f.rebateDepth": "Rebate / stop (m)",
|
||||
"oed.f.lintelHeight": "Lintel height (m)",
|
||||
"oed.f.sillBoard": "Window sill",
|
||||
"oed.cornerJoin.vertikal": "Stiles through",
|
||||
"oed.cornerJoin.horizontal": "Rails through",
|
||||
"oed.cornerJoin.gehrung": "Mitre",
|
||||
@@ -596,6 +599,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"oed.glazing.3": "Triple",
|
||||
"oed.insetFace.aussen": "Outer face",
|
||||
"oed.insetFace.innen": "Inner face",
|
||||
"oed.insetFace.mitte": "Centre (reveal on both sides)",
|
||||
"oed.fluegel.hint": "Sashes and posts from left to right. Opening type and hinge per sash.",
|
||||
"oed.fluegel.col.kind": "Type",
|
||||
"oed.fluegel.col.opening": "Opening",
|
||||
@@ -611,6 +615,9 @@ export const en: Record<TranslationKey, string> = {
|
||||
"oed.shading.raffstore": "Venetian blind",
|
||||
"oed.shading.markise": "Awning",
|
||||
"oed.shading.boxHeight": "Box height (m)",
|
||||
"oed.shading.mount": "Box",
|
||||
"oed.shading.vorgesetzt": "Surface-mounted",
|
||||
"oed.shading.sturz": "In lintel (concealed blind box)",
|
||||
"oed.shading.boxDepth": "Box depth (m)",
|
||||
"oed.door.leafCount": "Door leaves",
|
||||
"oed.door.leaf1": "Single leaf",
|
||||
@@ -1030,6 +1037,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"resources.frameKind.blockrahmen": "Block frame",
|
||||
"resources.insetFace.aussen": "Outer",
|
||||
"resources.insetFace.innen": "Inner",
|
||||
"resources.insetFace.mitte": "Centre",
|
||||
"resources.field.windowKind": "Opening style",
|
||||
"resources.field.wingCount": "Wing count",
|
||||
"resources.field.glazing": "Glazing",
|
||||
|
||||
@@ -546,7 +546,7 @@ export type DoorType = {
|
||||
*/
|
||||
insetFromFace?: number;
|
||||
/** Von welcher Wandfläche der {@link insetFromFace} gemessen wird; Default "aussen". */
|
||||
insetFace?: "aussen" | "innen";
|
||||
insetFace?: "aussen" | "innen" | "mitte";
|
||||
/**
|
||||
* Oberlicht: Höhe eines festen, verglasten Oberlichts über dem Türblatt
|
||||
* (Meter). 0/fehlt ⇒ kein Oberlicht. Das Oberlicht sitzt oberhalb eines
|
||||
@@ -559,6 +559,17 @@ export type DoorType = {
|
||||
defaultHeight: number;
|
||||
/** Bodenschwelle/Anschlag zeichnen (3D/Detail). */
|
||||
threshold?: boolean;
|
||||
/**
|
||||
* Anschlag (Maueranschlag): so weit (Meter, je Seite und oben) springt die Wand zwischen
|
||||
* der Fläche aus {@link insetFace} und der Rahmen-Vorderkante in die Öffnung vor. Wirkt nur
|
||||
* mit Leibung (`insetFromFace` > 0 bzw. `insetFace: "mitte"`). 0/fehlt ⇒ stumpf (bisher).
|
||||
*/
|
||||
rebateDepth?: number;
|
||||
/**
|
||||
* Sturz: Höhe des Sturzes über der Öffnung (Meter), im Schnitt als eigener Querschnitt
|
||||
* gezeichnet. 0/fehlt ⇒ kein eigener Sturz (bisher).
|
||||
*/
|
||||
lintelHeight?: number;
|
||||
};
|
||||
|
||||
/** Ein freies 2D-Zeichenelement auf einer Zeichnungsebene. */
|
||||
@@ -2758,8 +2769,16 @@ export type WindowShading = {
|
||||
kind: "rollladen" | "raffstore" | "markise";
|
||||
/** Kastenmasse (Meter): Breite (quer, meist = Öffnung), Höhe, Tiefe. */
|
||||
box: { width: number; height: number; depth: number };
|
||||
/**
|
||||
* Einbau des Kastens: "vorgesetzt" (vor der Rahmenebene, bisher) oder "sturz" (Storenkasten
|
||||
* im Sturz, in der Wand verdeckt — in der Schweiz üblich bei Lamellenstoren). Fehlt ⇒ vorgesetzt.
|
||||
*/
|
||||
mount?: WindowShadingMount;
|
||||
};
|
||||
|
||||
/** Einbau des Sonnenschutzkastens ({@link WindowShading.mount}). */
|
||||
export type WindowShadingMount = "vorgesetzt" | "sturz";
|
||||
|
||||
export type WindowType = {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -2819,7 +2838,7 @@ export type WindowType = {
|
||||
*/
|
||||
insetFromFace?: number;
|
||||
/** Von welcher Wandfläche der {@link insetFromFace} gemessen wird; Default "aussen". */
|
||||
insetFace?: "aussen" | "innen";
|
||||
insetFace?: "aussen" | "innen" | "mitte";
|
||||
/**
|
||||
* Schicht-Rücksprung an der Laibung: weicht die INNERSTE Wandschicht (meist
|
||||
* Gipsplatte/Holzverkleidung) an diesem Fenster um ihre eigene Dicke von der
|
||||
@@ -2850,4 +2869,15 @@ export type WindowType = {
|
||||
defaultHeight: number;
|
||||
/** Fensterbank zeichnen (Detail): keine / innen / aussen / beide. */
|
||||
sillBoard?: "keine" | "innen" | "aussen" | "beide";
|
||||
/**
|
||||
* Anschlag (Maueranschlag): so weit (Meter, je Seite und oben) springt die Wand zwischen
|
||||
* der Fläche aus {@link insetFace} und der Rahmen-Vorderkante in die Öffnung vor. Wirkt nur
|
||||
* mit Leibung (`insetFromFace` > 0 bzw. `insetFace: "mitte"`). 0/fehlt ⇒ stumpf (bisher).
|
||||
*/
|
||||
rebateDepth?: number;
|
||||
/**
|
||||
* Sturz: Höhe des Sturzes über der Öffnung (Meter), im Schnitt als eigener Querschnitt
|
||||
* gezeichnet. 0/fehlt ⇒ kein eigener Sturz (bisher).
|
||||
*/
|
||||
lintelHeight?: number;
|
||||
};
|
||||
@@ -287,8 +287,9 @@ describe("generatePlan — Fensterbank (window-sill) folgt der eingezogenen Rahm
|
||||
// die volle Wandfläche (−0.15 — der alte, fehlerhafte Wert vor dem Fix).
|
||||
expect(Math.max(...ys)).toBeCloseTo(-0.1, 6);
|
||||
expect(Math.max(...ys)).not.toBeCloseTo(-0.15, 2);
|
||||
// Auskragung geht weiter nach aussen (algebraisch kleiner): −0.10 − 0.04.
|
||||
expect(Math.min(...ys)).toBeCloseTo(-0.14, 6);
|
||||
// Auskragung über die ganze Leibung bis 4 cm vor die Fassade ([94]): −0.15 − 0.04
|
||||
// (früher endete die Bank bei −0.14, also in der Leibung).
|
||||
expect(Math.min(...ys)).toBeCloseTo(-0.19, 6);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -341,6 +341,7 @@ function BasisPanel({
|
||||
options={[
|
||||
{ value: "aussen", label: t("oed.insetFace.aussen") },
|
||||
{ value: "innen", label: t("oed.insetFace.innen") },
|
||||
{ value: "mitte", label: t("oed.insetFace.mitte") },
|
||||
]}
|
||||
onChange={(v) => patchWt({ insetFace: v })}
|
||||
/>
|
||||
@@ -460,6 +461,34 @@ function RahmenPanel({
|
||||
options={cornerJoinOptions()}
|
||||
onChange={(v) => patchDt({ frameCornerJoin: v })}
|
||||
/>
|
||||
<SelField
|
||||
label={t("oed.f.insetFace")}
|
||||
value={dt.insetFace ?? "aussen"}
|
||||
options={[
|
||||
{ value: "aussen", label: t("oed.insetFace.aussen") },
|
||||
{ value: "innen", label: t("oed.insetFace.innen") },
|
||||
{ value: "mitte", label: t("oed.insetFace.mitte") },
|
||||
]}
|
||||
onChange={(v) => patchDt({ insetFace: v })}
|
||||
/>
|
||||
<NumField
|
||||
label={t("oed.f.insetFromFace")}
|
||||
value={dt.insetFromFace ?? 0}
|
||||
min={0}
|
||||
onCommit={(n) => patchDt({ insetFromFace: n })}
|
||||
/>
|
||||
<NumField
|
||||
label={t("oed.f.rebateDepth")}
|
||||
value={dt.rebateDepth ?? 0}
|
||||
min={0}
|
||||
onCommit={(n) => patchDt({ rebateDepth: n || undefined })}
|
||||
/>
|
||||
<NumField
|
||||
label={t("oed.f.lintelHeight")}
|
||||
value={dt.lintelHeight ?? 0}
|
||||
min={0}
|
||||
onCommit={(n) => patchDt({ lintelHeight: n || undefined })}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -490,6 +519,29 @@ function RahmenPanel({
|
||||
options={cornerJoinOptions()}
|
||||
onChange={(v) => patchWt({ frameCornerJoin: v })}
|
||||
/>
|
||||
<NumField
|
||||
label={t("oed.f.rebateDepth")}
|
||||
value={wt.rebateDepth ?? 0}
|
||||
min={0}
|
||||
onCommit={(n) => patchWt({ rebateDepth: n || undefined })}
|
||||
/>
|
||||
<NumField
|
||||
label={t("oed.f.lintelHeight")}
|
||||
value={wt.lintelHeight ?? 0}
|
||||
min={0}
|
||||
onCommit={(n) => patchWt({ lintelHeight: n || undefined })}
|
||||
/>
|
||||
<SelField
|
||||
label={t("oed.f.sillBoard")}
|
||||
value={wt.sillBoard ?? "aussen"}
|
||||
options={[
|
||||
{ value: "keine", label: t("resources.sillBoard.keine") },
|
||||
{ value: "aussen", label: t("resources.sillBoard.aussen") },
|
||||
{ value: "innen", label: t("resources.sillBoard.innen") },
|
||||
{ value: "beide", label: t("resources.sillBoard.beide") },
|
||||
]}
|
||||
onChange={(v) => patchWt({ sillBoard: v })}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -681,6 +733,15 @@ function SonnenschutzPanel({
|
||||
set({ kind: v as NonNullable<WindowType["shading"]>["kind"] })
|
||||
}
|
||||
/>
|
||||
<SelField
|
||||
label={t("oed.shading.mount")}
|
||||
value={sh.mount ?? "vorgesetzt"}
|
||||
options={[
|
||||
{ value: "vorgesetzt", label: t("oed.shading.vorgesetzt") },
|
||||
{ value: "sturz", label: t("oed.shading.sturz") },
|
||||
]}
|
||||
onChange={(v) => set({ mount: v })}
|
||||
/>
|
||||
<NumField
|
||||
label={t("oed.shading.boxHeight")}
|
||||
value={box.height}
|
||||
|
||||
@@ -13,9 +13,10 @@ import { DeleteButton } from "./fields";
|
||||
|
||||
// Bezugsfläche des Schichteinzugs — von aussen oder innen gemessen. Für Tür UND
|
||||
// Fenster genutzt (gleiche Semantik).
|
||||
export const INSET_FACE_OPTIONS: { value: "aussen" | "innen"; labelKey: string }[] = [
|
||||
export const INSET_FACE_OPTIONS: { value: "aussen" | "innen" | "mitte"; labelKey: string }[] = [
|
||||
{ value: "aussen", labelKey: "resources.insetFace.aussen" },
|
||||
{ value: "innen", labelKey: "resources.insetFace.innen" },
|
||||
{ value: "mitte", labelKey: "resources.insetFace.mitte" },
|
||||
];
|
||||
|
||||
export function TypeLibraryTab<T extends { id: string; name: string }>({
|
||||
|
||||
Reference in new issue
Block a user