[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:
38 files changed
+125
-505
No files matched your search
+1
-24
@@ -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 } };
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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`.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user