[K4][G10] Merge: Aufräumen (tote TS-/Rust-Doppelspuren), id-Index, Commit ohne Kopie, Punkttyp im Kern; Tests unter Last stabil
CLAUDE.md: Dokument im Kern, Modulkarte nachgeführt. Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
53 files changed
+1293
-1043
No files matched your search
@@ -27,11 +27,6 @@ pub fn bulge_from_sagitta_point(ax: f64, ay: f64, bx: f64, by: f64, px: f64, py:
|
||||
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> {
|
||||
|
||||
@@ -87,7 +87,7 @@ fn problems_text(r: Option<Result<(), Vec<String>>>, parsed_err: Option<String>)
|
||||
pub fn doc_apply(h: u32, ops_json: &str) -> String {
|
||||
match parse_ops(ops_json) {
|
||||
Err(e) => problems_text(None, Some(e)),
|
||||
Ok(ops) => problems_text(with_doc(h, |d| d.apply_marked(&ops, may_have_marks(ops_json))), None),
|
||||
Ok(ops) => problems_text(with_doc(h, |d| d.apply_marked(ops, may_have_marks(ops_json))), None),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,15 +174,9 @@ 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.
|
||||
/// Abfrage auf dem typisierten Projekt mit Zahlen- und Textargument; 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_args(h: u32, name: &str, args: &[f64], text: &str) -> String {
|
||||
let result = with_doc(h, |d| {
|
||||
@@ -196,10 +190,10 @@ pub fn doc_query_args(h: u32, name: &str, args: &[f64], text: &str) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// Abfrage auf der rohen Projekt-Wurzel (`crate::queries::run_root`); Fehler wie bei [`doc_query`].
|
||||
/// Abfrage auf der rohen Projekt-Wurzel (`crate::queries::run_root`); Fehler wie bei [`doc_query_args`].
|
||||
#[wasm_bindgen]
|
||||
pub fn doc_query_root(h: u32, name: &str, text: &str) -> String {
|
||||
let result = with_doc(h, |d| crate::queries::run_root(d.root(), name, text)).unwrap_or_else(|| Err("Dokument nicht offen".to_string()));
|
||||
let result = with_doc(h, |d| crate::queries::run_root(&d.lookup(), name, text)).unwrap_or_else(|| Err("Dokument nicht offen".to_string()));
|
||||
match result {
|
||||
Ok(json) => json,
|
||||
Err(e) => format!("\u{1}{e}"),
|
||||
@@ -226,3 +220,11 @@ pub fn doc_query_bin(h: u32, name: &str, args: &[f64], text: &str) -> Vec<u8> {
|
||||
let result = with_doc(h, |d| crate::queries::run_bin_doc(d, name, args, text)).unwrap_or_else(|| Err("Dokument nicht offen".to_string()));
|
||||
result.unwrap_or_else(|e| crate::plan_buf::encode_error(&e))
|
||||
}
|
||||
|
||||
/// Je Op der zuletzt angewendeten Folge (`doc_commit`, `doc_apply`, `doc_grip_commit`, `doc_undo`,
|
||||
/// `doc_redo`) die Position des von `replace` getroffenen Elements, −1 = keine (TS führt die
|
||||
/// Leseansicht damit ohne Suche nach, `applyOps`).
|
||||
#[wasm_bindgen]
|
||||
pub fn doc_last_hits(h: u32) -> Vec<f64> {
|
||||
with_doc(h, |d| d.last_hits().iter().map(|p| p.map_or(-1.0, |i| i as f64)).collect()).unwrap_or_default()
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
//! Bindungen der 2D-Zeichnungen im 3D (`crate::drawing2d_3d`). Kodierung s. dort.
|
||||
|
||||
use crate::drawing2d_3d as d;
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
|
||||
/// LineList-Vertices `[px, höhe, py, r, g, b]` (zwei je Segment) einer Charge.
|
||||
#[wasm_bindgen]
|
||||
pub fn drawing3d_line_verts(drawings: &[f64]) -> Vec<f32> {
|
||||
d::line_verts(drawings)
|
||||
}
|
||||
|
||||
/// Pick-Strecken `[ax, ay, bx, by, baseElevation, zeichnung]` einer Charge.
|
||||
#[wasm_bindgen]
|
||||
pub fn drawing3d_pick_segs(drawings: &[f64], tolerance: f64) -> Vec<f64> {
|
||||
d::pick_segs(drawings, tolerance)
|
||||
}
|
||||
@@ -19,7 +19,7 @@ pub fn doc_grip_commit(h: u32, req_json: &str, key: &str, now_ms: f64) -> String
|
||||
let key = (!key.is_empty()).then_some(key);
|
||||
let now = if now_ms.is_finite() { now_ms } else { 0.0 };
|
||||
let out = with_doc(h, |d| -> Result<String, String> {
|
||||
let res = crate::grips::run(d.root(), &req)?;
|
||||
let res = crate::grips::run(&d.lookup(), &req)?;
|
||||
let text = crate::grips::result_json(&res);
|
||||
if res.ops.is_empty() {
|
||||
return Ok(text);
|
||||
@@ -79,3 +79,16 @@ pub fn edge_grips(pts: &[f64], closed: bool, bulge: &[f64], use_bulge: bool) ->
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Punkttyp am Punkt `index` einer Polylinie (`crate::polyline_vertex`; `pts = [x0, y0, …]`, `bulge` je
|
||||
/// Segment): `[typ, ecke, bogen, spline]` mit typ −1 = gemischt bzw. kein Punkt, 0 Ecke, 1 Bogen,
|
||||
/// 2 Spline; danach je Typ 1/0, ob er sich setzen lässt.
|
||||
#[wasm_bindgen]
|
||||
pub fn polyline_vertex_info(pts: &[f64], bulge: &[f64], closed: bool, index: f64) -> Vec<f64> {
|
||||
use crate::polyline_vertex::{can_set, index_of, type_of, Poly, VertexType};
|
||||
let verts: Vec<(f64, f64)> = pts.chunks_exact(2).map(|c| (c[0], c[1])).collect();
|
||||
let g = Poly { pts: &verts, closed, bulge };
|
||||
let Some(i) = index_of(index, verts.len()) else { return vec![-1.0, 0.0, 0.0, 0.0] };
|
||||
let can = |t| if can_set(&g, i, t) { 1.0 } else { 0.0 };
|
||||
vec![type_of(&g, i).map_or(-1.0, VertexType::code), can(VertexType::Corner), can(VertexType::Arc), can(VertexType::Spline)]
|
||||
}
|
||||
@@ -75,16 +75,3 @@ pub fn hatch_line_family_flat(poly: &[f64], angle_rad: f64, spacing_m: f64, offs
|
||||
segs_out(&hatch::hatch_line_family(&pts(poly), angle_rad, spacing_m, offset_m, v2(ax, ay)))
|
||||
}
|
||||
|
||||
/// `len_min`/`len_max` NaN = nicht gesetzt.
|
||||
#[wasm_bindgen]
|
||||
pub fn scatter_strokes_flat(
|
||||
poly: &[f64],
|
||||
cell: f64,
|
||||
base_angle_rad: f64,
|
||||
seed: f64,
|
||||
stroke_len: f64,
|
||||
len_min: f64,
|
||||
len_max: f64,
|
||||
) -> Vec<f64> {
|
||||
runs_out(&hatch::scatter_strokes(&pts(poly), cell, base_angle_rad, seed, stroke_len, opt(len_min), opt(len_max)))
|
||||
}
|
||||
@@ -15,7 +15,6 @@ mod stair;
|
||||
mod room_area;
|
||||
mod room_boundary;
|
||||
mod polygon_holes;
|
||||
mod drawing2d_3d;
|
||||
mod plan_buf;
|
||||
mod project_format;
|
||||
mod gpu_compile;
|
||||
@@ -48,9 +47,3 @@ use wasm_bindgen::prelude::wasm_bindgen;
|
||||
pub fn start() {
|
||||
console_error_panic_hook::set_once();
|
||||
}
|
||||
|
||||
/// Version des Kern-Moduls (für Diagnose/Startprotokoll).
|
||||
#[wasm_bindgen]
|
||||
pub fn core_version() -> String {
|
||||
env!("CARGO_PKG_VERSION").to_string()
|
||||
}
|
||||
Reference in new issue
Block a user