@chanmeng666/archlang-3d 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.
- package/CHANGELOG.md +36 -0
- package/LICENSE +22 -0
- package/README.md +83 -2
- package/THIRD_PARTY_NOTICES +975 -0
- package/dist/browser.d.ts +29 -0
- package/dist/browser.js +249 -0
- package/dist/chunk-2WKSS3IA.js +495 -0
- package/dist/chunk-54YVSAVZ.js +54 -0
- package/dist/chunk-CTFMM64C.js +435 -0
- package/dist/chunk-IQJQDQSC.js +950 -0
- package/dist/chunk-NADV4D3M.js +857 -0
- package/dist/cli.js +686 -0
- package/dist/facts-DMBpeo-q.d.ts +29 -0
- package/dist/index.d.ts +475 -0
- package/dist/index.js +130 -0
- package/dist/node.d.ts +130 -0
- package/dist/node.js +60 -0
- package/dist/replay.d.ts +62 -0
- package/dist/scene3d.schema.json +578 -0
- package/dist/strip-BMxWrvYD.d.ts +433 -0
- package/dist/viewer.iife.js +4220 -0
- package/package.json +82 -4
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { World } from '@chanmeng666/archlang';
|
|
2
|
+
import { p as ReplayView, R as ReplayFacts } from './strip-BMxWrvYD.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The metrics strip's numbers (card G4), read from the core's public `describe()` and `lint()` for
|
|
6
|
+
* the same source the replay was built from: nothing is measured here and nothing is guessed. The
|
|
7
|
+
* strip itself (`strip.ts`) is browser-safe and core-free; this module is the one that asks the core.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
interface FactsOptions {
|
|
11
|
+
world?: World;
|
|
12
|
+
/**
|
|
13
|
+
* The level numbers the replay shows, lowest first: `storeysOf(mesh)` of the mesh before `viewMesh`.
|
|
14
|
+
* A level with nothing to raise (a `dim` only) is not among them, so a view's index is NOT an index
|
|
15
|
+
* into the core's levels; the numbers are what both are matched on.
|
|
16
|
+
*/
|
|
17
|
+
storeys: readonly number[];
|
|
18
|
+
/** The replay's view: the storeys combined (default), or storey `n` (1-based, of `storeys`). */
|
|
19
|
+
view?: ReplayView;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The facts for the replay of `source`, or `undefined` when the core gives none (the plan does not
|
|
23
|
+
* resolve, or a shown level has no summary). The combined view sums the shown storeys (the core's
|
|
24
|
+
* top-level totals are the lowest storey's alone); a storey view reads that level's own totals.
|
|
25
|
+
* Warnings are `lint()`'s, restricted to the shown levels.
|
|
26
|
+
*/
|
|
27
|
+
declare function replayFacts(source: string, opts: FactsOptions): ReplayFacts | undefined;
|
|
28
|
+
|
|
29
|
+
export { type FactsOptions as F, replayFacts as r };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
import { ResolvedPlan, RWall, Point, JoinedCut, loopsToPolygons, World, Diagnostic } from '@chanmeng666/archlang';
|
|
2
|
+
export { Point } from '@chanmeng666/archlang';
|
|
3
|
+
import { a as Scene3D, F as Floor, P as Polygon, M as Mesh3D, b as Pt, c as Shell, d as Ring3, A as Assumption, e as Furniture, f as ReplayEvent, g as ReplayState } from './strip-BMxWrvYD.js';
|
|
4
|
+
export { D as DoorKind, E as EXPLODE_GAP_MM, h as FIXTURE_FAMILIES, i as Fence, L as Level, j as MeshNode, k as Meta, N as NodeKind, l as NodeState, O as Opening, m as Outdoor, n as PHASE, o as Provenance, R as ReplayFacts, p as ReplayView, q as Roof, r as STOP_LEAD, t as Source, u as Stage, v as Stair, S as StripItem, U as Um, W as Wall, w as authoringOrder, x as ease, y as explodeLifts, z as keyFrames, B as stateAt, C as storeysOf, s as stripAt, G as timeline, H as viewLabel, I as viewMesh } from './strip-BMxWrvYD.js';
|
|
5
|
+
export { F as FactsOptions, r as replayFacts } from './facts-DMBpeo-q.js';
|
|
6
|
+
|
|
7
|
+
/** The package's own version, stamped into `meta.tool`. */
|
|
8
|
+
declare const ARCHLANG_3D_VERSION: string;
|
|
9
|
+
/** A resolved storey: its number, name and IR. */
|
|
10
|
+
interface Storey {
|
|
11
|
+
level: number;
|
|
12
|
+
name?: string;
|
|
13
|
+
ir: ResolvedPlan;
|
|
14
|
+
}
|
|
15
|
+
interface BuildOptions {
|
|
16
|
+
/** The core version the plan was resolved with, stamped into `meta.tool.archlang`. */
|
|
17
|
+
coreVersion: string;
|
|
18
|
+
/** Largest sagitta (mm) of an arc's chords; default {@link DEFAULT_CURVE_TOL_MM}. */
|
|
19
|
+
curveTolMm?: number;
|
|
20
|
+
}
|
|
21
|
+
/** Resolved storeys (lowest first) → a Scene3D v0. */
|
|
22
|
+
declare function buildScene3D(storeys: readonly Storey[], opts: BuildOptions): Scene3D;
|
|
23
|
+
|
|
24
|
+
/** A ring of plan points (mm), as `loopsToPolygons` returns it: closed, no repeated vertex. */
|
|
25
|
+
type Ring = Point[];
|
|
26
|
+
/** One connected piece of a wall's owned region: its outer ring, then the holes inside it. */
|
|
27
|
+
interface Piece {
|
|
28
|
+
outer: Ring;
|
|
29
|
+
holes: Ring[];
|
|
30
|
+
}
|
|
31
|
+
interface OwnedWall {
|
|
32
|
+
/** Index into the wall list given to {@link wallOwnership}. */
|
|
33
|
+
index: number;
|
|
34
|
+
wall: RWall;
|
|
35
|
+
pieces: Piece[];
|
|
36
|
+
/** The same region with EVERY opening's cut removed (the plan's slots), one entry per piece:
|
|
37
|
+
* the wall body between each opening's sill and head. */
|
|
38
|
+
body: Piece[];
|
|
39
|
+
/** Plan area owned, mm² (outer minus holes). */
|
|
40
|
+
area: number;
|
|
41
|
+
}
|
|
42
|
+
interface Ownership {
|
|
43
|
+
owned: OwnedWall[];
|
|
44
|
+
/** Area of the joined solid (every group's fill), mm²: the owned areas tile it. */
|
|
45
|
+
fillArea: number;
|
|
46
|
+
/** Every opening's cut, joined back to its host wall, from the same joinery. */
|
|
47
|
+
cuts: JoinedCut[];
|
|
48
|
+
/** The outer rings of the joined solid (the building's wall footprint, holes dropped). */
|
|
49
|
+
outline: Ring[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Rings → connected pieces. The joinery's loops come out with outers and holes of opposite
|
|
53
|
+
* orientation; the sign of the larger-magnitude ring is the outer sign, and each hole joins the
|
|
54
|
+
* outer that contains its first vertex.
|
|
55
|
+
*/
|
|
56
|
+
declare function piecesOf(rings: readonly Ring[]): Piece[];
|
|
57
|
+
/**
|
|
58
|
+
* Every wall's owned region, in the order given. `walls` must be in the drawing's order
|
|
59
|
+
* (`ResolvedPlan.walls` is): that order breaks the joinery's thickness ties.
|
|
60
|
+
*/
|
|
61
|
+
declare function wallOwnership(walls: readonly RWall[], tessellate?: (loops: Parameters<typeof loopsToPolygons>[0]) => Ring[]): Ownership;
|
|
62
|
+
/** Whether two pieces share a point of their boundaries (an edge or a vertex), within `tol` mm. */
|
|
63
|
+
declare function piecesTouch(a: Piece, b: Piece, tol?: number): boolean;
|
|
64
|
+
interface MixedHeightJoint {
|
|
65
|
+
code: "W3D_MIXED_HEIGHT_JOINT";
|
|
66
|
+
/** The lower wall that owns part of the taller wall's band, and the taller wall it notches. */
|
|
67
|
+
owner: {
|
|
68
|
+
id: string;
|
|
69
|
+
height: number;
|
|
70
|
+
};
|
|
71
|
+
notched: {
|
|
72
|
+
id: string;
|
|
73
|
+
height: number;
|
|
74
|
+
};
|
|
75
|
+
/** Plan area of the taller wall's band the lower wall owns, mm². */
|
|
76
|
+
lostMm2: number;
|
|
77
|
+
message: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Same-storey walls of different heights where the LOWER wall owns part of the taller wall's band,
|
|
81
|
+
* so the taller wall is notched where they meet (archlang-3d Q19, V-GEO-12; the synthetic `s11` is
|
|
82
|
+
* the regression case). Decided by ownership, never by thickness alone: each touching pair is
|
|
83
|
+
* joined on its own (in the drawing's order, so the joinery's tie-break holds) and the taller
|
|
84
|
+
* wall's owned area compared with its band alone. A butt joint, where the bands meet without
|
|
85
|
+
* overlapping, loses nothing and is not reported. Reported, never repaired: the geometry is the
|
|
86
|
+
* core's ownership, as drawn.
|
|
87
|
+
*/
|
|
88
|
+
declare function mixedHeightJoints(own: Ownership): MixedHeightJoint[];
|
|
89
|
+
|
|
90
|
+
/** More than this much overlap (µm², i.e. 1 cm²) is reported and lifted (plan §4.2). */
|
|
91
|
+
declare const FLOOR_OVERLAP_MIN_UM2 = 100000000;
|
|
92
|
+
/** The lift per step (µm): 0.5 mm. */
|
|
93
|
+
declare const FLOOR_LIFT_UM = 500;
|
|
94
|
+
interface FloorOverlap {
|
|
95
|
+
code: "W3D_FLOOR_OVERLAP";
|
|
96
|
+
/** The earlier room, then the later (lifted) one, in declaration order. */
|
|
97
|
+
rooms: [string, string];
|
|
98
|
+
/** Overlap area, mm², rounded. */
|
|
99
|
+
areaMm2: number;
|
|
100
|
+
message: string;
|
|
101
|
+
}
|
|
102
|
+
/** Overlap area of two polygons (µm²). */
|
|
103
|
+
declare function overlapArea(p: Polygon, q: Polygon): number;
|
|
104
|
+
/** Every pair of a storey's floors overlapping by more than 1 cm², in declaration order. */
|
|
105
|
+
declare function floorOverlaps(floors: readonly Floor[]): FloorOverlap[];
|
|
106
|
+
/** Each lifted floor's lift (µm), from its overlaps: one step above the highest earlier room it overlaps. */
|
|
107
|
+
declare function floorLifts(floors: readonly Floor[], overlaps: readonly FloorOverlap[]): Map<string, number>;
|
|
108
|
+
|
|
109
|
+
/** A warning of the package's own, on one storey. */
|
|
110
|
+
type Warning3D = (MixedHeightJoint | FloorOverlap) & {
|
|
111
|
+
level: number;
|
|
112
|
+
};
|
|
113
|
+
type RefusalCode = "E3D_CORE_TOO_OLD" | "E3D_PLAN_ERRORS" | "E3D_NO_WALLS";
|
|
114
|
+
interface Refusal {
|
|
115
|
+
code: RefusalCode;
|
|
116
|
+
message: string;
|
|
117
|
+
/** The core's error diagnostics, for `E3D_PLAN_ERRORS`. */
|
|
118
|
+
diagnostics?: Diagnostic[];
|
|
119
|
+
}
|
|
120
|
+
type AdaptResult = {
|
|
121
|
+
ok: true;
|
|
122
|
+
scene: Scene3D;
|
|
123
|
+
storeys: Storey[];
|
|
124
|
+
/** The core's diagnostics (warnings only: an error refuses). */
|
|
125
|
+
diagnostics: Diagnostic[];
|
|
126
|
+
/** The package's own warnings, per storey (`W3D_MIXED_HEIGHT_JOINT`, `W3D_FLOOR_OVERLAP`). */
|
|
127
|
+
warnings: Warning3D[];
|
|
128
|
+
} | {
|
|
129
|
+
ok: false;
|
|
130
|
+
refusal: Refusal;
|
|
131
|
+
};
|
|
132
|
+
interface AdaptOptions {
|
|
133
|
+
/** Where `import`s resolve; default: nothing resolves. */
|
|
134
|
+
world?: World;
|
|
135
|
+
/** The core version to stamp; default: `unknown`. */
|
|
136
|
+
coreVersion?: string;
|
|
137
|
+
/** Largest sagitta (mm) of an arc's chords; default 2 (plan §4.1, `--curve-tol`). */
|
|
138
|
+
curveTolMm?: number;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The first core release that carries every export this package reads: the seam (`resolvePlan`,
|
|
142
|
+
* ADR 0031) arrived in 1.44.0, `hatchKey`/`hatchOf` (card A0b) in 1.45.0. Kept equal to the
|
|
143
|
+
* `peerDependencies` floor (`test/package-meta.test.ts`).
|
|
144
|
+
*/
|
|
145
|
+
declare const MIN_CORE = "1.45.0";
|
|
146
|
+
declare function adaptPlan(source: string, opts?: AdaptOptions): AdaptResult;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The Scene3D v0 validator: zero dependencies, so it runs in the browser bundle. It checks what
|
|
150
|
+
* `scene3d.schema.json` states (shapes, integer micrometres, enums, no unknown keys) and what a
|
|
151
|
+
* JSON Schema cannot (ids unique per collection and level, each opening's host a wall of its
|
|
152
|
+
* level, each wall's `cuts` an opening of its level). `test/scene3d-schema.test.ts` holds this
|
|
153
|
+
* validator and the schema to the same verdicts on the corpus and on planted faults.
|
|
154
|
+
*/
|
|
155
|
+
interface ValidationIssue {
|
|
156
|
+
path: string;
|
|
157
|
+
message: string;
|
|
158
|
+
}
|
|
159
|
+
/** Every way `v` is not a valid Scene3D v0; `[]` when it is. */
|
|
160
|
+
declare function validateScene3D(v: unknown): ValidationIssue[];
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Scene3D lengths are integer micrometres (plan §3.4): a plan coordinate in millimetres is
|
|
164
|
+
* multiplied by 1000 and rounded ONCE, at the adapter's edge, so every later stage works on
|
|
165
|
+
* integers and a last-ulp difference between engines is absorbed here. Rounding is half away
|
|
166
|
+
* from zero, symmetric about the origin, and never yields `-0`.
|
|
167
|
+
*/
|
|
168
|
+
declare function um(mm: number): number;
|
|
169
|
+
/** A plan point as a Scene3D `[x, y]` pair in micrometres (plan axes: x right, y down). */
|
|
170
|
+
declare function umPoint(p: {
|
|
171
|
+
x: number;
|
|
172
|
+
y: number;
|
|
173
|
+
}): [number, number];
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Scene3D → Mesh3D (archlang-3d M1a, card A2). Every solid is a closed prism over a Scene3D polygon
|
|
177
|
+
* (`extrude.ts`); no boolean is computed here, because the core's joinery already gave each wall its
|
|
178
|
+
* owned pieces with the openings removed (`Wall.body`) and each opening its cut. What the plan does
|
|
179
|
+
* not state is a labelled default in the ledger (ADR 0005).
|
|
180
|
+
*
|
|
181
|
+
* Per storey, at its elevation `e` (µm):
|
|
182
|
+
* - slab: the rooms ∪ the storey's wall outline, less its voids, [e − 200 mm, e] (Q6, `slab.ts`);
|
|
183
|
+
* - floor: each room, a 5 mm finish [e, e + 5 mm], a void inside it as a hole; a room overlapping
|
|
184
|
+
* an earlier one is lifted 0.5 mm per step (V-GEO-05, `Floor.lift`);
|
|
185
|
+
* - column: its box, [e, e + storey height];
|
|
186
|
+
* - wall: its body pieces [e, e + h]; under each cut a sill [e, e + sill], over it a lintel
|
|
187
|
+
* [e + head, e + h] (§4.1 step 2; a cased opening's head at the wall top makes no lintel). The
|
|
188
|
+
* body's vertical edges are split at every sill and head that meets them, so body, sill and
|
|
189
|
+
* lintel meet vertex to vertex (no T-junction);
|
|
190
|
+
* - a demolished wall (B3a): its own pieces [e, e + h], a ghost keyed `wall:<id>:demolish` with
|
|
191
|
+
* `extras.status` "demolish", never one of the standing walls;
|
|
192
|
+
* - door: leaves 40 mm thick, [e + sill, e + head]. Closed by default (Q11): the core's leaves for a
|
|
193
|
+
* swinging door, one panel across the jambs for every other kind. `doors: "plan"` (`--doors plan`)
|
|
194
|
+
* swings each of the core's leaves to the pose the plan draws (`openLeaf`); a kind that sweeps no
|
|
195
|
+
* leaf (or a pre-A7 Scene3D leaf without its open tip) keeps its closed panel, ledgered. The 3D
|
|
196
|
+
* leaf is a fixed 40 mm (at most half the leaf) where the core draws max(40 mm, 2 pens) capped at
|
|
197
|
+
* 6 % of the width, so the two slabs can differ by a few mm in thickness; both share the hinge
|
|
198
|
+
* edge on the open radius and lie inside the one sector (not a misalignment);
|
|
199
|
+
* - window: a 16 mm glass pane across the jambs and a 40 × 60 mm frame (§4.3), every part kept
|
|
200
|
+
* inside its cut; on a curved host both follow the arc from jamb face to jamb face (`cutSector`);
|
|
201
|
+
* - furniture: a T0 parametric piece (`t0.ts`) fitted to its footprint for the twelve families it
|
|
202
|
+
* covers, else a grey box on the floor finish, its height a per-family default;
|
|
203
|
+
* - roof: a 150 mm flat slab on the storey's ring at the top of its tallest wall, hidden (Q7, D3).
|
|
204
|
+
* Stairs, outdoor surfaces and fences are not built yet (M4 and later); the ledger says so.
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Grey-box heights (mm) by catalogue family: rounded typical heights, drafting defaults, not
|
|
209
|
+
* measurements of any product. A family not listed stands {@link FURNITURE_DEFAULT_MM} high.
|
|
210
|
+
*/
|
|
211
|
+
declare const FURNITURE_HEIGHT_MM: Readonly<Record<string, number>>;
|
|
212
|
+
/** How the doors stand: `closed` (the default, Q11) or swung as the plan draws them (`plan`). */
|
|
213
|
+
type DoorPose = "closed" | "plan";
|
|
214
|
+
declare const DOOR_POSES: readonly DoorPose[];
|
|
215
|
+
interface MeshOptions {
|
|
216
|
+
/** Default `closed`: every leaf across its doorway. `plan`: each swinging leaf at its drawn swing. */
|
|
217
|
+
doors?: DoorPose;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* A leaf swung open as the core draws it: the slab along the open radius hinge → `end`, its
|
|
221
|
+
* thickness `t` laid off toward the far jamb `f` (inside the quarter-disc, where the core's own
|
|
222
|
+
* `leafSlab` puts it), the outer corner pulled onto the swing circle less a micrometre, so every
|
|
223
|
+
* corner, rounded, stays inside the sector the leaf sweeps. `[hinge, end, tip, heel]`.
|
|
224
|
+
*/
|
|
225
|
+
declare function openLeaf(h: Pt, f: Pt, end: Pt, t: number): Polygon;
|
|
226
|
+
/**
|
|
227
|
+
* A Scene3D → its Mesh3D: deterministic, nodes in canonical (level, kind, id, part) order. `opts`
|
|
228
|
+
* left out (or `doors: "closed"`) is the default build, byte for byte.
|
|
229
|
+
*/
|
|
230
|
+
declare function buildMesh(scene: Scene3D, opts?: MeshOptions): Mesh3D;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* A closed prism over `poly` from `z0` to `z1` (µm, z0 < z1), or `null` when the polygon is
|
|
234
|
+
* degenerate or a hole touches its outer ring or another hole (callers cut such voids exactly
|
|
235
|
+
* instead; see `lessVoids` in `build.ts`). Outer ring counter-clockwise and holes clockwise in plan numbers, so the solid lies to
|
|
236
|
+
* the LEFT of every edge.
|
|
237
|
+
*
|
|
238
|
+
* `splits`, when given, names heights (strictly between z0 and z1) at which a vertex's vertical
|
|
239
|
+
* edge is split: the side faces then carry those vertices, so a neighbouring shell whose edge ends
|
|
240
|
+
* there (a wall's sill or lintel against its body's jamb, card A2b) meets a vertex, not the middle
|
|
241
|
+
* of an edge (no T-junction). A side face whose two edges are not split keeps its two triangles.
|
|
242
|
+
*/
|
|
243
|
+
declare function prism(poly: Polygon, z0: number, z1: number, splits?: (p: Pt) => readonly number[]): Shell | null;
|
|
244
|
+
/**
|
|
245
|
+
* A thin plan box centred on segment `a`→`b`, `depth` across it: an oriented rectangle (a door
|
|
246
|
+
* leaf, a glazing pane, a frame member), rounded to whole micrometres.
|
|
247
|
+
*/
|
|
248
|
+
declare function slab2d(a: Pt, b: Pt, depth: number): Polygon;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* `ring ∩ convex` (Sutherland–Hodgman: any simple subject, a convex clip), rounded to whole
|
|
252
|
+
* micrometres; `null` when nothing of it is left.
|
|
253
|
+
*/
|
|
254
|
+
declare function clipToConvex(ring: readonly Pt[], convex: readonly Pt[]): Polygon | null;
|
|
255
|
+
/**
|
|
256
|
+
* `poly` (a convex part: a pane, a frame member) kept inside `ring` (its opening's cut): as it is
|
|
257
|
+
* when every corner already lies in or on the cut, which is every opening on a straight wall; else
|
|
258
|
+
* the cut clipped to it. On a curved host the pane runs along the chord between the jambs, so its
|
|
259
|
+
* corners cross the jambs' radial faces into the wall body (card A2b); clipped, its ends follow them.
|
|
260
|
+
*/
|
|
261
|
+
declare function insideCut(poly: Polygon, ring: readonly Pt[]): Polygon | null;
|
|
262
|
+
/**
|
|
263
|
+
* An opening's cut on a CURVED host, read back from its plan ring: the core's cut there is an
|
|
264
|
+
* annular sector bounded by two RADIAL jamb faces (`openingCut`, `src/geometry/band.ts`). `c` is the
|
|
265
|
+
* arc's centre (where the two jamb faces' lines meet), `r` the radius through the faces' midpoints
|
|
266
|
+
* (the host's centreline), `t0` the angle of the face at `jambs[0]` and `sweep` the signed angle to
|
|
267
|
+
* the face at `jambs[1]`, through the opening's centre; `steps` is how many chords the cut's longer
|
|
268
|
+
* arc was tessellated into. `null` for a straight host (a four-corner cut) or anything this does not
|
|
269
|
+
* recognise, where the chord between the jambs already runs between the jamb faces.
|
|
270
|
+
*/
|
|
271
|
+
interface CutSector {
|
|
272
|
+
c: Pt;
|
|
273
|
+
r: number;
|
|
274
|
+
t0: number;
|
|
275
|
+
sweep: number;
|
|
276
|
+
steps: number;
|
|
277
|
+
}
|
|
278
|
+
declare function cutSector(cut: readonly Pt[], jambs: readonly [Pt, Pt], centre: Pt): CutSector | null;
|
|
279
|
+
/**
|
|
280
|
+
* A band of `sector`, between radii `r + d0` and `r + d1` (d0 < d1) and from fraction `f0` to `f1`
|
|
281
|
+
* of its sweep (0 = the face at `jambs[0]`), tessellated as finely as the cut's arc; whole
|
|
282
|
+
* micrometres. Its ends lie on the jamb faces' radial lines, so a pane or a frame built on it runs
|
|
283
|
+
* from jamb face to jamb face, inside the cut.
|
|
284
|
+
*/
|
|
285
|
+
declare function sectorBand(sector: CutSector, d0: number, d1: number, f0?: number, f1?: number): Polygon;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* The storey slab's plan region (archlang-3d plan §4.2; card A2b): the rooms ∪ the wall outline,
|
|
289
|
+
* before the voids are cut. The wall outline (its outer rings, holes dropped) already covers every
|
|
290
|
+
* room the walls enclose; what a room adds is its part outside it (a room outside every wall had no
|
|
291
|
+
* slab under it before A2b).
|
|
292
|
+
*
|
|
293
|
+
* Exact when the outline and the room are rectilinear (every edge along an axis, every coordinate
|
|
294
|
+
* an integer): the room is cut into rectangles and the outline and every earlier addition are
|
|
295
|
+
* subtracted, so the additions never overlap anything. Otherwise a room that one ring already in the
|
|
296
|
+
* slab covers adds nothing, a room apart from all of them adds itself, and a room that crosses any
|
|
297
|
+
* (the outline, an earlier room's rectangles, a room added whole) adds itself whole, the solids
|
|
298
|
+
* overlapping, and the ledger says so (no boolean is guessed).
|
|
299
|
+
*/
|
|
300
|
+
|
|
301
|
+
/** An axis-aligned plan rectangle `[x0, y0, x1, y1]` (µm), x0 < x1, y0 < y1. */
|
|
302
|
+
type Rect = [number, number, number, number];
|
|
303
|
+
/** A rectilinear ring as rectangles, band by band between its distinct y's (even-odd). */
|
|
304
|
+
declare function rectsOf(r: readonly Pt[]): Rect[];
|
|
305
|
+
/**
|
|
306
|
+
* The slab's region on a storey: the wall outline's rings, then each room's part outside them
|
|
307
|
+
* (declaration order), as polygons ready for the voids.
|
|
308
|
+
*/
|
|
309
|
+
declare function slabRegion(footprint: readonly Ring3[], floors: readonly Floor[], ledger: Assumption[]): Polygon[];
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* T0 parametric furniture (archlang-3d plan §4.4, §5.1–5.3; card A2b): pure generators that build
|
|
313
|
+
* a piece from a few boxes, rounded parts and plates with holes, fitted EXACTLY to the plan's
|
|
314
|
+
* footprint. The twelve families laneway-house uses have one each; every other family stays a grey
|
|
315
|
+
* box. Each generator is mirror-symmetric across its own width, so a mirrored piece (`place …
|
|
316
|
+
* mirror`) needs no mirrored mesh and nothing gains handedness.
|
|
317
|
+
*
|
|
318
|
+
* Local frame (plan §3.4, §4.4): origin at the footprint's centre on the floor finish; +x along
|
|
319
|
+
* the piece's width, +z its FRONT (an unturned piece faces plan +y, down the page), heights up.
|
|
320
|
+
* The plan's `rotate` turns it clockwise on the page; widths and depths are fitted (the footprint
|
|
321
|
+
* is never stretched in height: heights are fixed defaults, in the ledger). Lengths in mm here,
|
|
322
|
+
* micrometres once placed.
|
|
323
|
+
*/
|
|
324
|
+
|
|
325
|
+
/** One part: a plan rectangle (or the ellipse inscribed in it) from `y0` to `y1` above the floor,
|
|
326
|
+
* optionally with holes (a worktop around its sink). Millimetres, local frame. */
|
|
327
|
+
interface Part {
|
|
328
|
+
x0: number;
|
|
329
|
+
x1: number;
|
|
330
|
+
z0: number;
|
|
331
|
+
z1: number;
|
|
332
|
+
y0: number;
|
|
333
|
+
y1: number;
|
|
334
|
+
round?: boolean;
|
|
335
|
+
holes?: Array<Omit<Part, "y0" | "y1" | "holes">>;
|
|
336
|
+
}
|
|
337
|
+
/** The families with a generator, each with the catalogue names it answers to (plan §5.2). */
|
|
338
|
+
declare const T0_FAMILIES: Readonly<Record<string, readonly string[]>>;
|
|
339
|
+
/** The asset a category is built with: `t0:<family>`, or `greybox` (plan §4.4 step 1). */
|
|
340
|
+
declare const assetFor: (category: string) => string;
|
|
341
|
+
/** The tallest point of each family (mm): the height the ledger records. */
|
|
342
|
+
declare const T0_HEIGHT_MM: Readonly<Record<string, number>>;
|
|
343
|
+
interface PlacedPart {
|
|
344
|
+
polygon: Polygon;
|
|
345
|
+
/** Above the floor finish, µm. */
|
|
346
|
+
y0: number;
|
|
347
|
+
y1: number;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* `f`'s T0 parts, placed in plan micrometres: `null` when its asset is not T0 or its turn is not a
|
|
351
|
+
* quarter turn (the grey box stands instead). The plan's `rotate` (clockwise on the page, y down)
|
|
352
|
+
* maps local (x, z) to plan (x cos r − z sin r, x sin r + z cos r) about the footprint's centre; at
|
|
353
|
+
* a quarter turn the piece's own width runs along plan y (`Furniture.size` is the turned box).
|
|
354
|
+
*/
|
|
355
|
+
declare function t0Parts(f: Furniture): PlacedPart[] | null;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* The replay's end camera as plain maths (card A3, look notes round 1): the viewer and the tests
|
|
359
|
+
* read the same functions, so "the end frame fills the canvas" is a property a test can check
|
|
360
|
+
* without a browser. Millimetres, the exporters' axes (X plan x, Y up, Z plan y). No three.js here:
|
|
361
|
+
* the conventions copy three.js's `lookAt` for a camera (it looks down its local −Z; right =
|
|
362
|
+
* up × back, true up = back × right, world up +Y).
|
|
363
|
+
*/
|
|
364
|
+
|
|
365
|
+
type Vec3 = [number, number, number];
|
|
366
|
+
interface Box {
|
|
367
|
+
lo: Vec3;
|
|
368
|
+
hi: Vec3;
|
|
369
|
+
}
|
|
370
|
+
/** Where the end camera looks from: elevation and azimuth in degrees, vertical field of view. */
|
|
371
|
+
interface Orbit {
|
|
372
|
+
elevation: number;
|
|
373
|
+
azimuth: number;
|
|
374
|
+
fov: number;
|
|
375
|
+
/** Canvas width / height. */
|
|
376
|
+
aspect: number;
|
|
377
|
+
}
|
|
378
|
+
interface EndCamera {
|
|
379
|
+
target: Vec3;
|
|
380
|
+
/** Distance from the target to the camera (mm). */
|
|
381
|
+
dist: number;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* The fraction of each half-axis the building may use: a margin of 6 % of the frame on each side
|
|
385
|
+
* of the binding axis.
|
|
386
|
+
*/
|
|
387
|
+
declare const FILL = 0.88;
|
|
388
|
+
declare function corners(b: Box): Vec3[];
|
|
389
|
+
/**
|
|
390
|
+
* The projected extent of `box` in normalised device coordinates (−1…1 on each axis) for a camera
|
|
391
|
+
* at `cam` with orbit `o`.
|
|
392
|
+
*/
|
|
393
|
+
declare function projectBox(box: Box, cam: EndCamera, o: Orbit): {
|
|
394
|
+
x: [number, number];
|
|
395
|
+
y: [number, number];
|
|
396
|
+
};
|
|
397
|
+
/**
|
|
398
|
+
* The end camera that fills the frame with `box`: the 8 corners are projected through the end
|
|
399
|
+
* orbit and the distance is solved so the binding corner sits at `FILL` of the half-frame; the
|
|
400
|
+
* target is then re-centred on the projected box (perspective makes the near half larger) and the
|
|
401
|
+
* distance solved again. A fixed number of rounds, so the result is a pure function of its input.
|
|
402
|
+
*/
|
|
403
|
+
declare function fitEndCamera(box: Box, o: Orbit): EndCamera;
|
|
404
|
+
/** The share of the binding axis the projected box fills (1 = edge to edge). */
|
|
405
|
+
declare function coverage(box: Box, cam: EndCamera, o: Orbit): number;
|
|
406
|
+
/** The end camera's lens and bearing. */
|
|
407
|
+
declare const END_FOV = 30;
|
|
408
|
+
declare const END_AZIMUTH = -32;
|
|
409
|
+
/**
|
|
410
|
+
* The end camera's elevation: 45° for every view. The combined view of a taller building needs it so
|
|
411
|
+
* the exploded gaps show the floors below (see `timeline.ts`'s header); a one-storey view took it
|
|
412
|
+
* too (card A9, by delegation, the owner may veto on a look): at 30° the near walls hid the floor,
|
|
413
|
+
* the inner doors and most furniture of `studio`. The storey count stays a parameter so a later
|
|
414
|
+
* look can split the two again without a signature change.
|
|
415
|
+
*/
|
|
416
|
+
declare const endElevation: (_storeys: number) => number;
|
|
417
|
+
/**
|
|
418
|
+
* The scene's box (mm) from the payload's nodes: positions in micrometres, each node lifted by its
|
|
419
|
+
* `lift` (the combined view's exploded storeys). A demolished wall's ghost (`part` "demolish") is not
|
|
420
|
+
* the building and is left out of a fit (`timeline.ts`'s header), unless nothing else is there;
|
|
421
|
+
* `ghosts: true` keeps it, for a box that must hold everything drawn (the viewer's clip range).
|
|
422
|
+
*/
|
|
423
|
+
declare function boxOfNodes(nodes: ReadonlyArray<{
|
|
424
|
+
positions: readonly number[];
|
|
425
|
+
lift?: number;
|
|
426
|
+
part?: string;
|
|
427
|
+
}>, opts?: {
|
|
428
|
+
ghosts?: boolean;
|
|
429
|
+
}): Box;
|
|
430
|
+
/** The perspective camera's lens at the start of the dolly (a near-orthographic top-down view). */
|
|
431
|
+
declare const START_FOV = 1.5;
|
|
432
|
+
/**
|
|
433
|
+
* One fitted camera per stop: stop k fills the frame with storeys 0…k (the combined view; a node's
|
|
434
|
+
* storey is its event's), the last stop with the whole building. One storey: one stop. Each stop is
|
|
435
|
+
* fitted for the end orbit, which `stateAt` has reached by the time of the first stop.
|
|
436
|
+
*/
|
|
437
|
+
declare function cameraStops(nodes: ReadonlyArray<{
|
|
438
|
+
key: string;
|
|
439
|
+
positions: readonly number[];
|
|
440
|
+
lift?: number;
|
|
441
|
+
part?: string;
|
|
442
|
+
}>, events: readonly ReplayEvent[], o: Orbit): EndCamera[];
|
|
443
|
+
/** The fitted camera at a (fractional) stop: between two stops, a straight blend of the two. */
|
|
444
|
+
declare function cameraAtStop(fits: readonly EndCamera[], stop: number): EndCamera;
|
|
445
|
+
/** The perspective camera of one frame: where it aims, from how far, with which lens and bearing. */
|
|
446
|
+
interface FrameCamera {
|
|
447
|
+
target: Vec3;
|
|
448
|
+
dist: number;
|
|
449
|
+
fov: number;
|
|
450
|
+
elevation: number;
|
|
451
|
+
azimuth: number;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* The perspective camera at state `s` (the viewer's `seek`): from straight down over the drawing's
|
|
455
|
+
* centre (`cx`, `cz`; `oh` the drawing's height in the frame) it tilts to the end orbit and dollies
|
|
456
|
+
* to the fitted camera of the current stop.
|
|
457
|
+
*/
|
|
458
|
+
declare function frameCamera(s: Pick<ReplayState, "tilt" | "dolly" | "stop">, fits: readonly EndCamera[], view: {
|
|
459
|
+
cx: number;
|
|
460
|
+
cz: number;
|
|
461
|
+
oh: number;
|
|
462
|
+
elevation: number;
|
|
463
|
+
}): FrameCamera;
|
|
464
|
+
/**
|
|
465
|
+
* The first frame frames the core drawing's viewBox exactly, letterboxed as the image is: its
|
|
466
|
+
* centre (`cx`, `cz`) and the height (`oh`) and width (`ow`) it spans in the frame, in plan mm.
|
|
467
|
+
*/
|
|
468
|
+
declare function drawingFrame(viewBox: readonly [number, number, number, number], aspect: number): {
|
|
469
|
+
cx: number;
|
|
470
|
+
cz: number;
|
|
471
|
+
ow: number;
|
|
472
|
+
oh: number;
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
export { ARCHLANG_3D_VERSION, type AdaptOptions, type AdaptResult, Assumption, type Box, type BuildOptions, type CutSector, DOOR_POSES, type DoorPose, END_AZIMUTH, END_FOV, type EndCamera, FILL, FLOOR_LIFT_UM, FLOOR_OVERLAP_MIN_UM2, FURNITURE_HEIGHT_MM, Floor, type FloorOverlap, type FrameCamera, Furniture, MIN_CORE, Mesh3D, type MeshOptions, type MixedHeightJoint, type Orbit, type OwnedWall, type Ownership, type Part, type Piece, type PlacedPart, Polygon, Pt, type Refusal, type RefusalCode, ReplayEvent, ReplayState, type Ring, Ring3, START_FOV, Scene3D, Shell, type Storey, T0_FAMILIES, T0_HEIGHT_MM, type ValidationIssue, type Vec3, type Warning3D, adaptPlan, assetFor, boxOfNodes, buildMesh, buildScene3D, cameraAtStop, cameraStops, clipToConvex, corners, coverage, cutSector, drawingFrame, endElevation, fitEndCamera, floorLifts, floorOverlaps, frameCamera, insideCut, mixedHeightJoints, openLeaf, overlapArea, piecesOf, piecesTouch, prism, projectBox, rectsOf, sectorBand, slab2d, slabRegion, t0Parts, um, umPoint, validateScene3D, wallOwnership };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DOOR_POSES,
|
|
3
|
+
FURNITURE_HEIGHT_MM,
|
|
4
|
+
MIN_CORE,
|
|
5
|
+
adaptPlan,
|
|
6
|
+
buildMesh,
|
|
7
|
+
clipToConvex,
|
|
8
|
+
cutSector,
|
|
9
|
+
insideCut,
|
|
10
|
+
openLeaf,
|
|
11
|
+
prism,
|
|
12
|
+
rectsOf,
|
|
13
|
+
sectorBand,
|
|
14
|
+
slab2d,
|
|
15
|
+
slabRegion
|
|
16
|
+
} from "./chunk-NADV4D3M.js";
|
|
17
|
+
import {
|
|
18
|
+
ARCHLANG_3D_VERSION,
|
|
19
|
+
FLOOR_LIFT_UM,
|
|
20
|
+
FLOOR_OVERLAP_MIN_UM2,
|
|
21
|
+
T0_FAMILIES,
|
|
22
|
+
T0_HEIGHT_MM,
|
|
23
|
+
assetFor,
|
|
24
|
+
buildScene3D,
|
|
25
|
+
floorLifts,
|
|
26
|
+
floorOverlaps,
|
|
27
|
+
mixedHeightJoints,
|
|
28
|
+
overlapArea,
|
|
29
|
+
piecesOf,
|
|
30
|
+
piecesTouch,
|
|
31
|
+
replayFacts,
|
|
32
|
+
t0Parts,
|
|
33
|
+
um,
|
|
34
|
+
umPoint,
|
|
35
|
+
validateScene3D,
|
|
36
|
+
wallOwnership
|
|
37
|
+
} from "./chunk-IQJQDQSC.js";
|
|
38
|
+
import {
|
|
39
|
+
END_AZIMUTH,
|
|
40
|
+
END_FOV,
|
|
41
|
+
EXPLODE_GAP_MM,
|
|
42
|
+
FILL,
|
|
43
|
+
FIXTURE_FAMILIES,
|
|
44
|
+
PHASE,
|
|
45
|
+
START_FOV,
|
|
46
|
+
STOP_LEAD,
|
|
47
|
+
authoringOrder,
|
|
48
|
+
boxOfNodes,
|
|
49
|
+
cameraAtStop,
|
|
50
|
+
cameraStops,
|
|
51
|
+
corners,
|
|
52
|
+
coverage,
|
|
53
|
+
drawingFrame,
|
|
54
|
+
ease,
|
|
55
|
+
endElevation,
|
|
56
|
+
explodeLifts,
|
|
57
|
+
fitEndCamera,
|
|
58
|
+
frameCamera,
|
|
59
|
+
keyFrames,
|
|
60
|
+
projectBox,
|
|
61
|
+
stateAt,
|
|
62
|
+
storeysOf,
|
|
63
|
+
stripAt,
|
|
64
|
+
timeline,
|
|
65
|
+
viewLabel,
|
|
66
|
+
viewMesh
|
|
67
|
+
} from "./chunk-CTFMM64C.js";
|
|
68
|
+
export {
|
|
69
|
+
ARCHLANG_3D_VERSION,
|
|
70
|
+
DOOR_POSES,
|
|
71
|
+
END_AZIMUTH,
|
|
72
|
+
END_FOV,
|
|
73
|
+
EXPLODE_GAP_MM,
|
|
74
|
+
FILL,
|
|
75
|
+
FIXTURE_FAMILIES,
|
|
76
|
+
FLOOR_LIFT_UM,
|
|
77
|
+
FLOOR_OVERLAP_MIN_UM2,
|
|
78
|
+
FURNITURE_HEIGHT_MM,
|
|
79
|
+
MIN_CORE,
|
|
80
|
+
PHASE,
|
|
81
|
+
START_FOV,
|
|
82
|
+
STOP_LEAD,
|
|
83
|
+
T0_FAMILIES,
|
|
84
|
+
T0_HEIGHT_MM,
|
|
85
|
+
adaptPlan,
|
|
86
|
+
assetFor,
|
|
87
|
+
authoringOrder,
|
|
88
|
+
boxOfNodes,
|
|
89
|
+
buildMesh,
|
|
90
|
+
buildScene3D,
|
|
91
|
+
cameraAtStop,
|
|
92
|
+
cameraStops,
|
|
93
|
+
clipToConvex,
|
|
94
|
+
corners,
|
|
95
|
+
coverage,
|
|
96
|
+
cutSector,
|
|
97
|
+
drawingFrame,
|
|
98
|
+
ease,
|
|
99
|
+
endElevation,
|
|
100
|
+
explodeLifts,
|
|
101
|
+
fitEndCamera,
|
|
102
|
+
floorLifts,
|
|
103
|
+
floorOverlaps,
|
|
104
|
+
frameCamera,
|
|
105
|
+
insideCut,
|
|
106
|
+
keyFrames,
|
|
107
|
+
mixedHeightJoints,
|
|
108
|
+
openLeaf,
|
|
109
|
+
overlapArea,
|
|
110
|
+
piecesOf,
|
|
111
|
+
piecesTouch,
|
|
112
|
+
prism,
|
|
113
|
+
projectBox,
|
|
114
|
+
rectsOf,
|
|
115
|
+
replayFacts,
|
|
116
|
+
sectorBand,
|
|
117
|
+
slab2d,
|
|
118
|
+
slabRegion,
|
|
119
|
+
stateAt,
|
|
120
|
+
storeysOf,
|
|
121
|
+
stripAt,
|
|
122
|
+
t0Parts,
|
|
123
|
+
timeline,
|
|
124
|
+
um,
|
|
125
|
+
umPoint,
|
|
126
|
+
validateScene3D,
|
|
127
|
+
viewLabel,
|
|
128
|
+
viewMesh,
|
|
129
|
+
wallOwnership
|
|
130
|
+
};
|