@ifc-lite/create 2.2.0 → 2.4.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.
Files changed (60) hide show
  1. package/dist/ifc-creator.d.ts +1 -0
  2. package/dist/ifc-creator.d.ts.map +1 -1
  3. package/dist/ifc-creator.js +15 -15
  4. package/dist/ifc-creator.js.map +1 -1
  5. package/dist/in-store/anchor.d.ts +16 -1
  6. package/dist/in-store/anchor.d.ts.map +1 -1
  7. package/dist/in-store/anchor.js +20 -0
  8. package/dist/in-store/anchor.js.map +1 -1
  9. package/dist/in-store/drawing-markup-geometry.d.ts +46 -0
  10. package/dist/in-store/drawing-markup-geometry.d.ts.map +1 -0
  11. package/dist/in-store/drawing-markup-geometry.js +80 -0
  12. package/dist/in-store/drawing-markup-geometry.js.map +1 -0
  13. package/dist/in-store/drawing-markup-tags.d.ts +29 -0
  14. package/dist/in-store/drawing-markup-tags.d.ts.map +1 -0
  15. package/dist/in-store/drawing-markup-tags.js +31 -0
  16. package/dist/in-store/drawing-markup-tags.js.map +1 -0
  17. package/dist/in-store/drawing-markup.d.ts +184 -0
  18. package/dist/in-store/drawing-markup.d.ts.map +1 -0
  19. package/dist/in-store/drawing-markup.js +196 -0
  20. package/dist/in-store/drawing-markup.js.map +1 -0
  21. package/dist/in-store/extract-walls.d.ts +16 -16
  22. package/dist/in-store/extract-walls.d.ts.map +1 -1
  23. package/dist/in-store/extract-walls.js +31 -289
  24. package/dist/in-store/extract-walls.js.map +1 -1
  25. package/dist/in-store/generate-spaces.d.ts +3 -15
  26. package/dist/in-store/generate-spaces.d.ts.map +1 -1
  27. package/dist/in-store/generate-spaces.js +11 -146
  28. package/dist/in-store/generate-spaces.js.map +1 -1
  29. package/dist/in-store/length-unit-scale.d.ts +34 -0
  30. package/dist/in-store/length-unit-scale.d.ts.map +1 -0
  31. package/dist/in-store/length-unit-scale.js +44 -0
  32. package/dist/in-store/length-unit-scale.js.map +1 -0
  33. package/dist/in-store/placement-frame.d.ts +132 -0
  34. package/dist/in-store/placement-frame.d.ts.map +1 -0
  35. package/dist/in-store/placement-frame.js +266 -0
  36. package/dist/in-store/placement-frame.js.map +1 -0
  37. package/dist/in-store/resolve-anchor.d.ts.map +1 -1
  38. package/dist/in-store/resolve-anchor.js +7 -14
  39. package/dist/in-store/resolve-anchor.js.map +1 -1
  40. package/dist/in-store/resolve-source.d.ts.map +1 -1
  41. package/dist/in-store/resolve-source.js +3 -10
  42. package/dist/in-store/resolve-source.js.map +1 -1
  43. package/dist/in-store/room-footprint-offset.d.ts +27 -0
  44. package/dist/in-store/room-footprint-offset.d.ts.map +1 -0
  45. package/dist/in-store/room-footprint-offset.js +146 -0
  46. package/dist/in-store/room-footprint-offset.js.map +1 -0
  47. package/dist/in-store/space.d.ts +4 -1
  48. package/dist/in-store/space.d.ts.map +1 -1
  49. package/dist/in-store/space.js +5 -1
  50. package/dist/in-store/space.js.map +1 -1
  51. package/dist/in-store/spatial-zone.js +1 -1
  52. package/dist/in-store/storey-plan-frame.d.ts +69 -0
  53. package/dist/in-store/storey-plan-frame.d.ts.map +1 -0
  54. package/dist/in-store/storey-plan-frame.js +157 -0
  55. package/dist/in-store/storey-plan-frame.js.map +1 -0
  56. package/dist/index.d.ts +3 -0
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +3 -0
  59. package/dist/index.js.map +1 -1
  60. package/package.json +6 -6
@@ -5,6 +5,8 @@ import { resolveSpatialAnchor } from './resolve-anchor.js';
5
5
  import { extractWallSegmentsForStorey, } from './extract-walls.js';
6
6
  import { detectEnclosedAreasWithStats, } from './auto-space-detect.js';
7
7
  import { addSpaceToStore } from './space.js';
8
+ import { offsetRoomFootprint, pointInPolygon, polygonArea } from './room-footprint-offset.js';
9
+ export { offsetRoomFootprint } from './room-footprint-offset.js';
8
10
  /**
9
11
  * IfcSpace.ObjectType marker stamped on every derived space, so a re-run can
10
12
  * recognise its own output and skip it instead of duplicating (idempotency),
@@ -80,13 +82,17 @@ export function generateSpacesFromWalls(editor, store, storeyExpressId, options
80
82
  if (options.guidRandom !== undefined)
81
83
  anchor.guidRandom = options.guidRandom;
82
84
  const allOutlines = rooms.map((r) => r.outline);
85
+ const boundaryMode = options.boundaryMode ?? 'inner';
83
86
  rooms.forEach((region, i) => {
84
87
  const name = namePattern.replace('{n}', String(i + 1));
85
88
  const others = allOutlines.filter((_, j) => j !== i);
86
- // Bake the solid at the inner (net) face — IfcSpace should stop at the room
87
- // side of the walls, not run to their centreline. GrossFloorArea keeps the
88
- // centreline measure; NetFloorArea falls out of the inset OuterCurve.
89
- const netOutline = offsetRoomFootprint(region.outline, extraction.segments, extraction.wallThicknesses, options.boundaryMode ?? 'inner', others);
89
+ // Bake the solid at the chosen boundary face, but always derive
90
+ // NetFloorArea from the inner (room-side) inset — under 'outer'/'center'
91
+ // OuterCurve isn't the inner face, so reusing its area would report
92
+ // NetFloorArea > GrossFloorArea.
93
+ const netOutline = offsetRoomFootprint(region.outline, extraction.segments, extraction.wallThicknesses, boundaryMode, others);
94
+ const netFootprint = boundaryMode === 'inner' ? netOutline
95
+ : offsetRoomFootprint(region.outline, extraction.segments, extraction.wallThicknesses, 'inner', others);
90
96
  const result = addSpaceToStore(editor, anchor, {
91
97
  Profile: 'polygon',
92
98
  OuterCurve: netOutline,
@@ -97,6 +103,7 @@ export function generateSpacesFromWalls(editor, store, storeyExpressId, options
97
103
  PredefinedType: options.predefinedType,
98
104
  boundaries: buildSpaceBoundaries(region.outline, extraction.segments, extraction.contributingWallIds, others),
99
105
  grossFloorArea: region.area,
106
+ netFloorArea: polygonArea(netFootprint),
100
107
  });
101
108
  emitted.push({ region, result, name });
102
109
  });
@@ -110,148 +117,6 @@ export function generateSpacesFromWalls(editor, store, storeyExpressId, options
110
117
  skippedExisting,
111
118
  };
112
119
  }
113
- /** Absolute polygon area (shoelace), m². */
114
- function polygonArea(pts) {
115
- let acc = 0;
116
- for (let i = 0; i < pts.length; i++) {
117
- const p = pts[i];
118
- const q = pts[(i + 1) % pts.length];
119
- acc += p[0] * q[1] - q[0] * p[1];
120
- }
121
- return Math.abs(acc) / 2;
122
- }
123
- /** Intersection of two lines given as point + unit direction; null if parallel. */
124
- function lineIntersect(p0, d0, p1, d1) {
125
- const denom = d0[0] * d1[1] - d0[1] * d1[0];
126
- if (Math.abs(denom) < 1e-9)
127
- return null;
128
- const t = ((p1[0] - p0[0]) * d1[1] - (p1[1] - p0[1]) * d1[0]) / denom;
129
- return [p0[0] + d0[0] * t, p0[1] + d0[1] * t];
130
- }
131
- /** Does outline edge a→b run along wall segment `seg` (parallel, on its
132
- * centreline, overlapping extent)? */
133
- function edgeRunsAlong(a, b, seg) {
134
- const PERP_TOL = 0.2, PARALLEL_TOL = 0.03, OVERLAP_MARGIN = 0.3;
135
- let ex = b[0] - a[0], ey = b[1] - a[1];
136
- const el = Math.hypot(ex, ey);
137
- if (el < 1e-6)
138
- return false;
139
- ex /= el;
140
- ey /= el;
141
- let sx = seg.b[0] - seg.a[0], sy = seg.b[1] - seg.a[1];
142
- const sl = Math.hypot(sx, sy);
143
- if (sl < 1e-6)
144
- return false;
145
- sx /= sl;
146
- sy /= sl;
147
- if (Math.abs(ex * sy - ey * sx) > PARALLEL_TOL)
148
- return false;
149
- const mx = (a[0] + b[0]) / 2, my = (a[1] + b[1]) / 2;
150
- const t = (mx - seg.a[0]) * sx + (my - seg.a[1]) * sy;
151
- const px = seg.a[0] + sx * t, py = seg.a[1] + sy * t;
152
- if (Math.hypot(mx - px, my - py) > PERP_TOL)
153
- return false;
154
- return t >= -OVERLAP_MARGIN && t <= sl + OVERLAP_MARGIN;
155
- }
156
- /** Drop vertices whose two adjacent edges are collinear (e.g. a T-junction
157
- * point left on a straight wall run). Such a vertex makes its two adjacent
158
- * offset lines parallel, so they don't intersect — the offset then falls back
159
- * to the un-offset centreline point and the corner skews. */
160
- function simplifyCollinear(pts) {
161
- const n = pts.length;
162
- if (n < 4)
163
- return pts;
164
- const out = [];
165
- for (let i = 0; i < n; i++) {
166
- const p = pts[(i - 1 + n) % n], c = pts[i], q = pts[(i + 1) % n];
167
- let ax = c[0] - p[0], ay = c[1] - p[1];
168
- let bx = q[0] - c[0], by = q[1] - c[1];
169
- const al = Math.hypot(ax, ay) || 1, bl = Math.hypot(bx, by) || 1;
170
- ax /= al;
171
- ay /= al;
172
- bx /= bl;
173
- by /= bl;
174
- if (Math.abs(ax * by - ay * bx) > 1e-4)
175
- out.push(c); // keep real corners only
176
- }
177
- return out.length >= 3 ? out : pts;
178
- }
179
- /**
180
- * Offset a (centreline) room outline to the chosen wall boundary: `center` =
181
- * the centreline as-is; `inner` = each edge shifted toward the room by half the
182
- * wall thickness (net / inner face); `outer` = shifted away by half (gross /
183
- * outer face). Re-corners by intersecting adjacent offset edges. `segments[k]`
184
- * has thickness `wallThicknesses[k]`. `otherRooms` (other rooms' centreline
185
- * outlines) lets `outer` keep shared/internal edges on the centreline so
186
- * neighbouring rooms meet there instead of overlapping inside the wall.
187
- * Returns the original outline if the offset degenerates (e.g. an inner inset
188
- * of a room thinner than its walls). Exact for orthogonal rooms.
189
- */
190
- export function offsetRoomFootprint(outline, segments, wallThicknesses, mode = 'inner', otherRooms = []) {
191
- if (mode === 'center')
192
- return outline;
193
- const simple = simplifyCollinear(outline);
194
- const n = simple.length;
195
- if (n < 3)
196
- return outline;
197
- const sign = mode === 'inner' ? 1 : -1; // inner → inward, outer → outward
198
- const lines = [];
199
- for (let i = 0; i < n; i++) {
200
- const a = simple[i];
201
- const b = simple[(i + 1) % n];
202
- let dx = b[0] - a[0];
203
- let dy = b[1] - a[1];
204
- const l = Math.hypot(dx, dy);
205
- if (l < 1e-6)
206
- return outline;
207
- dx /= l;
208
- dy /= l;
209
- let half = 0; // half the thickest wall this edge runs along
210
- for (let k = 0; k < segments.length; k++) {
211
- const t = wallThicknesses[k];
212
- if (t !== undefined && t / 2 > half && edgeRunsAlong(a, b, segments[k]))
213
- half = t / 2;
214
- }
215
- let off = sign * half;
216
- // A shared (internal) edge has another room on its OUTWARD side. Pushing it
217
- // outward (outer mode) would overlap that room, so pin shared edges to the
218
- // centreline; only edges facing outside the building actually push out.
219
- if (mode === 'outer' && half > 0 && otherRooms.length) {
220
- const mx = (a[0] + b[0]) / 2 + dy * 0.1; // outward = right normal (dy, -dx)
221
- const my = (a[1] + b[1]) / 2 - dx * 0.1;
222
- if (otherRooms.some((poly) => pointInPolygon(mx, my, poly)))
223
- off = 0;
224
- }
225
- // Inward normal of a CCW outline is to the left of a→b: (-dy, dx).
226
- lines.push({ p: [a[0] - dy * off, a[1] + dx * off], d: [dx, dy] });
227
- }
228
- const verts = [];
229
- for (let i = 0; i < n; i++) {
230
- const prev = lines[(i - 1 + n) % n];
231
- const cur = lines[i];
232
- verts.push(lineIntersect(prev.p, prev.d, cur.p, cur.d) ?? simple[i]);
233
- }
234
- if (!verts.every((v) => Number.isFinite(v[0]) && Number.isFinite(v[1])))
235
- return outline;
236
- const gross = polygonArea(simple);
237
- const got = polygonArea(verts);
238
- if (got <= 1e-6)
239
- return outline;
240
- if (mode === 'inner' && got > gross + 1e-6)
241
- return outline; // inset inverted
242
- return verts;
243
- }
244
- /** Ray-cast point-in-polygon test. */
245
- function pointInPolygon(x, y, poly) {
246
- let inside = false;
247
- for (let i = 0, j = poly.length - 1; i < poly.length; j = i++) {
248
- const xi = poly[i][0], yi = poly[i][1];
249
- const xj = poly[j][0], yj = poly[j][1];
250
- if ((yi > y) !== (yj > y) && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi)
251
- inside = !inside;
252
- }
253
- return inside;
254
- }
255
120
  /** Wall ids whose centreline an outline edge runs along (parallel, on the
256
121
  * line, overlapping extent). `segments[k]` was extracted from `wallIds[k]`. */
257
122
  function matchEdgeWalls(a, b, segments, wallIds) {
@@ -1 +1 @@
1
- {"version":3,"file":"generate-spaces.js","sourceRoot":"","sources":["../../src/in-store/generate-spaces.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAkB/D,OAAO,EAAE,oBAAoB,EAA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AAE,kBAAkB,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3D,SAAS;QACT,kBAAkB;QAClB,iBAAiB,EAAE,UAAmB;KACvC,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { type EntityRef, type IfcSourceBytes } from '@ifc-lite/parser';
2
+ /**
3
+ * Single validated read of `extractLengthUnitScale`, shared by every caller
4
+ * in this package that turns the result into a coordinate multiplier.
5
+ *
6
+ * `extractLengthUnitScale` itself never throws and never returns a
7
+ * non-positive or non-finite value for its OWN degenerate inputs — a
8
+ * missing `IFCPROJECT`, an unresolved `UnitsInContext`, a garbled prefix —
9
+ * every one of those routes back to its documented 1.0 fallback (see
10
+ * `unit-extractor.ts`, pinned by `resolve-anchor-zero-scale.test.ts` which
11
+ * mocks the export because the real implementation cannot produce a zero).
12
+ * This wrapper is defense in depth against that contract changing, or
13
+ * against a caller-supplied `entityIndex` whose `.get` throws — without it,
14
+ * a caller trusting the return value verbatim would scale every length in
15
+ * the model by 0, a negative number, or `NaN` with no warning.
16
+ *
17
+ * Returns `null` when the value cannot be trusted (thrown error, `NaN`,
18
+ * non-finite, zero, or negative) rather than guessing on the caller's
19
+ * behalf. Two call sites in this package used to duplicate this guard with
20
+ * different strictness (`?? 1` here only excluded `null`/`undefined`,
21
+ * `Number.isFinite(raw) && raw > 0` there) — on a store where the lookup
22
+ * degenerated, one side would have refused while the other scaled by 0 or
23
+ * 1. Centralizing the check means they cannot disagree again; each caller
24
+ * still decides for itself what "unreliable" means for its own output —
25
+ * `?? 1.0` to keep the existing metres-fallback behaviour, or an early
26
+ * return to refuse the operation outright.
27
+ */
28
+ export declare function safeLengthUnitScale(source: Uint8Array | IfcSourceBytes, entityIndex: {
29
+ byId: {
30
+ get(expressId: number): EntityRef | undefined;
31
+ };
32
+ byType: Map<string, number[]>;
33
+ }, context: string, projectId?: number): number | null;
34
+ //# sourceMappingURL=length-unit-scale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"length-unit-scale.d.ts","sourceRoot":"","sources":["../../src/in-store/length-unit-scale.ts"],"names":[],"mappings":"AAIA,OAAO,EAA0B,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,UAAU,GAAG,cAAc,EACnC,WAAW,EAAE;IAAE,IAAI,EAAE;QAAE,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;KAAE,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;CAAE,EACvG,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,GAAG,IAAI,CAYf"}
@@ -0,0 +1,44 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ import { extractLengthUnitScale } from '@ifc-lite/parser';
5
+ /**
6
+ * Single validated read of `extractLengthUnitScale`, shared by every caller
7
+ * in this package that turns the result into a coordinate multiplier.
8
+ *
9
+ * `extractLengthUnitScale` itself never throws and never returns a
10
+ * non-positive or non-finite value for its OWN degenerate inputs — a
11
+ * missing `IFCPROJECT`, an unresolved `UnitsInContext`, a garbled prefix —
12
+ * every one of those routes back to its documented 1.0 fallback (see
13
+ * `unit-extractor.ts`, pinned by `resolve-anchor-zero-scale.test.ts` which
14
+ * mocks the export because the real implementation cannot produce a zero).
15
+ * This wrapper is defense in depth against that contract changing, or
16
+ * against a caller-supplied `entityIndex` whose `.get` throws — without it,
17
+ * a caller trusting the return value verbatim would scale every length in
18
+ * the model by 0, a negative number, or `NaN` with no warning.
19
+ *
20
+ * Returns `null` when the value cannot be trusted (thrown error, `NaN`,
21
+ * non-finite, zero, or negative) rather than guessing on the caller's
22
+ * behalf. Two call sites in this package used to duplicate this guard with
23
+ * different strictness (`?? 1` here only excluded `null`/`undefined`,
24
+ * `Number.isFinite(raw) && raw > 0` there) — on a store where the lookup
25
+ * degenerated, one side would have refused while the other scaled by 0 or
26
+ * 1. Centralizing the check means they cannot disagree again; each caller
27
+ * still decides for itself what "unreliable" means for its own output —
28
+ * `?? 1.0` to keep the existing metres-fallback behaviour, or an early
29
+ * return to refuse the operation outright.
30
+ */
31
+ export function safeLengthUnitScale(source, entityIndex, context, projectId) {
32
+ try {
33
+ const raw = extractLengthUnitScale(source, entityIndex, projectId);
34
+ if (Number.isFinite(raw) && raw > 0)
35
+ return raw;
36
+ console.warn(`${context}: failed to extract length unit scale; extractLengthUnitScale returned ${raw}`);
37
+ return null;
38
+ }
39
+ catch (error) {
40
+ console.warn(`${context}: failed to extract length unit scale`, error);
41
+ return null;
42
+ }
43
+ }
44
+ //# sourceMappingURL=length-unit-scale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"length-unit-scale.js","sourceRoot":"","sources":["../../src/in-store/length-unit-scale.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,sBAAsB,EAAuC,MAAM,kBAAkB,CAAC;AAE/F;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAmC,EACnC,WAAuG,EACvG,OAAe,EACf,SAAkB;IAElB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,sBAAsB,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QACnE,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC;YAAE,OAAO,GAAG,CAAC;QAChD,OAAO,CAAC,IAAI,CACV,GAAG,OAAO,0EAA0E,GAAG,EAAE,CAC1F,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,uCAAuC,EAAE,KAAK,CAAC,CAAC;QACvE,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Planar rigid frames read out of an `IfcLocalPlacement` chain, and the algebra
3
+ * for composing, inverting and applying them.
4
+ *
5
+ * Split out of `extract-walls.ts` so the storey frame has ONE implementation.
6
+ * `extract-walls` needs it to express wall axes and existing space footprints
7
+ * storey-locally; `storey-plan-frame.ts` needs the same chain composed all the
8
+ * way to the model's own world frame, so a producer working in that frame can
9
+ * divide the storey out before authoring into a storey-local slot. Two copies
10
+ * of the composition order or of `invertFrame`'s sign convention would put the
11
+ * read side and the write side on coordinates that differ by a rotation, which
12
+ * is exactly the failure the storey-local contract exists to prevent.
13
+ *
14
+ * Every frame here is 2D and in the file's own raw length unit: the Z-up ground
15
+ * plane of the IFC coordinates, unscaled. Callers that speak metres apply the
16
+ * length-unit scale themselves.
17
+ */
18
+ import { EntityExtractor, type IfcDataStore, type IfcAttributeValue } from '@ifc-lite/parser';
19
+ import type { Vec2 } from './auto-space-detect.js';
20
+ /**
21
+ * Optional overlay reader. If supplied, overlay walls (entities
22
+ * created via `editor.addEntity('IfcWall', ...)` since the model was
23
+ * parsed) are included alongside the source walls.
24
+ */
25
+ export interface OverlayWallReader {
26
+ /** Iterate every overlay-created entity. */
27
+ getNewEntities(): Iterable<{
28
+ expressId: number;
29
+ type: string;
30
+ attributes: IfcAttributeValue[];
31
+ }>;
32
+ /** Resolve a positional attribute (with mutations applied). */
33
+ getAttribute?(expressId: number, index: number): IfcAttributeValue | undefined;
34
+ }
35
+ export declare const AXIS_EPS = 0.000001;
36
+ export interface PlacementFrame {
37
+ /** Placement origin in storey-local 2D (X, Y). */
38
+ origin: Vec2;
39
+ /** Local X axis (RefDirection) projected onto the ground plane. */
40
+ axisX: Vec2;
41
+ }
42
+ /**
43
+ * Walk IfcLocalPlacement → IfcAxis2Placement3D → CartesianPoint and read the
44
+ * ground-plane origin + RefDirection *of this one placement*, i.e. expressed
45
+ * in its own `PlacementRelTo` parent's frame. Returns null when any link is
46
+ * missing.
47
+ */
48
+ export declare function readOwnPlacementFrame(store: IfcDataStore, extractor: EntityExtractor, overlay: OverlayWallReader | undefined, placementId: number): PlacementFrame | null;
49
+ /**
50
+ * The storey's OWN placement chain: its `ObjectPlacement` and every ancestor
51
+ * reachable from it via `IfcLocalPlacement.PlacementRelTo`, mapped to the
52
+ * number of hops from the storey's own placement (`0` for that placement
53
+ * itself). Composition stops when it reaches one of these, and the hop count
54
+ * says how much of the storey's own chain still separates the stopping point
55
+ * from the storey frame — see `frameInStoreyFrame`.
56
+ *
57
+ * Returns `null` — NOT an empty map — when the storey has no resolvable
58
+ * placement, which `IfcProduct.ObjectPlacement` being OPTIONAL makes a
59
+ * well-formed possibility. An empty map is not "no storey frame", it is
60
+ * "a storey frame the walk can never reach": the walk would find nothing to
61
+ * stop on and compose every hop up to the world root, labelling world
62
+ * coordinates storey-local. `frameInStoreyFrame` treats `null` as "compose
63
+ * nothing" instead — see there.
64
+ */
65
+ export declare function storeyPlacementChain(store: IfcDataStore, extractor: EntityExtractor, overlay: OverlayWallReader | undefined, storeyId: number): Map<number, number> | null;
66
+ /**
67
+ * The storey's frame expressed in the frame of the chain entry `hops` steps
68
+ * above its own placement: compose the storey's first `hops` placements, the
69
+ * innermost one first. `hops === 0` is the storey's own placement, whose frame
70
+ * relative to itself is the identity.
71
+ *
72
+ * Returns `null` when any of those placements has no readable frame — the
73
+ * caller must then leave the element where it is rather than move it by a
74
+ * partial chain.
75
+ */
76
+ export declare function storeyFrameAboveBy(store: IfcDataStore, extractor: EntityExtractor, overlay: OverlayWallReader | undefined, storeyChain: ReadonlyMap<number, number>, hops: number): PlacementFrame | null;
77
+ /**
78
+ * The inverse of a planar rigid frame: `invertFrame(f)` maps a point expressed
79
+ * in `f`'s parent frame back into `f`'s own frame, so
80
+ * `composeFrames(invertFrame(f), g)` re-expresses `g` — a sibling of `f` in
81
+ * that parent frame — relative to `f`.
82
+ *
83
+ * With `axisX = (c, s)` the frame applies `p ↦ R·p + origin`, `R = [[c,−s],
84
+ * [s,c]]`. The inverse applies `p ↦ Rᵀ·(p − origin)`, and `Rᵀ` is the rotation
85
+ * whose `axisX` is `(c, −s)`, which is why only the Y component flips.
86
+ */
87
+ export declare function invertFrame(frame: PlacementFrame): PlacementFrame;
88
+ /**
89
+ * Compose `inner` (expressed in `outer`'s frame) with `outer`, giving the
90
+ * frame of `inner` expressed in whatever frame `outer` is expressed in.
91
+ */
92
+ export declare function composeFrames(outer: PlacementFrame, inner: PlacementFrame): PlacementFrame;
93
+ /**
94
+ * Frame of `placementId` expressed in the STOREY's frame: this placement's
95
+ * own frame composed with every intermediate `IfcLocalPlacement.
96
+ * PlacementRelTo` hop, stopping *before* the storey's own placement.
97
+ *
98
+ * An element's `ObjectPlacement` is not always one hop from its storey. The
99
+ * IFC-standard grouping pattern — an `IfcElementAssembly` for a curtain
100
+ * wall, precast panel run or railing system, all of them in
101
+ * `DEFAULT_DIVIDER_TYPES` — inserts an intermediate `IfcLocalPlacement`
102
+ * between the member and the storey. Reading only the member's own
103
+ * `RelativePlacement` silently drops that hop's translation and rotation, so
104
+ * the member is extracted at the wrong position relative to walls placed
105
+ * directly under the storey: corners that should meet come out disconnected
106
+ * and the enclosed room is never detected.
107
+ *
108
+ * Composition deliberately STOPS at the storey rather than continuing to the
109
+ * root. Storey-local is the frame the write side uses: `generateSpacesFromWalls`
110
+ * hands these segments to `addSpaceToStore`, which authors the new `IfcSpace`
111
+ * with `anchor.storeyPlacementId` as its `PlacementRelTo` (see `space.ts` and
112
+ * `resolve-anchor.ts`). Composing to the root would bake the storey's own
113
+ * offset into the coordinates and the storey placement would then apply it a
114
+ * second time, putting the space a whole site-offset away from its room.
115
+ *
116
+ * A `null` `storeyChain` (storey with no `ObjectPlacement`) means there is no
117
+ * storey frame to compose towards, so no hop is composed at all.
118
+ */
119
+ export declare function frameInStoreyFrame(store: IfcDataStore, extractor: EntityExtractor, overlay: OverlayWallReader | undefined, placementId: number, storeyChain: ReadonlyMap<number, number> | null): PlacementFrame | null;
120
+ /**
121
+ * Apply a placement frame to a storey-local 2D point. The point's X is
122
+ * along the wall's local axis; Y is perpendicular (perpendicular to
123
+ * the wall direction in the ground plane).
124
+ */
125
+ export declare function applyFrame(frame: PlacementFrame, local: Vec2): Vec2;
126
+ export declare function readEntity(store: IfcDataStore, extractor: EntityExtractor, overlay: OverlayWallReader | undefined, expressId: number): {
127
+ type?: string;
128
+ attributes: IfcAttributeValue[];
129
+ } | null;
130
+ export declare function numericAttr(v: IfcAttributeValue | undefined): number | null;
131
+ export declare function readVec3(v: IfcAttributeValue | undefined): [number, number, number] | null;
132
+ //# sourceMappingURL=placement-frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placement-frame.d.ts","sourceRoot":"","sources":["../../src/in-store/placement-frame.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,cAAc,IAAI,QAAQ,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,iBAAiB,EAAE,CAAA;KAAE,CAAC,CAAC;IACjG,+DAA+D;IAC/D,YAAY,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;CAChF;AAED,eAAO,MAAM,QAAQ,WAAO,CAAC;AAE7B,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,MAAM,EAAE,IAAI,CAAC;IACb,mEAAmE;IACnE,KAAK,EAAE,IAAI,CAAC;C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