[K4] Aufräumen: tote TS-Funktionen und Bindungen gelöscht, Höhenregeln/JS-Helfer im Kern zusammengelegt

Gelöscht: vertikale Ausdehnungen in model/wall.ts und geometry/opening.ts (ohne Aufrufer seit dem
Schnitt-Port), weitere ungenutzte Exporte (types.ts, ceiling.ts, glPlan, toWalls3d, truckSolid,
meshImport, bulge, planView) und die Bindungen doc_query, core_version, drawing3d_*,
bulge_between_angles, scatter_strokes_flat. Rust: model/helpers.rs::heights für typisierte Sicht
und rohe Wurzel, truthy/or_zero/js_string/arr je einmal.
This commit is contained in:
Claude committed 2026-10-29 13:08:08 +00:00
1 parent 24ab554c2e
commit 8b94abd854
38 files changed
+125 -505

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@ export { exportObj, exportStl, exportGlb, exportGltf } from "../export/exportMes
export { exportProjectStep } from "../export/exportStep";
export { planToSvgString } from "../export/planToSvgString";
export { setWasmBytesProvider } from "../engine/wasmSource";
export { initCore, coreReady } from "../engine/coreWasm";
export { initCore } from "../engine/coreWasm";
export { applyOps, validateProject, validateOps } from "./ops";
export type { CoreOp } from "./ops";
export type { Project, DrawingLevel } from "../model/types";
-3
View File
@@ -9,7 +9,6 @@ export {
bulgeArc,
bulgeArcPoints,
bulgePolylinePoints,
bulgeBetweenAngles,
bulgeFromSagittaPoint,
bulgePointAt,
bulgeThroughPoint,
@@ -97,7 +96,6 @@ export {
} from "../geometry/lineSegments";
export {
openingVerticalExtent,
} from "../geometry/opening";
export { autoExteriorDimensions } from "../geometry/autoDimensions";
export * as polygonBool from "../geometry/polygonBool";
@@ -255,7 +253,6 @@ export {
meetScale,
mmToPx,
pointInPolygon,
pointSegDistPx,
printStrokeVb,
scaleFromView,
toScreen,
-4
View File
@@ -24,10 +24,6 @@ export function initCoreSync(bytes: BufferSource): void {
ready = true;
}
export function coreReady(): boolean {
return ready;
}
/** Der geladene Kern; wirft, wenn `initCore()` noch nicht gelaufen ist (Programmierfehler). */
export function core(): CoreModule {
if (!ready) throw new Error("Rust-Kern nicht geladen: initCore() muss vor der ersten Kern-Funktion laufen.");
-31
View File
@@ -70,37 +70,6 @@ export async function extrudeCircle(
return JSON.parse(json) as ExtrudedMesh;
}
export type BooleanOp = "union" | "difference" | "intersection";
export interface BooleanMeshResult {
positions: number[];
indices: number[];
empty: boolean;
}
/** Boolesche Operation zweier Dreiecks-Meshes (Mesh-Ebenen-CSG via csgrs,
* truck-Integration Phase 4). Beide Meshes müssen konsistent nach außen
* gewundene Dreiecke haben (Rechte-Hand-Regel) — sonst liefert csgrs ein
* falsches Ergebnis, ohne das zu erkennen. */
export async function booleanMesh(
a: ExtrudedMesh,
b: ExtrudedMesh,
op: BooleanOp,
): Promise<BooleanMeshResult> {
const json = await guarded((m) =>
m.boolean_mesh(
JSON.stringify({
a_positions: a.positions,
a_indices: a.indices,
b_positions: b.positions,
b_indices: b.indices,
op,
}),
),
);
return JSON.parse(json) as BooleanMeshResult;
}
// ── B-Rep-Körper (truck 0.6): Spezifikation → Mesh / STEP ────────────────────
/** Ein Loft-Schnitt: Höhe + geschlossener Ring [x0,y0,x1,y1,…]. */
-15
View File
@@ -120,21 +120,6 @@ export function arcThroughPoints(a: Vec2, through: Vec2, b: Vec2): ArcParams | n
return toArcParams(core().arc_through_points(a.x, a.y, through.x, through.y, b.x, b.y));
}
/**
* Bulge-Wert für den Teilbogen desselben Kreises (center, r) von Winkel `aFrom` zu `aTo`, in der
* durch `sweepSign` vorgegebenen Schwenkrichtung (+1 = CCW, −1 = CW), z. B. beim Zuschneiden/
* Offsetten eines Bogen-Segments.
*/
export function bulgeBetweenAngles(
center: Vec2,
r: number,
aFrom: number,
aTo: number,
sweepSign: 1 | -1,
): number {
return core().bulge_between_angles(center.x, center.y, r, aFrom, aTo, sweepSign);
}
/**
* Kreisbogen durch zwei Endpunkte `a`→`b` mit vorgegebenem Radius `r` (Methode „Start-Ende-
* Radius"). `near` (typischerweise der Cursor) wählt die Seite der Sehne; es entsteht immer der
-33
View File
@@ -32,44 +32,11 @@ export function normalizeOutline(pts: Vec2[]): Vec2[] | null {
return isCCW(clean) ? clean : clean.slice().reverse();
}
/** Ob ein Umriss ein gültiges (nicht entartetes) Deckenpolygon bildet. */
export function isValidOutline(pts: Vec2[]): boolean {
const norm = normalizeOutline(pts);
return norm != null && ceilingArea(norm) >= MIN_CEILING_AREA;
}
/** Fläche eines Deckenumrisses in m² (immer positiv). */
export function ceilingArea(pts: Vec2[]): number {
return Math.abs(signedArea(pts));
}
/** Schwerpunkt (Zentroid) des Umriss-Polygons (für HUD/Beschriftung). */
export function outlineCentroid(pts: Vec2[]): Vec2 {
const a = signedArea(pts);
if (Math.abs(a) < 1e-12) {
// Entartet: einfacher Mittelwert der Punkte.
let sx = 0,
sy = 0;
for (const p of pts) {
sx += p.x;
sy += p.y;
}
const n = pts.length || 1;
return { x: sx / n, y: sy / n };
}
let cx = 0,
cy = 0;
for (let i = 0; i < pts.length; i++) {
const p = pts[i];
const q = pts[(i + 1) % pts.length];
const cr = p.x * q.y - q.x * p.y;
cx += (p.x + q.x) * cr;
cy += (p.y + q.y) * cr;
}
const f = 1 / (6 * a);
return { x: cx * f, y: cy * f };
}
/**
* Punkt-in-Polygon-Test (Ray-Casting) für einen geschlossenen Umriss — dient dem
* Body-Select einer Decke im Grundriss/3D. Randpunkte gelten als innen genug.
+2 -2
View File
@@ -113,8 +113,8 @@ export interface VerticalExtent {
}
/**
* UK/OK von Wänden und Decken aus dem Kern (`selection_info.rs::vertical_extents`, Regeln wie
* `wallVerticalExtent`/`ceilingVerticalExtent`): Geschoss-Bindungen und Deckentypen aus `project`, die
* UK/OK von Wänden und Decken aus dem Kern (`selection_info.rs::vertical_extents`, Regeln
* `model/helpers.rs::heights`): Geschoss-Bindungen und Deckentypen aus `project`, die
* Elemente selbst als ganze Fassung (auch gerade gezogene, noch nicht übernommene — 3D-Griffe).
*/
export function verticalExtents(
+4 -34
View File
@@ -1,7 +1,7 @@
// Geometrie-Helfer für Öffnungen (Fenster/Türen) — reine Funktionen, die eine
// `Opening` relativ zu ihrer Wirts-Wand in konkrete Welt-Geometrie auflösen:
// • die Öffnungs-Lücke entlang der Wandachse (from/to in Metern),
// • die vertikale Lage (UK/OK der Öffnung, absolut in Metern).
// • die Öffnungs-Lücke entlang der Wandachse (from/to in Metern), die Pfosten.
// (Die vertikale Lage rechnet der Kern: `model3d.rs`/`plan/section.rs`, UK/OK der Wand: `model/helpers.rs::heights`.)
//
// Da JEDE Größe aus der aktuellen Wandachse (`wall.start`/`wall.end`) abgeleitet
// wird, folgt eine Öffnung ihrer Wand automatisch, sobald die Wand bewegt wird —
@@ -9,9 +9,8 @@
//
// Bezeichner englisch, Kommentare deutsch (CONVENTIONS.md).
import type { Opening, Project, Vec2, Wall } from "../model/types";
import { along, leftNormal, normalize, sub } from "../model/geometry";
import { wallVerticalExtent } from "../model/wall";
import type { Opening, Vec2, Wall } from "../model/types";
import { along } from "../model/geometry";
/** Achslänge einer Wand (Meter). */
export function wallAxisLength(wall: Wall): number {
@@ -34,29 +33,6 @@ export function openingInterval(
return { from, to };
}
/**
* Vertikale Lage einer Öffnung (absolute Z-Werte in Metern) relativ zur Wand-UK.
* Türen sitzen am Boden (sillHeight 0); Fenster ab Brüstung. Die OK wird auf die
* Wand-OK geklemmt, damit die Öffnung nie über den Wandkopf hinausragt.
*/
export function openingVerticalExtent(
project: Project,
wall: Wall,
o: Opening,
): { zBottom: number; zTop: number } {
const { zBottom, zTop } = wallVerticalExtent(project, wall);
const sill = Math.max(0, o.sillHeight);
const oBottom = zBottom + sill;
const oTop = Math.min(zTop, oBottom + o.height);
return { zBottom: oBottom, zTop: oTop };
}
/** Einheits-Laufrichtung (u) und linke Normale (n) der Wandachse. */
export function wallAxisFrame(wall: Wall): { u: Vec2; n: Vec2 } {
const u = normalize(sub(wall.end, wall.start));
return { u, n: leftNormal(u) };
}
/** Die beiden Pfosten-Punkte (auf der Achse) einer Öffnung im Grundriss. */
export function openingJambs(
wall: Wall,
@@ -70,9 +46,3 @@ export function openingJambs(
};
}
/** Mittelpunkt einer Öffnung im Grundriss (Achse) — für HUD/Auswahl-Anker. */
export function openingCenter(wall: Wall, o: Opening): Vec2 | null {
const iv = openingInterval(wall, o);
if (!iv) return null;
return along(wall.start, wall.end, (iv.from + iv.to) / 2);
}
-2
View File
@@ -19,8 +19,6 @@
import type { Stair, Vec2 } from "../model/types";
import { core } from "../engine/coreWasm";
/** SIA-nahe Schrittregel: gute Steigungshöhe ≈ 0.17 m, Auftritt ≈ 0.29 m. */
export const IDEAL_RISER = 0.17;
export const IDEAL_TREAD = 0.29;
export const MIN_STEPS = 2;
+2 -2
View File
@@ -14,7 +14,7 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import { exportIfcSpf, ifcGuid } from "../export/exportIfc";
import { sampleProject } from "../model/sampleProject";
import { ceilingVerticalExtent } from "../model/wall";
import { verticalExtents } from "../geometry/grips";
import { polygonArea } from "../geometry/roomArea";
import { wallMeshVolumes } from "../export/meshScene.testutil";
import { formatIfcReport, handleIfcWorkerRequest, ifcToImportedMeshes, readIfc, type IfcProduct, type IfcWorkerRequest } from "./ifcImport";
@@ -100,7 +100,7 @@ describe("IFC-Import: Rundreise mit dem eigenen Export", () => {
const slabsExpected = (sampleProject.ceilings ?? [])
.filter((c) => c.outline.length >= 3)
.map((c) => {
const { zBottom, zTop } = ceilingVerticalExtent(sampleProject, c);
const { zBottom, zTop } = verticalExtents(sampleProject, [], [c]).ceilings[0];
return Math.abs(polygonArea(c.outline)) * Math.max(zTop - zBottom, 0.001);
})
.sort((a, b) => a - b);
-11
View File
@@ -346,17 +346,6 @@ export function meshObjectsToImportedMeshes(objects: readonly MeshObject[], file
});
}
/** Datei-Bytes → Kontext-Meshes + Bericht. */
export async function meshBytesToImportedMeshes(
bytes: Uint8Array,
fileName: string,
read?: MeshReadOptions,
place?: MeshToContextOptions,
): Promise<{ meshes: ImportedMesh[]; report: MeshImportReport }> {
const { objects, report } = await readMesh(bytes, fileName, read);
return { meshes: meshObjectsToImportedMeshes(objects, fileName, place), report };
}
/** Bericht als kurzer Text; `tr` übersetzt (Kern kennt kein i18n, die Hülle reicht `t` herein). */
export function formatMeshReport(
r: MeshImportReport,
-32
View File
@@ -18,7 +18,6 @@ import type {
BuiltinPaletteBanks,
Ceiling,
CeilingType,
Column,
Component,
DoorType,
DrawingLevel,
@@ -30,8 +29,6 @@ import type {
RichTextDoc,
Roof,
SashDef,
Stair,
StairType,
Vec2,
Wall,
WallType,
@@ -204,35 +201,6 @@ export const glazingPanesOf = (wt: WindowType): 1 | 2 | 3 => {
return wt.glazing === "dreifach" ? 3 : wt.glazing === "zweifach" ? 2 : 1;
};
/** Löst den {@link StairType} einer Treppe auf, oder `undefined`. */
export const getStairType = (project: Project, stair: Stair): StairType | undefined =>
stair.typeId ? (project.stairTypes ?? []).find((t) => t.id === stair.typeId) : undefined;
/** Alle Öffnungen einer Wand (leere Liste, wenn keine oder `openings` fehlt). */
export const openingsOfWall = (project: Project, wallId: string): Opening[] =>
(project.openings ?? []).filter((o) => o.hostWallId === wallId);
/** Menschenlesbarer Standardname einer Öffnung (Fenster/Tür + Breite×Höhe). */
export const openingLabel = (o: Opening): string =>
`${o.kind === "door" ? "Tür" : "Fenster"} ${(o.width * 100).toFixed(0)}×${(
o.height * 100
).toFixed(0)}`;
/** Menschenlesbarer Standardname einer Stütze (Profil + Masse in cm). */
export const columnLabel = (c: Column): string => {
if (c.profile.kind === "round") {
return `Stütze Ø${(c.profile.radius * 200).toFixed(0)}`;
}
return `Stütze ${(c.profile.width * 100).toFixed(0)}×${(c.profile.depth * 100).toFixed(0)}`;
};
/** Liefert ein Bauteil-Material (Component) per ID oder wirft. */
export const getComponent = (project: Project, id: string): Component => {
const c = project.components.find((co) => co.id === id);
if (!c) throw new Error(`Unbekanntes Bauteil-Material: ${id}`);
return c;
};
/** Liefert eine Schraffur (HatchStyle) per ID oder wirft. */
export const getHatch = (project: Project, id: string): HatchStyle => {
const h = project.hatches.find((ht) => ht.id === id);
+8 -4
View File
@@ -1,8 +1,9 @@
// Unit-Tests für die Wand-/Decken-Resolver (wallVerticalExtent /
// ceilingVerticalExtent): reine Datenschicht, kein React/Store.
// Unit-Tests für die Wand-/Decken-Resolver: Referenzlinie (`wallReferenceOffset`) und die UK/OK der
// Decken über den Kern (`verticalExtents`, Regeln `model/helpers.rs::heights`).
import { describe, it, expect } from "vitest";
import { ceilingVerticalExtent, wallReferenceOffset } from "./wall";
import { wallReferenceOffset } from "./wall";
import { verticalExtents } from "../geometry/grips";
import type { Ceiling, Project, Wall } from "./types";
/** Minimalprojekt mit einem Geschoss (baseElevation 0, floorHeight 2.6) und
@@ -68,7 +69,10 @@ function makeCeiling(overrides?: Partial<Ceiling>): Ceiling {
};
}
describe("ceilingVerticalExtent", () => {
/** UK/OK einer Decke (Kern-Abfrage). */
const ceilingVerticalExtent = (p: Project, c: Ceiling) => verticalExtents(p, [], [c]).ceilings[0];
describe("UK/OK einer Decke", () => {
it("ohne top/bottom: OK = Geschoss-Oberkante, UK = OK − Dicke (heutiges Verhalten)", () => {
const project = makeProject();
const ceiling = makeCeiling();
+3 -92
View File
@@ -1,12 +1,9 @@
// Wand-Resolver: leitet aus den (optionalen) Wand-Attributen die konkreten
// geometrischen Größen ab — Versatz der Achse über die Dicke (Referenzlinie)
// und die vertikale Ausdehnung (UK..OK). Alle Defaults entsprechen exakt dem
// bisherigen Verhalten, sodass bestehende Wände unverändert rendern.
// Wand-Resolver: Versatz der Achse über die Dicke (Referenzlinie). Die vertikale Ausdehnung (UK/OK)
// rechnet der Kern (`model/helpers.rs::heights`; TS: Abfrage `verticalExtents`, `geometry/grips.ts`).
//
// Bezeichner englisch, Kommentare deutsch (CONVENTIONS.md).
import type { Ceiling, Column, Project, VerticalAnchor, Wall } from "./types";
import { ceilingThickness, getFloor } from "./types";
import type { Wall } from "./types";
/**
* Versatz der Schichtstapelung entlang der linken Normalen `+n` (leftNormal),
@@ -38,89 +35,3 @@ export function wallReferenceOffset(
if (ref === "right") return -half;
return 0;
}
/** Löst einen VerticalAnchor zu einem absoluten Z (Meter) auf oder `null`. */
function resolveAnchor(
project: Project,
anchor: VerticalAnchor | undefined,
): number | null {
if (!anchor) return null;
if (anchor.mode === "custom") return anchor.z;
// "floor": baseElevation des gebundenen Geschosses (+ optionalem Offset).
const floor = project.drawingLevels.find((z) => z.id === anchor.floorId);
if (!floor) return null;
return (floor.baseElevation ?? 0) + (anchor.offset ?? 0);
}
/**
* Vertikale Ausdehnung der Wand (absolute Z-Werte in Metern).
* • zBottom: aus `wall.bottom`, sonst baseElevation des Wand-Geschosses
* (= heutiges Verhalten).
* • zTop: aus `wall.top`, sonst `zBottom + wall.height` (= heute).
* Sind beide UK/OK ungesetzt, liefert dies exakt `[baseElevation, base+height]`.
*/
export function wallVerticalExtent(
project: Project,
wall: Wall,
): { zBottom: number; zTop: number } {
// Geschoss-baseElevation als Default-UK (heutiges Verhalten). Fehlt das
// Geschoss, 0 als sicherer Rückfall.
let floorBase = 0;
try {
floorBase = getFloor(project, wall.floorId).baseElevation ?? 0;
} catch {
floorBase = 0;
}
const zBottom = resolveAnchor(project, wall.bottom) ?? floorBase;
const zTop = resolveAnchor(project, wall.top) ?? zBottom + wall.height;
return { zBottom, zTop };
}
/**
* Vertikale Ausdehnung einer Decke (absolute Z-Werte in Metern).
* • zTop: aus `ceiling.top`, sonst Oberkante des Geschosses
* (baseElevation + floorHeight) — also bündig mit dem Wandkopf.
* • zBottom: aus `ceiling.bottom`, sonst zTop − Deckendicke (die Decke
* wächst nach UNTEN — heutiges Verhalten). Die `thickness` bleibt bei
* gesetztem `bottom` rein informativ (dient nicht mehr der UK-Ableitung).
* Fehlt das Geschoss, dient 0 als sicherer Rückfall für die Oberkante.
*/
export function ceilingVerticalExtent(
project: Project,
ceiling: Ceiling,
): { zBottom: number; zTop: number } {
let floorTop = 0;
try {
const floor = getFloor(project, ceiling.floorId);
floorTop = (floor.baseElevation ?? 0) + (floor.floorHeight ?? 0);
} catch {
floorTop = 0;
}
const zTop = resolveAnchor(project, ceiling.top) ?? floorTop;
const zBottom =
resolveAnchor(project, ceiling.bottom) ??
zTop - ceilingThickness(project, ceiling);
return { zBottom, zTop };
}
/**
* Vertikale Ausdehnung einer Stütze (absolute Z-Werte in Metern) — dieselbe
* Regel wie {@link wallVerticalExtent}:
* • zBottom: aus `column.bottom`, sonst baseElevation des Geschosses.
* • zTop: aus `column.top`, sonst `zBottom + column.height`.
* Fehlt das Geschoss, dient 0 als sicherer Rückfall für die Unterkante.
*/
export function columnVerticalExtent(
project: Project,
column: Column,
): { zBottom: number; zTop: number } {
let floorBase = 0;
try {
floorBase = getFloor(project, column.floorId).baseElevation ?? 0;
} catch {
floorBase = 0;
}
const zBottom = resolveAnchor(project, column.bottom) ?? floorBase;
const zTop = resolveAnchor(project, column.top) ?? zBottom + column.height;
return { zBottom, zTop };
}
+1 -24
View File
@@ -5,13 +5,12 @@
* Querschnitt.
* • 3D (projectToModel3d/emitColumns): eine Stütze wird zu einem Prisma-Mesh
* (Rechteck-Box bzw. Kreis-Prisma) mit der erwarteten vertikalen Ausdehnung.
* • Vertikale Lage (columnVerticalExtent): Geschoss-Default sowie UK/OK-Anker.
* (Vertikale Lage: Rust-Tests `model/helpers.rs::heights`.)
*/
import { describe, it, expect } from "vitest";
import { generatePlan } from "./generatePlan";
import { projectToModel3d } from "./toWalls3d";
import { columnVerticalExtent } from "../model/wall";
import { columnFootprint } from "../geometry/column";
import type { Column, Project } from "../model/types";
@@ -125,28 +124,6 @@ describe("Stütze — 3D (projectToModel3d / emitColumns)", () => {
});
});
describe("Stütze — vertikale Lage (columnVerticalExtent)", () => {
it("nutzt Geschoss-UK + Höhe als Default", () => {
const { zBottom, zTop } = columnVerticalExtent(
projectWithColumn(rectColumn),
rectColumn,
);
expect(zBottom).toBeCloseTo(0, 6);
expect(zTop).toBeCloseTo(3, 6);
});
it("bindet UK/OK an Anker (custom + floor)", () => {
const anchored: Column = {
...rectColumn,
bottom: { mode: "custom", z: 0.5 },
top: { mode: "floor", floorId: "og" }, // baseElevation OG = 3
};
const { zBottom, zTop } = columnVerticalExtent(projectWithColumn(anchored), anchored);
expect(zBottom).toBeCloseTo(0.5, 6);
expect(zTop).toBeCloseTo(3, 6);
});
});
describe("Stütze — Footprint-Helfer (columnFootprint)", () => {
it("tesselliert ein rundes Profil als 32-Eck um die Position", () => {
const round: Column = { ...rectColumn, profile: { kind: "round", radius: 0.15 } };
-4
View File
@@ -42,9 +42,6 @@ export type DetailLevel = "grob" | "mittel" | "fein";
/** Stroke-Farbe der Schicht-Polygone (neutrales Schwarz, geteilte Tinte mit der Schraffur). */
export const POCHE_STROKE = "#1a1a1a";
/** Tinte für den Schwarz-Weiss-Modus: einheitliches Dunkel für alle Striche. */
export const MONO_INK = "#111111";
// ── Linienstärken in PAPIER-Millimeter (vgl. docs/design/plans-output.md §3.2) ──
// Alle Stricharten sind in mm Papier definiert; die PlanView rechnet sie über
// dpi = 96 in konstante Bildschirm-Pixel um (non-scaling-stroke), damit Linien
@@ -58,7 +55,6 @@ export const LAYER_LINE_MM = 0.02;
// seit [K3d] im Kern (`src-tauri/core/src/plan/style.rs`).
/** Default-Umrandungs-Strichstärke (mm), falls die Kategorie keine lw trägt
(Grundeinstellung für „normale Elemente"). */
export const WALL_FALLBACK_MM = 0.18;
/**
* Aufgelöste Schraffur eines Polygons — alle Werte stammen aus einer
-18
View File
@@ -144,24 +144,6 @@ export function buildHatchRuns(poly: Vec2[], hatch: HatchRender): HatchRun[] {
return toRuns(core().hatch_runs_flat(flat(poly), encodeHatch(hatch)));
}
/**
* Streut kurze Striche deterministisch und MODELLRAUM-STABIL über ein Polygon (eine Zelle des
* absoluten Gitters je Strich, Lage/Winkel/Länge aus `hash(ix, iy, seed)`), aufs Polygon geclippt.
*/
export function scatterStrokes(
poly: Vec2[],
cell: number,
baseAngleRad: number,
seed: number,
strokeLen: number,
lenMin?: number,
lenMax?: number,
): HatchRun[] {
return toRuns(
core().scatter_strokes_flat(flat(poly), cell, baseAngleRad, seed, strokeLen, lenMin ?? NaN, lenMax ?? NaN),
);
}
/**
* Random-Vektor-Schraffur eines Polygons (Kies/Splitt): Dichte und Strichlänge an die Kachel
* (8·scale px) gekoppelt, Seed nur aus Muster-Parametern + `hatch.seed`.
-24
View File
@@ -16,30 +16,6 @@
/** RGBA-Farbe, Komponenten in [0,1]. */
export type Rgba = [number, number, number, number];
/** Shader-Programm mit kompiliertem Programm + Attribut-/Uniform-Orten. */
export interface ShaderProgram {
program: WebGLProgram;
attribs: {
position?: GLint;
/** Bildschirm-Raum-Miter-Bisektor (Einheits-Versatzrichtung) für Linien. */
normal?: GLint;
/** Seite der Linie: +1 oder -1. */
side?: GLint;
/** Miter-Längenfaktor 1/cos(θ/2) (1 = gerade). */
miter?: GLint;
};
uniforms: {
viewProj?: WebGLUniformLocation | null;
color?: WebGLUniformLocation | null;
/** Basis-Strichbreite in Geräte-Pixeln (bei strokeScale=1). */
strokePx?: WebGLUniformLocation | null;
/** Zoom-Skalierung der Strichbreite (>1 = reingezoomt → dicker, Papier). */
strokeScale?: WebGLUniformLocation | null;
/** Zeichenpuffer-Größe in Geräte-Pixeln [w,h] (px→Clip-Umrechnung). */
viewportPx?: WebGLUniformLocation | null;
};
}
/** Ein Zeichen-Batch: zusammenhängender Index-Bereich mit einer Farbe. */
export interface FillBatch {
startIndex: number;
-15
View File
@@ -207,21 +207,6 @@ export function pointInPolygon(pt: Vec2, poly: Vec2[]): boolean {
return inside;
}
/** Abstand Punkt→Strecke (alle in denselben Koordinaten, hier Client-Pixel). */
export function pointSegDistPx(
p: { x: number; y: number },
a: { x: number; y: number },
b: { x: number; y: number },
): number {
const dx = b.x - a.x;
const dy = b.y - a.y;
const len2 = dx * dx + dy * dy;
if (len2 < 1e-9) return Math.hypot(p.x - a.x, p.y - a.y);
let t = ((p.x - a.x) * dx + (p.y - a.y) * dy) / len2;
t = Math.max(0, Math.min(1, t));
return Math.hypot(p.x - (a.x + dx * t), p.y - (a.y + dy * t));
}
/** Achsenparalleles Rechteck in Modell-Metern (Auswahl-Marquee). */
export interface ModelRect {
minX: number;
-4
View File
@@ -243,10 +243,6 @@ export interface RModel3d {
/** Warmer, neutraler Wand-Grundton (wie render3d default). */
export const WALL_RGB: RRgb = [0.82, 0.8, 0.76];
/** Etwas hellerer, kühlerer Ton für Deckenplatten (heben sich von Wänden ab). */
export const SLAB_RGB: RRgb = [0.86, 0.86, 0.88];
/** Fallback-Farbe für 2D-Zeichnungen ohne color/lineStyle/Kategorie (wie drawing2DColor in Viewport3D.tsx, "#888888"). */
export const DRAWING_LINE_FALLBACK_RGB: RRgb = [0x88 / 255, 0x88 / 255, 0x88 / 255];
/** Ignoriere entartete vertikale Ausschnitte (Rundungsrauschen). */
export const EPS = 1e-4;