Merge branch 'worktree-agent-ab029230363ec44f6' into claude/practical-noether-1hb2s1
# Conflicts: # TODO.md # src-tauri/core/src/cmd_transform.rs # src/plan/__golden__/komplex-ansicht-ansicht-sued.txt # src/plan/__golden__/komplex-grundriss-eg-100.txt # src/plan/__golden__/komplex-grundriss-eg-50.txt # src/plan/__golden__/komplex-grundriss-og-50.txt # src/state/projectSlice.ts
This commit is contained in:
51 files changed
+1304
-231
No files matched your search
+1
-1
@@ -70,7 +70,7 @@ export { cmdMutation } from "./document";
|
||||
export type { EntityCollection, EntityOf, ProjectMutation } from "./opsBuild";
|
||||
export { EMPTY_MEMBERSHIP, containingGroupId, expandToGroups, isInsideActiveGroup, transitiveMembership } from "../model/groups";
|
||||
export type { GroupMembership, MemberKind } from "../model/groups";
|
||||
export { drawingVertices, gripPt, openEdges, polylineEdgeGrips, ringEdges } from "../geometry/grips";
|
||||
export { arcApex, drawingVertices, gripPt, openEdges, polylineEdgeGrips, ringEdges } from "../geometry/grips";
|
||||
export { verticalExtents } from "../geometry/grips";
|
||||
export type { VerticalExtent } from "../geometry/grips";
|
||||
export type { GripRequest, RingKind } from "../geometry/grips";
|
||||
|
||||
+14
-3
@@ -48,6 +48,8 @@ export type GripRequest =
|
||||
| { op: "ringInsert"; kind: RingKind; id: string; seg: number; pt: P }
|
||||
| { op: "ringDelete"; kind: RingKind; id: string; index: number }
|
||||
| { op: "ringTidy"; kind: RingKind; id: string; index: number; tol?: number }
|
||||
// [191] Bogen-Scheitel einer Umriss-Kante (Decke, Raum, Dach samt Höfen; `seg` wie bei `ringInsert`).
|
||||
| { op: "ringArc"; kind: "roof" | "ceiling" | "room"; id: string; seg: number; pt: P }
|
||||
// [151] Parameter-Griff einer Podesttreppe (Kern `grip_drag::stair_param_drag`).
|
||||
| { op: "stairParam"; id: string; index: number; pt: P }
|
||||
| { op: "excavationEdge"; id: string; a: number; b: number; delta: P }
|
||||
@@ -117,9 +119,18 @@ function edges(verts: readonly Vec2[], closed: boolean, bulge: readonly number[]
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Geschlossener Ring → Kanten-Griffe mit Aussennormale (vom Eckpunkt-Mittel weg), inkl. Schlusskante. */
|
||||
export function ringEdges(verts: readonly Vec2[], owner: Owner): EdgeGrip[] {
|
||||
return edges(verts, true, null, owner);
|
||||
/**
|
||||
* Geschlossener Ring → Kanten-Griffe mit Aussennormale (vom Eckpunkt-Mittel weg), inkl. Schlusskante.
|
||||
* [191] `bulge` (je Kante): Bogenkanten haben keinen Kanten-Griff (sie haben ihren Scheitel-Griff).
|
||||
*/
|
||||
export function ringEdges(verts: readonly Vec2[], owner: Owner, bulge?: readonly number[]): EdgeGrip[] {
|
||||
return edges(verts, true, bulge ?? null, owner);
|
||||
}
|
||||
|
||||
/** [191] Scheitel (Bogenmitte) der Kante a → b mit `bulge`; gerade: Kantenmitte. */
|
||||
export function arcApex(a: Vec2, b: Vec2, bulge: number | undefined): Vec2 {
|
||||
const k = Number.isFinite(bulge) ? (bulge as number) / 2 : 0;
|
||||
return { x: (a.x + b.x) / 2 - (b.y - a.y) * k, y: (a.y + b.y) / 2 + (b.x - a.x) * k };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -130,6 +130,8 @@ export interface RoomAreaOptions {
|
||||
* dem SIA-416-Grenzwert, die nicht zur anrechenbaren Fläche zählen. Default 0.
|
||||
*/
|
||||
deduction?: number;
|
||||
/** [191] Bögen je Kante (`Room.boundaryBulge`): Fläche und Umfang exakt. */
|
||||
bulge?: readonly number[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +143,7 @@ export function evaluateRoom(
|
||||
category: SiaCategory,
|
||||
options: RoomAreaOptions = {},
|
||||
): RoomAreaResult {
|
||||
const r = core().room_evaluate(new FlatWriter().pts(polygon).done(), options.deduction ?? 0);
|
||||
const r = core().room_evaluate(new FlatWriter().pts(polygon).done(), options.deduction ?? 0, Float64Array.from(options.bulge ?? []));
|
||||
return {
|
||||
grossArea: r[0],
|
||||
netArea: r[1],
|
||||
|
||||
@@ -58,8 +58,6 @@ function arcPts(c: Vec2, r: number, a0: number, a1: number, n: number): Vec2[] {
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Kreis als Polygon (n Ecken). */
|
||||
const circlePts = (c: Vec2, r: number, n: number): Vec2[] => arcPts(c, r, 0, 2 * Math.PI, n).slice(0, n);
|
||||
|
||||
const textDoc = (lines: { text: string; bold?: boolean; sizePt?: number; italic?: boolean }[], align: "left" | "center" = "left"): RichTextDoc => ({
|
||||
version: 1,
|
||||
@@ -393,32 +391,49 @@ door("dg-t2", "dg-iw-y6", "mk-tu-schiebe", 3.0, 0.9, 2.0);
|
||||
const ERKER_C = P(15, 5);
|
||||
/** Ursprung des 2D-Details (abseits des Geländes). */
|
||||
const DETAIL_X = 60;
|
||||
/** Umriss bis Aussenkante: Haupthaus, Erker (Halbkreis r = 2 + 0.195), optional Anbau. */
|
||||
function slabOutline(withErker: boolean, withAnbau: boolean): Vec2[] {
|
||||
/** Bulge eines Bogens mit Öffnungswinkel `sweep` (Bogenmass), Scheitel rechts der Kante (aussen im Gegenuhrzeigersinn). */
|
||||
const bulgeRight = (sweep: number) => -Math.tan(sweep / 4);
|
||||
|
||||
/**
|
||||
* Umriss bis Aussenkante: Haupthaus, Erker (Halbkreis r = 2 + 0.195 als echter Bogen, [191]), optional Anbau.
|
||||
* `outlineBulge` je Kante; ohne Erker ohne Bögen.
|
||||
*/
|
||||
function slabOutline(withErker: boolean, withAnbau: boolean): { outline: Vec2[]; outlineBulge?: number[] } {
|
||||
const o = 15 + HA;
|
||||
const pts: Vec2[] = [P(-HA, -HA), P(o, -HA)];
|
||||
const bulge: number[] = [0, 0];
|
||||
if (withErker) {
|
||||
const r = 2 + HA;
|
||||
const dy = Math.sqrt(r * r - HA * HA);
|
||||
const a0 = Math.atan2(-dy, HA);
|
||||
pts.push(...arcPts(ERKER_C, r, a0, -a0, 16));
|
||||
pts.push(P(o, ERKER_C.y - dy), P(o, ERKER_C.y + dy));
|
||||
bulge.push(bulgeRight(2 * Math.atan2(dy, HA)), 0);
|
||||
}
|
||||
pts.push(P(o, 10 + HA));
|
||||
if (withAnbau) pts.push(P(10 + HA, 10 + HA), P(10 + HA, 15 + HA), P(5 - HA, 15 + HA), P(5 - HA, 10 + HA));
|
||||
bulge.push(0);
|
||||
if (withAnbau) {
|
||||
pts.push(P(10 + HA, 10 + HA), P(10 + HA, 15 + HA), P(5 - HA, 15 + HA), P(5 - HA, 10 + HA));
|
||||
bulge.push(0, 0, 0, 0);
|
||||
}
|
||||
pts.push(P(-HA, 10 + HA));
|
||||
return pts;
|
||||
return withErker ? { outline: pts, outlineBulge: bulge } : { outline: pts };
|
||||
}
|
||||
|
||||
/** Kreis als Ring aus vier Viertelbögen ([191], Gegenuhrzeigersinn). */
|
||||
const circleRing = (c: Vec2, r: number): { pts: Vec2[]; bulge: number[] } => ({
|
||||
pts: [P(c.x + r, c.y), P(c.x, c.y + r), P(c.x - r, c.y), P(c.x, c.y - r)],
|
||||
bulge: [0, 0, 0, 0].map(() => bulgeRight(Math.PI / 2)),
|
||||
});
|
||||
|
||||
// Treppenlöcher: Wendel UG→EG im Erker, L-Treppe EG→OG im Kern, gerade Treppe OG→DG.
|
||||
const HOLE_SPIRAL = circlePts(P(15.3, 5), 1.2, 24);
|
||||
const HOLE_SPIRAL = circleRing(P(15.3, 5), 1.2);
|
||||
const HOLE_L = [P(8.8, 6.3), P(9.9275, 6.3), P(9.9275, 9.9275), P(7.25, 9.9275), P(7.25, 8.35), P(8.8, 8.35)];
|
||||
const HOLE_OGDG = rect(10.0725, 5.4, 11.15, 8.9);
|
||||
|
||||
const ceilings: NonNullable<Project["ceilings"]> = [
|
||||
{ id: "c-bodenplatte", type: "ceiling", floorId: "ug", categoryCode: "30", outline: slabOutline(true, false), wallTypeId: "", ceilingTypeId: "mk-ct-bodenplatte", top: { mode: "floor", floorId: "ug", offset: 0 }, loadBearing: true },
|
||||
{ id: "c-ug", type: "ceiling", floorId: "ug", categoryCode: "30", outline: slabOutline(true, true), openings: [HOLE_SPIRAL], wallTypeId: "", ceilingTypeId: "mk-ct-platten", loadBearing: true },
|
||||
{ id: "c-eg", type: "ceiling", floorId: "eg", categoryCode: "30", outline: slabOutline(true, true), openings: [HOLE_L], wallTypeId: "", ceilingTypeId: "mk-ct-parkett", loadBearing: true },
|
||||
{ id: "c-og", type: "ceiling", floorId: "og", categoryCode: "30", outline: slabOutline(false, true), openings: [HOLE_OGDG], wallTypeId: "", ceilingTypeId: "mk-ct-parkett", loadBearing: true },
|
||||
{ id: "c-bodenplatte", type: "ceiling", floorId: "ug", categoryCode: "30", ...slabOutline(true, false), wallTypeId: "", ceilingTypeId: "mk-ct-bodenplatte", top: { mode: "floor", floorId: "ug", offset: 0 }, loadBearing: true },
|
||||
{ id: "c-ug", type: "ceiling", floorId: "ug", categoryCode: "30", ...slabOutline(true, true), openings: [HOLE_SPIRAL.pts], openingsBulge: [HOLE_SPIRAL.bulge], wallTypeId: "", ceilingTypeId: "mk-ct-platten", loadBearing: true },
|
||||
{ id: "c-eg", type: "ceiling", floorId: "eg", categoryCode: "30", ...slabOutline(true, true), openings: [HOLE_L], wallTypeId: "", ceilingTypeId: "mk-ct-parkett", loadBearing: true },
|
||||
{ id: "c-og", type: "ceiling", floorId: "og", categoryCode: "30", ...slabOutline(false, true), openings: [HOLE_OGDG], wallTypeId: "", ceilingTypeId: "mk-ct-parkett", loadBearing: true },
|
||||
];
|
||||
|
||||
// ═════════════════════════════════════════════════════════════════════════════
|
||||
@@ -440,7 +455,10 @@ const roofs: NonNullable<Project["roofs"]> = [
|
||||
shape: "sattel", pitchDeg: PITCH, overhang: 0.6, overhangGable: 0.35, ridgeAxis: "y", baseElevation: EAVE_MAIN, thickness: 0.41, roofTypeId: "std-rt-steildach-holz",
|
||||
},
|
||||
{
|
||||
id: "dach-erker", type: "roof", floorId: "og", categoryCode: "31", outline: [P(15 + HA, 5 - 2.2), ...arcPts(ERKER_C, 2 + HA + 0.15, -Math.PI / 2 + 0.09, Math.PI / 2 - 0.09, 14), P(15 + HA, 5 + 2.2)],
|
||||
// [191] Rand als echter Bogen (r = 2.345, ±(90° − 5.2°) um den Erker-Mittelpunkt).
|
||||
id: "dach-erker", type: "roof", floorId: "og", categoryCode: "31",
|
||||
outline: [P(15 + HA, 5 - 2.2), ...[-1, 1].map((k) => P(ERKER_C.x + (2 + HA + 0.15) * Math.cos(k * (Math.PI / 2 - 0.09)), ERKER_C.y + (2 + HA + 0.15) * Math.sin(k * (Math.PI / 2 - 0.09)))), P(15 + HA, 5 + 2.2)],
|
||||
outlineBulge: [0, bulgeRight(Math.PI - 0.18), 0, 0],
|
||||
shape: "flach", pitchDeg: 0, overhang: 0, ridgeAxis: "x", thickness: 0.46, roofTypeId: "mk-rt-flach",
|
||||
// Attika ([148]): Betonbrüstung 50 cm über der Dachhaut.
|
||||
parapetHeight: 0.5, parapetWidth: 0.2, parapetComponentId: "std-c-stahlbeton",
|
||||
|
||||
@@ -99,6 +99,14 @@ export type Ceiling = {
|
||||
* (Poché-Loch + Randlinien) und 3D (Loch im Slab). Fehlt/leer ⇒ Volldecke.
|
||||
*/
|
||||
openings?: Array<Array<Vec2>>;
|
||||
/**
|
||||
* [191] Bögen im Umriss: `outlineBulge[i]` krümmt die Kante `outline[i] → outline[i+1]` (letzte: zum
|
||||
* Start) zum Kreisbogen, `bulge = tan(Öffnungswinkel/4)`, positiv = Scheitel links der Kante (wie
|
||||
* `Wall.bulge`/Polylinien). Fehlt/kürzer/0 = gerade Kante. Ableitungen rechnen über `ring_arc`.
|
||||
*/
|
||||
outlineBulge?: Array<number>;
|
||||
/** [191] Bögen der Aussparungen, je Loch wie `outlineBulge` (Index wie `openings`). */
|
||||
openingsBulge?: Array<Array<number>>;
|
||||
/**
|
||||
* LEGACY-Verweis auf einen Aufbau-Typ aus `wallTypes` (Rückwärtskompatibilität
|
||||
* für Projekte von vor den dedizierten Deckenstilen). Nur wirksam, wenn
|
||||
@@ -3027,6 +3035,13 @@ export type Roof = {
|
||||
* Höfe wirkungslos (Dach wie ohne). Fehlt ⇒ keine Höfe.
|
||||
*/
|
||||
holes?: Array<Array<Vec2>>;
|
||||
/**
|
||||
* [191] Bögen im Umriss je Kante wie `Ceiling.outlineBulge`. Eine Bogenkante bleibt EINE Kante
|
||||
* (Neigung/Giebel aus `edgePitchDeg` gilt für den ganzen Bogen).
|
||||
*/
|
||||
outlineBulge?: Array<number>;
|
||||
/** [191] Bögen der Höfe, je Ring wie `outlineBulge` (Index wie `holes`). */
|
||||
holesBulge?: Array<Array<number>>;
|
||||
/**
|
||||
* Neigung je Umrisskante in Grad. Nummerierung: erst die Kanten von `outline` (Kante i =
|
||||
* Punkt i → i+1, in der gespeicherten Reihenfolge), danach die Kanten der `holes` Ring für
|
||||
@@ -3166,6 +3181,8 @@ export type Room = {
|
||||
* zu boundary[0]).
|
||||
*/
|
||||
boundary: Array<Vec2>;
|
||||
/** [191] Bögen im Umriss je Kante wie `Ceiling.outlineBulge`. */
|
||||
boundaryBulge?: Array<number>;
|
||||
/** Strich-/Füllfarbe des Raums (hex). */
|
||||
color: string;
|
||||
/** Stift-Kopplung von `color` (s. `Component.colorPenId`-Doku). */
|
||||
|
||||
@@ -23,7 +23,7 @@ import { downloadCsv } from "./downloadFile";
|
||||
function roomAreas(rooms: Room[]): { category: Room["siaCategory"]; area: number }[] {
|
||||
return rooms.map((r) => ({
|
||||
category: r.siaCategory,
|
||||
area: evaluateRoom(r.boundary, r.siaCategory).netArea,
|
||||
area: evaluateRoom(r.boundary, r.siaCategory, { bulge: r.boundaryBulge }).netArea,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ export function RoomBalancePanel() {
|
||||
name: roomDisplayName(r),
|
||||
level: floorNameOf(levels, r.floorId),
|
||||
category: r.siaCategory,
|
||||
area: evaluateRoom(r.boundary, r.siaCategory).netArea,
|
||||
area: evaluateRoom(r.boundary, r.siaCategory, { bulge: r.boundaryBulge }).netArea,
|
||||
})),
|
||||
);
|
||||
downloadCsv("flaechenbilanz.csv", csv);
|
||||
@@ -95,7 +95,7 @@ export function RoomBalancePanel() {
|
||||
<div className="balance-section-label">{t("balance.rooms")}</div>
|
||||
<div className="balance-table">
|
||||
{rooms.map((r) => {
|
||||
const res = evaluateRoom(r.boundary, r.siaCategory);
|
||||
const res = evaluateRoom(r.boundary, r.siaCategory, { bulge: r.boundaryBulge });
|
||||
return (
|
||||
<div key={r.id} className="balance-row">
|
||||
<span className="balance-name">{roomDisplayName(r)}</span>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
viewBox -4.2 0 38 18.478
|
||||
bytes 175617
|
||||
bytes 206772
|
||||
circle 4
|
||||
g 1
|
||||
line 521
|
||||
path 2
|
||||
polygon 754
|
||||
polyline 161
|
||||
line 505
|
||||
path 3
|
||||
polygon 1004
|
||||
polyline 165
|
||||
rect 1
|
||||
svg 1
|
||||
text 4
|
||||
hash ebd823ab8ac843c7
|
||||
hash eb6974efb87719d3
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -41.5 0 95 63.6
|
||||
bytes 66337
|
||||
bytes 65810
|
||||
circle 16
|
||||
g 1
|
||||
line 141
|
||||
path 36
|
||||
polygon 91
|
||||
path 37
|
||||
polygon 92
|
||||
polyline 102
|
||||
rect 1
|
||||
svg 1
|
||||
text 115
|
||||
tspan 24
|
||||
hash 1042a774ff09039d
|
||||
hash 68515f761190ee71
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -41.5 0 95 63.6
|
||||
bytes 108411
|
||||
bytes 107526
|
||||
circle 16
|
||||
g 1
|
||||
line 369
|
||||
path 68
|
||||
polygon 212
|
||||
polygon 213
|
||||
polyline 120
|
||||
rect 1
|
||||
svg 1
|
||||
text 115
|
||||
tspan 24
|
||||
hash 8c09c5728a08bbec
|
||||
hash 121ab15920e2ad30
|
||||
@@ -1,5 +1,5 @@
|
||||
viewBox -13.448 0 38.615 33.813
|
||||
bytes 45473
|
||||
bytes 45534
|
||||
circle 14
|
||||
g 1
|
||||
line 116
|
||||
@@ -10,4 +10,4 @@ rect 1
|
||||
svg 1
|
||||
text 87
|
||||
tspan 19
|
||||
hash cfea6b6c1949a5de
|
||||
hash 055018d8c96b5bc2
|
||||
@@ -1,13 +1,13 @@
|
||||
viewBox -12.974 0 37.808 33.406
|
||||
bytes 354615
|
||||
bytes 354336
|
||||
circle 14
|
||||
g 1
|
||||
line 3259
|
||||
path 39
|
||||
path 38
|
||||
polygon 152
|
||||
polyline 167
|
||||
rect 1
|
||||
svg 1
|
||||
text 86
|
||||
tspan 18
|
||||
hash fd034ff22b6b3cbb
|
||||
hash b4ad7e563da6abeb
|
||||
@@ -1,5 +1,5 @@
|
||||
viewBox -13.693 0 38.86 33.813
|
||||
bytes 42016
|
||||
bytes 42044
|
||||
circle 16
|
||||
g 1
|
||||
line 98
|
||||
@@ -10,4 +10,4 @@ rect 1
|
||||
svg 1
|
||||
text 71
|
||||
tspan 15
|
||||
hash 914de604bff9969a
|
||||
hash 17f978c98ef86dfe
|
||||
@@ -1,5 +1,5 @@
|
||||
viewBox -13.693 0 38.527 33.406
|
||||
bytes 47974
|
||||
bytes 47996
|
||||
circle 16
|
||||
g 1
|
||||
line 94
|
||||
@@ -10,4 +10,4 @@ rect 1
|
||||
svg 1
|
||||
text 71
|
||||
tspan 15
|
||||
hash a4878f4a1e60006c
|
||||
hash b6b4ca860e3563c6
|
||||
@@ -1,17 +1,17 @@
|
||||
meshes [1962]
|
||||
meshes[].color [3] x1962
|
||||
meshes[].indices [108] x6
|
||||
meshes[].indices [11376]
|
||||
meshes[].indices [1152]
|
||||
meshes[].indices [1248] x3
|
||||
meshes[].indices [12960]
|
||||
meshes[].indices [144] x55
|
||||
meshes[].indices [156642]
|
||||
meshes[].indices [1584]
|
||||
meshes[].indices [1716]
|
||||
meshes[].indices [180]
|
||||
meshes[].indices [192] x3
|
||||
meshes[].indices [2376]
|
||||
meshes[].indices [31104]
|
||||
meshes[].indices [348] x6
|
||||
meshes[].indices [360]
|
||||
meshes[].indices [36] x1861
|
||||
meshes[].indices [396]
|
||||
meshes[].indices [564] x2
|
||||
@@ -23,19 +23,20 @@ meshes[].indices [9288]
|
||||
meshes[].indices [96] x6
|
||||
meshes[].positions [1044] x6
|
||||
meshes[].positions [108] x30
|
||||
meshes[].positions [1188]
|
||||
meshes[].positions [120]
|
||||
meshes[].positions [180] x10
|
||||
meshes[].positions [16428]
|
||||
meshes[].positions [180] x9
|
||||
meshes[].positions [1890] x3
|
||||
meshes[].positions [216]
|
||||
meshes[].positions [24] x1829
|
||||
meshes[].positions [252] x2
|
||||
meshes[].positions [264]
|
||||
meshes[].positions [288] x8
|
||||
meshes[].positions [306] x3
|
||||
meshes[].positions [324] x6
|
||||
meshes[].positions [4128]
|
||||
meshes[].positions [4746]
|
||||
meshes[].positions [576]
|
||||
meshes[].positions [6096]
|
||||
meshes[].positions [7050]
|
||||
meshes[].positions [72] x2
|
||||
meshes[].positions [78837]
|
||||
@@ -45,31 +46,31 @@ meshes[].positions [864]
|
||||
roofLayers [59]
|
||||
roofLayers[].color [3] x59
|
||||
roofLayers[].normal [3] x59
|
||||
roofLayers[].polygon [17] x3
|
||||
roofLayers[].polygon [105] x3
|
||||
roofLayers[].polygon [4] x50
|
||||
roofLayers[].polygon [5] x6
|
||||
roofLayers[].polygon[] [3] x281
|
||||
roofLayers[].polygon[] [3] x545
|
||||
slabs [70]
|
||||
slabs[].color [3] x70
|
||||
slabs[].outline [104] x4
|
||||
slabs[].outline [124] x5
|
||||
slabs[].outline [12]
|
||||
slabs[].outline [21] x4
|
||||
slabs[].outline [22] x5
|
||||
slabs[].outline [24]
|
||||
slabs[].outline [41] x5
|
||||
slabs[].outline [26] x5
|
||||
slabs[].outline [270] x5
|
||||
slabs[].outline [4] x49
|
||||
slabs[].outline [55] x5
|
||||
slabs[].outline[] [2] x906
|
||||
walls [1492]
|
||||
walls[].arcCenter [2] x832
|
||||
walls[].color [3] x1492
|
||||
walls[].end [2] x1492
|
||||
walls[].endCut [4] x1105
|
||||
walls[].holes [1] x90
|
||||
slabs[].outline[] [2] x2748
|
||||
walls [1273]
|
||||
walls[].arcCenter [2] x613
|
||||
walls[].color [3] x1273
|
||||
walls[].end [2] x1273
|
||||
walls[].endCut [4] x869
|
||||
walls[].holes [1] x88
|
||||
walls[].holes [2] x25
|
||||
walls[].holes [3] x14
|
||||
walls[].layers [0] x1492
|
||||
walls[].start [2] x1492
|
||||
walls[].startCut [4] x1107
|
||||
walls[].layers [0] x1273
|
||||
walls[].start [2] x1273
|
||||
walls[].startCut [4] x873
|
||||
walls[].topDrop [2] x115
|
||||
walls[].topPlane [3] x271
|
||||
hash d00c532d2d56884e
|
||||
hash b2c8483fd14d95a1
|
||||
@@ -401,6 +401,8 @@ export interface ProjectSlice {
|
||||
insertRingVertex: (kind: RingKind, id: string, seg: number, pt: Vec2, coalesceKey?: string) => void;
|
||||
/** [26] Ecke löschen (mind. 3 bleiben); ein Undo-Schritt. */
|
||||
deleteRingVertex: (kind: RingKind, id: string, index: number) => void;
|
||||
/** [191] Bogen-Scheitel der Kante `seg` (Dach: flacher Index) ziehen: setzt den Bulge über die Pfeilhöhe. */
|
||||
setRingArc: (kind: "roof" | "ceiling" | "room", id: string, seg: number, pt: Vec2, coalesceKey?: string) => void;
|
||||
/** [26] Nach dem Ziehen: Ecke auf Nachbar bzw. Gerade zwischen den Nachbarn entfällt. */
|
||||
tidyRingVertex: (kind: RingKind, id: string, index: number, coalesceKey?: string, tol?: number) => void;
|
||||
moveExcavationEdge: (id: string, aIndex: number, bIndex: number, delta: Vec2) => void;
|
||||
@@ -1291,6 +1293,7 @@ export function createProjectSlice(
|
||||
applyGrip(kind === "contours" ? { op: "contourInsert", id, seg, pt: gripPt(pt) } : kind === "polyline" ? { op: "insertPoint", id, seg, pt: gripPt(pt) } : { op: "ringInsert", kind, id, seg, pt: gripPt(pt) }, coalesceKey),
|
||||
deleteRingVertex: (kind, id, index) =>
|
||||
kind === "contours" ? undefined : applyGrip(kind === "polyline" ? { op: "deletePoint", id, index } : { op: "ringDelete", kind, id, index }),
|
||||
setRingArc: (kind, id, seg, pt, coalesceKey) => applyGrip({ op: "ringArc", kind, id, seg, pt: gripPt(pt) }, coalesceKey ?? `ringArc:${kind}:${id}:${seg}`),
|
||||
tidyRingVertex: (kind, id, index, coalesceKey, tol) =>
|
||||
applyGrip({ op: "ringTidy", kind, id, index, ...(tol != null ? { tol } : {}) }, coalesceKey),
|
||||
tidySectionLine: (id, coalesceKey, tol) => applyGrip({ op: "sectionLineTidy", id, ...(tol != null ? { tol } : {}) }, coalesceKey),
|
||||
|
||||
+55
-24
@@ -12,9 +12,9 @@ import type { RingKind, SheetHeightKind } from "../core";
|
||||
import { t } from "../i18n";
|
||||
import type { Ceiling, Drawing2D, EdgeGrip, Excavation, Project, Roof, Room, Vec2, Wall } from "../model/types";
|
||||
import { wallTypeThickness } from "../model/types";
|
||||
import { bulgeArcPoints, drawingVertices, surfaceOpeningGripPatch, surfaceOpeningGrips, surfaceOpeningInfo, wallArcBand } from "../core";
|
||||
import { bulgeArcPoints, bulgePolylinePoints, drawingVertices, surfaceOpeningGripPatch, surfaceOpeningGrips, surfaceOpeningInfo, wallArcBand } from "../core";
|
||||
import { gripDrawingIdsFor } from "./gripLimits";
|
||||
import { openEdges, polylineEdgeGrips, ringEdges } from "../core";
|
||||
import { arcApex, openEdges, polylineEdgeGrips, ringEdges } from "../core";
|
||||
import {
|
||||
coincidentGripPoints,
|
||||
excavationGripPoints,
|
||||
@@ -239,6 +239,8 @@ export function useGripEditing(opts: {
|
||||
/** [26] Einfüge-Griff (Raute) in Kante `insertSeg` des Umriss-Rings `ring` (Dach: flacher Index). */
|
||||
insertSeg?: number;
|
||||
ring?: { kind: RingKind; id: string };
|
||||
/** [191] Scheitel-Griff der Bogenkante `arcSeg` (flacher Index wie `insertSeg`). */
|
||||
arcSeg?: number;
|
||||
}
|
||||
const gripOwners: GripOwner[] = [];
|
||||
// [ersterFlachIndex, letzterFlachIndex] DESSELBEN Elements — für die Anker-
|
||||
@@ -258,10 +260,11 @@ export function useGripEditing(opts: {
|
||||
modelEditable && !!selectedRoof && !selectedRoof.locked && !!opts.moveRoofVertex && !selectedCeiling && !selectedRoom &&
|
||||
!selectedExcavation && !selectedTree && !selectedSectionLine && effectiveDrawingIds.length === 0 && selectedWallIds.length === 0;
|
||||
/** Ringe des Dachs in der Reihenfolge des flachen Index (Umriss, dann Höfe) samt Start-Index. */
|
||||
const roofRings = (r: Roof): { pts: Vec2[]; off: number }[] => {
|
||||
const roofRings = (r: Roof): { pts: Vec2[]; off: number; bulge?: number[] }[] => {
|
||||
let off = 0;
|
||||
return [r.outline, ...(r.holes ?? [])].map((pts) => {
|
||||
const ring = { pts, off };
|
||||
const bulges = [r.outlineBulge, ...(r.holes ?? []).map((_, i) => r.holesBulge?.[i])];
|
||||
return [r.outline, ...(r.holes ?? [])].map((pts, i) => {
|
||||
const ring = { pts, off, bulge: bulges[i] };
|
||||
off += pts.length;
|
||||
return ring;
|
||||
});
|
||||
@@ -361,22 +364,37 @@ export function useGripEditing(opts: {
|
||||
*/
|
||||
const pushInsertGrips = (
|
||||
out: Vec2[],
|
||||
rings: { pts: Vec2[]; off: number }[],
|
||||
rings: { pts: Vec2[]; off: number; bulge?: number[] }[],
|
||||
ring: { kind: RingKind; id: string },
|
||||
owner: { drawingId?: string } = {},
|
||||
keep?: (seg: number) => boolean,
|
||||
) => {
|
||||
const start = out.length;
|
||||
for (const { pts, off } of rings) {
|
||||
for (const { pts, off, bulge } of rings) {
|
||||
pts.forEach((a, i) => {
|
||||
if (keep && !keep(off + i)) return;
|
||||
const b = pts[(i + 1) % pts.length];
|
||||
out.push({ x: a.x + (b.x - a.x) * INSERT_AT, y: a.y + (b.y - a.y) * INSERT_AT, insert: true } as Vec2);
|
||||
// [191] Bogenkante: die Raute sitzt auf dem Bogen (Viertel des Teilbogens bis zum Scheitel).
|
||||
const q = bulge?.[i] ? arcApex(a, arcApex(a, b, bulge[i]), Math.tan(Math.atan(bulge[i]) / 2)) : { x: a.x + (b.x - a.x) * INSERT_AT, y: a.y + (b.y - a.y) * INSERT_AT };
|
||||
out.push({ ...q, insert: true } as Vec2);
|
||||
gripOwners.push({ ...owner, localIndex: -1, insertSeg: off + i, ring });
|
||||
});
|
||||
}
|
||||
for (let i = start; i < out.length; i++) gripOwnerRange.push([start, out.length - 1]);
|
||||
};
|
||||
/** [191] Scheitel-Griffe der Bogenkanten (Ziehen ändert die Pfeilhöhe; auf die Sehne gezogen = gerade). */
|
||||
const pushArcGrips = (out: Vec2[], rings: { pts: Vec2[]; off: number; bulge?: number[] }[], ring: { kind: RingKind; id: string }) => {
|
||||
const start = out.length;
|
||||
for (const { pts, off, bulge } of rings) {
|
||||
pts.forEach((a, i) => {
|
||||
const b = bulge?.[i];
|
||||
if (!b || !Number.isFinite(b) || Math.abs(b) < 1e-9) return;
|
||||
out.push(arcApex(a, pts[(i + 1) % pts.length], b));
|
||||
gripOwners.push({ localIndex: -1, arcSeg: off + i, ring });
|
||||
});
|
||||
}
|
||||
for (let i = start; i < out.length; i++) gripOwnerRange.push([start, out.length - 1]);
|
||||
};
|
||||
|
||||
const grips: Vec2[] = (() => {
|
||||
// Öffnung (Fenster/Tür): EIN Mittelpunkt-Griff auf der Wandachse. Ziehen
|
||||
@@ -433,6 +451,7 @@ export function useGripEditing(opts: {
|
||||
pts.forEach((q, i) => { out.push(q); gripOwners.push({ localIndex: off + i }); gripOwnerRange.push([off, off + pts.length - 1]); });
|
||||
}
|
||||
pushInsertGrips(out, roofRings(selectedRoof), { kind: "roof", id: selectedRoof.id });
|
||||
pushArcGrips(out, roofRings(selectedRoof), { kind: "roof", id: selectedRoof.id });
|
||||
return out;
|
||||
}
|
||||
// [193] Höhenlinien: jeder Punkt ein Griff (flacher Index über alle Linien), dazu je Segment eine Einfüge-Raute.
|
||||
@@ -469,7 +488,11 @@ export function useGripEditing(opts: {
|
||||
if (modelEditable && selectedCeiling && effectiveDrawingIds.length === 0 && selectedWallIds.length === 0) {
|
||||
const pts = [...selectedCeiling.outline];
|
||||
pts.forEach((_, i) => { gripOwners.push({ localIndex: i }); gripOwnerRange.push([0, pts.length - 1]); });
|
||||
if (!selectedCeiling.locked) pushInsertGrips(pts, [{ pts: selectedCeiling.outline, off: 0 }], { kind: "ceiling", id: selectedCeiling.id });
|
||||
if (!selectedCeiling.locked) {
|
||||
const rings = [{ pts: selectedCeiling.outline, off: 0, bulge: selectedCeiling.outlineBulge }];
|
||||
pushInsertGrips(pts, rings, { kind: "ceiling", id: selectedCeiling.id });
|
||||
pushArcGrips(pts, rings, { kind: "ceiling", id: selectedCeiling.id });
|
||||
}
|
||||
return pts;
|
||||
}
|
||||
// Raum: die Umriss-Vertices als Griffe (nur bei genau einem gewählten Raum).
|
||||
@@ -482,7 +505,11 @@ export function useGripEditing(opts: {
|
||||
) {
|
||||
const pts = [...selectedRoom.boundary];
|
||||
pts.forEach((_, i) => { gripOwners.push({ localIndex: i }); gripOwnerRange.push([0, pts.length - 1]); });
|
||||
if (!selectedRoom.locked) pushInsertGrips(pts, [{ pts: selectedRoom.boundary, off: 0 }], { kind: "room", id: selectedRoom.id });
|
||||
if (!selectedRoom.locked) {
|
||||
const rings = [{ pts: selectedRoom.boundary, off: 0, bulge: selectedRoom.boundaryBulge }];
|
||||
pushInsertGrips(pts, rings, { kind: "room", id: selectedRoom.id });
|
||||
pushArcGrips(pts, rings, { kind: "room", id: selectedRoom.id });
|
||||
}
|
||||
return pts;
|
||||
}
|
||||
// Mehrfachauswahl (Regel- UND Standardfall): je gewähltem 2D-Element bzw.
|
||||
@@ -598,8 +625,8 @@ export function useGripEditing(opts: {
|
||||
// ringEdges/openEdges/polylineEdgeGrips: Kern (`geometry/grips.ts`, `grips.rs`).
|
||||
// [26] Dach: Kanten von Umriss und Höfen, Indizes im flachen Ecken-Index.
|
||||
if (roofGripsOn && selectedRoof) {
|
||||
return roofRings(selectedRoof).flatMap(({ pts, off }) =>
|
||||
ringEdges(pts, {}).map((e) => ({ ...e, aIndex: e.aIndex + off, bIndex: e.bIndex + off })),
|
||||
return roofRings(selectedRoof).flatMap(({ pts, off, bulge }) =>
|
||||
ringEdges(pts, {}, bulge ?? []).map((e) => ({ ...e, aIndex: e.aIndex + off, bIndex: e.bIndex + off })),
|
||||
);
|
||||
}
|
||||
if (modelEditable && selectedExcavation && !selectedCeiling && effectiveDrawingIds.length === 0 && selectedWallIds.length === 0) {
|
||||
@@ -607,7 +634,7 @@ export function useGripEditing(opts: {
|
||||
}
|
||||
// Decke: geschlossener Ring aus dem Umriss (Auswahl exklusiv, wie bei grips).
|
||||
if (modelEditable && selectedCeiling && effectiveDrawingIds.length === 0 && selectedWallIds.length === 0) {
|
||||
return ringEdges(selectedCeiling.outline, {});
|
||||
return ringEdges(selectedCeiling.outline, {}, selectedCeiling.outlineBulge ?? []);
|
||||
}
|
||||
// Raum: geschlossener Ring aus dem Umriss.
|
||||
if (
|
||||
@@ -617,7 +644,7 @@ export function useGripEditing(opts: {
|
||||
selectedWallIds.length === 0 &&
|
||||
!selectedCeiling
|
||||
) {
|
||||
return ringEdges(selectedRoom.boundary, {});
|
||||
return ringEdges(selectedRoom.boundary, {}, selectedRoom.boundaryBulge ?? []);
|
||||
}
|
||||
const out: EdgeGrip[] = [];
|
||||
for (const id of gripDrawingIds) {
|
||||
@@ -825,7 +852,7 @@ export function useGripEditing(opts: {
|
||||
// Wand/Öffnung/Treppe haben keine Polygon-Nachbarn → null.
|
||||
const resolvePolygonRing = (index: number): { pts: Vec2[]; index: number; closed: boolean } | null => {
|
||||
const owner = gripOwners[index];
|
||||
if (owner?.insertSeg != null) return null;
|
||||
if (owner?.insertSeg != null || owner?.arcSeg != null) return null;
|
||||
if (roofGripsOn && selectedRoof && !owner?.drawingId && !owner?.wallId) {
|
||||
const ring = roofRings(selectedRoof).find((rg) => index >= rg.off && index < rg.off + rg.pts.length);
|
||||
return ring ? { pts: ring.pts, index: index - ring.off, closed: true } : null;
|
||||
@@ -1072,6 +1099,11 @@ export function useGripEditing(opts: {
|
||||
return;
|
||||
}
|
||||
const ins = gripOwners[index];
|
||||
// [191] Scheitel-Griff einer Bogenkante: Bulge live, ein Undo-Schritt je Zug.
|
||||
if (modelEditable && ins?.arcSeg != null && ins.ring && ins.ring.kind !== "excavation" && ins.ring.kind !== "polyline") {
|
||||
storeState().setRingArc(ins.ring.kind, ins.ring.id, ins.arcSeg, pt);
|
||||
return;
|
||||
}
|
||||
if (modelEditable && ins?.insertSeg != null && ins.ring) {
|
||||
const key = `ringInsert:${ins.ring.id}:${Date.now()}`;
|
||||
ringDragRef.current = { ...ins.ring, key, midIndex: index, vertex: ins.insertSeg + 1 };
|
||||
@@ -1205,22 +1237,21 @@ export function useGripEditing(opts: {
|
||||
return [];
|
||||
}
|
||||
const pa = pendingAreaGripRef.current;
|
||||
// [191] Bogenkanten in der Vorschau als Bogen (Bulge bleibt beim Eck-Zug).
|
||||
if (pa?.kind === "roof" && selectedRoof) {
|
||||
return roofRings(selectedRoof).map(({ pts, off }) => ({
|
||||
return roofRings(selectedRoof).map(({ pts, off, bulge }) => ({
|
||||
kind: "poly" as const,
|
||||
pts: pts.map((q, i) => (off + i === pa.index ? pa.pt : q)),
|
||||
pts: bulgePolylinePoints(pts.map((q, i) => (off + i === pa.index ? pa.pt : q)), bulge, true),
|
||||
closed: true,
|
||||
}));
|
||||
}
|
||||
if (pa) {
|
||||
const ring =
|
||||
pa.kind === "room"
|
||||
? (project.rooms ?? []).find((r) => r.id === pa.id)?.boundary
|
||||
: pa.kind === "excavation"
|
||||
? selectedExcavation?.outline
|
||||
: (project.ceilings ?? []).find((c) => c.id === pa.id)?.outline;
|
||||
const room = pa.kind === "room" ? (project.rooms ?? []).find((r) => r.id === pa.id) : undefined;
|
||||
const ceiling = pa.kind === "ceiling" ? (project.ceilings ?? []).find((c) => c.id === pa.id) : undefined;
|
||||
const ring = room?.boundary ?? (pa.kind === "excavation" ? selectedExcavation?.outline : ceiling?.outline);
|
||||
if (!ring) return [];
|
||||
return [{ kind: "poly", pts: ring.map((q, i) => (i === pa.index ? pa.pt : q)), closed: true }];
|
||||
const bulge = room?.boundaryBulge ?? ceiling?.outlineBulge;
|
||||
return [{ kind: "poly", pts: bulgePolylinePoints(ring.map((q, i) => (i === pa.index ? pa.pt : q)), bulge, true), closed: true }];
|
||||
}
|
||||
const pw = pendingWallGripRef.current;
|
||||
if (pw) {
|
||||
|
||||
Reference in new issue
Block a user