[144] Öffnung in Bogenwand: Tab-Länge beim Griff und Zug im Schnitt-Blatt entlang des Bogens
This commit is contained in:
7 files changed
+163
-17
No files matched your search
@@ -9,6 +9,7 @@ import {
|
||||
gripPolarPoint,
|
||||
openingGripPoint,
|
||||
openingSheetSlide,
|
||||
openingTypedPosition,
|
||||
sheetHeightDrag,
|
||||
wallGripPoints,
|
||||
} from "./gripDrag";
|
||||
@@ -54,6 +55,19 @@ describe("Griff-Zug (Kern)", () => {
|
||||
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();
|
||||
// [144] Bogenwand im Schnitt: die Öffnungsmitte folgt dem Blatt-Delta auf dem Bogen (Bogenlänge > Blatt-Weg).
|
||||
const arc = { ...wall, bulge: 1 };
|
||||
const s = openingSheetSlide(arc, { position: 3, width: 1 }, { x: 1, y: 0 }, 0.4)!;
|
||||
expect(s.du).toBeCloseTo(0.4, 6);
|
||||
expect(openingGripPoint(arc, { position: s.position, width: 1 }).x - openingGripPoint(arc, { position: 3, width: 1 }).x).toBeCloseTo(0.4, 6);
|
||||
expect(s.position - 3).toBeGreaterThan(0.4);
|
||||
});
|
||||
|
||||
it("[144] getippte Länge an der Bogenwand = Bogenlänge ab der Lage beim Greifen", () => {
|
||||
const dir = { x: 1, y: 0 };
|
||||
const a = { x: 0, y: 0 };
|
||||
expect(openingTypedPosition(2, 1.5, a, { x: 1.5, y: 0 }, dir)).toBe(3.5);
|
||||
expect(openingTypedPosition(2, 1.5, a, { x: -1.5, y: 0.1 }, dir)).toBe(0.5);
|
||||
});
|
||||
|
||||
it("Wand-Griffe und koinzidente Ecken", () => {
|
||||
|
||||
@@ -104,17 +104,28 @@ export function openingGripPoint(w: Pick<Wall, "start" | "end" | "bulge">, op: P
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* [144] Getippte Länge beim Griff-Zug einer Öffnung in einer Bogenwand: neue `position` = Lage beim Greifen
|
||||
* `pos0` ± `length` als BOGENLÄNGE (nicht entlang der Sehne). Richtung aus dem Zielpunkt `pt` des
|
||||
* Feld-Controllers relativ zum Bezug `anchor`, gemessen an der Wandrichtung `wallDir`.
|
||||
*/
|
||||
export function openingTypedPosition(pos0: number, length: number, anchor: Vec2, pt: Vec2, wallDir: Vec2): number {
|
||||
const along = (pt.x - anchor.x) * wallDir.x + (pt.y - anchor.y) * wallDir.y;
|
||||
return pos0 + (along < 0 ? -length : length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Öffnung im Schnitt-Blatt waagrecht ziehen: Blatt-Delta `du` (gesamt, entlang `uAxis`) → neue `position`
|
||||
* und das wirksame Delta (nach dem Klemmen); null, wenn die Wand fast quer zur Schnittlinie steht.
|
||||
* Bogenwand ([144]): `position` = Bogenlänge, die Öffnungsmitte folgt dem Delta auf dem Bogen.
|
||||
*/
|
||||
export function openingSheetSlide(
|
||||
w: Pick<Wall, "start" | "end">,
|
||||
w: Pick<Wall, "start" | "end" | "bulge">,
|
||||
op: Pick<Opening, "position" | "width">,
|
||||
uAxis: Vec2,
|
||||
du: number,
|
||||
): { position: number; du: number } | null {
|
||||
const f = core().grip_opening_slide_sheet(w.start.x, w.start.y, w.end.x, w.end.y, uAxis.x, uAxis.y, op.position, op.width, du);
|
||||
const f = core().grip_opening_slide_sheet(w.start.x, w.start.y, w.end.x, w.end.y, w.bulge ?? 0, uAxis.x, uAxis.y, op.position, op.width, du);
|
||||
return f.length ? { position: f[0], du: f[1] } : null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user