Zusammenführung [291] Geländer
This commit is contained in:
29 files changed
+1444
-209
No files matched your search
@@ -114,7 +114,8 @@ pub enum SlabSource {
|
||||
/// [141] Index in `Project::columns` (Stützen-Prisma, je Höhenabschnitt von [`column_pieces`]).
|
||||
Column { index: usize },
|
||||
/// [279] Index in `Project::railings` (Prisma je Teil, `railing::pieces`).
|
||||
Railing { index: usize, fill: bool },
|
||||
/// `fill`: Tafel mit dieser Füllung ([291] je Feld), `None` = Gestänge.
|
||||
Railing { index: usize, fill: Option<RailingKind> },
|
||||
/// [280] Index in `Project::beams` (Träger-Prisma wie eine Stütze).
|
||||
Beam { index: usize },
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! [279] Geländer im 3D: Netze (`emit_railings`, im 3D bei den Stützen eingereiht), Platten für Schnitt, Ansicht und
|
||||
//! 3D-Dokument (`railing_slabs`, Herkunft `SlabSource::Railing`) und die Pick-Geometrie. Die Körper liefert
|
||||
//! `crate::railing::pieces` (lotrechte Prismen), eine Quelle für alle Ableitungen.
|
||||
//! `crate::railing::pieces` (lotrechte Prismen, auf Treppen geschert [291]), eine Quelle für alle Ableitungen.
|
||||
|
||||
use super::*;
|
||||
use crate::railing::{self, Part, Piece};
|
||||
@@ -12,7 +12,7 @@ fn merge<'a>(pieces: impl Iterator<Item = &'a Piece>) -> Option<(Vec<f64>, Vec<u
|
||||
if q.outline.len() < 3 || !(q.z1 - q.z0 > 1e-6) || !q.outline.iter().all(|v| v[0].is_finite() && v[1].is_finite()) {
|
||||
continue;
|
||||
}
|
||||
let (pp, ii) = crate::columns3d::prism(&q.outline, q.z0, q.z1);
|
||||
let (pp, ii) = q.mesh();
|
||||
let base = (positions.len() / 3) as u32;
|
||||
positions.extend(pp);
|
||||
indices.extend(ii.into_iter().map(|i| i + base));
|
||||
@@ -20,30 +20,39 @@ fn merge<'a>(pieces: impl Iterator<Item = &'a Piece>) -> Option<(Vec<f64>, Vec<u
|
||||
(!indices.is_empty()).then_some((positions, indices))
|
||||
}
|
||||
|
||||
/// Geländer als Netze: je Geländer die Tafel (Glas, Lochblech, Brüstung) und das Gestänge (Pfosten, Stäbe, Schienen,
|
||||
/// Handlauf) als eigene Netze mit eigener Farbe.
|
||||
/// Geländer als Netze: je Geländer die Tafeln (Glas, Lochblech, Brüstung; [291] je Füllung der Felder ein Netz) und das
|
||||
/// Gestänge (Pfosten, Stäbe, Schienen, Zwischenholme, Handlauf) als eigene Netze mit eigener Farbe.
|
||||
pub fn emit_railings(p: &Project) -> Vec<RMesh> {
|
||||
let mut out = Vec::new();
|
||||
for (ri, r) in p.railings.as_deref().unwrap_or(&[]).iter().enumerate() {
|
||||
let pcs = railing::pieces(p, r);
|
||||
for fill in [true, false] {
|
||||
let Some((positions, indices)) = merge(pcs.iter().filter(|q| (q.part == Part::Fill) == fill)) else { continue };
|
||||
let color = railing::color(p, r, if fill { Part::Fill } else { Part::Rail });
|
||||
let mut fills: Vec<RailingKind> = vec![r.kind];
|
||||
for q in pcs.iter().filter(|q| q.part == Part::Fill) {
|
||||
if !fills.contains(&q.kind) {
|
||||
fills.push(q.kind);
|
||||
}
|
||||
}
|
||||
for fill in fills.into_iter().map(Some).chain([None]) {
|
||||
let Some((positions, indices)) = merge(pcs.iter().filter(|q| if let Some(k) = fill { q.part == Part::Fill && q.kind == k } else { q.part != Part::Fill })) else { continue };
|
||||
let color = match fill {
|
||||
Some(k) => railing::color_of(p, r, Part::Fill, k),
|
||||
None => railing::color(p, r, Part::Rail),
|
||||
};
|
||||
out.push(RMesh { crease_angle: None, positions, indices, kind: "extrusion", color, vertex_colors: None, material_index: None, owner: Owner::Railing(ri) });
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Geländer als lotrechte Prismen-Platten (Schnitt, Ansicht, 3D-Dokument), Herkunft `SlabSource::Railing`.
|
||||
/// Geländer als Prismen-Platten (lotrecht; [291] auf Treppen mit Neigungsebene `slope`) (Schnitt, Ansicht, 3D-Dokument), Herkunft `SlabSource::Railing`.
|
||||
pub fn railing_slabs(p: &Project) -> Vec<RSlab> {
|
||||
let mut out = Vec::new();
|
||||
for (index, r) in p.railings.as_deref().unwrap_or(&[]).iter().enumerate() {
|
||||
for q in railing::pieces(p, r) {
|
||||
if q.z1 - q.z0 > 1e-6 && q.outline.len() >= 3 {
|
||||
let color = railing::color(p, r, q.part);
|
||||
let fill = q.part == Part::Fill;
|
||||
out.push(RSlab { outline: q.outline, z_bottom: q.z0, z_top: q.z1, color, ceiling_id: r.id.clone(), hatch: None, cut: None, monolith: None, slope: None, source: SlabSource::Railing { index, fill } });
|
||||
let color = railing::color_of(p, r, q.part, q.kind);
|
||||
let fill = (q.part == Part::Fill).then_some(q.kind);
|
||||
out.push(RSlab { outline: q.outline, z_bottom: q.z0, z_top: q.z1, color, ceiling_id: r.id.clone(), hatch: None, cut: None, monolith: None, slope: q.slope, source: SlabSource::Railing { index, fill } });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,12 +41,8 @@ pub(super) fn stair_input<'a>(p: &'a Project, wanted: impl Fn(&Stair, Option<&St
|
||||
buf.push(st.map_or(0.04, |t| t.tread_thickness));
|
||||
buf.push(st.and_then(|t| t.nosing).unwrap_or(0.0));
|
||||
buf.push(if st.is_some_and(|t| t.closed_risers) { 1.0 } else { 0.0 });
|
||||
buf.push(match st.and_then(|t| t.railing) {
|
||||
Some(StairTypeRailing::Links) => 1.0,
|
||||
Some(StairTypeRailing::Rechts) => 2.0,
|
||||
Some(StairTypeRailing::Beide) => 3.0,
|
||||
_ => 0.0,
|
||||
});
|
||||
// [291] Seiten mit gebundenem Geländer ohne eigenen Handlauf (das Geländer zeichnet sich selbst).
|
||||
buf.push(crate::railing::stair_code(p, s) as f64);
|
||||
buf.push(s.center_column.filter(|r| r.is_finite() && *r > 0.0).unwrap_or(0.0));
|
||||
buf.extend(s.rail_params());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user