Kern/Huelle Phase A.1: Kern-Lecks behoben (View-/Detail-Typen nach model/viewTypes, Pick-Typen nach plan/pickTypes, geomTransform/curves/lineSegments/layoutModel in den Kern verschoben)
This commit is contained in:
1 parent
1ea0fab6ce
commit
cb79c13753
46 files changed
+373
-344
No files matched your search
@@ -14,8 +14,8 @@ import {
|
||||
type Primitive,
|
||||
} from "./shared";
|
||||
import { layersStyleSig } from "./layerSig";
|
||||
import { ellipsePts, sampleBezierChain, sampleCatmullRom, sampleUniformBSpline } from "../../tools/curves";
|
||||
import { scaleGeom } from "../../tools/transform";
|
||||
import { ellipsePts, sampleBezierChain, sampleCatmullRom, sampleUniformBSpline } from "../../geometry/curves";
|
||||
import { scaleGeom } from "../../geometry/geomTransform";
|
||||
import { bulgeArc, bulgeArcPoints } from "../../geometry/bulge";
|
||||
import { END_MARK_DEFAULT_SIZE_MM, addEndMark, pullBack } from "./endMarks";
|
||||
import {
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
// Minimal-Formen der Pick-Geometrie (Wand-/Öffnungs-/Dach-… Körper für den 3D-Raycast). Sie
|
||||
// stehen im Kern (`pickGeometry` in toWalls3d erzeugt sie); der Raycast der Hülle
|
||||
// (viewport/raycast3d.ts) konsumiert sie.
|
||||
|
||||
export type Vec3 = [number, number, number];
|
||||
|
||||
/** Minimal-Form eines Wand-Quaders für den Raycast (RWall erfüllt sie strukturell). */
|
||||
export interface PickWall {
|
||||
start: readonly [number, number];
|
||||
end: readonly [number, number];
|
||||
thickness: number;
|
||||
height: number;
|
||||
baseElevation: number;
|
||||
wallId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form einer Öffnungs-Box (Fenster/Tür) für den Raycast — dieselbe
|
||||
* orientierte-Quader-Form wie `PickWall` (Achse jambStart→jambEnd in der
|
||||
* XZ-Ebene, Dicke = Wanddicke am Sitz der Öffnung), nur über ihre EIGENE
|
||||
* vertikale Ausdehnung (Brüstung..Sturz) statt der vollen Wandhöhe.
|
||||
*/
|
||||
export interface PickOpening {
|
||||
start: readonly [number, number];
|
||||
end: readonly [number, number];
|
||||
thickness: number;
|
||||
height: number;
|
||||
baseElevation: number;
|
||||
openingId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Segments einer freien 2D-Zeichnung (Linie/Polylinie/
|
||||
* Rechteck) für den Raycast — dieselbe orientierte-Quader-Form wie
|
||||
* `PickOpening`, aber mit fester (grosszügiger) Klick-Toleranz statt echter
|
||||
* Bauteildicke: die sichtbare Boden-Spur im 3D ist nur 0.008m breit (s.
|
||||
* `toWalls3d/drawing2d.ts::DRAWING_LINE_HALF_WIDTH`) — zu schmal, um
|
||||
* zuverlässig zu treffen. `baseElevation` ist bereits die UNTERE Kante der
|
||||
* Pick-Box (Boden-Spur-Höhe minus halbe Toleranzhöhe), s. `pickDrawingSegs`.
|
||||
*/
|
||||
export interface PickDrawingSeg {
|
||||
start: readonly [number, number];
|
||||
end: readonly [number, number];
|
||||
baseElevation: number;
|
||||
drawingId: string;
|
||||
}
|
||||
|
||||
/** Klick-Toleranz für 2D-Zeichnungs-Boden-Spuren im 3D (Welt-Meter, s.
|
||||
* {@link PickDrawingSeg}) — quer zur Linie UND vertikal, je zur Hälfte um die
|
||||
* sichtbare Spur zentriert. Analog dem 2D-Plan-Pick-Radius
|
||||
* (`PlanView.tsx::LINE_PICK_PX`), hier als fester Welt-Wert statt Pixel-
|
||||
* Toleranz (im 3D gibt es keinen globalen Pixel/Meter-Faktor). */
|
||||
export const DRAWING_PICK_TOLERANCE = 0.12;
|
||||
|
||||
/** Minimal-Form eines Decken-Prismas für den Raycast (RSlab erfüllt sie strukturell). */
|
||||
export interface PickSlab {
|
||||
outline: ReadonlyArray<readonly [number, number]>;
|
||||
zBottom: number;
|
||||
zTop: number;
|
||||
ceilingId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Treppen-Bounding-Prismas für den Raycast: ein achsparalleles
|
||||
* Rechteck über den Grundriss-Fußabdruck (alle Tritte + Podest), extrudiert über
|
||||
* die vertikale Ausdehnung der Treppe. Pragmatische Näherung statt Tritt-für-
|
||||
* Tritt-Boxen — reicht für zuverlässiges Anklicken im 3D-Viewport.
|
||||
*/
|
||||
export interface PickStair {
|
||||
outline: ReadonlyArray<readonly [number, number]>;
|
||||
zBottom: number;
|
||||
zTop: number;
|
||||
stairId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Dachs für den Raycast: die Dachflächen + Giebel als
|
||||
* WORLD-Dreiecke (fan-trianguliert, dieselbe Konvention wie `emitRoofs`:
|
||||
* model (x,y,z=Höhe) → world (x, z, y)). Präzise geneigte Flächen statt eines
|
||||
* grosszügigen Bounding-Prismas — sonst stähle das Dach Klicks auf die
|
||||
* Fassade dahinter (pickNearest entscheidet über die Strahl-Distanz).
|
||||
*/
|
||||
export interface PickRoof {
|
||||
tris: ReadonlyArray<readonly [Vec3, Vec3, Vec3]>;
|
||||
roofId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Kontext-Meshes (importiertes Gebäude/Terrain, s.
|
||||
* `ContextObject`) für den Raycast: rohe WORLD-Dreiecke (dieselbe Konvention
|
||||
* wie {@link PickRoof} — model (x,y,z=Höhe) → world (x, z, y)), keine
|
||||
* Vereinfachung auf ein Bounding-Prisma (Gebäude-Meshes sind zu unregelmässig
|
||||
* dafür, ein grosszügiges Prisma stähle Klicks auf dahinterliegende Bauteile).
|
||||
*/
|
||||
export interface PickContextMesh {
|
||||
tris: ReadonlyArray<readonly [Vec3, Vec3, Vec3]>;
|
||||
contextObjectId: string;
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import { docToLines, wrapDocToLines, type SvgLine } from "../../text/renderHtml"
|
||||
import type { Vec2 } from "../../model/types";
|
||||
import { quantizePen } from "../../export/sceneToPrintSvg";
|
||||
import { buildRandomHatchRuns, zigzagPoints, motifPoints, DASH_MM_TO_M } from "../glPlan/glPlanHatch";
|
||||
import { dashHasDot } from "../../ui/lineSegments";
|
||||
import { dashHasDot } from "../../geometry/lineSegments";
|
||||
import { HAIRLINE_PX, PX_PER_M, mmToPx, printStrokeVb, visibleEdgeRuns } from "./geometry";
|
||||
|
||||
/** Basis-Kachelmaß (viewBox-Einheiten) einer Bild-Schraffur bei scaleX/scaleY = 1. */
|
||||
|
||||
+13
-4
@@ -42,16 +42,15 @@
|
||||
|
||||
import type { Project, Vec2, Wall } from "../model/types";
|
||||
import { getWallType, wallTypeThickness } from "../model/types";
|
||||
import type { ToolDraft } from "../tools/types";
|
||||
import { stairVerticalExtent } from "../model/wall";
|
||||
import { openingJambs, openingVerticalExtent } from "../geometry/opening";
|
||||
import type { DetailLevel } from "../ui/TopBar";
|
||||
import type { DetailLevel } from "../model/viewTypes";
|
||||
import { stairBBox, stairGeometry } from "../geometry/stair";
|
||||
import { roofBaseElevation, roofGeometry } from "../geometry/roof";
|
||||
import type { Vec3 as RoofVec3 } from "../geometry/roof";
|
||||
import { computeJoins } from "../model/joins";
|
||||
import type { WallCuts } from "../model/joins";
|
||||
import type { PickOpening, PickRoof, PickStair, PickContextMesh, PickDrawingSeg } from "../viewport/raycast3d";
|
||||
import type { PickOpening, PickRoof, PickStair, PickContextMesh, PickDrawingSeg } from "./pickTypes";
|
||||
import {
|
||||
EPS,
|
||||
IMPORTED_RGB,
|
||||
@@ -538,6 +537,16 @@ const SNAP_MARKER_HALF = 0.06;
|
||||
* unendliche Linie liefe unkontrolliert durchs ganze Modell). */
|
||||
const SNAP_ANGLE_GUIDE_EXTEND_M = 6;
|
||||
|
||||
/**
|
||||
* Minimal-Form eines Werkzeug-Drafts (`ToolDraft` der Hülle erfüllt sie strukturell): nur das,
|
||||
* was `draftWorldLines` liest. So hängt der Kern nicht an `tools/types`.
|
||||
*/
|
||||
export interface DraftLike {
|
||||
preview: Array<{ kind: "line"; a: Vec2; b: Vec2 } | { kind: "poly"; pts: Vec2[]; closed?: boolean }>;
|
||||
vertices: Vec2[];
|
||||
snap?: { point: Vec2; kind?: string; refA?: Vec2 } | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wandelt den aktiven Werkzeug-Draft (`ToolDraft.preview`, Modell-Meter,
|
||||
* Grundriss-Ebene) in dasselbe flache Weltraum-LineList-Format wie
|
||||
@@ -559,7 +568,7 @@ const SNAP_ANGLE_GUIDE_EXTEND_M = 6;
|
||||
* schon, wohin der erste Punkt fängt — deshalb NICHT mehr früh bei leerem
|
||||
* `preview` abgebrochen.
|
||||
*/
|
||||
export function draftWorldLines(draft: ToolDraft | null, planeY: number): Float32Array {
|
||||
export function draftWorldLines(draft: DraftLike | null, planeY: number): Float32Array {
|
||||
if (!draft) return new Float32Array(0);
|
||||
const out: number[] = [];
|
||||
const pushSeg = (a: Vec2, bPt: Vec2, rgb: RRgb = DRAFT_LINE_RGB) => {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
import type { Drawing2D, Project, Vec2 } from "../../model/types";
|
||||
import { flattenCategories, getFloor } from "../../model/types";
|
||||
import { DRAWING_LINE_FALLBACK_RGB, hexToRgb, type RRgb } from "./shared";
|
||||
import { DRAWING_PICK_TOLERANCE, type PickDrawingSeg } from "../../viewport/raycast3d";
|
||||
import { DRAWING_PICK_TOLERANCE, type PickDrawingSeg } from "../pickTypes";
|
||||
|
||||
/** Höhen-Offset über der Geschossebene gegen Z-Fighting (wie addDrawing2DLines in Viewport3D.tsx). */
|
||||
const DRAWING_LINE_ELEVATION_EPS = 0.01;
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { FrameCornerJoin, Opening, Project, SashDef, Wall } from "../../mod
|
||||
import { getDoorType, getWindowType, glazingPanesOf, openingsOfWall } from "../../model/types";
|
||||
import { openingInterval, openingVerticalExtent } from "../../geometry/opening";
|
||||
import { wallVerticalExtent } from "../../model/wall";
|
||||
import type { DetailLevel } from "../../ui/TopBar";
|
||||
import type { DetailLevel } from "../../model/viewTypes";
|
||||
import { EPS, type RMesh, type RRgb } from "./shared";
|
||||
import { wallThicknessSafe } from "./bands";
|
||||
|
||||
|
||||
Reference in new issue
Block a user