Merge rust-core-k4 (Laptop): [K1][K3a][K3c][K3d][K4] Kern-Port; IFC-/Mesh-Export bleibt in fileio (Kern-Duplikate entfernt), Exporte holen 3D-Teile aus dem Dokument

Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
Claude committed 2026-10-28 17:35:14 +00:00
commit 3bf9eea5f9
111 files changed
+14145 -6506

No files matched your search

-10
View File
@@ -1,10 +0,0 @@
//! Bindung der Decken im 3D (`crate::ceilings3d`). Kodierung s. dort.
use crate::ceilings3d as c;
use wasm_bindgen::prelude::wasm_bindgen;
/// Deckenumrisse (mit eingefügten Aussparungen) und Schicht-z-Spannen; Unsinn → leer.
#[wasm_bindgen]
pub fn ceilings3d_flat(ceilings: &[f64]) -> Vec<f64> {
c::encode(&c::ceilings(ceilings))
}
-11
View File
@@ -1,11 +0,0 @@
//! Bindung der Stützen im 3D (`crate::columns3d`). Kodierung s. dort.
use crate::columns3d as c;
use crate::mesh3d::encode_meshes;
use wasm_bindgen::prelude::wasm_bindgen;
/// Prisma-Meshes aller Stützen aus Querschnitt und Höhen; Unsinn → leer.
#[wasm_bindgen]
pub fn columns3d_flat(columns: &[f64]) -> Vec<f64> {
encode_meshes(&c::columns(columns))
}
+27
View File
@@ -0,0 +1,27 @@
//! Bindungen der Kurven-Tessellierung (`crate::curves`). Punkte flach `[x0, y0, …]`.
use wasm_bindgen::prelude::wasm_bindgen;
/// Punkte einer (gedrehten) Ellipse, `n` gleichverteilte Parameterschritte.
#[wasm_bindgen]
pub fn curves_ellipse_flat(cx: f64, cy: f64, rx: f64, ry: f64, rotation: f64, n: f64) -> Vec<f64> {
crate::curves::ellipse(cx, cy, rx, ry, rotation, n)
}
/// Kubische Bezier-Kette (Anker·Griff·Griff·Anker …); unter 4 Punkten unverändert.
#[wasm_bindgen]
pub fn curves_bezier_chain_flat(pts: &[f64], segs_per_curve: f64) -> Vec<f64> {
crate::curves::bezier_chain(pts, segs_per_curve)
}
/// Catmull-Rom-Spline durch die Punkte; unter 3 Punkten unverändert.
#[wasm_bindgen]
pub fn curves_catmull_rom_flat(pts: &[f64], closed: bool, segs_per_span: f64) -> Vec<f64> {
crate::curves::catmull_rom(pts, closed, segs_per_span)
}
/// Uniformer kubischer B-Spline über Kontrollpunkten; unter 3 Punkten unverändert.
#[wasm_bindgen]
pub fn curves_uniform_bspline_flat(pts: &[f64], closed: bool, segs_per_span: f64) -> Vec<f64> {
crate::curves::uniform_bspline(pts, closed, segs_per_span)
}
+9
View File
@@ -0,0 +1,9 @@
//! Bindung der Delaunay-Triangulierung (`crate::delaunay`).
use wasm_bindgen::prelude::wasm_bindgen;
/// Delaunay-Dreiecke zu `[x0, y0, x1, y1 …]`; Indizes je drei; leer bei < 3 oder kollinearen Punkten.
#[wasm_bindgen]
pub fn delaunay_flat(coords: &[f64]) -> Vec<f64> {
crate::delaunay::triangulate(coords).into_iter().map(f64::from).collect()
}
+98
View File
@@ -0,0 +1,98 @@
//! Bindungen des Projekt-Dokuments (`crate::document`): Handles in einer Tabelle, damit TS das
//! Projekt nicht bei jedem Aufruf neu übergeben muss.
use crate::document::{Document, Op};
use serde_json::Value;
use std::cell::RefCell;
use wasm_bindgen::prelude::wasm_bindgen;
thread_local! {
static DOCS: RefCell<Vec<Option<Document>>> = const { RefCell::new(Vec::new()) };
}
fn with_doc<R>(h: u32, f: impl FnOnce(&mut Document) -> R) -> Option<R> {
DOCS.with(|d| d.borrow_mut().get_mut((h as usize).checked_sub(1)?)?.as_mut().map(f))
}
/// Öffnet ein Dokument aus Projekt-JSON; Handle ≥ 1, 0 bei Fehler.
#[wasm_bindgen]
pub fn doc_open(json: &str) -> u32 {
let Ok(doc) = Document::from_json(json) else { return 0 };
DOCS.with(|d| {
let mut d = d.borrow_mut();
if let Some(i) = d.iter().position(Option::is_none) {
d[i] = Some(doc);
i as u32 + 1
} else {
d.push(Some(doc));
d.len() as u32
}
})
}
#[wasm_bindgen]
pub fn doc_close(h: u32) {
DOCS.with(|d| {
if let Some(slot) = (h as usize).checked_sub(1).and_then(|i| d.borrow_mut().get_mut(i).map(|s| s.take())) {
drop(slot);
}
});
}
/// Wendet eine Op-Folge (JSON-Array) an. Leerer Text = ok, sonst JSON-Array der Meldungen.
#[wasm_bindgen]
pub fn doc_apply(h: u32, ops_json: &str) -> String {
let parsed: Result<Vec<Op>, String> = serde_json::from_str::<Value>(ops_json)
.map_err(|e| e.to_string())
.and_then(|v| v.as_array().ok_or("Ops sind kein Array".to_string()).and_then(|a| a.iter().map(Op::from_json).collect()));
let problems = match parsed {
Err(e) => vec![e],
Ok(ops) => match with_doc(h, |d| d.apply(&ops)) {
None => vec!["Dokument nicht offen".to_string()],
Some(Ok(())) => return String::new(),
Some(Err(p)) => p,
},
};
Value::from(problems).to_string()
}
/// Das ganze Dokument als JSON (leer, wenn nicht offen).
#[wasm_bindgen]
pub fn doc_json(h: u32) -> String {
with_doc(h, |d| d.to_json()).unwrap_or_default()
}
/// Abfrage auf dem typisierten Projekt; Ergebnis als JSON. Fehler (Dokument nicht offen, Modell
/// passt nicht, unbekannte Abfrage, Rechenfehler) kommen als Text mit vorangestelltem `\u{1}`.
/// Abfragen s. `crate::queries`.
#[wasm_bindgen]
pub fn doc_query(h: u32, name: &str) -> String {
doc_query_args(h, name, &[], "")
}
/// Wie [`doc_query`] mit Zahlen- und Textargument.
#[wasm_bindgen]
pub fn doc_query_args(h: u32, name: &str, args: &[f64], text: &str) -> String {
let result = with_doc(h, |d| {
let p = d.project().map_err(|e| format!("Projekt passt nicht zum Kern-Modell: {e}"))?;
crate::queries::run(&p, name, args, text)
})
.unwrap_or_else(|| Err("Dokument nicht offen".to_string()));
match result {
Ok(json) => json,
Err(e) => format!("\u{1}{e}"),
}
}
/// Boden-Spuren aller 2D-Zeichnungen als LineList-Vertices `[px, py, pz, r, g, b]` (Float32);
/// leer bei Fehler oder ohne Zeichnungen.
#[wasm_bindgen]
pub fn doc_drawing_line_verts(h: u32) -> Vec<f32> {
with_doc(h, |d| d.project().ok().map(|p| crate::model3d::drawing_line_verts(&p))).flatten().unwrap_or_default()
}
/// Das Projekt als Datei-Text (Formatversion vorn, Einrückung 2); leer, wenn das Dokument nicht offen ist.
#[wasm_bindgen]
pub fn doc_serialize(h: u32) -> String {
with_doc(h, |d| d.serialize()).unwrap_or_default()
}
+1 -40
View File
@@ -1,8 +1,7 @@
//! Bindungen der Kennzahlen-Rechenteile (`crate::kennzahlen`).
use crate::flat_read::pairs;
use crate::flat_read::Reader;
use crate::kennzahlen::{self, RoomIn, SolidIn};
use crate::kennzahlen;
use wasm_bindgen::prelude::wasm_bindgen;
/// Grundriss `[x0, y0, …]`, Kreisradius (NaN = kein Kreis), Höhe, Verjüngung → m³.
@@ -10,41 +9,3 @@ use wasm_bindgen::prelude::wasm_bindgen;
pub fn kz_solid_volume(points: &[f64], circle_r: f64, height: f64, taper: f64) -> f64 {
kennzahlen::solid_volume(&pairs(points), circle_r, height, taper)
}
fn read_rooms(buf: &[f64]) -> Option<Vec<RoomIn>> {
let mut r = Reader::new(buf);
let n = r.count()?;
let mut out = Vec::with_capacity(n.min(1 << 16));
for _ in 0..n {
let (level, category) = (r.count()?, r.count()?);
out.push(RoomIn { level, category, boundary: r.ring()? });
}
Some(out)
}
fn read_solids(buf: &[f64]) -> Option<Vec<SolidIn>> {
let mut r = Reader::new(buf);
let n = r.count()?;
let mut out = Vec::with_capacity(n.min(1 << 16));
for _ in 0..n {
let subtract = r.num()? != 0.0;
let (circle_r, height, taper) = (r.num()?, r.num()?, r.num()?);
out.push(SolidIn { subtract, points: r.ring()?, circle_r, height, taper });
}
Some(out)
}
/// Räume `[n, (geschoss, kategorie, nPkt, x, y, …)…]`, Körper
/// `[n, (abzug 0/1, radius|NaN, höhe, verjüngung, nPkt, x, y, …)…]`, Parzellenzahl, Parzellenring
/// `[x0, y0, …]` → `[gv, parzelle|NaN, (6 Kategorie-Summen je Geschoss)…]`.
#[wasm_bindgen]
pub fn kz_area_sums(n_levels: u32, rooms: &[f64], solids: &[f64], parcel_area: f64, parcel_ring: &[f64]) -> Vec<f64> {
let rooms = read_rooms(rooms).unwrap_or_default();
let solids = read_solids(solids).unwrap_or_default();
let s = kennzahlen::area_sums(n_levels.min(1 << 16) as usize, &rooms, &solids, parcel_area, &pairs(parcel_ring));
let mut out = vec![s.gv, s.parcel.unwrap_or(f64::NAN)];
for l in s.by_level {
out.extend(l);
}
out
}
+15
View File
@@ -0,0 +1,15 @@
//! Bindungen des Netz-Ebenenschnitts (`crate::mesh_section`). Layouts s. dort.
use wasm_bindgen::prelude::wasm_bindgen;
/// Schnitt eines Dreiecksnetzes mit einer Ebene; Unsinn → leer.
#[wasm_bindgen]
pub fn mesh_section_cut_flat(positions: &[f64], indices: &[f64], plane: &[f64]) -> Vec<f64> {
crate::mesh_section::cut(positions, indices, plane)
}
/// Ringe → Flächen mit Löchern; Unsinn → leer.
#[wasm_bindgen]
pub fn mesh_section_polygons_flat(input: &[f64]) -> Vec<f64> {
crate::mesh_section::rings_to_polygons(input)
}
+12 -5
View File
@@ -13,18 +13,25 @@ mod kennzahlen;
mod bulge;
mod stair;
mod joins;
mod wall_bands;
mod room_area;
mod room_boundary;
mod polygon_holes;
mod stairs3d;
mod ceilings3d;
mod columns3d;
mod drawing2d_3d;
mod openings3d;
mod wall_mesh_cut;
mod plan_buf;
mod project_format;
mod gpu_compile;
mod plan_stairs;
mod plan_walls;
mod plan_openings;
mod delaunay;
mod document;
mod mesh_section;
mod plan_elevation;
mod plan_misc;
mod plan_section;
mod voids;
mod curves;
mod hatch;
use wasm_bindgen::prelude::wasm_bindgen;
-15
View File
@@ -1,15 +0,0 @@
//! Bindungen der Öffnungs-Einbauteile in 3D (`crate::openings3d`). Kodierung s. dort.
use wasm_bindgen::prelude::wasm_bindgen;
/// Wände mit Öffnungen (+ Detailgrad) flach → Quader (Bauteil-Klasse, 8 Ecken) flach; nie ein Panic.
#[wasm_bindgen]
pub fn opening_meshes_flat(buf: &[f64]) -> Vec<f64> {
crate::openings3d::opening_meshes_flat(buf)
}
/// Rahmen-Ring als Vierecke (u, h) flach: `[n, (u, h) × 4 …]`.
#[wasm_bindgen]
pub fn frame_ring_quads_flat(from: f64, to: f64, z_b: f64, z_t: f64, w: f64, join: f64, bottom: bool) -> Vec<f64> {
crate::openings3d::frame_ring_quads_flat(from, to, z_b, z_t, w, join, bottom)
}
+45
View File
@@ -0,0 +1,45 @@
//! Bindungen der Ansichts-Geometrie (`crate::plan_elevation`). Layouts s. dort.
use wasm_bindgen::prelude::wasm_bindgen;
/// Sichtbare Teilstücke von Segmenten gegen nähere Verdecker; Unsinn → leer.
#[wasm_bindgen]
pub fn elevation_clip_segments_flat(occ: &[f64], segs: &[f64]) -> Vec<f64> {
crate::plan_elevation::clip_segments(occ, segs)
}
/// Ob Punkte hinter einem näheren Verdecker liegen; Unsinn → leer.
#[wasm_bindgen]
pub fn elevation_occluded_points_flat(occ: &[f64], pts: &[f64]) -> Vec<f64> {
crate::plan_elevation::occluded_points(occ, pts)
}
/// Schlagschatten auskragender Flächen auf Fassaden; Unsinn → leer.
#[wasm_bindgen]
pub fn elevation_shadows_flat(walls: &[f64], slabs: &[f64]) -> Vec<f64> {
crate::plan_elevation::shadows(walls, slabs)
}
/// XOR-Umrisskanten frontaler Rechteckgruppen; Unsinn → leer.
#[wasm_bindgen]
pub fn elevation_xor_outline_flat(polys: &[f64]) -> Vec<f64> {
crate::plan_elevation::xor_outline(polys)
}
/// Sichtbare Wand-, Decken- und Dachflächen in Ansichts-Koordinaten; Unsinn → leer.
#[wasm_bindgen]
pub fn elevation_faces_flat(frame: &[f64], walls: &[f64], slabs: &[f64], roofs: &[f64]) -> Vec<f64> {
crate::plan_elevation::faces(frame, walls, slabs, roofs)
}
/// Eck-Verlängerung der Wandenden für die Ansicht; Unsinn → leer.
#[wasm_bindgen]
pub fn elevation_wall_extensions_flat(input: &[f64]) -> Vec<f64> {
crate::plan_elevation::wall_extensions(input)
}
/// Projektion und Aufteilung (Glas, Flügel, Sprossen, Bank, Symbol) der Öffnungen; Unsinn → leer.
#[wasm_bindgen]
pub fn elevation_openings_flat(frame: &[f64], input: &[f64]) -> Vec<f64> {
crate::plan_elevation::openings(frame, input)
}
+27
View File
@@ -0,0 +1,27 @@
//! Bindungen kleiner Plan-Bausteine (`crate::plan_misc`). Layouts s. dort.
use wasm_bindgen::prelude::wasm_bindgen;
/// Grundriss-Fussabdruck eines Meshes (Sockelkanten); Unsinn → leer.
#[wasm_bindgen]
pub fn context_footprint_flat(positions: &[f64], indices: &[f64]) -> Vec<f64> {
crate::plan_misc::context_footprint(positions, indices)
}
/// `[minX, minY, maxX, maxY]` der x/y-Werte eines [x,y,z…]-Arrays; leer ohne Punkte.
#[wasm_bindgen]
pub fn context_bbox_flat(positions: &[f64]) -> Vec<f64> {
crate::plan_misc::bbox(positions)
}
/// Schnittführungs-Symbol einer Linie; leer bei zu kurzer Linie.
#[wasm_bindgen]
pub fn section_line_flat(p0x: f64, p0y: f64, p1x: f64, p1y: f64, sign: f64) -> Vec<f64> {
crate::plan_misc::section_line(p0x, p0y, p1x, p1y, sign)
}
/// Linienende (Pfeil, Punkt, Schrägstrich, Quadrat); leer ohne Wirkung.
#[wasm_bindgen]
pub fn end_mark_flat(x: f64, y: f64, dx: f64, dy: f64, art: f64, mm: f64, scale_denominator: f64) -> Vec<f64> {
crate::plan_misc::end_mark(x, y, dx, dy, art, mm, scale_denominator)
}
+15
View File
@@ -0,0 +1,15 @@
//! Bindungen von Öffnungs-Symbol und Fenster-Symbol (`crate::plan_openings`). Layout s. dort.
use wasm_bindgen::prelude::wasm_bindgen;
/// Tür-/Fenster-Symbol einer Öffnung im Grundriss; Unsinn → leer.
#[wasm_bindgen]
pub fn plan_opening_flat(buf: &[f64]) -> Vec<f64> {
crate::plan_openings::plan_opening(buf)
}
/// Fenster-Symbol (Rahmen, Glas, Flügel, Stulp) einer Öffnung; Unsinn/entartet → leer.
#[wasm_bindgen]
pub fn window_symbol_flat(buf: &[f64]) -> Vec<f64> {
crate::plan_openings::window_symbol_flat(buf)
}
+21
View File
@@ -0,0 +1,21 @@
//! Bindungen der Schnitt-Bänder (`crate::plan_section`). Layouts s. dort.
use wasm_bindgen::prelude::wasm_bindgen;
/// Dominanz-Subtraktion und Verschmelzung der Schnitt-Rechtecke; Unsinn → leer.
#[wasm_bindgen]
pub fn section_dominant_bands_flat(input: &[f64]) -> Vec<f64> {
crate::plan_section::dominant_bands(input)
}
/// Aussenringe der Vereinigung achsparalleler Rechtecke; Unsinn → leer.
#[wasm_bindgen]
pub fn section_union_outlines_flat(input: &[f64]) -> Vec<f64> {
crate::plan_section::union_outlines(input)
}
/// Spur der senkrechten Schnittebene auf den Dachflächen eines Dachs; Unsinn → leer.
#[wasm_bindgen]
pub fn section_roof_segments_flat(base_x: f64, base_y: f64, u_x: f64, u_y: f64, planes: &[f64]) -> Vec<f64> {
crate::plan_section::roof_segments(base_x, base_y, u_x, u_y, planes)
}
+10
View File
@@ -0,0 +1,10 @@
//! Bindung des Treppen-Symbols im Grundriss (`crate::plan_stairs`). Ausgabe-Layout s. dort.
use wasm_bindgen::prelude::wasm_bindgen;
/// Treppen-Parameter (16 Zahlen), Gesamt-Steighöhe, Schnitthöhe über der UK, Strichstärke (mm),
/// gefüllter Pfeil (0/1) → Primitivliste; Unsinn → leer.
#[wasm_bindgen]
pub fn plan_stair_flat(params: &[f64], total_rise: f64, cut_rise: f64, lw_mm: f64, filled_arrow: f64) -> Vec<f64> {
crate::plan_stairs::plan_stair(params, total_rise, cut_rise, lw_mm, filled_arrow != 0.0)
}
+15
View File
@@ -0,0 +1,15 @@
//! Bindungen von Wand-Poché und Decken-Umriss im Grundriss (`crate::plan_walls`). Layout s. dort.
use wasm_bindgen::prelude::wasm_bindgen;
/// Wand-Poché-Geometrie einer Wand; Unsinn → leer.
#[wasm_bindgen]
pub fn plan_wall_poche_flat(buf: &[f64]) -> Vec<f64> {
crate::plan_walls::wall_poche(buf)
}
/// Freie Teilstücke eines Decken-Umrisses gegen Wand-Footprints; Unsinn → leer.
#[wasm_bindgen]
pub fn plan_ceiling_outline_flat(buf: &[f64]) -> Vec<f64> {
crate::plan_walls::ceiling_outline(buf)
}
+22
View File
@@ -0,0 +1,22 @@
//! Bindungen des Projektdatei-Formats (`crate::project_format`).
use crate::project_format::{parse_project_file, Parsed};
use serde_json::{json, Value};
use wasm_bindgen::prelude::wasm_bindgen;
/// Liest eine Projektdatei (Text). Antwort als JSON:
/// `{"ok":true,"project":{…},"warnings":[…],"migratedFrom":null|n}` oder `{"ok":false,"error":"…"}`.
#[wasm_bindgen]
pub fn project_parse(text: &str, now_ms: f64) -> String {
let v: Value = match parse_project_file(text, now_ms) {
Parsed::Ok { project, warnings, migrated_from } => json!({"ok": true, "project": project, "warnings": warnings, "migratedFrom": migrated_from}),
Parsed::Err(error) => json!({"ok": false, "error": error}),
};
v.to_string()
}
/// Aktuelle Version des Dateiformats.
#[wasm_bindgen]
pub fn project_format_version() -> u32 {
crate::project_format::PROJECT_FORMAT_VERSION as u32
}
-12
View File
@@ -31,15 +31,3 @@ pub fn site_multi_polygon_area(polys: &[f64]) -> f64 {
pub fn site_allowed_area(rules: &[f64]) -> Vec<f64> {
encode(&read_rules(rules).map(|r| site_rules::allowed_area(&r)).unwrap_or_default())
}
/// `[gültig, Parzelle, zulässig, Verstoss, HöheÜberschritten, …flat(zulässig), …flat(Verstösse)]`;
/// ungültig → `[0]`. `footprint` = Teile der Gebäude-Grundfläche (`flat`), `max_top` NaN = keine.
#[wasm_bindgen]
pub fn site_check(rules: &[f64], footprint: &[f64], max_height: f64, max_top: f64) -> Vec<f64> {
let (Some(r), Some(fp)) = (read_rules(rules), decode(footprint)) else { return vec![0.0] };
let Some(c) = site_rules::check_site_rules(&r, &fp, max_height, max_top) else { return vec![0.0] };
let mut out = vec![1.0, c.parcel_area, c.allowed_area, c.violation_area, if c.height_exceeded { 1.0 } else { 0.0 }];
out.extend(encode(&c.allowed));
out.extend(encode(&c.violations));
out
}
-23
View File
@@ -1,23 +0,0 @@
//! Bindungen der Treppen im 3D (`crate::stairs3d`). Kodierung s. dort.
use crate::mesh3d::encode_meshes;
use crate::stairs3d as s;
use wasm_bindgen::prelude::wasm_bindgen;
/// Tritt-Prismen und Podeste aller Treppen als Slabs; `for_section`: auch gerade Betontreppen.
#[wasm_bindgen]
pub fn stairs3d_slabs_flat(stairs: &[f64], for_section: bool) -> Vec<f64> {
s::encode_slabs(&s::slabs(stairs, for_section))
}
/// Glatte Laufplatte gerader Betontreppen als Meshes.
#[wasm_bindgen]
pub fn stairs3d_meshes_flat(stairs: &[f64]) -> Vec<f64> {
encode_meshes(&s::slab_meshes(stairs))
}
/// Handlauf und Pfosten gerader Treppen als Quader-Meshes.
#[wasm_bindgen]
pub fn stairs3d_railings_flat(stairs: &[f64]) -> Vec<f64> {
encode_meshes(&s::railings(stairs))
}
+1 -32
View File
@@ -2,8 +2,7 @@
use crate::flat_read::pairs;
use crate::flat::{decode, encode};
use crate::flat_read::Reader;
use crate::sun::{self, Prism, SunPosition};
use crate::sun::{self, SunPosition};
use wasm_bindgen::prelude::wasm_bindgen;
/// `[azimut, höhe]` in Grad.
@@ -20,36 +19,6 @@ pub fn sun_shadow_of_prism(footprint: &[f64], z_bottom: f64, z_top: f64, azimuth
r.into_iter().flatten().collect()
}
fn read_prisms(buf: &[f64]) -> Option<Vec<Prism>> {
let mut r = Reader::new(buf);
let n = r.count()?;
let mut out = Vec::with_capacity(n.min(1 << 16));
for _ in 0..n {
let (z_bottom, z_top) = (r.num()?, r.num()?);
out.push(Prism { footprint: r.ring()?, z_bottom, z_top });
}
Some(out)
}
fn read_clouds(buf: &[f64]) -> Option<Vec<Vec<[f64; 3]>>> {
let mut r = Reader::new(buf);
let n = r.count()?;
let mut out = Vec::with_capacity(n.min(1 << 16));
for _ in 0..n {
let k = r.count()?;
out.push(r.points3(k)?);
}
Some(out)
}
/// Prismen `[n, (zUnten, zOben, nPkt, x, y, …)…]` und Punktwolken `[n, (nPkt, x, y, z, …)…]`
/// → vereinigter Schatten (Polygone, `flat`-Kodierung).
#[wasm_bindgen]
pub fn sun_shadow_union(prisms: &[f64], clouds: &[f64], azimuth: f64, elevation: f64) -> Vec<f64> {
let (Some(p), Some(c)) = (read_prisms(prisms), read_clouds(clouds)) else { return encode(&[]) };
encode(&sun::shadow_union(&p, &c, SunPosition { azimuth, elevation }))
}
/// Ein Polygon (`flat`, erstes Polygon zählt) → lochfreie Teile (`flat`, je ein Ring).
#[wasm_bindgen]
pub fn sun_without_holes(poly: &[f64]) -> Vec<f64> {
+27
View File
@@ -0,0 +1,27 @@
//! Bindungen der Abzugskörper-Geometrie (`crate::voids`). Layouts s. dort.
use wasm_bindgen::prelude::wasm_bindgen;
/// Löcher als Schlüsselloch-Stege in den Aussenring; Unsinn → leer.
#[wasm_bindgen]
pub fn voids_keyhole_flat(rings: &[f64]) -> Vec<f64> {
crate::voids::keyhole_flat(rings)
}
/// Polygon minus Schneider (mit nicht gestrichenen Kanten); `[-1]` = keine Überschneidung.
#[wasm_bindgen]
pub fn voids_subtract_rings_flat(pts: &[f64], cutters: &[f64], no_stroke: &[f64]) -> Vec<f64> {
crate::voids::subtract_rings_flat(pts, cutters, no_stroke)
}
/// Teile einer Strecke ausserhalb aller Ringe; Unsinn → leer.
#[wasm_bindgen]
pub fn voids_segment_outside_flat(seg: &[f64], cutters: &[f64]) -> Vec<f64> {
crate::voids::segment_outside_flat(seg, cutters)
}
/// Schnitt-Intervalle eines Prismas mit einer senkrechten Ebene; Unsinn → leer.
#[wasm_bindgen]
pub fn voids_section_rects_flat(pts: &[f64], base_u: &[f64]) -> Vec<f64> {
crate::voids::section_rects_flat(pts, base_u)
}
-9
View File
@@ -1,9 +0,0 @@
//! Bindungen der Wand-Schichtbänder (`crate::wall_bands`). Kodierung s. dort.
use wasm_bindgen::prelude::wasm_bindgen;
/// Wände + Geschosse (Decken, Dächer) flach → Körper je Wand flach; nie ein Panic.
#[wasm_bindgen]
pub fn wall_bands_flat(walls: &[f64], floors: &[f64]) -> Vec<f64> {
crate::wall_bands::wall_bands_flat(walls, floors)
}