[281] Geneigte Decken und Rampen: Neigung an der Decke, Schnitt/Ansicht/3D/axo, Gefällepfeil, IfcRamp, Befehl Rampe
Modell: Ceiling.slope (CeilingSlope: from, to, rise, ramp?) im Rust-Modell, gen:types. Am Bezugspunkt gilt die eingestellte OK/UK; längs der Gefällelinie steigt die Platte um rise. Alle Schichten parallel verschoben, Dicke lotrecht (Scherung: Volumen = Fläche × Dicke exakt, Mantel lotrecht). Kern: RSlab.slope und render3d SlabInput.slope (Netz, Live-Schnitt, Schnittbänder schräg; schräge Bänder nur in der polygonalen Dominanz), Projektion hinter dem Schnitt und 3D-Dokument (view_faces), Ansicht (Plattenpuffer mit negativer Eckenzahl + Ebene), Abzugskörper (extrude mit slope, Manifold), OBJ/glTF, Hervorhebung, Flächenmuster, Raumhöhe, Öffnung unter geneigter Decke ([234]), Ansichtsbereich/Auflager nach Höhenspanne. Wandschichten werden von geneigten Decken nicht eingeschnitten (keine Wand-an-Decke-Logik vorhanden). Grundriss: Gefällepfeil bzw. Rampen-Lauflinie mit Antrittspunkt und „x %“ (Linien ceiling-slope, Klasse der Decke). IFC: geneigt = IfcSlab als Netz (REC_CEILING_MESH), Rampe = IfcRamp + IfcRampFlight (IFC4/IFC2x3, ifcopenshell: 0 Befunde). UI: Objekt-Info Decke „Neigung“ (aus/Gefälle/Rampe, %, Grad, Höhenunterschied, Richtung, Bezugspunkt); Befehl „Rampe“ (rampe) in der Werkzeugliste; Pick im 3D über die Scherung. Beispiel Wettbewerb: Eingangsrampe 6 % (Schnitt B-B). Tests: ceiling_slope_tests (10), rampe_mit_gefaelle, ramp.test.ts, raycast3d, e2e ramp281. Geprüft im Linux-Container (CLI-SVG, Chromium, Playwright); nicht in der Tauri-App/auf dem Mac (Metal) geprüft. Goldens unverändert (Muster/Komplex ohne Neigung).
This commit is contained in:
60 files changed
+1274
-67
No files matched your search
@@ -918,6 +918,7 @@ mod tests {
|
||||
fn square_slab(s: f32, z_bottom: f32, z_top: f32) -> SlabInput {
|
||||
SlabInput {
|
||||
monolith: None,
|
||||
slope: None,
|
||||
outline: vec![[0.0, 0.0], [s, 0.0], [s, s], [0.0, s]],
|
||||
z_bottom,
|
||||
z_top,
|
||||
@@ -977,6 +978,7 @@ mod tests {
|
||||
// Zentrum weg zeigen.
|
||||
let slab = SlabInput {
|
||||
monolith: None,
|
||||
slope: None,
|
||||
outline: vec![[-2.0, -2.0], [2.0, -2.0], [2.0, 2.0], [-2.0, 2.0]],
|
||||
z_bottom: 0.0,
|
||||
z_top: 0.3,
|
||||
@@ -1011,7 +1013,7 @@ mod tests {
|
||||
fn entarteter_slab_erzeugt_nichts() {
|
||||
let mut mesh = Mesh::default();
|
||||
// <3 Ecken.
|
||||
extrude_slab(&mut mesh, &SlabInput { outline: vec![[0.0, 0.0], [1.0, 0.0]], z_bottom: 0.0, z_top: 0.2, color: [0.8, 0.8, 0.8], hatch: None, cut: None, monolith: None });
|
||||
extrude_slab(&mut mesh, &SlabInput { outline: vec![[0.0, 0.0], [1.0, 0.0]], z_bottom: 0.0, z_top: 0.2, color: [0.8, 0.8, 0.8], hatch: None, cut: None, monolith: None, slope: None });
|
||||
assert_eq!(mesh.vertex_count(), 0);
|
||||
// Nullhoehe.
|
||||
extrude_slab(&mut mesh, &square_slab(4.0, 2.6, 2.6));
|
||||
|
||||
@@ -1608,16 +1608,24 @@ pub fn extrude_slab(mesh: &mut Mesh, slab: &SlabInput) {
|
||||
return;
|
||||
}
|
||||
let color = slab.color;
|
||||
// world-Position: model [x, y] -> (x, hoehe, y).
|
||||
let w = |g: Point2, y: f32| -> [f32; 3] { [g[0], y, g[1]] };
|
||||
// world-Position: model [x, y] -> (x, hoehe, y); [281] geneigte Platte: Höhe + Versatz der Neigungsebene.
|
||||
let w = |g: Point2, y: f32| -> [f32; 3] { [g[0], y + slab.dz(g), g[1]] };
|
||||
// Deckel-/Bodennormale: senkrecht auf der (geneigten) Ebene.
|
||||
let up = match slab.slope {
|
||||
Some(s) => {
|
||||
let l = (s[2] * s[2] + 1.0 + s[3] * s[3]).sqrt();
|
||||
[-s[2] / l, 1.0 / l, -s[3] / l]
|
||||
}
|
||||
None => [0.0, 1.0, 0.0],
|
||||
};
|
||||
|
||||
// Deckel (+Y) und Boden (−Y) aus den Triangulierungs-Dreiecken.
|
||||
for t in tris.chunks_exact(3) {
|
||||
let a = pts[t[0] as usize];
|
||||
let b = pts[t[1] as usize];
|
||||
let c = pts[t[2] as usize];
|
||||
push_tri_oriented(mesh, w(a, y1), w(b, y1), w(c, y1), [0.0, 1.0, 0.0], color);
|
||||
push_tri_oriented(mesh, w(a, y0), w(b, y0), w(c, y0), [0.0, -1.0, 0.0], color);
|
||||
push_tri_oriented(mesh, w(a, y1), w(b, y1), w(c, y1), up, color);
|
||||
push_tri_oriented(mesh, w(a, y0), w(b, y0), w(c, y0), [-up[0], -up[1], -up[2]], color);
|
||||
}
|
||||
|
||||
// Mantelflaechen: je Kante ein vertikales Quad (unten y0, oben y1), Normale nach aussen (aus dem
|
||||
@@ -1767,7 +1775,7 @@ mod tests {
|
||||
if rev {
|
||||
o.reverse();
|
||||
}
|
||||
let slab = SlabInput { monolith: None, outline: o, z_bottom: 0.0, z_top: 0.3, color: [0.8, 0.8, 0.8], hatch: None, cut: None };
|
||||
let slab = SlabInput { monolith: None, slope: None, outline: o, z_bottom: 0.0, z_top: 0.3, color: [0.8, 0.8, 0.8], hatch: None, cut: None };
|
||||
let mut m = Mesh::default();
|
||||
extrude_slab(&mut m, &slab);
|
||||
let mut at_arc = 0;
|
||||
|
||||
@@ -345,9 +345,19 @@ struct Prism {
|
||||
/// Ebene Oberkante unter einer Dachfläche ([G2], `WallInput::top_plane`): Ursprung (Grundriss)
|
||||
/// und `[z, dz/dx, dz/dy]`; `z1` ist dann der höchste Eckwert.
|
||||
top: Option<(Point2, [f32; 3])>,
|
||||
/// [281] Geneigte Platte (`SlabInput::slope`): alle Höhen um den Versatz der Neigungsebene verschoben.
|
||||
shear: Option<[f32; 4]>,
|
||||
}
|
||||
|
||||
impl Prism {
|
||||
/// [281] Höhenversatz der geneigten Platte am Grundrisspunkt (sonst 0).
|
||||
fn dz(&self, p: Point2) -> f32 {
|
||||
match self.shear {
|
||||
Some(s) => s[2] * (p[0] - s[0]) + s[3] * (p[1] - s[1]),
|
||||
None => 0.0,
|
||||
}
|
||||
}
|
||||
|
||||
/// Oberkante an einem Grundriss-Punkt.
|
||||
fn top_at(&self, p: Point2) -> f32 {
|
||||
match self.top {
|
||||
@@ -447,6 +457,7 @@ fn wall_prism(index: usize, wall: &WallInput) -> Option<Prism> {
|
||||
cut: wall.cut.clone(),
|
||||
monolith: None,
|
||||
top: wall.top_plane.map(|c| (wall.start, c)),
|
||||
shear: None,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -472,6 +483,7 @@ fn slab_prism(index: usize, slab: &SlabInput) -> Option<Prism> {
|
||||
cut: slab.cut.clone(),
|
||||
monolith: slab.monolith.clone(),
|
||||
top: None,
|
||||
shear: slab.slope,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -653,6 +665,11 @@ fn prism_bounds(plane: &SectionPlane, prism: &Prism) -> PrismBounds {
|
||||
}
|
||||
}
|
||||
|
||||
// [281] Geneigte Platte: Hüllhöhe über den ganzen Umriss (konservativ, wie die achsparallele Näherung).
|
||||
let (dlo, dhi) = match prism.shear {
|
||||
Some(_) => prism.footprint.iter().fold((f32::INFINITY, f32::NEG_INFINITY), |(a, b), &p| (a.min(prism.dz(p)), b.max(prism.dz(p)))),
|
||||
None => (0.0, 0.0),
|
||||
};
|
||||
PrismBounds {
|
||||
kind: prism.kind,
|
||||
index: prism.index,
|
||||
@@ -661,8 +678,8 @@ fn prism_bounds(plane: &SectionPlane, prism: &Prism) -> PrismBounds {
|
||||
depth_min,
|
||||
depth_max,
|
||||
monolith: prism.monolith.clone(),
|
||||
z0: prism.z0,
|
||||
z1: prism.z1,
|
||||
z0: prism.z0 + dlo,
|
||||
z1: prism.z1 + dhi,
|
||||
opening_voids,
|
||||
}
|
||||
}
|
||||
@@ -897,19 +914,23 @@ fn prism_wireframe_edges(prism: &Prism) -> Vec<([f32; 3], [f32; 3], HeightBias)>
|
||||
let n = prism.footprint.len();
|
||||
let mut edges = Vec::with_capacity(3 * n);
|
||||
for i in 0..n {
|
||||
let d = prism.dz(prism.footprint[i]);
|
||||
edges.push((
|
||||
to_world(prism.footprint[i], prism.z0),
|
||||
to_world(prism.footprint[i], prism.top_at(prism.footprint[i])),
|
||||
to_world(prism.footprint[i], prism.z0 + d),
|
||||
to_world(prism.footprint[i], prism.top_at(prism.footprint[i]) + d),
|
||||
HeightBias::Vertical,
|
||||
));
|
||||
}
|
||||
// [281] Geneigte Platte: Boden- und Deckelkanten variieren in der Höhe.
|
||||
let sheared = prism.shear.is_some();
|
||||
for i in 0..n {
|
||||
let a = prism.footprint[i];
|
||||
let b = prism.footprint[(i + 1) % n];
|
||||
edges.push((to_world(a, prism.z0), to_world(b, prism.z0), HeightBias::BottomCap));
|
||||
let (da, db) = (prism.dz(a), prism.dz(b));
|
||||
edges.push((to_world(a, prism.z0 + da), to_world(b, prism.z0 + db), if sheared { HeightBias::Vertical } else { HeightBias::BottomCap }));
|
||||
// Schräge Deckelkante ([G2]): Höhe variiert, geschlossene Randbehandlung.
|
||||
let bias = if prism.top.is_some() { HeightBias::Vertical } else { HeightBias::TopCap };
|
||||
edges.push((to_world(a, prism.top_at(a)), to_world(b, prism.top_at(b)), bias));
|
||||
let bias = if prism.top.is_some() || sheared { HeightBias::Vertical } else { HeightBias::TopCap };
|
||||
edges.push((to_world(a, prism.top_at(a) + da), to_world(b, prism.top_at(b) + db), bias));
|
||||
}
|
||||
edges
|
||||
}
|
||||
@@ -1228,6 +1249,15 @@ fn cut_polygons_and_prisms(
|
||||
} else {
|
||||
(rz1, rz1)
|
||||
};
|
||||
// [281] Geneigte Platte: Unter- und Oberkante längs der Schnittlinie um den Versatz verschoben.
|
||||
let (dlo, dhi) = match prism.shear {
|
||||
Some(_) => {
|
||||
let (p0, ua) = (plane.plan_point(), plane.plan_u_axis());
|
||||
let at = |u: f32| prism.dz([p0[0] + u * ua[0], p0[1] + u * ua[1]]);
|
||||
(at(rlo), at(rhi))
|
||||
}
|
||||
None => (0.0, 0.0),
|
||||
};
|
||||
cut_polygons.push(CutPolygon {
|
||||
component: ComponentRef {
|
||||
kind: prism.kind,
|
||||
@@ -1235,7 +1265,7 @@ fn cut_polygons_and_prisms(
|
||||
},
|
||||
color: prism.color,
|
||||
hatch: prism.hatch,
|
||||
pts: vec![[rlo, rz0], [rhi, rz0], [rhi, zb], [rlo, za]],
|
||||
pts: vec![[rlo, rz0 + dlo], [rhi, rz0 + dhi], [rhi, zb + dhi], [rlo, za + dlo]],
|
||||
cut: prism.cut.clone(),
|
||||
});
|
||||
}
|
||||
@@ -1310,6 +1340,7 @@ mod tests {
|
||||
];
|
||||
let slabs = vec![SlabInput {
|
||||
monolith: None,
|
||||
slope: None,
|
||||
outline: vec![[-0.5, -0.5], [3.5, -0.5], [3.5, 3.5], [-0.5, 3.5]],
|
||||
z_bottom: -0.2,
|
||||
z_top: 0.0,
|
||||
|
||||
@@ -24,6 +24,16 @@ fn poly_from_rect(src: &CutPolygon, r: Rect) -> CutPolygon {
|
||||
}
|
||||
}
|
||||
|
||||
/// [281] Liegen alle Ecken auf den Kanten der Hüllbox (achsparalleles Rechteck)?
|
||||
fn is_axis_rect(pts: &[[f32; 2]]) -> bool {
|
||||
let (mut u0, mut u1, mut v0, mut v1) = (f32::INFINITY, f32::NEG_INFINITY, f32::INFINITY, f32::NEG_INFINITY);
|
||||
for p in pts {
|
||||
(u0, u1, v0, v1) = (u0.min(p[0]), u1.max(p[0]), v0.min(p[1]), v1.max(p[1]));
|
||||
}
|
||||
const E: f32 = 1e-5;
|
||||
pts.iter().all(|p| ((p[0] - u0).abs() < E || (p[0] - u1).abs() < E) && ((p[1] - v0).abs() < E || (p[1] - v1).abs() < E))
|
||||
}
|
||||
|
||||
/// Globale Schnitt-Dominanz (staerkere `join_priority` schneidet schwaechere weg, gleiche Komponente
|
||||
/// und Prioritaet verschmilzt) — siehe `dossier_hatch::section_dominance`.
|
||||
pub fn subtract_dominant_bands(bands: Vec<CutPolygon>) -> Vec<CutPolygon> {
|
||||
@@ -36,11 +46,11 @@ pub fn subtract_dominant_bands(bands: Vec<CutPolygon>) -> Vec<CutPolygon> {
|
||||
let n = ids.len() as u32;
|
||||
*ids.entry(id).or_insert(n)
|
||||
});
|
||||
Band {
|
||||
rect: rect_of_points(b.pts.iter().map(|p| (p[0] as f64, p[1] as f64))),
|
||||
prio: meta.and_then(|c| c.join_priority).map(f64::from),
|
||||
comp,
|
||||
}
|
||||
// [281] Schräge Bänder (geneigte Platte) sind kein Rechteck: nehmen an der Dominanz nicht teil
|
||||
// (wie Dach-Schichten), sonst schnitte ihre Hüllbox zu viel weg.
|
||||
let rect = rect_of_points(b.pts.iter().map(|p| (p[0] as f64, p[1] as f64)));
|
||||
let prio = meta.and_then(|c| c.join_priority).map(f64::from).filter(|_| b.component.kind != crate::section::ComponentKind::Slab || is_axis_rect(&b.pts));
|
||||
Band { rect, prio, comp }
|
||||
})
|
||||
.collect();
|
||||
dominant_bands(&inp)
|
||||
|
||||
@@ -575,6 +575,7 @@ mod tests {
|
||||
// z in [2.0, 2.4]; Prio 100 (Beton laeuft durch, schneidet die Wand).
|
||||
let slab = SlabInput {
|
||||
monolith: None,
|
||||
slope: None,
|
||||
outline: vec![[-1.0, -1.0], [4.0, -1.0], [4.0, 1.0], [-1.0, 1.0]],
|
||||
z_bottom: 2.0,
|
||||
z_top: 2.4,
|
||||
@@ -653,6 +654,7 @@ mod tests {
|
||||
// Wand in u ab (Umriss ueber y in [-1,1]).
|
||||
let screed = SlabInput {
|
||||
monolith: None,
|
||||
slope: None,
|
||||
outline: vec![[-1.0, -1.0], [4.0, -1.0], [4.0, 1.0], [-1.0, 1.0]],
|
||||
z_bottom: 1.0,
|
||||
z_top: 1.06,
|
||||
@@ -668,6 +670,7 @@ mod tests {
|
||||
// Daemmung-Slab (Prio 20, Muster 4), z in [0.96,1.0], gleiche u-Deckung.
|
||||
let insulation = SlabInput {
|
||||
monolith: None,
|
||||
slope: None,
|
||||
outline: vec![[-1.0, -1.0], [4.0, -1.0], [4.0, 1.0], [-1.0, 1.0]],
|
||||
z_bottom: 0.96,
|
||||
z_top: 1.0,
|
||||
|
||||
@@ -301,6 +301,21 @@ pub struct SlabInput {
|
||||
/// verschwinden, sichtbar bleibt der Umriss (Sägezahn). `None` = Einzelteil.
|
||||
#[serde(default)]
|
||||
pub monolith: Option<String>,
|
||||
/// [281] Geneigte Decke/Rampe: Neigungsebene `[ox, oy, gx, gy]` (Modell-Meter) — jede Höhe der Platte liegt
|
||||
/// am Grundrisspunkt (x, y) um `gx·(x−ox) + gy·(y−oy)` höher (Ober- und Unterkante parallel verschoben,
|
||||
/// Mantel bleibt lotrecht). `None` = waagrecht.
|
||||
#[serde(default)]
|
||||
pub slope: Option<[f32; 4]>,
|
||||
}
|
||||
|
||||
impl SlabInput {
|
||||
/// [281] Höhenversatz der Neigungsebene am Grundrisspunkt (waagrecht 0).
|
||||
pub fn dz(&self, p: Point2) -> f32 {
|
||||
match self.slope {
|
||||
Some(s) => s[2] * (p[0] - s[0]) + s[3] * (p[1] - s[1]),
|
||||
None => 0.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// EINE Dachflächen-Schicht für den 3D-Live-Schnitt (`crate::roof_cut`).
|
||||
|
||||
Reference in new issue
Block a user