[K4] Höhen der 3D-Griffe im Kern, tote Geometrie-Helfer gelöscht
Die 3D-Griffe (Griff-Lagen, Arbeitsebene) holen UK/OK von Wänden und Decken über die Wurzel-Abfrage `verticalExtents` (selection_info.rs, Fassade in geometry/grips.ts). Gelöscht, weil ohne Aufrufer: lineIntersect, clippedBand, wallBand, stairVerticalExtent, nextFloorAbove, openingGapQuad, roofBBox, stairBBox (+ Bindung stair_bbox_flat), outlineBBox, localToLv95, roofEdgeList. Die vertikalen Ausdehnungen in TS bleiben nur für die Plan-Ableitung. Claude-Session: https://claude.ai/code/session_01NTYBZBvLYCtugMJoKXaB67
This commit is contained in:
21 files changed
+149
-317
No files matched your search
+1
-75
@@ -22,53 +22,10 @@ export const cross = (p: Vec2, q: Vec2): number => p.x * q.y - p.y * q.x;
|
||||
/** Skalarprodukt zweier 2D-Vektoren. */
|
||||
export const dot = (p: Vec2, q: Vec2): number => p.x * q.x + p.y * q.y;
|
||||
|
||||
/** Eine unendliche Gerade als Stützpunkt + Richtung. */
|
||||
export interface Line {
|
||||
point: Vec2;
|
||||
dir: Vec2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Schnittpunkt der Geraden (a + t·da) mit (b + s·db).
|
||||
* Liefert null bei (nahezu) parallelen Richtungen.
|
||||
*/
|
||||
export function lineIntersect(
|
||||
a: Vec2,
|
||||
da: Vec2,
|
||||
b: Vec2,
|
||||
db: Vec2,
|
||||
): Vec2 | null {
|
||||
const denom = cross(da, db);
|
||||
if (Math.abs(denom) < 1e-9) return null; // parallel → kein Schnitt
|
||||
const t = cross(sub(b, a), db) / denom;
|
||||
return add(a, scale(da, t));
|
||||
}
|
||||
|
||||
/** Punkt entlang einer Strecke p1→p2 im Abstand d vom Start. */
|
||||
export const along = (p1: Vec2, p2: Vec2, d: number): Vec2 =>
|
||||
add(p1, scale(normalize(sub(p2, p1)), d));
|
||||
|
||||
/**
|
||||
* Die vier Eckpunkte eines Bandes, das quer zur Normalen zwischen den
|
||||
* Offsets offA und offB liegt (gemessen entlang der linken Normalen n).
|
||||
* Reihenfolge: start+n*offA, end+n*offA, end+n*offB, start+n*offB.
|
||||
*/
|
||||
export function wallBand(
|
||||
start: Vec2,
|
||||
end: Vec2,
|
||||
offA: number,
|
||||
offB: number,
|
||||
): [Vec2, Vec2, Vec2, Vec2] {
|
||||
const u = normalize(sub(end, start));
|
||||
const n = leftNormal(u);
|
||||
return [
|
||||
add(start, scale(n, offA)),
|
||||
add(end, scale(n, offA)),
|
||||
add(end, scale(n, offB)),
|
||||
add(start, scale(n, offB)),
|
||||
];
|
||||
}
|
||||
|
||||
/** Die vier Eckpunkte einer Wand als Polygon (gegen den Uhrzeigersinn). */
|
||||
export function wallCorners(
|
||||
start: Vec2,
|
||||
@@ -76,38 +33,7 @@ export function wallCorners(
|
||||
thickness: number,
|
||||
): [Vec2, Vec2, Vec2, Vec2] {
|
||||
const h = thickness / 2;
|
||||
return wallBand(start, end, h, -h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wie {@link wallBand}, aber die Bandenden werden bei Bedarf an Gehrungslinien
|
||||
* (startCut / endCut) abgeschnitten statt rechtwinklig gekappt. Jede der beiden
|
||||
* Bandkanten (bei Offset offA bzw. offB, Richtung u) wird mit der jeweiligen
|
||||
* Schnittlinie verschnitten; fehlt eine Schnittlinie, bleibt das Ende
|
||||
* rechtwinklig (Punkt auf der Achssenkrechten).
|
||||
* Reihenfolge bleibt konsistent zu wallBand: [A.start, A.end, B.end, B.start].
|
||||
*/
|
||||
export function clippedBand(
|
||||
start: Vec2,
|
||||
end: Vec2,
|
||||
offA: number,
|
||||
offB: number,
|
||||
startCut: Line | null,
|
||||
endCut: Line | null,
|
||||
): [Vec2, Vec2, Vec2, Vec2] {
|
||||
const u = normalize(sub(end, start));
|
||||
const n = leftNormal(u);
|
||||
|
||||
const edgeStart = (off: number): Vec2 => {
|
||||
const base = add(start, scale(n, off));
|
||||
if (!startCut) return base;
|
||||
return lineIntersect(base, u, startCut.point, startCut.dir) ?? base;
|
||||
};
|
||||
const edgeEnd = (off: number): Vec2 => {
|
||||
const base = add(end, scale(n, off));
|
||||
if (!endCut) return base;
|
||||
return lineIntersect(base, u, endCut.point, endCut.dir) ?? base;
|
||||
};
|
||||
|
||||
return [edgeStart(offA), edgeEnd(offA), edgeEnd(offB), edgeStart(offB)];
|
||||
return [add(start, scale(n, h)), add(end, scale(n, h)), add(end, scale(n, -h)), add(start, scale(n, -h))];
|
||||
}
|
||||
+1
-48
@@ -5,7 +5,7 @@
|
||||
//
|
||||
// Bezeichner englisch, Kommentare deutsch (CONVENTIONS.md).
|
||||
|
||||
import type { Ceiling, Column, Project, Stair, VerticalAnchor, Wall } from "./types";
|
||||
import type { Ceiling, Column, Project, VerticalAnchor, Wall } from "./types";
|
||||
import { ceilingThickness, getFloor } from "./types";
|
||||
|
||||
/**
|
||||
@@ -103,37 +103,6 @@ export function ceilingVerticalExtent(
|
||||
return { zBottom, zTop };
|
||||
}
|
||||
|
||||
/**
|
||||
* Vertikale Ausdehnung einer Treppe (absolute Z-Werte in Metern).
|
||||
* • zBottom: OKFF (baseElevation) des zugehörigen Geschosses.
|
||||
* • zTop: zBottom + Gesamt-Steighöhe. Fehlt `stair.totalRise`, gilt die
|
||||
* Geschosshöhe (floorHeight) des Geschosses — so steigt die Treppe genau ins
|
||||
* nächste Geschoss (OKFF → OKFF).
|
||||
* Fehlt das Geschoss, dient 0 als sicherer Rückfall für die Unterkante.
|
||||
*/
|
||||
export function stairVerticalExtent(
|
||||
project: Project,
|
||||
stair: Stair,
|
||||
): { zBottom: number; zTop: number } {
|
||||
let base = 0;
|
||||
let floorHeight = 0;
|
||||
try {
|
||||
const floor = getFloor(project, stair.floorId);
|
||||
base = floor.baseElevation ?? 0;
|
||||
floorHeight = floor.floorHeight ?? 0;
|
||||
} catch {
|
||||
base = 0;
|
||||
floorHeight = 0;
|
||||
}
|
||||
const rise =
|
||||
stair.totalRise != null && stair.totalRise > 0
|
||||
? stair.totalRise
|
||||
: floorHeight > 0
|
||||
? floorHeight
|
||||
: 2.6;
|
||||
return { zBottom: base, zTop: base + rise };
|
||||
}
|
||||
|
||||
/**
|
||||
* Vertikale Ausdehnung einer Stütze (absolute Z-Werte in Metern) — dieselbe
|
||||
* Regel wie {@link wallVerticalExtent}:
|
||||
@@ -155,19 +124,3 @@ export function columnVerticalExtent(
|
||||
const zTop = resolveAnchor(project, column.top) ?? zBottom + column.height;
|
||||
return { zBottom, zTop };
|
||||
}
|
||||
|
||||
/**
|
||||
* Das Geschoss DIREKT ÜBER dem Wand-Geschoss (in Dokumentreihenfolge der
|
||||
* "floor"-Ebenen) oder `undefined`, wenn die Wand im obersten Geschoss liegt.
|
||||
* Dient der „Verknüpfung zum oberen Geschoss" (OK an nächstes Geschoss binden).
|
||||
*/
|
||||
export function nextFloorAbove(
|
||||
project: Project,
|
||||
wall: Wall,
|
||||
): { id: string; name: string } | undefined {
|
||||
const floors = project.drawingLevels.filter((z) => z.kind === "floor");
|
||||
const idx = floors.findIndex((z) => z.id === wall.floorId);
|
||||
if (idx < 0) return undefined;
|
||||
const above = floors[idx + 1];
|
||||
return above ? { id: above.id, name: above.name } : undefined;
|
||||
}
|
||||
Reference in new issue
Block a user