[144] Öffnungen verschieben: Griff-Zug und Objekt-Info über den Kern (Bogenwand, Nachbaröffnung), Hinweise, vitest

This commit is contained in:
Claude committed 2026-11-06 07:38:23 +00:00
1 parent 8d916a290c
commit c77a57b9bb
14 files changed
+118 -55

No files matched your search

+4 -3
View File
@@ -9,7 +9,6 @@ import {
gripPolarPoint,
openingGripPoint,
openingSheetSlide,
openingSlidePosition,
sheetHeightDrag,
wallGripPoints,
} from "./gripDrag";
@@ -49,8 +48,10 @@ describe("Griff-Zug (Kern)", () => {
it("Öffnung entlang der Wand und im Schnitt", () => {
expect(openingGripPoint(wall, { position: 1, width: 1.2 })).toEqual({ x: 1.6, y: 0 });
expect(openingSlidePosition(wall, { width: 1.2 }, { x: 2.6, y: 3 })).toBe(2);
expect(openingSlidePosition({ start: wall.start, end: wall.start }, { width: 1.2 }, { x: 1, y: 0 })).toBeNull();
// Bogenwand (Halbkreis, Radius 2.5): Mitte bei der Bogenlänge 2.5·π/2 liegt im Scheitel.
const g = openingGripPoint({ ...wall, bulge: 1 }, { position: 2.5 * Math.PI / 2 - 0.6, width: 1.2 });
expect(g.x).toBeCloseTo(2.5, 9);
expect(Math.abs(g.y)).toBeCloseTo(2.5, 9);
expect(openingSheetSlide(wall, { position: 1, width: 1.2 }, { x: -1, y: 0 }, 0.5)).toEqual({ position: 0.5, du: 0.5 });
expect(openingSheetSlide(wall, { position: 1, width: 1.2 }, { x: 0.1, y: 0.995 }, 1)).toBeNull();
});
+6 -9
View File
@@ -96,15 +96,12 @@ export function sheetHeightDrag(
return { top: f[0], bottom: f[1], patch };
}
/** Mittelpunkt-Griff einer Öffnung auf der Achse ihrer Wirtswand. */
export function openingGripPoint(w: Pick<Wall, "start" | "end">, op: Pick<Opening, "position" | "width">): Vec2 {
return v(core().grip_opening_point(w.start.x, w.start.y, w.end.x, w.end.y, op.position, op.width));
}
/** Neue `position` beim Ziehen des Öffnungs-Griffs nach `pt` (auf die Wand geklemmt); null = Wand ohne Länge. */
export function openingSlidePosition(w: Pick<Wall, "start" | "end">, op: Pick<Opening, "width">, pt: Vec2): number | null {
const f = core().grip_opening_slide(w.start.x, w.start.y, w.end.x, w.end.y, op.width, pt.x, pt.y);
return f.length ? f[0] : null;
/**
* Mittelpunkt-Griff einer Öffnung auf der Achse ihrer Wirtswand (Bogenwand [T2]: auf dem Bogen, `position`
* = Bogenlänge). Den Zug selbst rechnet der Kern (`slideOpening`, Griff-Anfrage `openingSlide`).
*/
export function openingGripPoint(w: Pick<Wall, "start" | "end" | "bulge">, op: Pick<Opening, "position" | "width">): Vec2 {
return v(core().grip_opening_point(w.start.x, w.start.y, w.end.x, w.end.y, w.bulge ?? 0, op.position, op.width));
}
/**
+4 -1
View File
@@ -31,7 +31,10 @@ export type GripRequest =
| { op: "insertPoint"; id: string; seg: number; pt: P }
| { op: "deletePoint"; id: string; index: number }
| { op: "vertexType"; id: string; index: number; vertexType: "corner" | "arc" | "spline" }
| { op: "wallThickness" | "ceilingThickness"; id: string; thickness: number; newId: string; newName: string };
| { op: "wallThickness" | "ceilingThickness"; id: string; thickness: number; newId: string; newName: string }
// [144] Wandöffnung gleiten lassen (Kern `opening_slide`): Griff-Zug nach `pt` bzw. Position `a` ab Wandanfang.
| { op: "openingSlide"; id: string; pt: P }
| { op: "openingPosition"; id: string; a: number };
/** Punkt als Anfrage-Paar. */
export const gripPt = (p: Vec2): P => [p.x, p.y];