[308] 3D-Dokument: Gelände als Modellsockel, Zuschnitt auf Parzelle + 2 m (sonst Gebäude + 5 m) mit dunkleren Seitenflächen; Option terrainClip / --terrain-clip
This commit is contained in:
8 files changed
+184
-27
No files matched your search
@@ -11,7 +11,7 @@ Wer zu einer ID mehr wissen will (Entscheide, Tests, Bilder), sucht dort nach `*
|
||||
stehen im Archiv („Bewusst nicht übernommen“).
|
||||
- **Grösse** (eine Person mit Agenten): S ≤ 1 Tag · M ≤ 1 Woche · L ≤ 1 Monat · XL > 1 Monat.
|
||||
Steht keine Grösse im Archiv, ist sie hier geschätzt.
|
||||
- **IDs sind stabil.** Neue ID = nächste freie Zahl nach der höchsten im Archiv und hier (aktuell 307);
|
||||
- **IDs sind stabil.** Neue ID = nächste freie Zahl nach der höchsten im Archiv und hier (aktuell 308);
|
||||
nie eine ID wiederverwenden oder umnummerieren. Präfix-IDs (`[K]`, `[G]`, `[T]`, `[B]`, `[C]`) bleiben.
|
||||
- **Pro Punkt:** was fehlt · wo im Code · Grösse. Höchstens ein bis drei Sätze je Punkt;
|
||||
Messwerte und Befunde gehören in den Commit.
|
||||
@@ -57,6 +57,7 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC.
|
||||
|
||||
- ◐ **[266]** Wettbewerb einmal ganz durchgespielt (16.11., Bilder `doc/review-266/`). Offen: GV (`flaechen.rs`) — Studienkörper (frei, ≥ 9 m², ≥ 2.4 m) zählen nur ausserhalb der Geschossgrundrisse, Bodenplatte zählt von UK bis Fertigboden (FRAGE: SIA-416-Wortlaut zu Fundamenten/Sauberkeitsschicht nicht im Repo, gegen die Norm prüfen; Schwellen 9 m²/2.4 m sind Annahmen, Alternative: Merkmal „Gebäudekörper“). 3D-Dokument (`plan/axo.rs`): nicht auf dem Mac geprüft, kein eigener Reiter, kein Live-Schnitt (Gelände: [307]). Nicht geprüft: Tauri-App/Mac (Metal, 3D-Bild, Schatten, Rendering), Druck des A1-Plakats, DXF/IFC in Fremdsoftware; Plakat-Reste in [296]. · M
|
||||
- ◐ **[307]** 3D-Dokument: Gelände als helle Fläche mit Randlinie (20.11., Bild `doc/review-307/axo.png`; `plan/axo_terrain.rs`, Netz-Quelle `excavation::terrain_model_mesh` wie 3D/Ansicht, mit Baugruben, Klasse über Sichtbarkeit/Ebene, Parameter `terrain` Vorgabe an). Verdeckt den Keller, wird vom Haus verdeckt. Zu dichte Netze (> 12 000 Dreiecke im Ausschnitt um das Gebäude) werden auf ein ~3000-Zellen-Raster umgerechnet (Baugruben-Böschung dort gröber). Offen: keine Höhenlinien (Linien im Gelände), keine Durchdringungslinie Haus/Gelände; Wettbewerb hat kein Gelände, nur Musterhaus komplex geprüft; Mac/Tauri nicht geprüft. · S
|
||||
- ◐ **[308]** 3D-Dokument: Gelände als Modellsockel (20.11., Bild `doc/review-308/axo.png`; `plan/axo_terrain.rs`). Zuschnitt auf Parzelle (`siteRules.parcel`, Bounding-Box ∪ Gebäude) + 2 m, ohne Parzelle Gebäude + 5 m; an allen Randkanten senkrechte Seitenflächen bis tiefster Geländepunkt (inkl. Baugrube) − 1 m, dunkler getönt, senkrechte Kanten nur an Ecken. Bildgrösse folgt Haus + Sockel. Option `terrainClip` (`parcel` Vorgabe | `building` | `none` = wie bisher ohne Sockel), CLI `--terrain-clip`. Offen: Zuschnitt ist die Rechteck-Hülle der Parzelle (nicht ihr Polygon); Keller unter der Sockel-Unterkante nicht berücksichtigt; keine UI-Einstellung für `terrainClip` (nur Doc3d-Extra/CLI); Mac/Tauri nicht geprüft. · S
|
||||
- ◐ **[305]** 3D-Dokument: Fenster mit Rahmen und Glas (20.11., Bild `doc/review-305/axo.png`). Offen: Glaskanten meist vom Rahmen gedeckt; Öffnungsteile ohne eigene Id (`plan/axo.rs`, `section::model_view_faces`); Dach-/Deckenfenster ([103]) nicht geprüft; Mac/Tauri und Kern-WASM in der App nicht geprüft. · S
|
||||
- ◐ **[304]** 3D nur EG: Geländer oben bleibt sichtbar (20.11.). Offen: kein Browser-/Mac-Lauf (Kern-WASM nicht neu gebaut); Pick der Absturzsicherung hängt weiter an der Treppe (`retain_pick`: mit UG aus nicht anwählbar, obwohl sichtbar). · S
|
||||
- ◐ **[303]** Aus [300]: Bogenmasskette und Öffnungssymbole in der Ansicht (19.11., Bild `doc/review-303/plan.png`). Offen: Mac/Tauri und Druck-PDF nicht geprüft; Dreh-Linien-Strichlänge (2.2 mm) bei 1:100 unverändert; Treppe-Hilfslinien und Möbel im Schnitt aus [300] offen. · S
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 119 KiB |
@@ -22,6 +22,7 @@
|
||||
//! Klassen ([180]): jede Linie und Fläche gehört zu einem Bauteil und verschwindet mit dessen Klasse (Bauteile
|
||||
//! ausgeblendeter Klassen nehmen an der Verdeckung nicht teil).
|
||||
|
||||
use super::axo_terrain::TerrainClip;
|
||||
use super::prim::Primitive;
|
||||
use super::section::{line, polygon, v2, Kind, OwnerRef, Visibility};
|
||||
use super::style::no_hatch;
|
||||
@@ -286,7 +287,7 @@ fn perspective_pass(faces: Vec<hlr::Face>, model_n: Vec<V3>, zref: f64, tan_half
|
||||
}
|
||||
|
||||
/// Flächen des Modells in der Projektion; `None`, wenn die Projektion entartet ist.
|
||||
fn prepare(p: &Project, proj: &Projection, vis: &Visibility, context: bool, terrain: bool, scale: f64) -> Result<Option<(Prepared, Vec<OwnerRef>)>, String> {
|
||||
fn prepare(p: &Project, proj: &Projection, vis: &Visibility, context: bool, terrain: Option<TerrainClip>, scale: f64) -> Result<Option<(Prepared, Vec<OwnerRef>)>, String> {
|
||||
match *proj {
|
||||
Projection::Parallel { m, o } => {
|
||||
let Some(cof) = cofactor(&m) else { return Ok(None) };
|
||||
@@ -311,8 +312,8 @@ fn prepare(p: &Project, proj: &Projection, vis: &Visibility, context: bool, terr
|
||||
if vf.faces.len() > FACE_BUDGET && (context || ent.is_some()) {
|
||||
(vf, refs) = super::section::model_view_faces(p, vis, &view, &view_n, false, Some(opening_detail(scale)))?;
|
||||
}
|
||||
if terrain {
|
||||
super::axo_terrain::add_terrain(p, vis, &view, &view_n, &mut vf, &mut refs);
|
||||
if let Some(clip) = terrain {
|
||||
super::axo_terrain::add_terrain(p, vis, &view, &view_n, clip, &mut vf, &mut refs);
|
||||
}
|
||||
// Modell-Normale = Mᵀ · Normale (die Normale ging über M⁻ᵀ).
|
||||
let model_n = vf.faces.iter().map(|f| unit([0, 1, 2].map(|k| m[0][k] * f.normal[0] + m[1][k] * f.normal[1] + m[2][k] * f.normal[2])).unwrap_or([0.0, 0.0, 1.0])).collect();
|
||||
@@ -336,8 +337,8 @@ fn prepare(p: &Project, proj: &Projection, vis: &Visibility, context: bool, terr
|
||||
if vf.faces.len() > FACE_BUDGET && (context || ent.is_some()) {
|
||||
(vf, refs) = super::section::model_view_faces(p, vis, &view, &view_n, false, Some(opening_detail(scale)))?;
|
||||
}
|
||||
if terrain {
|
||||
super::axo_terrain::add_terrain(p, vis, &view, &view_n, &mut vf, &mut refs);
|
||||
if let Some(clip) = terrain {
|
||||
super::axo_terrain::add_terrain(p, vis, &view, &view_n, clip, &mut vf, &mut refs);
|
||||
}
|
||||
let model_n: Vec<V3> = vf.faces.iter().map(|q| unit([0, 1, 2].map(|k| r[k] * q.normal[0] + u[k] * q.normal[1] + f[k] * q.normal[2])).unwrap_or([0.0, 0.0, 1.0])).collect();
|
||||
Ok(Some((perspective_pass(vf.faces, model_n, zref, tan_half, aspect), refs)))
|
||||
@@ -611,8 +612,8 @@ const WINDOW_GLASS_FILL: &str = "#c6d6e0";
|
||||
const GLASS_EDGE_MM: f64 = 0.09;
|
||||
|
||||
/// [307] Geländefläche: helle, leicht grünliche Tönung (Grauwert `g` der Lage zum Licht moduliert sie).
|
||||
fn terrain_tint(g: f64) -> String {
|
||||
let k = 0.93 + 0.07 * ((g - 0.78) / 0.19).clamp(0.0, 1.0);
|
||||
fn terrain_tint(g: f64, side: bool) -> String {
|
||||
let k = (0.93 + 0.07 * ((g - 0.78) / 0.19).clamp(0.0, 1.0)) * if side { 0.78 } else { 1.0 };
|
||||
let c = |v: f64| (v * k * 255.0).round().clamp(0.0, 255.0) as u32;
|
||||
format!("#{:02x}{:02x}{:02x}", c(0.90), c(0.93), c(0.87))
|
||||
}
|
||||
@@ -630,6 +631,8 @@ pub struct AxoArgs {
|
||||
pub context: bool,
|
||||
/// [307] Gelände zeichnen (Vorgabe an; Klasse des Geländes bleibt massgebend).
|
||||
pub terrain: bool,
|
||||
/// [308] Zuschnitt des Geländes (`terrainClip`: `parcel` Vorgabe | `building` | `none`).
|
||||
pub terrain_clip: TerrainClip,
|
||||
pub vis: Visibility,
|
||||
/// Zeichenmassstab (Nenner) für den Detailgrad der Öffnungen ([305]); die Abfrage `axoPlan` setzt ihn.
|
||||
pub scale: f64,
|
||||
@@ -685,7 +688,7 @@ impl AxoArgs {
|
||||
None if !s("cameraId").is_empty() => project_camera(p, s("cameraId"), aspect, center)?,
|
||||
None => preset(s("view"), if s("projection").is_empty() { "iso" } else { s("projection") })?,
|
||||
};
|
||||
Some(AxoArgs { proj, opts: AxoOpts { hidden: b("hidden", false) || b("hiddenLines", false), fills: b("fills", true) }, context: b("context", false), terrain: b("terrain", true), vis: Visibility::from_json(v), scale: 100.0 })
|
||||
Some(AxoArgs { proj, opts: AxoOpts { hidden: b("hidden", false) || b("hiddenLines", false), fills: b("fills", true) }, context: b("context", false), terrain: b("terrain", true), terrain_clip: TerrainClip::parse(s("terrainClip")).unwrap_or_default(), vis: Visibility::from_json(v), scale: 100.0 })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,7 +712,7 @@ pub fn snapshot_text(p: &Project, snap: &ViewSnapshot, invisible: &[String]) ->
|
||||
|
||||
/// Plan-Primitive der Axonometrie und ihr Ausmass; `None` ohne sichtbares Bauteil.
|
||||
pub fn axo_primitives(p: &Project, a: &AxoArgs, mono: bool) -> Result<Option<(Vec<Primitive>, [f64; 4])>, String> {
|
||||
let Some((mut prep, refs)) = prepare(p, &a.proj, &a.vis, a.context, a.terrain, a.scale)? else { return Ok(None) };
|
||||
let Some((mut prep, refs)) = prepare(p, &a.proj, &a.vis, a.context, a.terrain.then_some(a.terrain_clip), a.scale)? else { return Ok(None) };
|
||||
// [279] Glas der Glasgeländer verdeckt nichts (Linien und Flächen dahinter bleiben sichtbar).
|
||||
for f in &mut prep.faces {
|
||||
f.occludes = !refs.get(f.owner as usize).is_some_and(|r| r.glass);
|
||||
@@ -725,10 +728,11 @@ pub fn axo_primitives(p: &Project, a: &AxoArgs, mono: bool) -> Result<Option<(Ve
|
||||
// Glas ([279]) zuletzt und durchscheinend, damit Flächen dahinter durchschimmern.
|
||||
let is_glass = |o: u32| refs.get(o as usize).is_some_and(|r| r.glass);
|
||||
let is_terrain = |o: u32| refs.get(o as usize).is_some_and(|r| r.terrain);
|
||||
let is_side = |o: u32| refs.get(o as usize).is_some_and(|r| r.terrain_side);
|
||||
let is_window = |o: u32| refs.get(o as usize).is_some_and(|r| r.opening);
|
||||
let ordered = out.fills.iter().filter(|f| !is_glass(f.2)).chain(out.fills.iter().filter(|f| is_glass(f.2)));
|
||||
for (polys, g, o) in ordered {
|
||||
let fill = if is_terrain(*o) { terrain_tint(*g) } else if is_window(*o) && is_glass(*o) { WINDOW_GLASS_FILL.to_string() } else if is_glass(*o) { GLASS_FILL.to_string() } else { grey_hex(*g) };
|
||||
let fill = if is_terrain(*o) { terrain_tint(*g, is_side(*o)) } else if is_window(*o) && is_glass(*o) { WINDOW_GLASS_FILL.to_string() } else if is_glass(*o) { GLASS_FILL.to_string() } else { grey_hex(*g) };
|
||||
for poly in polys {
|
||||
let ring = simplify(&if poly.len() > 1 { crate::voids::keyhole(poly).0 } else { poly[0].clone() });
|
||||
if ring.len() < 3 {
|
||||
|
||||
@@ -16,6 +16,60 @@ const TRI_BUDGET: usize = 12_000;
|
||||
/// Zellen des Rasters, auf das zu dichte Netze umgerechnet werden (je zwei Dreiecke).
|
||||
const GRID_CELLS: f64 = 3_000.0;
|
||||
|
||||
/// [308] Zuschnitt des Geländes im 3D-Dokument (Modellsockel).
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
|
||||
pub enum TerrainClip {
|
||||
/// Parzelle (`siteRules.parcel`) + 2 m Rand, ohne Parzelle Gebäude + 5 m; mit Sockel-Seitenflächen.
|
||||
#[default]
|
||||
Parcel,
|
||||
/// Immer Gebäude + 5 m; mit Sockel.
|
||||
Building,
|
||||
/// Wie vor [308]: weiter Ausschnitt um das Gebäude, kein Sockel.
|
||||
None,
|
||||
}
|
||||
|
||||
impl TerrainClip {
|
||||
pub fn parse(s: &str) -> Option<TerrainClip> {
|
||||
match s {
|
||||
"" | "parcel" => Some(TerrainClip::Parcel),
|
||||
"building" => Some(TerrainClip::Building),
|
||||
"none" => Some(TerrainClip::None),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Rand um die Parzelle bzw. das Gebäude (m).
|
||||
const PARCEL_MARGIN: f64 = 2.0;
|
||||
const BUILDING_MARGIN: f64 = 5.0;
|
||||
/// Sockel reicht so weit unter den tiefsten Geländepunkt (m).
|
||||
const SOCKEL_DEPTH: f64 = 1.0;
|
||||
|
||||
/// Ausschnitt [x0, y0, x1, y1] für das Gelände (`None`: keiner).
|
||||
fn clip_rect_of(p: &Project, bounds: Option<[f64; 4]>, clip: TerrainClip) -> Option<[f64; 4]> {
|
||||
let grow = |b: [f64; 4], m: f64| [b[0] - m, b[1] - m, b[2] + m, b[3] + m];
|
||||
if clip == TerrainClip::None {
|
||||
return bounds.map(|b| {
|
||||
let margin = (0.6 * (b[2] - b[0]).max(b[3] - b[1])).max(8.0);
|
||||
grow(b, margin)
|
||||
});
|
||||
}
|
||||
let parcel = (clip == TerrainClip::Parcel)
|
||||
.then(|| p.site_rules.as_ref().map(|r| &r.parcel))
|
||||
.flatten()
|
||||
.filter(|r| r.len() >= 3 && r.iter().all(|q| q.x.is_finite() && q.y.is_finite()));
|
||||
match (parcel, bounds) {
|
||||
(Some(r), b) => {
|
||||
let mut a = r.iter().fold([f64::INFINITY, f64::INFINITY, f64::NEG_INFINITY, f64::NEG_INFINITY], |a, q| [a[0].min(q.x), a[1].min(q.y), a[2].max(q.x), a[3].max(q.y)]);
|
||||
if let Some(b) = b {
|
||||
a = [a[0].min(b[0]), a[1].min(b[1]), a[2].max(b[2]), a[3].max(b[3])];
|
||||
}
|
||||
Some(grow(a, PARCEL_MARGIN))
|
||||
}
|
||||
(None, b) => b.map(|b| grow(b, BUILDING_MARGIN)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Grundrissausdehnung des Gebäudes (Wände, Decken); `None` ohne Bauteile.
|
||||
fn building_bounds(p: &Project) -> Option<[f64; 4]> {
|
||||
let mut b = [f64::INFINITY, f64::INFINITY, f64::NEG_INFINITY, f64::NEG_INFINITY];
|
||||
@@ -142,7 +196,7 @@ fn to_world(m: V3) -> V3 {
|
||||
}
|
||||
|
||||
/// Gelände-Flächen an `vf` / `refs` anhängen. `view`/`view_n`: wie bei `model_view_faces` (Welt: x, Höhe, y).
|
||||
pub(super) fn add_terrain(p: &Project, vis: &Visibility, view: &dyn Fn(V3) -> V3, view_n: &dyn Fn(V3) -> V3, vf: &mut ViewFaces, refs: &mut Vec<OwnerRef>) {
|
||||
pub(super) fn add_terrain(p: &Project, vis: &Visibility, view: &dyn Fn(V3) -> V3, view_n: &dyn Fn(V3) -> V3, clip: TerrainClip, vf: &mut ViewFaces, refs: &mut Vec<OwnerRef>) {
|
||||
let hidden = crate::model3d::hidden_category_codes(&p.layers);
|
||||
let bounds = building_bounds(p);
|
||||
for t in crate::excavation::terrains(p) {
|
||||
@@ -166,8 +220,7 @@ pub(super) fn add_terrain(p: &Project, vis: &Visibility, view: &dyn Fn(V3) -> V3
|
||||
}
|
||||
}
|
||||
// Ausschnitt: Umfang des Gebäudes + Rand.
|
||||
let margin = bounds.map_or(f64::INFINITY, |b| (0.6 * (b[2] - b[0]).max(b[3] - b[1])).max(8.0));
|
||||
let rect = bounds.map(|b| [b[0] - margin, b[1] - margin, b[2] + margin, b[3] + margin]);
|
||||
let rect = clip_rect_of(p, bounds, clip);
|
||||
let mut clipped: Vec<(Vec<V3>, Vec<bool>)> = Vec::new();
|
||||
for t in &tris {
|
||||
let rim = [0, 1, 2].map(|k| count.get(&ekey(t[k], t[(k + 1) % 3])).copied().unwrap_or(0) < 2);
|
||||
@@ -192,8 +245,9 @@ pub(super) fn add_terrain(p: &Project, vis: &Visibility, view: &dyn Fn(V3) -> V3
|
||||
continue;
|
||||
}
|
||||
let owner = refs.len() as u32;
|
||||
refs.push(OwnerRef { kind: Kind::Mesh, id: Some(t.id.clone()), stair: false, column: false, railing: false, glass: false, perforated: false, opening: false, terrain: true });
|
||||
refs.push(OwnerRef { kind: Kind::Mesh, id: Some(t.id.clone()), stair: false, column: false, railing: false, glass: false, perforated: false, opening: false, terrain: true, terrain_side: false });
|
||||
vf.owners.push((Kind::Mesh, usize::MAX));
|
||||
let mut oriented: Vec<(Vec<V3>, Vec<bool>, V3)> = Vec::new();
|
||||
for (pts, rim) in clipped {
|
||||
let (a, b, c) = (pts[0], pts[1], pts[2]);
|
||||
let (u, w) = ([b[0] - a[0], b[1] - a[1], b[2] - a[2]], [c[0] - a[0], c[1] - a[1], c[2] - a[2]]);
|
||||
@@ -212,9 +266,58 @@ pub(super) fn add_terrain(p: &Project, vis: &Visibility, view: &dyn Fn(V3) -> V3
|
||||
rim = (0..m).map(|i| rim[(2 * m - 2 - i) % m]).collect();
|
||||
}
|
||||
let n = [n[0] / l, n[1] / l, n[2] / l];
|
||||
let mut f = hlr::Face::new(pts.iter().map(|&q| view(to_world(q))).collect(), view_n(to_world(n)), owner);
|
||||
oriented.push((pts, rim, n));
|
||||
}
|
||||
for (pts, rim, n) in &oriented {
|
||||
let mut f = hlr::Face::new(pts.iter().map(|&q| view(to_world(q))).collect(), view_n(to_world(*n)), owner);
|
||||
f.no_edge = rim.iter().map(|r| !r).collect();
|
||||
vf.faces.push(f);
|
||||
}
|
||||
if clip != TerrainClip::None {
|
||||
add_sockel(&oriented, t.id.as_str(), view, view_n, vf, refs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [308] Sockel: senkrechte Seitenflächen unter allen Randkanten bis `tiefster Punkt − 1 m` (Schnittkante des Modells).
|
||||
/// Senkrechte Kanten nur an Ecken des Umrisses, die obere Kante zeichnet die Geländefläche selbst.
|
||||
fn add_sockel(tris: &[(Vec<V3>, Vec<bool>, V3)], id: &str, view: &dyn Fn(V3) -> V3, view_n: &dyn Fn(V3) -> V3, vf: &mut ViewFaces, refs: &mut Vec<OwnerRef>) {
|
||||
let zmin = tris.iter().flat_map(|t| t.0.iter().map(|q| q[2])).fold(f64::INFINITY, f64::min);
|
||||
if !zmin.is_finite() {
|
||||
return;
|
||||
}
|
||||
let zb = zmin - SOCKEL_DEPTH;
|
||||
// Randkanten (Umlaufsinn: Fläche links) und Richtung der einlaufenden Kante je Punkt.
|
||||
let mut rim: Vec<(V3, V3)> = Vec::new();
|
||||
for (pts, flags, _) in tris {
|
||||
let m = pts.len();
|
||||
for i in 0..m {
|
||||
if flags[i] {
|
||||
rim.push((pts[i], pts[(i + 1) % m]));
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut incoming: HashMap<K3, [f64; 2]> = HashMap::new();
|
||||
for (a, b) in &rim {
|
||||
incoming.insert(key(*b), [b[0] - a[0], b[1] - a[1]]);
|
||||
}
|
||||
let owner = refs.len() as u32;
|
||||
refs.push(OwnerRef { kind: Kind::Mesh, id: Some(id.to_string()), stair: false, column: false, railing: false, glass: false, perforated: false, opening: false, terrain: true, terrain_side: true });
|
||||
vf.owners.push((Kind::Mesh, usize::MAX));
|
||||
for (a, b) in rim {
|
||||
let (dx, dy) = (b[0] - a[0], b[1] - a[1]);
|
||||
let l = (dx * dx + dy * dy).sqrt();
|
||||
if !(l > 1e-9) {
|
||||
continue;
|
||||
}
|
||||
let n = [dy / l, -dx / l, 0.0];
|
||||
let corner = incoming.get(&key(a)).is_none_or(|d| {
|
||||
let dl = (d[0] * d[0] + d[1] * d[1]).sqrt();
|
||||
dl > 1e-9 && (d[0] * dy - d[1] * dx).abs() > 1e-6 * dl * l
|
||||
});
|
||||
let (al, bl) = ([a[0], a[1], zb], [b[0], b[1], zb]);
|
||||
let mut f = hlr::Face::new([a, al, bl, b].iter().map(|&q| view(to_world(q))).collect(), view_n(to_world(n)), owner);
|
||||
f.no_edge = vec![!corner, false, true, true];
|
||||
vf.faces.push(f);
|
||||
}
|
||||
}
|
||||
@@ -266,7 +266,7 @@ fn axo_zeit() {
|
||||
let p: Project = serde_json::from_str(&std::fs::read_to_string(path).unwrap()).unwrap();
|
||||
let a = args(serde_json::json!({"view": "southeast"}), &p);
|
||||
let t = std::time::Instant::now();
|
||||
let (prep, refs) = prepare(&p, &a.proj, &a.vis, false, true, 100.0).unwrap().unwrap();
|
||||
let (prep, refs) = prepare(&p, &a.proj, &a.vis, false, Some(TerrainClip::Parcel), 100.0).unwrap().unwrap();
|
||||
eprintln!("Flächen: {} in {:?}", prep.faces.len(), t.elapsed());
|
||||
let t = std::time::Instant::now();
|
||||
let segs = hlr::hidden_lines(&prep.faces, &hlr::Opts { tol: 1e-4, depth_eps: 1e-4, hidden: false, ..hlr::Opts::default() });
|
||||
@@ -382,7 +382,7 @@ fn fenster_mit_rahmen_und_glas() {
|
||||
let p: Project = serde_json::from_str(include_str!("../../tests/fixtures/robust/wettbewerb.json")).unwrap();
|
||||
let a = args(serde_json::json!({"view": "southeast"}), &p);
|
||||
let parts = |scale: f64| {
|
||||
let (prep, refs) = prepare(&p, &a.proj, &a.vis, false, true, scale).unwrap().expect("Flächen");
|
||||
let (prep, refs) = prepare(&p, &a.proj, &a.vis, false, Some(TerrainClip::Parcel), scale).unwrap().expect("Flächen");
|
||||
let n = |glass: bool| prep.faces.iter().filter(|f| refs.get(f.owner as usize).is_some_and(|r| r.opening && r.glass == glass)).count();
|
||||
(n(false), n(true))
|
||||
};
|
||||
@@ -401,7 +401,7 @@ fn fenster_mit_rahmen_und_glas() {
|
||||
codes.sort();
|
||||
codes.dedup();
|
||||
let off = args(serde_json::json!({"view": "southeast", "hasVis": true, "invisible": codes}), &p);
|
||||
let (prep, refs) = prepare(&p, &off.proj, &off.vis, false, true, 100.0).unwrap().expect("Flächen");
|
||||
let (prep, refs) = prepare(&p, &off.proj, &off.vis, false, Some(TerrainClip::Parcel), 100.0).unwrap().expect("Flächen");
|
||||
assert!(prep.faces.iter().all(|f| !refs.get(f.owner as usize).is_some_and(|r| r.opening)));
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ fn terrain_fills(prims: &[Primitive]) -> usize {
|
||||
#[test]
|
||||
fn gelaende_flaeche_mit_umriss_ohne_dreiecksfuge() {
|
||||
let p = with_terrain(cubes(&[(0.0, 0.0, 0.0)]));
|
||||
let prims = prims_of(&p, serde_json::json!({"view": "southeast"}));
|
||||
let prims = prims_of(&p, serde_json::json!({"view": "southeast", "terrainClip": "none"}));
|
||||
assert!(terrain_fills(&prims) >= 1, "Geländefläche fehlt");
|
||||
// Würfel auf dem Gelände: 9 Würfelkanten + 4 Geländekanten, die Diagonale der zwei Dreiecke fehlt.
|
||||
let l = lines(&prims_of(&p, serde_json::json!({"view": "southeast", "terrain": false})));
|
||||
@@ -431,7 +431,7 @@ fn gelaende_flaeche_mit_umriss_ohne_dreiecksfuge() {
|
||||
let mut q = with_terrain(cubes(&[(0.0, 0.0, 0.0)]));
|
||||
q.walls.clear();
|
||||
q.drawing_levels.clear();
|
||||
let prims = prims_of(&q, serde_json::json!({"view": "southeast"}));
|
||||
let prims = prims_of(&q, serde_json::json!({"view": "southeast", "terrainClip": "none"}));
|
||||
assert_eq!(lines(&prims).len(), 4, "{:?}", lines(&prims));
|
||||
assert_eq!(terrain_fills(&prims), 1);
|
||||
}
|
||||
@@ -440,11 +440,11 @@ fn gelaende_flaeche_mit_umriss_ohne_dreiecksfuge() {
|
||||
fn keller_unter_gelaende_verdeckt() {
|
||||
// Würfel unter dem Gelände (Oberkante −0.5): kein Würfel-Strich, nur der Geländerand.
|
||||
let p = with_terrain(cubes(&[(0.0, 0.0, -1.5)]));
|
||||
let l = lines(&prims_of(&p, serde_json::json!({"view": "southeast"})));
|
||||
let l = lines(&prims_of(&p, serde_json::json!({"view": "southeast", "terrainClip": "none"})));
|
||||
assert_eq!(l.len(), 4, "{l:?}");
|
||||
// Gelände aus (Parameter) bzw. Klasse „02“ ausgeblendet: der Würfel erscheint.
|
||||
assert_eq!(lines(&prims_of(&p, serde_json::json!({"view": "southeast", "terrain": false}))).len(), 9);
|
||||
let a = args(serde_json::json!({"view": "southeast", "hasVis": true, "invisible": ["02"]}), &p);
|
||||
let a = args(serde_json::json!({"view": "southeast", "terrainClip": "none", "hasVis": true, "invisible": ["02"]}), &p);
|
||||
let prims = axo_primitives(&p, &a, false).unwrap().unwrap().0;
|
||||
assert_eq!(terrain_fills(&prims), 0);
|
||||
assert_eq!(lines(&prims).len(), 9);
|
||||
@@ -457,6 +457,46 @@ fn baugrube_gibt_das_haus_im_gelaende_frei() {
|
||||
let v = |x: f64, y: f64| Vec2 { x, y };
|
||||
let pit = Excavation { id: "bg".into(), outline: vec![v(-3.0, -3.0), v(4.0, -3.0), v(4.0, 4.0), v(-3.0, 4.0)], bottom: -1.5, ..Default::default() };
|
||||
q.context.as_mut().unwrap().push(ContextObject::Excavation(pit));
|
||||
let n = lines(&prims_of(&q, serde_json::json!({"view": "southeast"}))).len();
|
||||
let n = lines(&prims_of(&q, serde_json::json!({"view": "southeast", "terrainClip": "none"}))).len();
|
||||
assert!(n > 4 + 3, "Würfel in der Baugrube sichtbar: {n}");
|
||||
}
|
||||
|
||||
/// [308] Gelände 60 × 60 m (zwei Dreiecke) um den Würfel, Parzelle 10 × 10 m.
|
||||
fn big_terrain(parcel: bool) -> Project {
|
||||
let mut p = cubes(&[(0.0, 0.0, 0.0)]);
|
||||
let t = TerrainMesh { id: "t".into(), category_code: "02".into(), positions: vec![-30.0, -30.0, 0.0, 30.0, -30.0, 0.0, 30.0, 30.0, 0.0, -30.0, 30.0, 0.0], indices: vec![0.0, 1.0, 2.0, 0.0, 2.0, 3.0], ..Default::default() };
|
||||
p.context = Some(vec![ContextObject::TerrainMesh(t)]);
|
||||
p.layers.push(serde_json::from_value(serde_json::json!({"code": "02", "name": "Gelände", "color": "#000", "lw": 0.5, "visible": true, "locked": false})).unwrap());
|
||||
if parcel {
|
||||
p.site_rules = serde_json::from_value(serde_json::json!({"parcel": [{"x": -5.0, "y": -5.0}, {"x": 5.0, "y": -5.0}, {"x": 5.0, "y": 5.0}, {"x": -5.0, "y": 5.0}], "defaultSetback": 3.0})).ok();
|
||||
}
|
||||
p
|
||||
}
|
||||
|
||||
fn extent(p: &Project, v: serde_json::Value) -> (Vec<Primitive>, [f64; 4]) {
|
||||
let a = args(v, p);
|
||||
axo_primitives(p, &a, false).unwrap().unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gelaende_auf_parzelle_zugeschnitten_mit_sockel() {
|
||||
let p = big_terrain(true);
|
||||
let (prims, b) = extent(&p, serde_json::json!({"view": "southeast"}));
|
||||
let (_, b_none) = extent(&p, serde_json::json!({"view": "southeast", "terrainClip": "none"}));
|
||||
assert!((b[2] - b[0]) < 0.9 * (b_none[2] - b_none[0]), "Bild kleiner als ohne Zuschnitt: {b:?} vs {b_none:?}");
|
||||
// Parzelle ± 2 m = 14 m breit, Isometrie: Breite ≈ 14·√2 ≈ 19.8 m.
|
||||
assert!((b[2] - b[0]) < 22.0 && (b[2] - b[0]) > 12.0, "{b:?}");
|
||||
// Sockel: Seitenflächen sind eigene, dunklere Flächen mit Geländebezug.
|
||||
let tints: std::collections::BTreeSet<String> = prims.iter().filter_map(|q| match q {
|
||||
Primitive::Polygon { context_object_id: Some(id), fill, .. } if id == "t" => Some(format!("{fill:?}")),
|
||||
_ => None,
|
||||
}).collect();
|
||||
assert!(tints.len() >= 2, "Oberfläche und Sockelseiten verschieden getönt: {tints:?}");
|
||||
// Ohne Parzelle: Gebäude + 5 m (11 × 11 m Gebäude-Rand → deutlich kleiner als 60 m).
|
||||
let q = big_terrain(false);
|
||||
let (_, bq) = extent(&q, serde_json::json!({"view": "southeast"}));
|
||||
assert!((bq[2] - bq[0]) < 0.9 * (b_none[2] - b_none[0]), "{bq:?}");
|
||||
// Ohne Sockel („none“) keine Seitenflächen.
|
||||
let n_side = |v: serde_json::Value| terrain_fills(&extent(&p, v).0);
|
||||
assert!(n_side(serde_json::json!({"view": "southeast"})) > n_side(serde_json::json!({"view": "southeast", "terrainClip": "none"})));
|
||||
}
|
||||
@@ -336,6 +336,8 @@ pub(crate) struct OwnerRef {
|
||||
pub opening: bool,
|
||||
/// [307] Gelände (Netz mit Baugruben, nur im 3D-Dokument): helle Tönung, Kanten nur am Rand.
|
||||
pub terrain: bool,
|
||||
/// [308] Seitenfläche des Geländesockels (dunkler getönt).
|
||||
pub terrain_side: bool,
|
||||
}
|
||||
|
||||
/// [305] Besitzer-Nummern der Öffnungsteile in `ViewFaces::owners` (Index `usize::MAX` bzw. `- 1` der Art `Wall`).
|
||||
@@ -376,7 +378,7 @@ pub(crate) fn model_view_faces(p: &Project, vis: &Visibility, view: &dyn Fn([f64
|
||||
.iter()
|
||||
.map(|&(kind, i)| {
|
||||
if kind == Kind::Wall && (i == OPENING_FRAME || i == OPENING_GLASS) {
|
||||
return OwnerRef { kind, id: None, stair: false, column: false, railing: false, glass: i == OPENING_GLASS, perforated: false, opening: true, terrain: false };
|
||||
return OwnerRef { kind, id: None, stair: false, column: false, railing: false, glass: i == OPENING_GLASS, perforated: false, opening: true, terrain: false, terrain_side: false };
|
||||
}
|
||||
let (id, stair, column, railing) = match kind {
|
||||
Kind::Wall => (walls_r.get(i).map(|w| w.wall_id.clone()), false, false, false),
|
||||
@@ -394,7 +396,7 @@ pub(crate) fn model_view_faces(p: &Project, vis: &Visibility, view: &dyn Fn([f64
|
||||
};
|
||||
let glass = railing && matches!(kind, Kind::Slab) && matches!(slabs.get(i), Some(SlabOwner::Railing(_, Some(RailingKind::Glass))));
|
||||
let perforated = railing && matches!(kind, Kind::Slab) && matches!(slabs.get(i), Some(SlabOwner::Railing(_, Some(RailingKind::Perforated))));
|
||||
OwnerRef { kind, id, stair, column, railing, glass, perforated, opening: false, terrain: false }
|
||||
OwnerRef { kind, id, stair, column, railing, glass, perforated, opening: false, terrain: false, terrain_side: false }
|
||||
})
|
||||
.collect();
|
||||
Ok((vf, refs))
|
||||
|
||||
+6
-1
@@ -31,7 +31,7 @@
|
||||
// --hide <Code|Name,…> blendet Klassen aus (z. B. --hide "Schatten,Auto-Bemassung") [180]
|
||||
// --snapshot <Name|id> übernimmt Geschoss, Massstab, Vorlage und Sichtbarkeit eines Ausschnitts [207]
|
||||
// dossier-cli <projekt.obp> axo [--view southeast|southwest|northeast|northwest|iso|…] [--projection iso|military|military30]
|
||||
// [--camera Name|id] [--snapshot Name|id] [--hidden] [--no-fills] [--context] [--hide …]
|
||||
// [--camera Name|id] [--snapshot Name|id] [--hidden] [--no-fills] [--context] [--terrain-clip parcel|building|none] [--hide …]
|
||||
// [--scale 200] [--hatch] [--color] [--format svg|json|dxf|dxfbin|dwg] [--out axo.svg]
|
||||
// [266] 3D-Dokument: Vektor-Axonometrie/-Perspektive mit verdeckten Kanten aus dem Kern
|
||||
// (Linienzeichnung, Silhouette kräftig, Flächen nach Lage grau; ohne GPU)
|
||||
@@ -1293,6 +1293,11 @@ async function execute(project: Project, file: string, command: string, rest: st
|
||||
if (on("hidden")) opts.hiddenLines = true;
|
||||
if (f.has("no-fills") || f.get("fills") === "false") opts.fills = false;
|
||||
if (on("context")) opts.context = true;
|
||||
const tc = f.get("terrain-clip");
|
||||
if (tc) {
|
||||
if (tc !== "parcel" && tc !== "building" && tc !== "none") fail("--terrain-clip: parcel | building | none");
|
||||
opts.terrainClip = tc;
|
||||
}
|
||||
const mono = f.has("color") ? inkArg(args) : true;
|
||||
const t0 = Date.now();
|
||||
const plan = generateAxoPlan(project, { ...opts, ...(renovationFlags(project, args) ?? {}), visibleCodes: codes, scaleDenominator: axScale, mono });
|
||||
|
||||
@@ -20,6 +20,8 @@ export interface AxoOptions extends Doc3d {
|
||||
/** Sichtbare Klassen (fehlt: alle). Bauteile ausgeblendeter Klassen verdecken auch nichts. */
|
||||
visibleCodes?: Set<string>;
|
||||
mono?: boolean;
|
||||
/** [308] Zuschnitt des Geländes: "parcel" (Vorgabe: Parzelle + 2 m, sonst Gebäude + 5 m, mit Sockel) | "building" | "none" (weit, ohne Sockel). */
|
||||
terrainClip?: "parcel" | "building" | "none";
|
||||
/** Massstabsnenner (Strichstärken nach Massstab); Vorgabe 100. */
|
||||
scaleDenominator?: number;
|
||||
/** [271] Umbaufilter (Id oder Name) und Etappe. */
|
||||
|
||||
Reference in new issue
Block a user