@kruschdev/pascal-mep-kernel 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Unified Cross-Trade Occupancy, Physical MEP Extents & Exact OBB Clash Engine (`INV-MEP-07`).
3
+ *
4
+ * Single source of truth shared across Structural (IRC), Plumbing (IPC), HVAC (IMC), and Electrical (NEC):
5
+ * 1. Exact physical OD/extents tables for plumbing pipes, electrical conduits, and round/rectangular HVAC ducts
6
+ * 2. Exact Y-oriented prism (`OrientedPrismY`) extractors for beams (2D & 3D), columns, equipment, plenums,
7
+ * plumbing fixtures, and NEC 110.26(A)/(E) working & dedicated electrical spaces
8
+ * 3. Priority-ordered cross-trade obstacle extraction (`structural (1) < plumbing (2) < hvac (3) < electrical (4)`)
9
+ * 4. Mutable `TradeOccupancyGrid` with swept-segment run reservation (`reserveRun` / `reserveBox` / `unreserve`)
10
+ * and exact OBB/AABB clash queries (`segmentClashes`, `detectPathClashes`)
11
+ *
12
+ * Pure framework-free TypeScript (`INV-MEP-01`): zero React, Three.js, `@pascal-app/*`, Next, Zod, or `node:*`.
13
+ */
14
+ import { type Aabb3, type OrientedPrismY, type SceneNodeLike, type TradeId, type TradePriorityRank, type Vec3 } from '../types';
15
+ export type MepRunExtents = {
16
+ readonly halfXZ: number;
17
+ readonly halfY: number;
18
+ };
19
+ /** Exact half outer-diameter (meters) lookup for nominal plumbing pipe sizes (copper/PEX/PVC/DWV). */
20
+ export declare const PLUMBING_PIPE_HALF_OD_M: Readonly<Record<string, number>>;
21
+ /** Exact half outer-diameter (meters) lookup for nominal electrical conduit trade sizes (EMT/PVC/RMC). */
22
+ export declare const ELECTRICAL_CONDUIT_HALF_OD_M: Readonly<Record<string, number>>;
23
+ /**
24
+ * Parse a nominal imperial inch value from a number or string
25
+ * (supports integers, decimals, fractions like `"3/4"`, mixed fractions like `"1-1/2"` or `"1 1/2"`,
26
+ * and trailing quote marks like `'2"'`). Returns `null` if invalid or non-positive.
27
+ */
28
+ export declare function parseNominalInches(raw: unknown): number | null;
29
+ /**
30
+ * Resolve real physical half-extents (`halfXZ`, `halfY` in meters) for HVAC ducts/linesets,
31
+ * plumbing pipes, and electrical conduits so cross-trade clash detection catches large ducts
32
+ * (e.g. `14"x8"`) and `3"`/`4"` DWV stacks without over-inflating `1/2"` PEX or EMT.
33
+ */
34
+ export declare function resolveMepRunExtents(run: SceneNodeLike): MepRunExtents;
35
+ export type OccupancyKind = 'structural-beam' | 'structural-column' | 'plumbing-pipe' | 'plumbing-equipment' | 'plumbing-manifold' | 'plumbing-fixture' | 'hvac-duct' | 'hvac-equipment' | 'hvac-plenum' | 'hvac-terminal' | 'electrical-dedicated-space' | 'electrical-working-space' | 'electrical-conduit' | 'reserved-run';
36
+ export type OccupancyObstacle = {
37
+ readonly id: string;
38
+ readonly nodeId: string;
39
+ readonly trade: TradeId;
40
+ readonly priorityRank: TradePriorityRank;
41
+ readonly kind: OccupancyKind;
42
+ readonly label: string;
43
+ readonly aabb: Aabb3;
44
+ readonly prism?: OrientedPrismY;
45
+ readonly requiredClearanceM: number;
46
+ readonly beamRole?: string;
47
+ readonly structuralKind?: 'beam' | 'column';
48
+ readonly nodeType?: string;
49
+ };
50
+ export type PathClashRecord = {
51
+ readonly obstacle: OccupancyObstacle;
52
+ readonly segmentIndex: number;
53
+ };
54
+ export type ExtractTradeOccupancyOptions = {
55
+ readonly forTrade: TradeId;
56
+ readonly includeElectricalWorkingSpace?: boolean;
57
+ readonly includeUnparented?: boolean;
58
+ readonly includeHidden?: boolean;
59
+ readonly includePlumbingFixtures?: boolean;
60
+ };
61
+ export type ElectricalDedicatedSpacePrisms = {
62
+ readonly dedicated: OrientedPrismY;
63
+ readonly workingSpace?: OrientedPrismY;
64
+ };
65
+ export type EquipmentPrismObstacle = OccupancyObstacle & {
66
+ readonly prism: OrientedPrismY;
67
+ };
68
+ /**
69
+ * Extract an exact Y-oriented prism for a `structural:beam` or generic `beam` node.
70
+ *
71
+ * Supports BOTH 2D `[x, z]` and 3D `[x, y, z]` `start`/`end` coordinates and builds an
72
+ * exact rotated OBB along the beam's true centerline with zero diagonal AABB staircase artifacts.
73
+ */
74
+ export declare function extractBeamPrism(node: SceneNodeLike, levelH?: number): OrientedPrismY | null;
75
+ /**
76
+ * Extract an exact Y-oriented prism for a `structural:column` or generic `column` node,
77
+ * honoring Three.js yaw rotation (`rotation` number or 3-tuple), `widthIn`/`depthIn`/`heightM`,
78
+ * and generic `width`/`depth`/`height`.
79
+ */
80
+ export declare function extractColumnPrism(node: SceneNodeLike, levelH?: number): OrientedPrismY | null;
81
+ /** Exact Y-oriented prism for `hvac:equipment` / `hvac-equipment`. */
82
+ export declare function getHvacEquipmentPrism(node: SceneNodeLike): OrientedPrismY | null;
83
+ /** Shared flat AABB for `hvac:equipment` / `hvac-equipment` (routing + NEC 110.26 audit parity). */
84
+ export declare function getHvacEquipmentAabb(node: SceneNodeLike): Aabb3 | null;
85
+ /** Exact Y-oriented prism for `hvac:plenum` (`widthIn`/`heightIn`/`depthIn` x `INCHES_TO_METERS`). */
86
+ export declare function getHvacPlenumPrism(node: SceneNodeLike): OrientedPrismY | null;
87
+ /** Shared flat AABB for `hvac:plenum`. */
88
+ export declare function getHvacPlenumAabb(node: SceneNodeLike): Aabb3 | null;
89
+ /** Exact Y-oriented prism for `plumbing:fixture` (honoring `fixtureKind` footprint and yaw rotation). */
90
+ export declare function getPlumbingFixturePrism(node: SceneNodeLike): OrientedPrismY | null;
91
+ /** Shared flat AABB for `plumbing:fixture`. */
92
+ export declare function getPlumbingFixtureAabb(node: SceneNodeLike): Aabb3 | null;
93
+ /** Exact Y-oriented prism for `plumbing:equipment` and `plumbing:manifold`. */
94
+ export declare function getPlumbingEquipmentPrism(node: SceneNodeLike): OrientedPrismY | null;
95
+ /** Shared flat AABB for `plumbing:equipment` and `plumbing:manifold`. */
96
+ export declare function getPlumbingEquipmentAabb(node: SceneNodeLike): Aabb3 | null;
97
+ /**
98
+ * Compute NEC 110.26(E) Dedicated Electrical Space prism and optional NEC 110.26(A)
99
+ * Working Space prism (36" deep x 30" min wide x 78" tall in front of panel) for
100
+ * `electrical:panel` and `electrical:transformer` nodes.
101
+ */
102
+ export declare function getElectricalDedicatedSpacePrisms(node: SceneNodeLike, levelH?: number, opts?: {
103
+ readonly includeWorkingSpace?: boolean;
104
+ }): ElectricalDedicatedSpacePrisms | null;
105
+ /**
106
+ * Extract one or more exact `OrientedPrismY` occupancy obstacles for any MEP equipment,
107
+ * plenum, fixture, terminal, fitting, or electrical panel/transformer node.
108
+ */
109
+ export declare function extractEquipmentPrisms(node: SceneNodeLike, levelH?: number, opts?: {
110
+ readonly includeElectricalWorkingSpace?: boolean;
111
+ }): EquipmentPrismObstacle[];
112
+ /**
113
+ * Extract all occupancy obstacles relevant to `opts.forTrade` on `levelId`, enforcing `INV-MEP-07`
114
+ * trade priority ordering (`structural (1) < plumbing (2) < hvac (3) < electrical (4)`):
115
+ *
116
+ * - `plumbing` avoids `structural` + `electrical-dedicated-space` (plus `electrical-working-space` if opted in)
117
+ * - `hvac` avoids `structural` + `plumbing` + `electrical-dedicated-space` + `electrical-working-space`
118
+ * - `electrical` avoids `structural` + `plumbing` + `hvac`
119
+ * - `structural` inspects all MEP trades (`plumbing`, `hvac`, `electrical`) for audit clash checks
120
+ */
121
+ export declare function extractTradeOccupancyObstacles(nodes: Readonly<Record<string, SceneNodeLike>>, levelId: string | null, opts: ExtractTradeOccupancyOptions): OccupancyObstacle[];
122
+ export type ReserveRunParams = {
123
+ readonly runId: string;
124
+ readonly trade: TradeId;
125
+ readonly path: readonly Vec3[];
126
+ readonly halfXZ: number;
127
+ readonly halfY: number;
128
+ readonly clearanceM?: number;
129
+ readonly label?: string;
130
+ };
131
+ export type ReserveBoxParams = {
132
+ readonly id: string;
133
+ readonly nodeId?: string;
134
+ readonly trade: TradeId;
135
+ readonly kind: OccupancyKind;
136
+ readonly aabb: Aabb3;
137
+ readonly prism?: OrientedPrismY;
138
+ readonly clearanceM?: number;
139
+ readonly label?: string;
140
+ };
141
+ export type SegmentClashParams = {
142
+ readonly halfXZ: number;
143
+ readonly halfY: number;
144
+ readonly extraClearanceM?: number;
145
+ readonly ignoreNodeIds?: ReadonlySet<string>;
146
+ /**
147
+ * When `true` (default), effective clearance is `Math.max(obs.requiredClearanceM, extraClearanceM ?? 0)`.
148
+ * Pass `false` for exact zero-buffer physical penetration audits (e.g., Structural IRC R502.8).
149
+ */
150
+ readonly useObstacleClearance?: boolean;
151
+ };
152
+ export type DetectPathClashesParams = SegmentClashParams & {
153
+ /**
154
+ * When `true`, emit at most one `PathClashRecord` per obstacle `nodeId` across the whole path.
155
+ * When `false` (default), deduplicate per `(nodeId, segmentIndex)` so every clashing path
156
+ * segment is reported once per obstacle node.
157
+ */
158
+ readonly deduplicateByNode?: boolean;
159
+ };
160
+ /**
161
+ * Shared cross-trade occupancy container supporting dynamic run/box reservation
162
+ * and exact OBB (`OrientedPrismY`) / anisotropic AABB clash queries (`INV-MEP-07`).
163
+ */
164
+ export declare class TradeOccupancyGrid {
165
+ private readonly _obstacles;
166
+ private readonly _activeIds;
167
+ private readonly _reservations;
168
+ private _seq;
169
+ constructor(initialObstacles?: readonly OccupancyObstacle[]);
170
+ get obstacles(): readonly OccupancyObstacle[];
171
+ /**
172
+ * Reserve every valid 3D segment of a committed run as an exact swept `OrientedPrismY`
173
+ * so lower-priority trades and subsequent sibling runs avoid it by construction.
174
+ */
175
+ reserveRun(params: ReserveRunParams): string;
176
+ /**
177
+ * Reserve an arbitrary AABB or `OrientedPrismY` obstacle (e.g., placed equipment or keepout box).
178
+ */
179
+ reserveBox(params: ReserveBoxParams): string;
180
+ /**
181
+ * Remove all obstacles previously inserted by `reserveRun` or `reserveBox` in a single O(M) pass.
182
+ */
183
+ unreserve(reservationId: string): void;
184
+ /**
185
+ * Return all obstacles intersecting 3D segment `[a, b]` inflated by anisotropic
186
+ * `[halfXZ + clear, halfY + clear, halfXZ + clear]`. Uses exact `segmentIntersectsOrientedPrismY`
187
+ * whenever `obs.prism` is present, falling back to `segmentIntersectsAabb3`.
188
+ */
189
+ segmentClashes(a: Vec3, b: Vec3, params: SegmentClashParams): OccupancyObstacle[];
190
+ /**
191
+ * Detect all obstacle clashes along a 3D polyline `path`.
192
+ */
193
+ detectPathClashes(path: readonly Vec3[], params: DetectPathClashesParams): PathClashRecord[];
194
+ }
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Canonical Wall & 3D Opening Keepout Prism Extractor (`INV-MEP-01`, `INV-MEP-06`).
3
+ *
4
+ * Unifies:
5
+ * - Native Pascal `door`/`window` nodes AND legacy wall-attached `type === 'item'` openings
6
+ * (`asset.category` or `name`/`asset.id` regex).
7
+ * - Unclamped `rawSillYM >= 0` (preserving `0 m` floor-to-ceiling storefront glass for NEC 210.52(A)(2)(1))
8
+ * alongside `framedSillYM = Math.max(0.08, rawSillYM)` for IRC cripple-stud framing.
9
+ * - Exact 3D wall-local `OrientedPrismY` keepout prisms for axis-aligned and diagonal walls.
10
+ *
11
+ * Pure framework-free TypeScript: zero React, Three.js, `@pascal-app/*`, Next, Zod, or `node:*`.
12
+ */
13
+ import { type OrientedPrismY, type SceneNodeLike, type Vec2, type Vec3 } from '../types';
14
+ export type CanonicalWallOpening = {
15
+ readonly id: string;
16
+ readonly wallId: string;
17
+ readonly kind: 'door' | 'window';
18
+ readonly name?: string;
19
+ /** Distance along wall centerline from `wall.start` (meters). */
20
+ readonly uCenterM: number;
21
+ /** Start of rough opening along wall centerline from `wall.start` (meters). */
22
+ readonly startU: number;
23
+ /** End of rough opening along wall centerline from `wall.start` (meters). */
24
+ readonly endU: number;
25
+ /** Rough opening width along wall (meters). */
26
+ readonly widthM: number;
27
+ /** Rough opening vertical height (meters). */
28
+ readonly heightM: number;
29
+ /** Unclamped sill elevation above wall base (`>= 0`; `0` for doors & floor-to-ceiling storefront glass). */
30
+ readonly rawSillYM: number;
31
+ /** IRC-framed sill elevation (`0` for doors; `Math.max(0.08, rawSillYM)` for windows). */
32
+ readonly framedSillYM: number;
33
+ /** Head elevation above wall base (meters). */
34
+ readonly headYM: number;
35
+ /** World/level-local X coordinate of opening center on wall centerline. */
36
+ readonly centerX: number;
37
+ /** World/level-local Z coordinate of opening center on wall centerline. */
38
+ readonly centerZ: number;
39
+ /** Exact 3D wall-local keepout prism. */
40
+ readonly prism: OrientedPrismY;
41
+ };
42
+ export type CanonicalWall = {
43
+ readonly id: string;
44
+ readonly levelId: string | null;
45
+ readonly start: Vec2;
46
+ readonly end: Vec2;
47
+ readonly lengthM: number;
48
+ /** Unit tangent along wall `(end - start) / lengthM`. */
49
+ readonly ux: number;
50
+ readonly uz: number;
51
+ /** Left unit normal in XZ plane `(-uz, ux)`. */
52
+ readonly nx: number;
53
+ readonly nz: number;
54
+ readonly heightM: number;
55
+ readonly thicknessM: number;
56
+ readonly visible: boolean;
57
+ readonly openings: readonly CanonicalWallOpening[];
58
+ };
59
+ export type TaggedOpeningPrism = OrientedPrismY & {
60
+ readonly id: string;
61
+ readonly wallId: string;
62
+ readonly kind: 'door' | 'window';
63
+ };
64
+ export type NearestWallProjection = {
65
+ readonly wall: CanonicalWall;
66
+ readonly wallIdx: number;
67
+ /** Clamped distance along the wall from `wall.start` in `[0, wall.lengthM]`. */
68
+ readonly t: number;
69
+ /** Euclidean distance in XZ from `(px, pz)` to `(projectedX, projectedZ)`. */
70
+ readonly distM: number;
71
+ /** Signed perpendicular offset along the wall left normal `(wall.nx, wall.nz)`. */
72
+ readonly perpDistM: number;
73
+ readonly projectedX: number;
74
+ readonly projectedZ: number;
75
+ };
76
+ export type ClassifyOpeningOptions = {
77
+ /** When `false`, returns `null` if `node.visible === false`. Default: `true`. */
78
+ readonly includeHidden?: boolean;
79
+ };
80
+ export type ExtractWallOpeningsOptions = {
81
+ /** Whether to include `visible === false` opening nodes. Default: `false`. */
82
+ readonly includeHidden?: boolean;
83
+ /** Override host wall height in meters (falls back to `wall.heightM` / `resolveWallHeightM`). */
84
+ readonly wallHeightM?: number;
85
+ };
86
+ export type ExtractCanonicalWallsOptions = {
87
+ /** Whether to include `visible === false` walls and openings. Default: `false`. */
88
+ readonly includeHidden?: boolean;
89
+ /** Whether unparented walls (`parentId == null`) match a non-null `levelId`. Default: `false`. */
90
+ readonly includeUnparented?: boolean;
91
+ /** Minimum valid wall length in meters. Default: `0.1`. */
92
+ readonly minLengthM?: number;
93
+ /** Fallback wall height when neither wall nor level define one. */
94
+ readonly defaultWallHeightM?: number;
95
+ };
96
+ /**
97
+ * Classify a Pascal scene node as `'door'`, `'window'`, or `null`.
98
+ * Handles both native `door`/`window` nodes and wall-attached `type === 'item'` openings
99
+ * via `asset.category`, `node.category`, or `name`/`asset.id`/`asset.name` patterns.
100
+ */
101
+ export declare function classifyOpeningKind(node: SceneNodeLike, opts?: ClassifyOpeningOptions): 'door' | 'window' | null;
102
+ /**
103
+ * Extract all doors and windows hosted by a given wall (`CanonicalWall` or raw `SceneNodeLike`),
104
+ * preserving both `rawSillYM` (unclamped `>= 0` for floor-to-ceiling storefront glass) and
105
+ * `framedSillYM` (`Math.max(0.08, rawSillYM)` for windows, `0` for doors), and constructing
106
+ * exact 3D wall-local `OrientedPrismY` keepout prisms.
107
+ */
108
+ export declare function extractCanonicalWallOpenings(nodes: Readonly<Record<string, SceneNodeLike>>, wall: CanonicalWall | SceneNodeLike, opts?: ExtractWallOpeningsOptions): CanonicalWallOpening[];
109
+ /**
110
+ * Extract canonical wall segments (with unit tangent, left normal, height, thickness, visibility,
111
+ * and pre-extracted `CanonicalWallOpening[]`) for a level or unscoped scene.
112
+ */
113
+ export declare function extractCanonicalWalls(nodes: Readonly<Record<string, SceneNodeLike>>, levelId?: string | null, opts?: ExtractCanonicalWallsOptions): CanonicalWall[];
114
+ /**
115
+ * Flatten all wall openings on a level into tagged 3D `OrientedPrismY` keepout prisms.
116
+ */
117
+ export declare function extractLevelOpeningPrisms(walls: readonly CanonicalWall[]): readonly TaggedOpeningPrism[];
118
+ /**
119
+ * Count how many segments along a 3D polyline intersect at least one opening keepout prism.
120
+ */
121
+ export declare function countPathOpeningPrismHits(path: readonly Vec3[], prisms: readonly OrientedPrismY[], padM?: number): number;
122
+ /**
123
+ * Project a 2D XZ point onto the nearest `CanonicalWall` segment.
124
+ */
125
+ export declare function findNearestWallToPoint(px: number, pz: number, walls: readonly CanonicalWall[]): NearestWallProjection | null;
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Single Authoritative 7-Type Canonical Roof Shell & Multi-Story Adoption Engine (`INV-MEP-05`).
3
+ *
4
+ * Shared across Structural (IRC), Plumbing (IPC), HVAC (IMC), and Electrical (NEC) plugins.
5
+ * Framework-free (`INV-MEP-01`): zero `three`, `react`, `@pascal-app/*`, `next`, `zod`, or `node:*` imports.
6
+ *
7
+ * Guarantees:
8
+ * - Full cycle-safe parent chain traversal for nested `roof` container transforms (`position` +
9
+ * `extractNodeYawRad(rotation)`), even when `levelId === null`.
10
+ * - Complete support for all 7 Pascal roof types (`flat`, `shed`, `gable`, `hip`, `dutch`,
11
+ * `mansard`, `conical`), including `width < depth` long-axis swap (`effYaw = yaw + Math.PI / 2`)
12
+ * for `hip` / `dutch` / `mansard`, and strict preservation of `pitch === 0` as flat (`0`).
13
+ * - Per-segment spatial wall-less roof level adoption (`shouldAdoptRoofSegmentOntoLevel` with
14
+ * `0.8 m` XZ wall-overlap pad, falling back to `shouldAdoptWallLessRoofLevel`) plus
15
+ * `isDirectUpperWingRoof` seating so upper-level wing roofs never double-add `wallHeightM`.
16
+ */
17
+ import { type SceneNodeLike, type Vec3, type XzBounds2D } from '../types';
18
+ export type RoofSegmentKind = 'flat' | 'shed' | 'gable' | 'hip' | 'dutch' | 'mansard' | 'conical';
19
+ export type CanonicalRoofSegment = {
20
+ readonly id: string;
21
+ readonly levelId: string | null;
22
+ readonly adoptedFromWallLessLevel: boolean;
23
+ readonly cx: number;
24
+ readonly cz: number;
25
+ readonly eaveY: number;
26
+ readonly width: number;
27
+ readonly depth: number;
28
+ readonly wallHeightM: number;
29
+ readonly pitchDeg: number;
30
+ readonly pitchRad: number;
31
+ readonly roofType: RoofSegmentKind;
32
+ readonly yaw: number;
33
+ readonly cos: number;
34
+ readonly sin: number;
35
+ readonly effWidth: number;
36
+ readonly effDepth: number;
37
+ readonly effYaw: number;
38
+ readonly effCos: number;
39
+ readonly effSin: number;
40
+ readonly peakY: number;
41
+ readonly overhangM: number;
42
+ };
43
+ export type CompileRoofShellOptions = {
44
+ readonly includeHidden?: boolean;
45
+ readonly clampOverhangToEave?: boolean;
46
+ readonly footprintPadM?: number;
47
+ readonly fallbackPitchRiseOver12?: number;
48
+ readonly wallBounds?: XzBounds2D | null;
49
+ readonly levelBaseY?: number;
50
+ };
51
+ export type LevelRoofShell = {
52
+ readonly levelId: string | null;
53
+ readonly wallHeightM: number;
54
+ readonly segments: readonly CanonicalRoofSegment[];
55
+ readonly hasRoofAbove: boolean;
56
+ readonly isFlatRoof: boolean;
57
+ readonly maxRidgeY: number;
58
+ readonly fallbackBounds: XzBounds2D | null;
59
+ readonly fallbackPitchRiseOver12: number;
60
+ readonly roofSurfaceY: (x: number, z: number) => number | null;
61
+ readonly roofEnvelopeY: (x: number, z: number) => number;
62
+ readonly minRoofYOverAabb: (minX: number, maxX: number, minZ: number, maxZ: number) => number;
63
+ readonly isPathClearOfRoof: (path: readonly Vec3[], halfV: number, clearanceM?: number) => boolean;
64
+ readonly safeGableCorridorHalfWidth: (y: number, clearanceM?: number) => number | null;
65
+ };
66
+ /**
67
+ * Determine whether a wall-less roof level should be adopted onto `targetLevelId`
68
+ * (the highest walled level in the same building at or below `roofLevel`).
69
+ */
70
+ export declare function shouldAdoptWallLessRoofLevel(nodes: Readonly<Record<string, SceneNodeLike>>, targetLevelId: string, roofLevel: SceneNodeLike): boolean;
71
+ /**
72
+ * Per-segment wall-less roof level adoption: picks the highest walled level at or below
73
+ * `roofLevel` whose visible walls overlap the segment's XZ bounding box (padded by `0.8 m`),
74
+ * falling back to `shouldAdoptWallLessRoofLevel` only when no walled level overlaps.
75
+ *
76
+ * Ensures 1-story wing roofs placed on a wall-less Roof level seat onto the 1st-floor wing
77
+ * walls instead of floating at 2nd-floor eave elevation.
78
+ */
79
+ export declare function shouldAdoptRoofSegmentOntoLevel(nodes: Readonly<Record<string, SceneNodeLike>>, targetLevelId: string, roofLevel: SceneNodeLike, segCenterX: number, segCenterZ: number, halfX: number, halfZ: number): boolean;
80
+ /**
81
+ * Evaluate the roof-plane surface elevation `y` of a single `CanonicalRoofSegment` at world `(wx, wz)`,
82
+ * or `null` if `(wx, wz)` lies outside the segment's plan footprint (including eave overhang + `footprintPadM`).
83
+ */
84
+ export declare function evaluateRoofSegmentSurfaceY(seg: CanonicalRoofSegment, wx: number, wz: number, opts?: {
85
+ readonly clampOverhangToEave?: boolean;
86
+ readonly footprintPadM?: number;
87
+ }): number | null;
88
+ /**
89
+ * Extract all `CanonicalRoofSegment`s applicable to `levelId` (direct children plus segments
90
+ * spatially adopted from wall-less roof levels).
91
+ *
92
+ * Walks the FULL cycle-safe parent chain for nested `roof` container transforms (`position` +
93
+ * `extractNodeYawRad(rotation)`) BEFORE evaluating level scoping — even when `levelId === null`.
94
+ */
95
+ export declare function extractCanonicalRoofSegments(nodes: Readonly<Record<string, SceneNodeLike>>, levelId: string | null, wallHeightM: number, opts?: {
96
+ readonly includeHidden?: boolean;
97
+ readonly levelBaseY?: number;
98
+ }): CanonicalRoofSegment[];
99
+ /**
100
+ * Compile the single authoritative `LevelRoofShell` for `levelId` (`INV-MEP-05`).
101
+ */
102
+ export declare function compileLevelRoofShell(nodes: Readonly<Record<string, SceneNodeLike>>, levelId: string | null, wallHeightM: number, opts?: CompileRoofShellOptions): LevelRoofShell;