[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
@@ -520,6 +520,20 @@ truck (`trucksolid`) bleibt eigenes WASM-Modul (Panic-Isolation), wird vom Kern
|
||||
96–138 µs, Zeichnung (Position 10 000) 150–300 → 160–390 µs, Dach 5 → 30–60 µs (TS merkte sich die Dachgeometrie je
|
||||
Objekt; im Kern ist sie für die letzten 16 Dächer gemerkt, der Rest ist die JSON-Übergabe), Griff-Schritt samt Objekt-Info
|
||||
1,6–2,6 ms → 1,5–2,4 ms; je Darstellung also ~0,05 ms mehr. Nicht in der Tauri-App geprüft.
|
||||
**Höhen und Wand-Bänder (29.10.)** — zu (5)/(6): die 3D-Griffe (`Wasm3DViewport`: Griff-Lagen, Arbeitsebene beim Ziehen)
|
||||
holen UK/OK von Wänden und Decken über die Wurzel-Abfrage `verticalExtents` (`selection_info.rs`, dieselbe Rechnung wie die
|
||||
Objekt-Info; Fassade `verticalExtents` in `geometry/grips.ts`, ganze Elemente, auch gerade gezogene Fassungen). Gleichheit
|
||||
(einmalig, Test gelöscht): 480 000 Höhen über 20 000 Zufallsfälle (Bindungen UK/OK, fehlende Geschosse/Typen, NaN/±∞/null
|
||||
in den Elementen) gleich `wallVerticalExtent`/`ceilingVerticalExtent` (−0 kommt als 0). Gelöscht, weil ohne Aufrufer:
|
||||
`lineIntersect`/`clippedBand`/`Line`/`wallBand` (`model/geometry.ts`, `wallCorners` rechnet das Band selbst),
|
||||
`stairVerticalExtent`/`nextFloorAbove` (`model/wall.ts`), `openingGapQuad`, `roofBBox`, `stairBBox` samt Bindung
|
||||
`stair_bbox_flat`, `outlineBBox`, `localToLv95`, `roofEdgeList` (Kantenliste nur noch im Kern; Test über `deriveSelection`;
|
||||
`setRoofEdge` zählt die Kanten direkt). Bleibt in TS: `wallVerticalExtent`/`ceilingVerticalExtent`/`columnVerticalExtent`/
|
||||
`openingVerticalExtent` nur noch für die Plan-Ableitung (`toSection`, `voids`, `sectionOpenings`, `toElevation` — fallen mit
|
||||
deren Port; im Kern gibt es die Regeln doppelt: roh in `selection_info.rs`, typisiert in `model/helpers.rs`, beim Plan-Port
|
||||
zusammenlegen); `wallCorners` (Plan-Treffer `planHitTest`, Werkzeug-Vorschau, Griff-Vorschau, `voids`, STEP-Export — ein
|
||||
Kern-Aufruf je Wand wäre teurer als die vier Punkte) und `wallReferenceOffset` (Fang, `geometry/opening.ts`). Nicht in
|
||||
der Tauri-App geprüft (3D-Griffe nur über e2e im Browser).
|
||||
- ◐ **S4 Typen aus Rust**: `types.ts` wird aus den Rust-Strukturen erzeugt (ts-rs); Datei-I/O (`projectFormat`, Migration, IFC/DXF/
|
||||
STEP-Ex- und -Import) im Kern.
|
||||
**Typen (28.10.):** Das Rust-Modell (`core/src/model/generated.rs`, `manual.rs`) ist die Quelle; ts-rs 12 (MIT, nur
|
||||
|
||||
@@ -114,6 +114,11 @@ pub fn run_root(root: &serde_json::Map<String, serde_json::Value>, name: &str, t
|
||||
let ids: Vec<String> = serde_json::from_str(text).map_err(|e| format!("drawingBBoxes: {e}"))?;
|
||||
Ok(crate::selection_info::drawing_bboxes(root, &ids).into_string())
|
||||
}
|
||||
// UK/OK von Wänden und Decken (3D-Griffe): `text` = `{walls: […], ceilings: […]}` (ganze Elemente).
|
||||
"verticalExtents" => {
|
||||
let a: crate::selection_info::ExtentArgs = serde_json::from_str(text).map_err(|e| format!("verticalExtents: {e}"))?;
|
||||
Ok(crate::selection_info::vertical_extents(root, &a).into_string())
|
||||
}
|
||||
_ => Err(format!("Unbekannte Wurzel-Abfrage: {name}")),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,6 +337,35 @@ fn vertical_extent(root: &Map<String, Value>, el: &Value) -> (f64, f64) {
|
||||
(zb, zt)
|
||||
}
|
||||
|
||||
/// (UK, OK) einer Decke (`ceilingVerticalExtent`): OK aus `top` sonst Geschoss-Oberkante (Basis + Höhe), UK aus
|
||||
/// `bottom` sonst OK − `thickness` (die Decke wächst nach unten).
|
||||
fn ceiling_extent(root: &Map<String, Value>, c: &Value, thickness: f64) -> (f64, f64) {
|
||||
let floor_top = level(root, field(c, "floorId")).map_or(0.0, |f| num_or(field(f, "baseElevation"), 0.0) + num_or(field(f, "floorHeight"), 0.0));
|
||||
let zt = anchor(root, field(c, "top")).unwrap_or(floor_top);
|
||||
let zb = anchor(root, field(c, "bottom")).unwrap_or(zt - thickness);
|
||||
(zb, zt)
|
||||
}
|
||||
|
||||
/// Anfrage `verticalExtents`: Wände und Decken als ganze Elemente (die 3D-Griffe zeigen auch gerade gezogene,
|
||||
/// noch nicht übernommene Fassungen).
|
||||
#[derive(serde::Deserialize, Default)]
|
||||
#[serde(default)]
|
||||
pub struct ExtentArgs {
|
||||
pub walls: Vec<Value>,
|
||||
pub ceilings: Vec<Value>,
|
||||
}
|
||||
|
||||
/// (UK, OK) der Wände, dann der Decken, flach: `[zb, zt, zb, zt, …]`.
|
||||
pub fn vertical_extents(root: &Map<String, Value>, a: &ExtentArgs) -> J {
|
||||
let walls = a.walls.iter().map(|w| vertical_extent(root, w));
|
||||
let ceilings = a.ceilings.iter().map(|c| ceiling_extent(root, c, ceiling_thickness(root, c)));
|
||||
J::arr(walls.chain(ceilings).flat_map(|(zb, zt)| [zb, zt]).map(|x| {
|
||||
let mut out = Vec::new();
|
||||
js_num(x).emit(&mut out);
|
||||
J(out)
|
||||
}))
|
||||
}
|
||||
|
||||
/// Aufbau-Typ einer Decke (`getCeilingType`): eigener Deckentyp, sonst Alt-Wandtyp, sonst Fehler.
|
||||
fn ceiling_type<'a>(root: &'a Map<String, Value>, c: &Value) -> Result<&'a Value, String> {
|
||||
if truthy(field(c, "ceilingTypeId")) {
|
||||
@@ -546,9 +575,7 @@ fn ceiling_selection(root: &Map<String, Value>, c: &Value) -> Result<J, String>
|
||||
let outer = component(root, arr(field(wt, "layers")).first().and_then(|l| field(l, "componentId")))?;
|
||||
let (fg, bg, hatch) = effective(c, Some(outer), cat);
|
||||
let floor = level(root, field(c, "floorId"));
|
||||
let floor_top = floor.map_or(0.0, |f| num_or(field(f, "baseElevation"), 0.0) + num_or(field(f, "floorHeight"), 0.0));
|
||||
let zt = anchor(root, field(c, "top")).unwrap_or(floor_top);
|
||||
let zb = anchor(root, field(c, "bottom")).unwrap_or(zt - thickness);
|
||||
let (zb, zt) = ceiling_extent(root, c, thickness);
|
||||
let area = ceiling_area(field(c, "outline"));
|
||||
let openings: Vec<J> = arr(field(c, "openings"))
|
||||
.iter()
|
||||
@@ -1215,6 +1242,21 @@ mod tests {
|
||||
assert_eq!(sel(&bad, json!({"wallIds": ["w"]})).unwrap_err(), "Unbekannter Wandtyp: x");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hoehen_von_waenden_und_decken() {
|
||||
let r = root(json!({
|
||||
"wallTypes": [{"id": "t", "layers": [{"componentId": "a", "thickness": 0.3}]}],
|
||||
"drawingLevels": [{"id": "eg", "kind": "floor", "baseElevation": 1, "floorHeight": 3}, {"id": "og", "kind": "floor", "baseElevation": 4}],
|
||||
}));
|
||||
let a: ExtentArgs = serde_json::from_value(json!({
|
||||
"walls": [{"floorId": "eg", "height": 2.5}, {"floorId": "eg", "height": 2.5, "top": {"mode": "floor", "floorId": "og", "offset": -0.2}}, {"floorId": "x"}],
|
||||
"ceilings": [{"floorId": "eg", "wallTypeId": "t"}, {"floorId": "eg", "thickness": 0.25, "bottom": {"mode": "custom", "z": 3}}, {"floorId": "x", "ceilingTypeId": "fehlt"}],
|
||||
}))
|
||||
.unwrap();
|
||||
let v: Value = serde_json::from_str(&vertical_extents(&r, &a).into_string()).unwrap();
|
||||
assert_eq!(v, json!([1, 3.5, 1, 3.8, 0, "\u{1}NaN", 3.7, 4, 3, 4, -0.2, 0]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn typ_beschriftung_wie_ts() {
|
||||
let r = root(json!({"components": [{"id": "a", "abbrev": "BET"}, {"id": "b", "abbrev": "GKB"}]}));
|
||||
|
||||
@@ -21,12 +21,6 @@ pub fn stair_cut_flat(geometry: &[f64], cut_rise: f64) -> Vec<f64> {
|
||||
s::cut(geometry, cut_rise)
|
||||
}
|
||||
|
||||
/// `[minX, minY, maxX, maxY]` aller Tritte + Podest.
|
||||
#[wasm_bindgen]
|
||||
pub fn stair_bbox_flat(geometry: &[f64]) -> Vec<f64> {
|
||||
s::bbox(geometry)
|
||||
}
|
||||
|
||||
/// Vorgabe-Stufenzahl aus Steighöhe und Lauflänge.
|
||||
#[wasm_bindgen]
|
||||
pub fn stair_default_step_count(total_rise: f64, run_length: f64) -> u32 {
|
||||
|
||||
@@ -259,7 +259,7 @@ export class ProjectDocument {
|
||||
* Wie {@link queryRoot} für Abfragen, deren Antwort nicht endliche Zahlen als Marken trägt
|
||||
* (`selectionInfo`, `drawingBBoxes`); die Marken werden wieder Zahlen.
|
||||
*/
|
||||
queryRootMarked<T>(name: "selectionInfo" | "drawingBBoxes", text = ""): T {
|
||||
queryRootMarked<T>(name: "selectionInfo" | "drawingBBoxes" | "verticalExtents", text = ""): T {
|
||||
if (!this.handle) throw new Error(`Kern-Abfrage „${name}": Dokument nicht offen`);
|
||||
const out = core().doc_query_root(this.handle, name, text);
|
||||
if (out.startsWith("\u0001")) throw new Error(out.slice(1));
|
||||
|
||||
@@ -54,4 +54,6 @@ 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 { verticalExtents } from "../geometry/grips";
|
||||
export type { VerticalExtent } from "../geometry/grips";
|
||||
export type { GripRequest } from "../geometry/grips";
|
||||
@@ -20,7 +20,6 @@ export {
|
||||
export {
|
||||
ceilingArea,
|
||||
normalizeOutline,
|
||||
outlineBBox,
|
||||
pointInOutline,
|
||||
} from "../geometry/ceiling";
|
||||
|
||||
@@ -98,7 +97,6 @@ export {
|
||||
} from "../geometry/lineSegments";
|
||||
|
||||
export {
|
||||
openingGapQuad,
|
||||
openingVerticalExtent,
|
||||
} from "../geometry/opening";
|
||||
export { autoExteriorDimensions } from "../geometry/autoDimensions";
|
||||
@@ -122,7 +120,6 @@ export {
|
||||
} from "../geometry/revisionCloud";
|
||||
|
||||
export {
|
||||
roofBBox,
|
||||
roofBaseElevation,
|
||||
roofGeometry,
|
||||
} from "../geometry/roof";
|
||||
@@ -130,7 +127,6 @@ export {
|
||||
export {
|
||||
addRoofHole,
|
||||
removeRoofHole,
|
||||
roofEdgeList,
|
||||
roofHoleWorks,
|
||||
setRoofEdge,
|
||||
} from "../geometry/roofEdges";
|
||||
@@ -155,7 +151,6 @@ export {
|
||||
IDEAL_TREAD,
|
||||
MIN_STEPS,
|
||||
defaultStepCount,
|
||||
stairBBox,
|
||||
stairGeometry,
|
||||
stairOutline,
|
||||
} from "../geometry/stair";
|
||||
|
||||
@@ -43,30 +43,6 @@ export function ceilingArea(pts: Vec2[]): number {
|
||||
return Math.abs(signedArea(pts));
|
||||
}
|
||||
|
||||
/**
|
||||
* Achsparallele Bounding-Box eines Umrisses (Modell-Meter). Leerer/entarteter
|
||||
* Umriss → Null-Box.
|
||||
*/
|
||||
export function outlineBBox(pts: Vec2[]): {
|
||||
minX: number;
|
||||
minY: number;
|
||||
maxX: number;
|
||||
maxY: number;
|
||||
} {
|
||||
let minX = Infinity,
|
||||
minY = Infinity,
|
||||
maxX = -Infinity,
|
||||
maxY = -Infinity;
|
||||
for (const p of pts) {
|
||||
minX = Math.min(minX, p.x);
|
||||
minY = Math.min(minY, p.y);
|
||||
maxX = Math.max(maxX, p.x);
|
||||
maxY = Math.max(maxY, p.y);
|
||||
}
|
||||
if (!isFinite(minX)) return { minX: 0, minY: 0, maxX: 0, maxY: 0 };
|
||||
return { minX, minY, maxX, maxY };
|
||||
}
|
||||
|
||||
/** Schwerpunkt (Zentroid) des Umriss-Polygons (für HUD/Beschriftung). */
|
||||
export function outlineCentroid(pts: Vec2[]): Vec2 {
|
||||
const a = signedArea(pts);
|
||||
|
||||
+24
-1
@@ -7,7 +7,8 @@
|
||||
// Bewusst TS: die Rahmen-Ecken einer Textspalte (`textFrameCorners` braucht die Schrift-Metrik der
|
||||
// Hülle) — der Kern meldet dafür nur „Textspalte".
|
||||
|
||||
import type { Drawing2D, Drawing2DGeom, EdgeGrip, Vec2 } from "../model/types";
|
||||
import type { Ceiling, Drawing2D, Drawing2DGeom, EdgeGrip, Project, Vec2, Wall } from "../model/types";
|
||||
import { documentFor } from "../core/document";
|
||||
import { core } from "../engine/coreWasm";
|
||||
import { toMarkedJson } from "../core/ops";
|
||||
import { DEFAULT_SCALE_DENOMINATOR } from "../model/dimension";
|
||||
@@ -103,3 +104,25 @@ export function openEdges(verts: readonly Vec2[], owner: Owner): EdgeGrip[] {
|
||||
export function polylineEdgeGrips(g: Extract<Drawing2DGeom, { shape: "polyline" }>, owner: Owner): EdgeGrip[] {
|
||||
return edges(g.pts, !!g.closed, g.bulge ?? [], owner);
|
||||
}
|
||||
|
||||
/** Unter-/Oberkante (absolutes Z, Meter) eines Bauteils. */
|
||||
export interface VerticalExtent {
|
||||
zBottom: number;
|
||||
zTop: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* UK/OK von Wänden und Decken aus dem Kern (`selection_info.rs::vertical_extents`, Regeln wie
|
||||
* `wallVerticalExtent`/`ceilingVerticalExtent`): Geschoss-Bindungen und Deckentypen aus `project`, die
|
||||
* Elemente selbst als ganze Fassung (auch gerade gezogene, noch nicht übernommene — 3D-Griffe).
|
||||
*/
|
||||
export function verticalExtents(
|
||||
project: Project,
|
||||
walls: readonly Wall[],
|
||||
ceilings: readonly Ceiling[] = [],
|
||||
): { walls: VerticalExtent[]; ceilings: VerticalExtent[] } {
|
||||
if (walls.length === 0 && ceilings.length === 0) return { walls: [], ceilings: [] };
|
||||
const f = documentFor(project).queryRootMarked<number[]>("verticalExtents", toMarkedJson({ walls, ceilings }));
|
||||
const at = (i: number): VerticalExtent => ({ zBottom: f[2 * i], zTop: f[2 * i + 1] });
|
||||
return { walls: walls.map((_, i) => at(i)), ceilings: ceilings.map((_, i) => at(walls.length + i)) };
|
||||
}
|
||||
+1
-23
@@ -13,7 +13,7 @@
|
||||
import type { Opening, Project, SashDef, Vec2, Wall } from "../model/types";
|
||||
import { core } from "../engine/coreWasm";
|
||||
import { getWallType, wallTypeThickness } from "../model/types";
|
||||
import { add, along, leftNormal, normalize, scale, sub } from "../model/geometry";
|
||||
import { along, leftNormal, normalize, sub } from "../model/geometry";
|
||||
import { wallReferenceOffset, wallVerticalExtent } from "../model/wall";
|
||||
|
||||
/** Achslänge einer Wand (Meter). */
|
||||
@@ -73,28 +73,6 @@ export function openingJambs(
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Die Lücken-Rechteck-Ecken (über die volle Wanddicke), z. B. um im Plan die
|
||||
* Öffnung als Aussparung zu markieren (Auswahl-Highlight). Reihenfolge:
|
||||
* jambStart(+n/2) → jambEnd(+n/2) → jambEnd(−n/2) → jambStart(−n/2).
|
||||
*/
|
||||
export function openingGapQuad(project: Project, wall: Wall, o: Opening): Vec2[] | null {
|
||||
const jambs = openingJambs(wall, o);
|
||||
if (!jambs) return null;
|
||||
const { n } = wallAxisFrame(wall);
|
||||
const total = wallTypeThickness(getWallType(project, wall));
|
||||
const refOff = wallReferenceOffset(wall, total);
|
||||
const outer = refOff + total / 2;
|
||||
const inner = refOff - total / 2;
|
||||
const { jambStart, jambEnd } = jambs;
|
||||
return [
|
||||
add(jambStart, scale(n, outer)),
|
||||
add(jambEnd, scale(n, outer)),
|
||||
add(jambEnd, scale(n, inner)),
|
||||
add(jambStart, scale(n, inner)),
|
||||
];
|
||||
}
|
||||
|
||||
/** Mittelpunkt einer Öffnung im Grundriss (Achse) — für HUD/Auswahl-Anker. */
|
||||
export function openingCenter(wall: Wall, o: Opening): Vec2 | null {
|
||||
const iv = openingInterval(wall, o);
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { roofGeometry, roofBBox, roofUndersideAt } from "./roof";
|
||||
import { roofGeometry, roofUndersideAt } from "./roof";
|
||||
import type { Roof, Vec2 } from "../model/types";
|
||||
|
||||
/** Bounding-Box eines Umrisses (Prüfhilfe). */
|
||||
function roofBBox(outline: Vec2[]): { x0: number; y0: number; x1: number; y1: number } {
|
||||
const xs = outline.map((p) => p.x);
|
||||
const ys = outline.map((p) => p.y);
|
||||
return { x0: Math.min(...xs), y0: Math.min(...ys), x1: Math.max(...xs), y1: Math.max(...ys) };
|
||||
}
|
||||
|
||||
// Rechteck 6×4 (x:0..6, y:0..4), Neigung 45° (tan=1), Traufhöhe 10, kein Überstand.
|
||||
const RECT: Vec2[] = [
|
||||
{ x: 0, y: 0 },
|
||||
@@ -35,12 +42,6 @@ function allZ(g: ReturnType<typeof roofGeometry>): number[] {
|
||||
return zs;
|
||||
}
|
||||
|
||||
describe("roofBBox", () => {
|
||||
it("liefert die Bounding-Box", () => {
|
||||
expect(roofBBox(RECT)).toEqual({ x0: 0, y0: 0, x1: 6, y1: 4 });
|
||||
});
|
||||
});
|
||||
|
||||
describe("roofGeometry — Formen (6×4, 45°, First entlang X)", () => {
|
||||
it("flach: eine waagrechte Fläche auf Traufhöhe, kein First", () => {
|
||||
const g = roofGeometry(roof({ shape: "flach" }), E);
|
||||
|
||||
@@ -39,21 +39,6 @@ export interface RoofGeometry {
|
||||
ridgeHeight: number;
|
||||
}
|
||||
|
||||
/** Bounding-Box eines Umrisses. */
|
||||
export function roofBBox(outline: Vec2[]): { x0: number; y0: number; x1: number; y1: number } {
|
||||
let x0 = Infinity;
|
||||
let y0 = Infinity;
|
||||
let x1 = -Infinity;
|
||||
let y1 = -Infinity;
|
||||
for (const p of outline) {
|
||||
if (p.x < x0) x0 = p.x;
|
||||
if (p.y < y0) y0 = p.y;
|
||||
if (p.x > x1) x1 = p.x;
|
||||
if (p.y > y1) y1 = p.y;
|
||||
}
|
||||
return { x0, y0, x1, y1 };
|
||||
}
|
||||
|
||||
/**
|
||||
* Traufhöhe (absolutes Z) eines Dachs: `baseElevation`, sonst die OBERKANTE des
|
||||
* zugehörigen Geschosses (baseElevation + floorHeight) — das Dach sitzt also
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// Kanten und Höfe eines Dachs ([26]): Liste, Änderung der Kantenneigung, Hof hinzufügen/entfernen.
|
||||
// Kanten und Höfe eines Dachs ([26]): Änderung der Kantenneigung, Hof hinzufügen/entfernen (die
|
||||
// Kantenliste rechnet der Kern, Test in `state/selectionInfo.test.ts`).
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { Roof, Vec2 } from "../model/types";
|
||||
import { addRoofHole, removeRoofHole, roofEdgeList, roofHoleWorks, setRoofEdge } from "./roofEdges";
|
||||
import { addRoofHole, removeRoofHole, roofHoleWorks, setRoofEdge } from "./roofEdges";
|
||||
|
||||
const rect = (x: number, y: number, w: number, h: number): Vec2[] => [
|
||||
{ x, y },
|
||||
@@ -26,27 +27,6 @@ const roof = (extra: Partial<Roof> = {}): Roof => ({
|
||||
|
||||
const court = rect(4, 2, 4, 4);
|
||||
|
||||
describe("roofEdgeList", () => {
|
||||
it("Umrisskanten, dann Hofkanten; Standard ohne Feld", () => {
|
||||
const list = roofEdgeList(roof({ holes: [court] }));
|
||||
expect(list).toHaveLength(8);
|
||||
expect(list.map((e) => e.ring)).toEqual([0, 0, 0, 0, 1, 1, 1, 1]);
|
||||
expect(list[0]).toMatchObject({ index: 0, spec: { kind: "default" }, length: 12 });
|
||||
expect(list[5].index).toBe(5);
|
||||
});
|
||||
|
||||
it("liest Giebel, Neigung und negativ = Standard; Sattel: Giebelregel zeigt sich als Vorgabe", () => {
|
||||
const list = roofEdgeList(roof({ edgePitchDeg: [20, null, -1] }));
|
||||
expect(list[0].spec).toEqual({ kind: "pitch", deg: 20 });
|
||||
expect(list[1].spec).toEqual({ kind: "gable" });
|
||||
expect(list[2].spec).toEqual({ kind: "default" });
|
||||
expect(list[3].spec).toEqual({ kind: "default" });
|
||||
const sattel = roofEdgeList(roof({ shape: "sattel" }));
|
||||
expect(sattel.map((e) => e.defaultGable)).toEqual([false, true, false, true]);
|
||||
expect(roofEdgeList(roof()).every((e) => !e.defaultGable)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("setRoofEdge", () => {
|
||||
it("setzt Neigung/Giebel, füllt mit Standard auf, entfernt das Feld wenn alles Standard", () => {
|
||||
const a = setRoofEdge(roof(), 2, { kind: "pitch", deg: 25 });
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Kanten und Höfe eines Dachs ([26]): die Kantenliste fürs Objekt-Info (Neigung je Kante, Giebel),
|
||||
// Kanten und Höfe eines Dachs ([26]): Typen der Kantenliste (gerechnet im Kern, `selection_info.rs`),
|
||||
// Änderungen als Teilobjekt (`Partial<Roof>`, für `updateRoof`/`patchItem` — ein Undo-Schritt) und
|
||||
// die Prüfung, ob ein Hof wirkt. Die Geometrie selbst rechnet der Rust-Kern (`roof.rs`).
|
||||
//
|
||||
@@ -31,46 +31,6 @@ export interface RoofEdge {
|
||||
|
||||
const MAX_PITCH = 89;
|
||||
|
||||
/** Die Vorgabe aus einem Eintrag von `edgePitchDeg`. */
|
||||
function specOf(v: number | null | undefined): EdgeSpec {
|
||||
if (v === null) return { kind: "gable" };
|
||||
if (v === undefined || !Number.isFinite(v) || v < 0) return { kind: "default" };
|
||||
return { kind: "pitch", deg: v };
|
||||
}
|
||||
|
||||
/** Giebelt der Standard dieser Dachform die Kante a→b (quer zur Firstrichtung)? */
|
||||
function defaultGableEdge(roof: Roof, a: Vec2, b: Vec2): boolean {
|
||||
const gabled = roof.shape === "sattel" || (roof.shape === "mansarde" && (roof.mansardType ?? "giebel") === "giebel");
|
||||
if (!gabled) return false;
|
||||
const dx = Math.abs(b.x - a.x);
|
||||
const dy = Math.abs(b.y - a.y);
|
||||
return roof.ridgeAxis === "y" ? dy < dx : dx < dy;
|
||||
}
|
||||
|
||||
/** Alle Kanten des Dachs (Umriss, dann Höfe) mit ihrer Vorgabe. */
|
||||
export function roofEdgeList(roof: Roof): RoofEdge[] {
|
||||
const rings: Vec2[][] = [roof.outline, ...(roof.holes ?? [])];
|
||||
const out: RoofEdge[] = [];
|
||||
let index = 0;
|
||||
rings.forEach((ring, r) => {
|
||||
ring.forEach((a, edge) => {
|
||||
const b = ring[(edge + 1) % ring.length];
|
||||
out.push({
|
||||
index,
|
||||
ring: r,
|
||||
edge,
|
||||
a,
|
||||
b,
|
||||
length: Math.hypot(b.x - a.x, b.y - a.y),
|
||||
spec: specOf(roof.edgePitchDeg?.[index]),
|
||||
defaultGable: defaultGableEdge(roof, a, b),
|
||||
});
|
||||
index++;
|
||||
});
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
/** `edgePitchDeg` ohne Standard-Einträge am Ende; alles Standard ⇒ `undefined` (Feld entfällt). */
|
||||
function normalized(values: (number | null)[]): (number | null)[] | undefined {
|
||||
const v = values.slice();
|
||||
@@ -80,7 +40,7 @@ function normalized(values: (number | null)[]): (number | null)[] | undefined {
|
||||
|
||||
/** Teilobjekt für `updateRoof`: Kante `index` auf `spec` setzen. */
|
||||
export function setRoofEdge(roof: Roof, index: number, spec: EdgeSpec): Pick<Roof, "edgePitchDeg"> {
|
||||
const total = roofEdgeList(roof).length;
|
||||
const total = roof.outline.length + (roof.holes ?? []).reduce((n, h) => n + h.length, 0);
|
||||
const values: (number | null)[] = Array.from({ length: total }, (_, i) => {
|
||||
const v = roof.edgePitchDeg?.[i];
|
||||
return v === undefined ? -1 : v;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Referenz, Schnitt, Rahmen und Unsinn-Eingaben (Rust-Tests decken die Mathematik je Fall ab).
|
||||
*/
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { defaultStepCount, stairBBox, stairCut, stairGeometry, stairOutline } from "./stair";
|
||||
import { defaultStepCount, stairCut, stairGeometry, stairOutline } from "./stair";
|
||||
import type { Stair } from "../model/types";
|
||||
|
||||
const base: Stair = {
|
||||
@@ -51,11 +51,10 @@ describe("stairGeometry", () => {
|
||||
expect(stairGeometry(base, NaN).treads).toEqual([]);
|
||||
expect(stairGeometry({ ...base, stepCount: 0 }, 2.8).treads).toHaveLength(2);
|
||||
expect(stairOutline({ ...base, runLength: NaN }, 0)).toEqual({ polygon: null, spiral: null });
|
||||
expect(stairBBox(stairGeometry(base, NaN))).toEqual({ minX: 0, minY: 0, maxX: 0, maxY: 0 });
|
||||
});
|
||||
});
|
||||
|
||||
describe("stairCut / stairBBox / defaultStepCount", () => {
|
||||
describe("stairCut / defaultStepCount", () => {
|
||||
it("Schnitt teilt die Tritte und legt eine Doppel-Bruchlinie", () => {
|
||||
const g = stairGeometry(base, 2.8);
|
||||
const c = stairCut(g, 1.0);
|
||||
@@ -66,12 +65,6 @@ describe("stairCut / stairBBox / defaultStepCount", () => {
|
||||
expect(stairCut(stairGeometry(base, NaN), 1)).toEqual({ belowIndices: [], aboveIndices: [], breakLine: null });
|
||||
});
|
||||
|
||||
it("BBox über Tritte", () => {
|
||||
const b = stairBBox(stairGeometry(base, 2.8));
|
||||
expect(b.maxX).toBeCloseTo(3, 12);
|
||||
expect(b.minY).toBeCloseTo(-0.6, 12);
|
||||
});
|
||||
|
||||
it("Vorgabe-Stufenzahl: Steighöhe 0.17, gedeckelt durch die Lauflänge, mind. 2", () => {
|
||||
expect(defaultStepCount(2.8, 10)).toBe(16);
|
||||
expect(defaultStepCount(2.8, 3)).toBe(13);
|
||||
|
||||
+2
-14
@@ -152,8 +152,8 @@ function encodeGeometry(g: StairGeometry): Float64Array {
|
||||
|
||||
/**
|
||||
* Leitet die vollständige Geometrie einer Treppe ab. `totalRise` MUSS vom
|
||||
* Aufrufer aufgelöst übergeben werden (Geschosshöhe-Default liegt in
|
||||
* `stairVerticalExtent`), damit dieses Modul modellfrei bleibt.
|
||||
* Aufrufer aufgelöst übergeben werden (Geschosshöhe-Default liegt im Kern,
|
||||
* `stair_vertical_extent` in `model/helpers.rs`), damit dieses Modul modellfrei bleibt.
|
||||
*/
|
||||
export function stairGeometry(stair: Stair, totalRise: number): StairGeometry {
|
||||
return decodeGeometry(core().stair_geometry_flat(encodeStair(stair), totalRise));
|
||||
@@ -199,18 +199,6 @@ export function stairCut(geo: StairGeometry, cutRise: number): StairCut {
|
||||
return { belowIndices, aboveIndices, breakLine };
|
||||
}
|
||||
|
||||
/** Achsparallele Bounding-Box aller Tritte (+ Podest) einer Treppengeometrie. */
|
||||
export function stairBBox(geo: StairGeometry): {
|
||||
minX: number;
|
||||
minY: number;
|
||||
maxX: number;
|
||||
maxY: number;
|
||||
} {
|
||||
const f = core().stair_bbox_flat(encodeGeometry(geo));
|
||||
if (f.length < 4) return { minX: 0, minY: 0, maxX: 0, maxY: 0 };
|
||||
return { minX: f[0], minY: f[1], maxX: f[2], maxY: f[3] };
|
||||
}
|
||||
|
||||
/**
|
||||
* Spiral-Outline: Innenbogen + Aussenbogen + zwei radiale Schliesslinien.
|
||||
* Die Bögen werden als Kreisbogen-Parameter geliefert (cx/cy/r/a0/a1), die
|
||||
|
||||
@@ -120,15 +120,6 @@ export function lv95ToLocal(pt: LV95, origin: GeoOrigin): { x: number; y: number
|
||||
return { x: pt.e - origin.e, y: pt.n - origin.n };
|
||||
}
|
||||
|
||||
/** Lokale Modell-Meter → LV95 (Umkehrung von {@link lv95ToLocal}). */
|
||||
export function localToLv95(
|
||||
x: number,
|
||||
y: number,
|
||||
origin: GeoOrigin,
|
||||
): LV95 {
|
||||
return { e: x + origin.e, n: y + origin.n };
|
||||
}
|
||||
|
||||
/**
|
||||
* WGS84 → lokale Modell-Meter (über LV95 und die Origin). Praktisch für
|
||||
* OSM-Punkte (lon/lat), die zuerst nach LV95 projiziert und dann verschoben
|
||||
|
||||
+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;
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { deriveSelection } from "./selectionInfo";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import type { Project } from "../model/types";
|
||||
import type { Project, Roof } from "../model/types";
|
||||
|
||||
const base = (): Project => structuredClone(sampleProject);
|
||||
|
||||
@@ -60,4 +60,30 @@ describe("deriveSelection (Kern)", () => {
|
||||
"height", "taper", "cornerRadius", "chamfer", "area", "spec", "subtract", "canSubtract", "baseOffset", "floorId", "floorName",
|
||||
]);
|
||||
});
|
||||
|
||||
it("Dach: Kantenliste (Umriss, dann Hof), Vorgaben je Kante und Giebel-Standard", () => {
|
||||
const p = base();
|
||||
const rect = (x: number, y: number, w: number, h: number) => [
|
||||
{ x, y }, { x: x + w, y }, { x: x + w, y: y + h }, { x, y: y + h },
|
||||
];
|
||||
const roof = (extra: Partial<Roof>): Roof => ({
|
||||
id: "R", type: "roof", floorId: p.drawingLevels.find((z) => z.kind === "floor")!.id, categoryCode: "31",
|
||||
outline: rect(0, 0, 12, 8), shape: "walm", pitchDeg: 35, overhang: 0, ridgeAxis: "x", thickness: 0.2, ...extra,
|
||||
});
|
||||
const edges = (r: Roof) => {
|
||||
// Neues Projekt-Objekt je Fall: der Kern gleicht über Referenzen ab.
|
||||
return deriveSelection({ ...p, roofs: [r] }, [], null, null, null, null, null, null, null, "R")!.roof!.edges;
|
||||
};
|
||||
const list = edges(roof({ holes: [rect(4, 2, 4, 4)] }));
|
||||
expect(list).toHaveLength(8);
|
||||
expect(list.map((e) => e.ring)).toEqual([0, 0, 0, 0, 1, 1, 1, 1]);
|
||||
expect(list[0]).toMatchObject({ index: 0, spec: { kind: "default" }, length: 12 });
|
||||
expect(list[5].index).toBe(5);
|
||||
const specs = edges(roof({ edgePitchDeg: [20, null, -1] }));
|
||||
expect(specs.map((e) => e.spec)).toEqual([
|
||||
{ kind: "pitch", deg: 20 }, { kind: "gable" }, { kind: "default" }, { kind: "default" },
|
||||
]);
|
||||
expect(edges(roof({ shape: "sattel" })).map((e) => e.defaultGable)).toEqual([false, true, false, true]);
|
||||
expect(edges(roof({})).every((e) => !e.defaultGable)).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -44,8 +44,7 @@
|
||||
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import type { Project, Wall, Drawing2D, Ceiling, Roof, Vec2 } from "../model/types";
|
||||
import { ceilingVerticalExtent, wallVerticalExtent } from "../model/wall";
|
||||
import { roofBaseElevation, roofGeometry } from "../core";
|
||||
import { roofBaseElevation, roofGeometry, verticalExtents } from "../core";
|
||||
import { projectToModel3d, pickGeometry, draftWorldLines, TRUCK_MESH_READY_EVENT } from "../core";
|
||||
import type { DetailLevel, RenderMode, View3d } from "../model/viewTypes";
|
||||
import type { ToolDraft } from "../tools/types";
|
||||
@@ -146,8 +145,9 @@ function computeGrips(
|
||||
drawingElevation: number,
|
||||
): Grip[] {
|
||||
const out: Grip[] = [];
|
||||
for (const w of walls) {
|
||||
const { zBottom, zTop } = wallVerticalExtent(project, w);
|
||||
const ext = verticalExtents(project, walls, ceilings);
|
||||
walls.forEach((w, wi) => {
|
||||
const { zBottom, zTop } = ext.walls[wi];
|
||||
const target = { wallId: w.id };
|
||||
out.push({ kind: "vertex", target, index: 0, pos: [w.start.x, zBottom, w.start.y] });
|
||||
out.push({ kind: "vertex", target, index: 1, pos: [w.end.x, zBottom, w.end.y] });
|
||||
@@ -155,7 +155,7 @@ function computeGrips(
|
||||
const midY = (w.start.y + w.end.y) / 2;
|
||||
out.push({ kind: "height", target, index: -1, pos: [midX, zTop, midY] });
|
||||
out.push({ kind: "move", target, index: -1, pos: [midX, zBottom + 0.05, midY] });
|
||||
}
|
||||
});
|
||||
for (const d of drawings) {
|
||||
const verts = drawingGripVertices(d);
|
||||
const target = { drawingId: d.id };
|
||||
@@ -167,12 +167,12 @@ function computeGrips(
|
||||
// Decken: Eckpunkt-Griffe (Umriss) + je Seite ein Kanten-Mittelpunkt-Griff
|
||||
// (Nutzer-Wunsch „an allen seiten auch ein punkt … wie an den eckpunkten") +
|
||||
// ein Verschiebe-Griff im Schwerpunkt. Griffe sitzen auf der Deckenoberkante.
|
||||
for (const c of ceilings) {
|
||||
ceilings.forEach((c, ci) => {
|
||||
const pts = c.outline;
|
||||
const n = pts.length;
|
||||
if (n < 2) continue;
|
||||
if (n < 2) return;
|
||||
const target = { ceilingId: c.id };
|
||||
const y = ceilingVerticalExtent(project, c).zTop + 0.02;
|
||||
const y = ext.ceilings[ci].zTop + 0.02;
|
||||
let sx = 0;
|
||||
let sy = 0;
|
||||
pts.forEach((p, i) => {
|
||||
@@ -189,7 +189,7 @@ function computeGrips(
|
||||
sy += p.y;
|
||||
});
|
||||
out.push({ kind: "move", target, index: -1, pos: [sx / n, y + 0.03, sy / n] });
|
||||
}
|
||||
});
|
||||
// Dächer: Eckpunkt-Griffe (Umriss = Traufe-Grundriss, resize) + Verschiebe-Griff
|
||||
// + ein FIRST-/Neigungs-Griff am höchsten Punkt (vertikal ziehen ändert die
|
||||
// Neigung). Eckpunkte auf Traufhöhe.
|
||||
@@ -927,11 +927,11 @@ export function Wasm3DViewport({
|
||||
const gripPlaneY = (target: GripTarget): number | null => {
|
||||
if (target.wallId) {
|
||||
const wall = editWallsRef.current.find((w) => w.id === target.wallId);
|
||||
return wall ? wallVerticalExtent(projectRef.current, wall).zBottom : null;
|
||||
return wall ? verticalExtents(projectRef.current, [wall]).walls[0].zBottom : null;
|
||||
}
|
||||
if (target.ceilingId) {
|
||||
const c = editCeilingsRef.current.find((x) => x.id === target.ceilingId);
|
||||
return c ? ceilingVerticalExtent(projectRef.current, c).zTop : null;
|
||||
return c ? verticalExtents(projectRef.current, [], [c]).ceilings[0].zTop : null;
|
||||
}
|
||||
if (target.roofId) {
|
||||
const r = editRoofsRef.current.find((x) => x.id === target.roofId);
|
||||
|
||||
Reference in new issue
Block a user