[K1][K2] Bögen und Treppen nach Rust: bulge.ts und stair.ts nur noch Fassade über den Kern

Bögen: Tessellation, Drei-Punkt-/Radius-/Tangenten-Bogen, bulgePointAt und ganze
Polylinien (bulge_polyline_points) in kernel2d; TS-Formeln gelöscht, Aufrufer mit
Segmentschleifen nutzen bulgePolylinePoints. Treppen: stair_geometry um Referenz
(links/rechts) ergänzt, stair_outline neu; stairCut/stairBBox/defaultStepCount über
flache Puffer; pointInPolygon/pointHitsStair (ungenutzt) gelöscht.
This commit is contained in:
Claude committed 2026-10-27 21:42:29 +00:00
1 parent d9daed7c47
commit 6c84cd371b
21 files changed
+1395 -734

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
//! Bindungen der Bogen-Formeln (`crate::bulge`) für `src/geometry/bulge.ts`. Skalare Argumente
//! (kein Puffer) für Einzelaufrufe; Polylinien als flache `Float64Array`s.
use crate::bulge as b;
use wasm_bindgen::prelude::wasm_bindgen;
/// `[cx, cy, r, a0, a1, sweep]`; leer = Gerade/entartet.
#[wasm_bindgen]
pub fn bulge_arc(ax: f64, ay: f64, bx: f64, by: f64, bulge: f64) -> Vec<f64> {
b::arc(ax, ay, bx, by, bulge)
}
/// Tessellierte Bogenpunkte `[x0, y0, …]` (Gerade: nur a, b).
#[wasm_bindgen]
pub fn bulge_arc_points(ax: f64, ay: f64, bx: f64, by: f64, bulge: f64) -> Vec<f64> {
b::arc_points(ax, ay, bx, by, bulge)
}
/// Ganze Polylinie tessellieren: Punkte `[x0, y0, …]`, bulge je Kante, geschlossen ja/nein.
#[wasm_bindgen]
pub fn bulge_polyline_points(pts: &[f64], bulge: &[f64], closed: bool) -> Vec<f64> {
b::polyline_points(pts, bulge, closed)
}
#[wasm_bindgen]
pub fn bulge_from_sagitta_point(ax: f64, ay: f64, bx: f64, by: f64, px: f64, py: f64) -> f64 {
b::from_sagitta_point(ax, ay, bx, by, px, py)
}
#[wasm_bindgen]
pub fn bulge_between_angles(cx: f64, cy: f64, r: f64, a_from: f64, a_to: f64, sweep_sign: f64) -> f64 {
b::between_angles(cx, cy, r, a_from, a_to, sweep_sign)
}
/// `[x, y]` auf dem Bogen bei t∈[0,1].
#[wasm_bindgen]
pub fn bulge_point_at(ax: f64, ay: f64, bx: f64, by: f64, bulge: f64, t: f64) -> Vec<f64> {
b::point_at(ax, ay, bx, by, bulge, t)
}
#[wasm_bindgen]
pub fn bulge_through_point(ax: f64, ay: f64, tx: f64, ty: f64, bx: f64, by: f64) -> f64 {
b::through_point(ax, ay, tx, ty, bx, by)
}
/// `[cx, cy, r, a0, a1]` (CCW) oder leer.
#[wasm_bindgen]
pub fn arc_through_points(ax: f64, ay: f64, tx: f64, ty: f64, bx: f64, by: f64) -> Vec<f64> {
b::arc_through_points(ax, ay, tx, ty, bx, by)
}
#[wasm_bindgen]
pub fn arc_from_start_end_radius(ax: f64, ay: f64, bx: f64, by: f64, r: f64, nx: f64, ny: f64) -> Vec<f64> {
b::arc_from_start_end_radius(ax, ay, bx, by, r, nx, ny)
}
#[wasm_bindgen]
pub fn arc_from_start_end_direction(ax: f64, ay: f64, bx: f64, by: f64, dx: f64, dy: f64) -> Vec<f64> {
b::arc_from_start_end_direction(ax, ay, bx, by, dx, dy)
}
+2
View File
@@ -10,6 +10,8 @@ mod sun;
mod site_rules;
mod auto_dimensions;
mod kennzahlen;
mod bulge;
mod stair;
use wasm_bindgen::prelude::wasm_bindgen;
+34
View File
@@ -0,0 +1,34 @@
//! Bindungen der Treppen-Geometrie (`crate::stair`). Kodierung s. dort.
use crate::stair as s;
use wasm_bindgen::prelude::wasm_bindgen;
/// Parameter (16 Zahlen) + Gesamt-Steighöhe → flache Treppengeometrie; Unsinn → leer.
#[wasm_bindgen]
pub fn stair_geometry_flat(params: &[f64], total_rise: f64) -> Vec<f64> {
s::geometry(params, total_rise)
}
/// Plan-Aussenlinie: `[0, n, x, y …]` (Polygon) oder `[1, …]` (Wendel).
#[wasm_bindgen]
pub fn stair_outline_flat(params: &[f64]) -> Vec<f64> {
s::outline(params)
}
/// Schnittaufteilung aus flacher Geometrie und Schnitthöhe über der Treppen-UK.
#[wasm_bindgen]
pub fn stair_cut_flat(geometry: &[f64], cut_rise: f64) -> Vec<f64> {
s::cut(geometry, cut_rise)
}
/// `[minX, minY, maxX, maxY]` aller Tritte + Podest.
#[wasm_bindgen]
pub fn stair_bbox_flat(geometry: &[f64]) -> Vec<f64> {
s::bbox(geometry)
}
/// Vorgabe-Stufenzahl aus Steighöhe und Lauflänge.
#[wasm_bindgen]
pub fn stair_default_step_count(total_rise: f64, run_length: f64) -> u32 {
s::default_step_count(total_rise, run_length)
}