@chanmeng666/archlang-3d 0.5.0 → 0.7.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 +102 -0
- package/README.md +4 -3
- package/THIRD_PARTY_NOTICES +2 -2
- package/dist/browser.d.ts +4 -3
- package/dist/browser.js +612 -11
- package/dist/{camera-DVOiag0F.d.ts → camera-CGIIudHj.d.ts} +1 -1
- package/dist/{chunk-4SQ5YKKX.js → chunk-FHBR2U5Z.js} +17 -4
- package/dist/{chunk-OWZWBKMI.js → chunk-FVD3DZU2.js} +34 -7
- package/dist/{chunk-WCWLYIVD.js → chunk-GXWLZ2KC.js} +61 -9
- package/dist/chunk-QN4LQTVG.js +2192 -0
- package/dist/{chunk-EQBMPXB5.js → chunk-TI4RYEOL.js} +80 -5
- package/dist/cli.js +5 -5
- package/dist/{facts-BRIFxHL_.d.ts → facts-3wb9egIT.d.ts} +1 -1
- package/dist/index.d.ts +308 -7
- package/dist/index.js +62 -4
- package/dist/node.d.ts +5 -3
- package/dist/node.js +4 -4
- package/dist/replay.d.ts +22 -2
- package/dist/{strip-Nt7eJ-4E.d.ts → strip-Sdsm54Qw.d.ts} +118 -4
- package/dist/viewer.iife.js +504 -499
- package/package.json +3 -3
- package/dist/chunk-L2CX7KWM.js +0 -950
|
@@ -47,20 +47,42 @@ var PALETTE = {
|
|
|
47
47
|
water: m("#a3c6d0", 0.1, 0, 0.7)
|
|
48
48
|
};
|
|
49
49
|
var STAIR_MATERIAL = "wood";
|
|
50
|
+
var STAIR_RAIL_MATERIAL = "wood_dark";
|
|
51
|
+
var DOOR_OAK = m("#c2a27e", 0.7);
|
|
52
|
+
var FRAME_BRONZE = m("#55534f", 0.5);
|
|
50
53
|
var KIND_PALETTE = {
|
|
51
54
|
slab: m("#bdb6ab", 0.9),
|
|
52
55
|
column: m("#e6e1d8", 0.85),
|
|
53
56
|
wall: m("#f2f0eb", 0.9),
|
|
54
|
-
door:
|
|
55
|
-
"window:frame":
|
|
57
|
+
door: DOOR_OAK,
|
|
58
|
+
"window:frame": FRAME_BRONZE,
|
|
56
59
|
"window:glass": m("#bcd6e0", 0.05, 0, 0.4),
|
|
60
|
+
// The trim (card RM8.6): a window's reveal in its frame's bronze, its exterior sill in the pale
|
|
61
|
+
// stone and its interior board in the oak of the palette; a cased opening's lining and casing in
|
|
62
|
+
// the doors' oak (a door's own lining and casing are `door`). Drafting defaults, ledgered once per
|
|
63
|
+
// Mesh3D as `trim-material-default` from `TRIM_MATERIAL`.
|
|
64
|
+
"window:reveal": FRAME_BRONZE,
|
|
65
|
+
"window:sill": PALETTE.stone,
|
|
66
|
+
"window:board": PALETTE.wood,
|
|
67
|
+
"opening:lining": DOOR_OAK,
|
|
68
|
+
"opening:casing": DOOR_OAK,
|
|
57
69
|
opening: m("#e6e1d8", 0.85),
|
|
58
70
|
furniture: m("#d6cec1", 0.9),
|
|
59
71
|
roof: m("#9c958a", 0.9),
|
|
60
72
|
"wall:demolish": m("#c8553d", 0.9, 0, 0.3),
|
|
61
73
|
// A stair (card X3): the core gives it no material, so the ledgered default (`STAIR_MATERIAL`,
|
|
62
74
|
// `stair-material-default`): that slot's own entry, never a second copy of its colour.
|
|
63
|
-
stair: PALETTE[STAIR_MATERIAL]
|
|
75
|
+
stair: PALETTE[STAIR_MATERIAL],
|
|
76
|
+
"stair:rail": PALETTE[STAIR_RAIL_MATERIAL]
|
|
77
|
+
};
|
|
78
|
+
var TRIM_MATERIAL = {
|
|
79
|
+
"door:lining": { material: "door", srgb: KIND_PALETTE.door.srgb },
|
|
80
|
+
"door:casing": { material: "door", srgb: KIND_PALETTE.door.srgb },
|
|
81
|
+
"opening:lining": { material: "opening:lining", srgb: KIND_PALETTE["opening:lining"].srgb },
|
|
82
|
+
"opening:casing": { material: "opening:casing", srgb: KIND_PALETTE["opening:casing"].srgb },
|
|
83
|
+
"window:reveal": { material: "window:reveal", srgb: KIND_PALETTE["window:reveal"].srgb },
|
|
84
|
+
"window:sill": { material: "window:sill", srgb: KIND_PALETTE["window:sill"].srgb },
|
|
85
|
+
"window:board": { material: "window:board", srgb: KIND_PALETTE["window:board"].srgb }
|
|
64
86
|
};
|
|
65
87
|
var WALL_CAP_SRGB = "#8f877d";
|
|
66
88
|
var FLOOR_FINISHES = ["timber", "tile", "neutral"];
|
|
@@ -78,6 +100,44 @@ function floorFinish(uses) {
|
|
|
78
100
|
for (const [finish, kinds] of FLOOR_FINISH_RULES) if (uses?.some((u) => kinds.includes(u))) return finish;
|
|
79
101
|
return "neutral";
|
|
80
102
|
}
|
|
103
|
+
var GROUND_TINT = {
|
|
104
|
+
lawn: "lawn",
|
|
105
|
+
planting: "lawn",
|
|
106
|
+
paving: "paving",
|
|
107
|
+
deck: "paving",
|
|
108
|
+
gravel: "paving",
|
|
109
|
+
water: "water",
|
|
110
|
+
driveway: "paving",
|
|
111
|
+
patio: "paving",
|
|
112
|
+
balcony: "paving"
|
|
113
|
+
};
|
|
114
|
+
var GROUND_WASH = 6;
|
|
115
|
+
var SITE_PALETTE = {
|
|
116
|
+
gravel: m("#cbc3b4", 0.95),
|
|
117
|
+
tarmac: m("#8c8984", 0.85)
|
|
118
|
+
};
|
|
119
|
+
var GROUND_SPLITS = {
|
|
120
|
+
planting: PALETTE.foliage,
|
|
121
|
+
deck: PALETTE.wood,
|
|
122
|
+
gravel: SITE_PALETTE.gravel,
|
|
123
|
+
driveway: SITE_PALETTE.tarmac
|
|
124
|
+
};
|
|
125
|
+
var GROUND_ROUGHNESS = { lawn: 0.95, paving: 0.85, water: 0.1 };
|
|
126
|
+
var FENCE_PALETTE = {
|
|
127
|
+
picket: m("#eeebe4", 0.8),
|
|
128
|
+
panel: PALETTE.wood,
|
|
129
|
+
post: PALETTE.wood_dark
|
|
130
|
+
};
|
|
131
|
+
var GROUND_PLANE = { light: "#e2ddd3", dark: "#16293d", marginMm: 6e3 };
|
|
132
|
+
function siteColour(own, theme, toward) {
|
|
133
|
+
if (theme === "light") return own;
|
|
134
|
+
const mix = (i) => {
|
|
135
|
+
const a = Number.parseInt(own.slice(i, i + 2), 16);
|
|
136
|
+
const b = Number.parseInt(toward.slice(i, i + 2), 16);
|
|
137
|
+
return Math.round(a * 0.4 + b * 0.6).toString(16).padStart(2, "0");
|
|
138
|
+
};
|
|
139
|
+
return `#${mix(1)}${mix(3)}${mix(5)}`;
|
|
140
|
+
}
|
|
81
141
|
function linearRgb(hex) {
|
|
82
142
|
const ch = (i) => {
|
|
83
143
|
const c = Number.parseInt(hex.slice(i, i + 2), 16) / 255;
|
|
@@ -174,10 +234,14 @@ function groupOf(n) {
|
|
|
174
234
|
return 3;
|
|
175
235
|
case "furniture":
|
|
176
236
|
return FIXTURE_FAMILIES.has(String(n.extras.category)) ? 0 : 1;
|
|
237
|
+
case "outdoor":
|
|
238
|
+
return 1;
|
|
239
|
+
case "fence":
|
|
240
|
+
return 4;
|
|
177
241
|
}
|
|
178
242
|
}
|
|
179
243
|
var isGhost = (n) => n.part === "demolish";
|
|
180
|
-
var isFlat = (n) => n.kind === "slab" || n.kind === "floor";
|
|
244
|
+
var isFlat = (n) => n.kind === "slab" || n.kind === "floor" || n.kind === "outdoor";
|
|
181
245
|
function authoringOrder(mesh) {
|
|
182
246
|
return [...mesh.nodes].sort(
|
|
183
247
|
(a, b) => STAGES.indexOf(a.stage) - STAGES.indexOf(b.stage) || groupOf(a) - groupOf(b) || a.level - b.level || a.order - b.order || (a.key < b.key ? -1 : a.key > b.key ? 1 : 0)
|
|
@@ -264,7 +328,7 @@ function timeline(mesh) {
|
|
|
264
328
|
if (isGhost(n)) rise = [a, w];
|
|
265
329
|
else if (wallRise.has(n.key)) rise = wallRise.get(n.key);
|
|
266
330
|
else if (thingRise.has(n.key)) rise = thingRise.get(n.key);
|
|
267
|
-
else if (n.kind === "door" || n.kind === "window")
|
|
331
|
+
else if (n.kind === "door" || n.kind === "window" || n.kind === "opening")
|
|
268
332
|
rise = hostRise.get(`${n.level}/${String(n.extras.host)}`) ?? [a, w];
|
|
269
333
|
else if (isFlat(n)) {
|
|
270
334
|
const at = appearOf.get(n.key) ?? a;
|
|
@@ -325,6 +389,7 @@ function stateAt(events, t) {
|
|
|
325
389
|
stop,
|
|
326
390
|
settle,
|
|
327
391
|
svg,
|
|
392
|
+
ground: u >= PHASE.rise ? 1 - svg : 0,
|
|
328
393
|
nodes
|
|
329
394
|
};
|
|
330
395
|
}
|
|
@@ -569,12 +634,22 @@ export {
|
|
|
569
634
|
MATERIAL_SLOTS,
|
|
570
635
|
PALETTE,
|
|
571
636
|
STAIR_MATERIAL,
|
|
637
|
+
STAIR_RAIL_MATERIAL,
|
|
572
638
|
KIND_PALETTE,
|
|
639
|
+
TRIM_MATERIAL,
|
|
573
640
|
WALL_CAP_SRGB,
|
|
574
641
|
FLOOR_FINISHES,
|
|
575
642
|
FINISH_PALETTE,
|
|
576
643
|
FLOOR_FINISH_RULES,
|
|
577
644
|
floorFinish,
|
|
645
|
+
GROUND_TINT,
|
|
646
|
+
GROUND_WASH,
|
|
647
|
+
SITE_PALETTE,
|
|
648
|
+
GROUND_SPLITS,
|
|
649
|
+
GROUND_ROUGHNESS,
|
|
650
|
+
FENCE_PALETTE,
|
|
651
|
+
GROUND_PLANE,
|
|
652
|
+
siteColour,
|
|
578
653
|
linearRgb,
|
|
579
654
|
slotColour,
|
|
580
655
|
finishColour,
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
DOOR_POSES,
|
|
4
4
|
adaptPlan,
|
|
5
5
|
buildMesh
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QN4LQTVG.js";
|
|
7
7
|
import {
|
|
8
8
|
SWIFTSHADER_ARGS,
|
|
9
9
|
checkGlb,
|
|
@@ -13,18 +13,18 @@ import {
|
|
|
13
13
|
renderReplay,
|
|
14
14
|
replayHtml,
|
|
15
15
|
writeGlb
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FVD3DZU2.js";
|
|
17
17
|
import {
|
|
18
18
|
ARCHLANG_3D_VERSION,
|
|
19
19
|
replayFacts
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-GXWLZ2KC.js";
|
|
21
|
+
import "./chunk-FHBR2U5Z.js";
|
|
22
22
|
import {
|
|
23
23
|
storeysOf,
|
|
24
24
|
timeline,
|
|
25
25
|
viewLabel,
|
|
26
26
|
viewMesh
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-TI4RYEOL.js";
|
|
28
28
|
|
|
29
29
|
// src/cli/run.ts
|
|
30
30
|
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { World } from '@chanmeng666/archlang';
|
|
2
|
-
import {
|
|
2
|
+
import { U as ReplayView, R as ReplayFacts } from './strip-Sdsm54Qw.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The metrics strip's numbers (card G4), read from the core's public `describe()` and `lint()` for
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import * as _chanmeng666_archlang from '@chanmeng666/archlang';
|
|
1
2
|
import { ResolvedPlan, RWall, Point, JoinedCut, loopsToPolygons, World, Diagnostic } from '@chanmeng666/archlang';
|
|
2
3
|
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
|
|
4
|
-
export { D as DoorKind, E as EXPLODE_GAP_MM,
|
|
5
|
-
export { F as FactsOptions, r as replayFacts } from './facts-
|
|
6
|
-
export { B as Box, E as ELEVATION_AZIMUTH, a as ELEVATION_RANGE, b as END_AZIMUTH, c as END_FOV, d as EndCamera, F as FILL, e as FrameCamera, O as Orbit, f as PRESET_NAMES, P as PresetName, S as START_FOV, V as Vec3, g as ViewScene, Z as ZOOM, h as boxOfNodes, i as cameraAtStop, j as cameraStops, k as corners, l as coverage, m as distanceLimits, n as drawingFrame, o as endElevation, p as fitEndCamera, q as frameCamera, r as pivotAbove, s as presetCamera, t as projectBox, u as settledLift, v as stopCount, w as takenLens, x as targetBounds } from './camera-
|
|
4
|
+
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, O as Opening, L as Level, e as Side, f as Stair, g as StairFlight, h as MaterialSlot, i as Furniture, j as Fence, G as GroundTint } from './strip-Sdsm54Qw.js';
|
|
5
|
+
export { D as DoorKind, E as EXPLODE_GAP_MM, k as FENCE_PALETTE, l as FINISH_PALETTE, m as FIXTURE_FAMILIES, n as FLOOR_FINISHES, o as FLOOR_FINISH_RULES, p as FloorFinish, q as GROUND_PLANE, r as GROUND_ROUGHNESS, t as GROUND_SPLITS, u as GROUND_TINT, v as GROUND_WASH, K as KIND_PALETTE, w as KindMaterial, x as MATERIAL_SLOTS, y as MeshNode, z as Meta, N as NodeKind, B as NodeState, C as Outdoor, H as PALETTE, I as PHASE, J as Provenance, Q as ReplayEvent, R as ReplayFacts, T as ReplayState, U as ReplayView, V as Roof, W as SITE_PALETTE, X as STAIR_MATERIAL, Y as STAIR_RAIL_MATERIAL, Z as STOP_LEAD, _ as SlotMaterial, $ as Source, a0 as Stage, a1 as StairLanding, S as StripItem, a2 as TRIM_MATERIAL, a3 as Um, a4 as WALL_CAP_SRGB, a5 as Wall, a6 as authoringOrder, a7 as ease, a8 as explodeLifts, a9 as finishColour, aa as floorFinish, ab as keyFrames, ac as linearRgb, ad as siteColour, ae as slotColour, af as slotGroups, ag as stateAt, ah as storeysOf, s as stripAt, ai as timeline, aj as viewLabel, ak as viewMesh } from './strip-Sdsm54Qw.js';
|
|
6
|
+
export { F as FactsOptions, r as replayFacts } from './facts-3wb9egIT.js';
|
|
7
|
+
export { B as Box, E as ELEVATION_AZIMUTH, a as ELEVATION_RANGE, b as END_AZIMUTH, c as END_FOV, d as EndCamera, F as FILL, e as FrameCamera, O as Orbit, f as PRESET_NAMES, P as PresetName, S as START_FOV, V as Vec3, g as ViewScene, Z as ZOOM, h as boxOfNodes, i as cameraAtStop, j as cameraStops, k as corners, l as coverage, m as distanceLimits, n as drawingFrame, o as endElevation, p as fitEndCamera, q as frameCamera, r as pivotAbove, s as presetCamera, t as projectBox, u as settledLift, v as stopCount, w as takenLens, x as targetBounds } from './camera-CGIIudHj.js';
|
|
7
8
|
|
|
8
9
|
/** The package's own version, stamped into `meta.tool`. */
|
|
9
10
|
declare const ARCHLANG_3D_VERSION: string;
|
|
@@ -292,8 +293,131 @@ declare function rectsOf(r: readonly Pt[]): Rect[];
|
|
|
292
293
|
declare function slabRegion(footprint: readonly Ring3[], floors: readonly Floor[], ledger: Assumption[]): Polygon[];
|
|
293
294
|
|
|
294
295
|
/**
|
|
295
|
-
*
|
|
296
|
-
*
|
|
296
|
+
* The trim of a doorway and a window (product-roadmap card RM8.6; design
|
|
297
|
+
* `docs/plans/product-roadmap/design/visual-language.md` §2.1, §2.2), as parts of the opening's
|
|
298
|
+
* node, every size a clamped share of the host wall's thickness `t`, rounded to a whole millimetre:
|
|
299
|
+
*
|
|
300
|
+
* - a door (every kind) and a cased `opening`: a lining on the two jamb faces and the head, `l` =
|
|
301
|
+
* 0.1 t in [12, 25] thick along the wall; a door's in two halves across the wall, a 40 mm slot
|
|
302
|
+
* between them for the leaf (which keeps its length and place, so it stays the core's `doorLeaves`
|
|
303
|
+
* leaf); and a casing (architrave) on each wall face, `c` = 0.35 t in [50, 90] wide and `p` =
|
|
304
|
+
* 0.1 t in [10, 20] proud, its legs from the floor to the head, its head piece over the full width,
|
|
305
|
+
* cut at the wall's top (none when the head is at the top). A barn door has no casing on the face
|
|
306
|
+
* its panel hangs on (the core's `swing`), a garage door none at all, a door on a curved host no
|
|
307
|
+
* trim (its closed leaf is the chord between its jambs; a cased opening there keeps its lining,
|
|
308
|
+
* along the arc), and a leg that would stand in a wall or a column (a doorway at a corner), in
|
|
309
|
+
* standing furniture (not a rug: `FLAT_MM`), in another doorway or in another doorway's casing
|
|
310
|
+
* (two doorways side by side: both legs) is left out, never shortened, its head piece then
|
|
311
|
+
* stopping at that jamb;
|
|
312
|
+
* - a window: on the interior half of the cut, a reveal lining 0.075 t in [10, 20] on the jambs and
|
|
313
|
+
* the head, in the frame's colour; on its sill, an exterior sill 0.15 t in [20, 40] thick, proud
|
|
314
|
+
* of the outside face by 0.2 t and past each jamb by 0.2 t (the core's `SILL_PROJECTION` and
|
|
315
|
+
* `SILL_HORN`, of the host's own `t`), and an interior board 0.1 t in [18, 30] thick, past the
|
|
316
|
+
* inside face and each jamb by 0.1 t in [15, 30]. Which face is outside is the core's own rule
|
|
317
|
+
* (`exteriorNormal`, `src/elements/window.ts`): one wall thickness off each face, the side with no
|
|
318
|
+
* room or void of the storey there. Inside on both sides (an interior window): a reveal on both
|
|
319
|
+
* halves, no sill; on neither (a free-standing wall): nothing. A window with no sill (`sill 0`)
|
|
320
|
+
* has neither sill nor board. At a mitred end (a window run to a corner) a sill or a board stops
|
|
321
|
+
* on the mitre, past no jamb, and an end that would stand in a neighbour's doorway, casing, sill
|
|
322
|
+
* or board stops at its jamb (`window-sill-horn-omitted`); on a curved host the reveals follow the
|
|
323
|
+
* arc and the sill and the board stay inside the cut.
|
|
324
|
+
*
|
|
325
|
+
* A storey's trim is decided all at once (`storeyTrim`), never in the order the plan writes its
|
|
326
|
+
* openings: every casing before any sill or board (a casing beats a horn), and two casing legs, or
|
|
327
|
+
* two windows' horns or spans, that meet are both left out or cut back, so a plan's trim is the same whatever order
|
|
328
|
+
* its openings are written in, and a mirror-symmetric plan gets mirror-symmetric trim (RM8.6b).
|
|
329
|
+
*
|
|
330
|
+
* Every part is square to its wall, built in its jamb frame and rounded to whole micrometres; every
|
|
331
|
+
* shell closed (`prism`). Each default is ledgered per opening (ADR 0030 decision 5).
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
/** The trim's sizes (mm) for a host `t` mm thick (design §2.1, §2.2). */
|
|
335
|
+
declare const OPENING_DETAIL: {
|
|
336
|
+
/** The slot a door's lining leaves for its leaf: the leaf's own thickness (`LEAF_MM`). */
|
|
337
|
+
readonly slot: 40;
|
|
338
|
+
readonly lining: (t: number) => number;
|
|
339
|
+
readonly casingWidth: (t: number) => number;
|
|
340
|
+
readonly casingProud: (t: number) => number;
|
|
341
|
+
readonly sillThickness: (t: number) => number;
|
|
342
|
+
/** The core's `SILL_PROJECTION` and `SILL_HORN` (both 0.2 of the host's thickness). */
|
|
343
|
+
readonly sillProjection: (t: number) => number;
|
|
344
|
+
readonly sillHorn: (t: number) => number;
|
|
345
|
+
readonly boardThickness: (t: number) => number;
|
|
346
|
+
readonly boardOverhang: (t: number) => number;
|
|
347
|
+
readonly reveal: (t: number) => number;
|
|
348
|
+
/** The window frame's half depth (`FRAME_DEPTH_MM` / 2): where the reveal and the sills start. */
|
|
349
|
+
readonly frameHalfDepth: 30;
|
|
350
|
+
};
|
|
351
|
+
/** One part of an opening's node: its name and its shells (a `null` one was degenerate). */
|
|
352
|
+
interface TrimPart {
|
|
353
|
+
part: "lining" | "casing" | "sill" | "board" | "reveal";
|
|
354
|
+
shells: Array<Shell | null>;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* The side of the frame (`+1`: `+v`, `−1`: `−v`) a room or void lies on, one wall thickness off each
|
|
358
|
+
* face at the opening's centre (the core's `exteriorNormal`, through `wallFaceProbes`): `"both"` for
|
|
359
|
+
* an interior window, `null` for one on a free-standing wall.
|
|
360
|
+
*/
|
|
361
|
+
declare function insideOf(o: Opening, t: number, level: Level): 1 | -1 | "both" | null;
|
|
362
|
+
/**
|
|
363
|
+
* What a trim piece can stand in: one class per kind of obstacle a piece is tested against. A
|
|
364
|
+
* neighbour's doorway (its cut and a casing's depth off each face) is three of them:
|
|
365
|
+
* - `opening`: between its sill and its head, what a casing is tested against (above a door's head
|
|
366
|
+
* is its lintel, which a neighbour's casing may well pass in front of);
|
|
367
|
+
* - `doorway`: at every height, what a sill's or a board's span is tested against;
|
|
368
|
+
* - `jamb`: at every height and a millimetre wider each way along its wall, what a sill's or a
|
|
369
|
+
* board's horn is tested against. Its pier's jamb face runs from the floor to the wall's top
|
|
370
|
+
* whatever the doorway's own height, so a horn ending flush with it (a horn exactly as long as the
|
|
371
|
+
* pier is wide) would share that face at any height (RM8.6b n2; the coplanar check found it).
|
|
372
|
+
*/
|
|
373
|
+
type ObstacleClass = "wall" | "column" | "furniture" | "opening" | "doorway" | "jamb" | "trim";
|
|
374
|
+
/** Furniture lower than this (mm) lies flat on the floor (a rug, a mat): trim passes through it. */
|
|
375
|
+
declare const FLAT_MM = 50;
|
|
376
|
+
/** The extruder `build.ts` counts degenerate holes with. */
|
|
377
|
+
type Prism = (poly: Polygon, z0: number, z1: number) => Shell | null;
|
|
378
|
+
/** One opening the storey's trim is built for. */
|
|
379
|
+
interface TrimInput {
|
|
380
|
+
o: Opening;
|
|
381
|
+
/** The host's thickness (µm). */
|
|
382
|
+
t: number;
|
|
383
|
+
/** The head as built (µm over `e`; the opening's head capped at the host's built top). */
|
|
384
|
+
head: number;
|
|
385
|
+
/** The host's built top (µm over `e`). */
|
|
386
|
+
top: number;
|
|
387
|
+
}
|
|
388
|
+
/** An opening's trim: its parts (each a part of its node) and the ledger rows that say what was assumed. */
|
|
389
|
+
interface TrimResult {
|
|
390
|
+
parts: TrimPart[];
|
|
391
|
+
ledger: Assumption[];
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* The trim of every opening of a storey (product-roadmap RM8.6, RM8.6b), decided all at once so it
|
|
395
|
+
* never depends on the order the plan writes its openings in (review of PR #729, S1):
|
|
396
|
+
*
|
|
397
|
+
* 1. Each doorway's casing legs are tested against the storey's fixed obstacles (`fixedObstacles`)
|
|
398
|
+
* and every OTHER doorway's casing legs as planned. A leg that meets one is left out, never
|
|
399
|
+
* shortened; two legs that meet each other are both left out (two doorways closer than two
|
|
400
|
+
* casings), so neither doorway wins by coming first and a symmetric plan stays symmetric.
|
|
401
|
+
* 2. Each head piece's two ends past the jambs, one at a time (S3): an end is cut back to its jamb
|
|
402
|
+
* when its leg was left out, or when it meets a fixed obstacle (a neighbour's doorway above this
|
|
403
|
+
* one's head, a wall, a column, tall furniture); its span between the jambs is left out when it
|
|
404
|
+
* meets a fixed obstacle. Another doorway's casing cannot reach either: an end stands over its own
|
|
405
|
+
* leg, which met that casing first, and the span over its own doorway, which that casing's leg met
|
|
406
|
+
* first.
|
|
407
|
+
* 3. Only then each window's sill and board, a casing beating a horn: each horn past a jamb is cut
|
|
408
|
+
* back when it meets a neighbour's jamb (`jamb`), any built casing, or another window's sill or
|
|
409
|
+
* board as planned (both cut); a sill or board whose span meets a neighbour's doorway
|
|
410
|
+
* (`doorway`), a built casing or another window's span is left out. The reveal stands on the
|
|
411
|
+
* board, or on the sill block when the board is left out.
|
|
412
|
+
*
|
|
413
|
+
* Every omission is ledgered with what it met, end by end.
|
|
414
|
+
*/
|
|
415
|
+
declare function storeyTrim(level: Level, inputs: readonly TrimInput[], e: number, prism: Prism, furnitureZ: (f: Level["furniture"][number]) => [number, number]): Map<string, TrimResult>;
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* A stair as stepped solids (card X3, `stairSolid`) and in its parts (card RM8.6, `stairDetail`:
|
|
419
|
+
* what the mesh builds), from the Scene3D's flights and landings, which are the core's own
|
|
420
|
+
* (`scene3d/build.ts`): nothing here re-derives a stair from its bounding box. The solid:
|
|
297
421
|
*
|
|
298
422
|
* - Risers: one per tread the plan draws on a flight, plus one more at its head, because a flight's
|
|
299
423
|
* last riser lands on the landing or the floor above. So a stair of flights with `n₁ … n_F` treads
|
|
@@ -326,6 +450,101 @@ interface StairSolid {
|
|
|
326
450
|
declare function stairSolid(stair: Stair, z0: number, rise: number): (StairSolid & {
|
|
327
451
|
dropped: number;
|
|
328
452
|
}) | null;
|
|
453
|
+
/**
|
|
454
|
+
* The drafting defaults a stair's parts are built to (mm), each a clamped share of its own geometry
|
|
455
|
+
* (design `docs/plans/product-roadmap/design/visual-language.md` §2.3): `r` the riser (`rise / R`),
|
|
456
|
+
* `g` a flight's going (`run / treads`), `W` the flight band's width. They are drawing defaults,
|
|
457
|
+
* never a check against any regulation.
|
|
458
|
+
*/
|
|
459
|
+
declare const STAIR_DETAIL: {
|
|
460
|
+
/** A tread board, 0.25 r in [30, 50] thick (never more than half a riser). */
|
|
461
|
+
readonly tread: (r: number) => number;
|
|
462
|
+
/** Its nosing past the front edge (not on a flight's first tread), 0.1 g in [15, 30]. */
|
|
463
|
+
readonly nosing: (g: number) => number;
|
|
464
|
+
/** A stringer, 0.05 W in [40, 60] wide (at most a quarter of the band). */
|
|
465
|
+
readonly stringer: (W: number) => number;
|
|
466
|
+
/** The stringer's band: 0.3 r in [40, 60] over the nosing line, 1.2 r in [150, 250] under it. */
|
|
467
|
+
readonly above: (r: number) => number;
|
|
468
|
+
readonly below: (r: number) => number;
|
|
469
|
+
/** The handrail's top over the nosing line (measured upright), and its 50 × 50 section. */
|
|
470
|
+
readonly railHeight: 900;
|
|
471
|
+
readonly rail: 50;
|
|
472
|
+
/** A baluster a tread, 0.03 W in [20, 30] square. */
|
|
473
|
+
readonly baluster: (W: number) => number;
|
|
474
|
+
/** A newel at each end of a flight, 0.06 W in [60, 90] square, this far over the handrail. */
|
|
475
|
+
readonly newel: (W: number) => number;
|
|
476
|
+
readonly newelAbove: 100;
|
|
477
|
+
/** A landing's open edge: its handrail's top over the landing; balusters a going apart. */
|
|
478
|
+
readonly landingRailHeight: 1000;
|
|
479
|
+
/** How far past an edge the wall probe looks. */
|
|
480
|
+
readonly probe: 100;
|
|
481
|
+
};
|
|
482
|
+
/** What a flight's long edge, or a landing's edge, has past it (the probe's answer). */
|
|
483
|
+
interface StairSide {
|
|
484
|
+
/** `flight <k>` or `landing <k>`, 1-based in climbing order. */
|
|
485
|
+
of: string;
|
|
486
|
+
side: Side;
|
|
487
|
+
/**
|
|
488
|
+
* `flight` / `landing`: the stair's other flights (and landings) lie past the whole edge; `newel`: a
|
|
489
|
+
* landing edge open past it, but wholly held by the flights' newels standing on it.
|
|
490
|
+
*/
|
|
491
|
+
against: "wall" | "open" | "flight" | "landing" | "newel";
|
|
492
|
+
}
|
|
493
|
+
/** A stair built in its parts (RM8.6): treads and landings, stringers, the balustrade. */
|
|
494
|
+
interface StairDetail {
|
|
495
|
+
/** The treads (the risers open) and the solid landings: the stair node's own shells. */
|
|
496
|
+
treads: Shell[];
|
|
497
|
+
stringers: Shell[];
|
|
498
|
+
/** Handrails, balusters and newels. */
|
|
499
|
+
rails: Shell[];
|
|
500
|
+
risers: number;
|
|
501
|
+
/** Shells left out as degenerate. */
|
|
502
|
+
dropped: number;
|
|
503
|
+
/** Every edge the probe looked past, in climbing order. */
|
|
504
|
+
sides: StairSide[];
|
|
505
|
+
/** The sizes used (mm). */
|
|
506
|
+
dims: {
|
|
507
|
+
tread: number;
|
|
508
|
+
nosing: number[];
|
|
509
|
+
stringer: {
|
|
510
|
+
width: number;
|
|
511
|
+
above: number;
|
|
512
|
+
below: number;
|
|
513
|
+
};
|
|
514
|
+
balustrade: {
|
|
515
|
+
height: number;
|
|
516
|
+
rail: [number, number];
|
|
517
|
+
baluster: number;
|
|
518
|
+
newel: number;
|
|
519
|
+
newel_above: number;
|
|
520
|
+
landing_height: number;
|
|
521
|
+
};
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* `stair` climbing `rise` µm from `z0`, in its parts (product-roadmap RM8.6; design
|
|
526
|
+
* `visual-language.md` §2.3), or `null` where `stairSolid` refuses one. Every tread top is
|
|
527
|
+
* `stairSolid`'s riser top (`z0 + round(rise·k/R)`), so the climb is the same; the stair is built:
|
|
528
|
+
*
|
|
529
|
+
* - each tread a board `STAIR_DETAIL.tread` thick under its riser top, from its tread line (less
|
|
530
|
+
* the nosing, but on a flight's first tread) to the next, between the two stringers (so no face
|
|
531
|
+
* of a tread lies in a stringer's); the risers are open;
|
|
532
|
+
* - two stringers on the flight band's long edges, their side section the band from `below` under
|
|
533
|
+
* to `above` over the nosing line (through the tread tops' front edges), clipped to the run and
|
|
534
|
+
* to `[z0, the flight's head]`;
|
|
535
|
+
* - each landing a solid box, as before;
|
|
536
|
+
* - a balustrade on each long edge the probe finds open (`solidAt` false 100 mm past it at mid-run;
|
|
537
|
+
* the caller answers from the storey's wall bodies and columns): a sloping handrail centred on the
|
|
538
|
+
* stringer, a baluster under the middle of each tread from inside the stringer to inside the rail,
|
|
539
|
+
* a newel centred on each end of the flight; on a landing's open edge (no flight and no wall past
|
|
540
|
+
* it) a level handrail inside the edge with balusters a going apart, stopping where a newel or an
|
|
541
|
+
* earlier rail already stands.
|
|
542
|
+
*
|
|
543
|
+
* Square to the plan, integer micrometres, every shell closed and wound outward (`prism`,
|
|
544
|
+
* `sideways`). Read from the shape alone: a mirrored plan probes the mirrored edges and builds the
|
|
545
|
+
* mirrored stair, so nothing gains a hand.
|
|
546
|
+
*/
|
|
547
|
+
declare function stairDetail(stair: Stair, z0: number, rise: number, solidAt: (p: Pt) => boolean): StairDetail | null;
|
|
329
548
|
|
|
330
549
|
/**
|
|
331
550
|
* The T0 kit (visual-assets V2, V5, V6): the part type every generator returns and the few helpers
|
|
@@ -370,7 +589,24 @@ interface Part extends SectionShape {
|
|
|
370
589
|
z0: number;
|
|
371
590
|
z1: number;
|
|
372
591
|
}>;
|
|
592
|
+
/**
|
|
593
|
+
* A lofted part (product-roadmap RM8.6, backlog VA.1): its section (`round`, `radius` or a box)
|
|
594
|
+
* placed as one ring at the bottom and one at each height of this table, each `[height as a
|
|
595
|
+
* fraction of y0..y1, scale as a fraction of the box's half-extents]` about the box's centre,
|
|
596
|
+
* neighbouring rings joined by quads and the bottom and top rings capped: one closed shell whose
|
|
597
|
+
* silhouette slopes from ring to ring instead of stepping. Vertical parts only, no holes, no
|
|
598
|
+
* `profile`; its widest ring should scale 1, so the shell spans its box.
|
|
599
|
+
*/
|
|
600
|
+
loft?: DomeTable;
|
|
373
601
|
}
|
|
602
|
+
/**
|
|
603
|
+
* A dome's profile, each row `[a height as a fraction of the dome's, its radius there as a fraction
|
|
604
|
+
* of the half-extents]` (once the top of a stacked tier; since RM8.6 a lofted ring, `Part.loft`).
|
|
605
|
+
* The tables (`t0-outdoor.ts`) slice an ellipsoid at equal steps of latitude (15°), so the rings
|
|
606
|
+
* crowd toward the top and the dome rounds over; the radii are cos(mid-latitude), the widest scaled
|
|
607
|
+
* to 1, written out (no engine's `Math.cos` reaches a coordinate).
|
|
608
|
+
*/
|
|
609
|
+
type DomeTable = ReadonlyArray<readonly [number, number]>;
|
|
374
610
|
|
|
375
611
|
/**
|
|
376
612
|
* T0 parametric furniture (archlang-3d plan §4.4, §5.1–5.3; card A2b; visual-assets V1–V3,
|
|
@@ -496,4 +732,69 @@ declare function t0Shells(f: Furniture, floor: number): {
|
|
|
496
732
|
holesDropped: number;
|
|
497
733
|
} | null;
|
|
498
734
|
|
|
499
|
-
|
|
735
|
+
/** An outdoor surface's slab, mm: thin, its top at the storey's floor level. */
|
|
736
|
+
declare const OUTDOOR_MM = 50;
|
|
737
|
+
/** A fence's height by style, mm: drafting defaults (a front-garden picket, a pool panel, a post-and-rail). */
|
|
738
|
+
declare const FENCE_HEIGHT_MM: Readonly<Record<string, number>>;
|
|
739
|
+
/**
|
|
740
|
+
* The core's post spacing per style, mm (`POST_PITCH`, `src/elements/fence.ts`, not exported): it
|
|
741
|
+
* draws `postCount` = round(run / pitch), clamped to 1…60, divisions on each straight run, a tick at
|
|
742
|
+
* each division and one at an open fence's far end. The 3D posts stand exactly on those ticks
|
|
743
|
+
* (`fencePosts`); `test/outdoor.test.ts` holds them to the ticks the core draws, across the corpus.
|
|
744
|
+
*/
|
|
745
|
+
declare const CORE_POST_PITCH_MM: Readonly<Record<string, number>>;
|
|
746
|
+
/** The core's clamp on a run's divisions (`MIN_POSTS`, `MAX_POSTS`). */
|
|
747
|
+
declare const CORE_POSTS_PER_RUN: readonly [1, 60];
|
|
748
|
+
/**
|
|
749
|
+
* Each style's profile, mm: what stands along a run. A square post stands on every tick the core
|
|
750
|
+
* draws (`CORE_POST_PITCH_MM`); a picket fence adds two rails and its pickets, a panel fence one board
|
|
751
|
+
* the whole height, a post-and-rail fence one rail along the top: the core draws the three as dense
|
|
752
|
+
* ticks, a double line and posts on a single rail.
|
|
753
|
+
*/
|
|
754
|
+
interface FenceProfile {
|
|
755
|
+
post: number;
|
|
756
|
+
/** Boards along the run: [depth across it, bottom, top], mm above the base. */
|
|
757
|
+
rails: ReadonlyArray<readonly [number, number, number]>;
|
|
758
|
+
/** Pickets: [width along the run, depth across it, pitch], mm, or none. */
|
|
759
|
+
pickets?: readonly [number, number, number];
|
|
760
|
+
}
|
|
761
|
+
declare const FENCE_PROFILES: Readonly<Record<string, FenceProfile>>;
|
|
762
|
+
/** The most pickets one run takes, whatever its length. */
|
|
763
|
+
declare const MAX_FENCE_REPEAT = 400;
|
|
764
|
+
/** The theme's tint laid on `GROUND_WASH` times over its paper (`materials.ts`). */
|
|
765
|
+
declare function groundColour(tint: GroundTint, theme?: _chanmeng666_archlang.Theme): string;
|
|
766
|
+
/** A surface's 3D colour and where it came from (the ledger's rule). */
|
|
767
|
+
declare function outdoorColour(surface: string): {
|
|
768
|
+
srgb: string;
|
|
769
|
+
rule: "outdoor-colour-theme" | "outdoor-colour-3d";
|
|
770
|
+
};
|
|
771
|
+
/** A fence's colour (its style's, or a picket's for a style this package does not know). */
|
|
772
|
+
declare const fenceColour: (style: string) => string;
|
|
773
|
+
/** The core's `postCount`: a run's divisions for a style (`CORE_POST_PITCH_MM`). */
|
|
774
|
+
declare function corePostCount(lenUm: number, style: string): number;
|
|
775
|
+
/**
|
|
776
|
+
* A fence's runs as the core draws them (`fenceSegments`, then `render`): consecutive points, plus
|
|
777
|
+
* the closing run of a closed fence of three points or more, zero-length runs left out; and whether
|
|
778
|
+
* the runs close into a ring (then the last run's far end is the first run's start, and an open
|
|
779
|
+
* fence's last run takes a post at its far end).
|
|
780
|
+
*/
|
|
781
|
+
declare function fenceRuns(f: Pick<Fence, "points" | "closed">): {
|
|
782
|
+
runs: Array<[Pt, Pt]>;
|
|
783
|
+
ring: boolean;
|
|
784
|
+
};
|
|
785
|
+
/** Where the core draws a fence's ticks, so where its posts stand (µm, the plan point, its run). */
|
|
786
|
+
declare function fencePosts(f: Pick<Fence, "points" | "closed" | "style">): Array<{
|
|
787
|
+
at: Pt;
|
|
788
|
+
run: [Pt, Pt];
|
|
789
|
+
}>;
|
|
790
|
+
/**
|
|
791
|
+
* A fence's plan pieces, each with its [bottom, top] in mm above its base: a post on every tick the
|
|
792
|
+
* core draws (`fencePosts`), and per run its rails and its pickets, each a box aligned with the run.
|
|
793
|
+
* A fence with no run of positive length has no piece.
|
|
794
|
+
*/
|
|
795
|
+
declare function fencePieces(f: Pick<Fence, "points" | "closed" | "style">, profile: FenceProfile, height: number): Array<{
|
|
796
|
+
poly: Polygon;
|
|
797
|
+
z: readonly [number, number];
|
|
798
|
+
}>;
|
|
799
|
+
|
|
800
|
+
export { ARCHLANG_3D_VERSION, type AdaptOptions, type AdaptResult, Assumption, type BuildOptions, CORE_POSTS_PER_RUN, CORE_POST_PITCH_MM, type CutSector, DOOR_POSES, type DoorPose, FENCE_HEIGHT_MM, FENCE_PROFILES, FLAT_MM, FLOOR_LIFT_UM, FLOOR_OVERLAP_MIN_UM2, FURNITURE_HEIGHT_MM, Fence, type FenceProfile, Floor, type FloorOverlap, Furniture, GroundTint, Level, MAX_FENCE_REPEAT, MIN_CORE, MaterialSlot, Mesh3D, type MeshOptions, type MixedHeightJoint, OPENING_DETAIL, OUTDOOR_MM, type ObstacleClass, Opening, type OwnedWall, type Ownership, type Part, type Piece, Polygon, type Prism, Pt, type Refusal, type RefusalCode, type Ring, Ring3, STAIR_DETAIL, Scene3D, type SectionShape, Shell, Side, Stair, type StairDetail, StairFlight, type StairSide, type StairSolid, type Storey, T0_FAMILIES, T0_HANDED, T0_HEIGHT_MM, T0_HUNG_FROM_TOP, T0_MATERIALS, T0_MOUNT_MM, type TrimInput, type TrimPart, type TrimResult, type ValidationIssue, type Warning3D, adaptPlan, assetFor, buildMesh, buildScene3D, clipToConvex, corePostCount, cutSector, fenceColour, fencePieces, fencePosts, fenceRuns, floorLifts, floorOverlaps, groundColour, handedAt, insideCut, insideOf, mixedHeightJoints, openLeaf, outdoorColour, overlapArea, partShell, piecesOf, piecesTouch, prism, rectsOf, sectionRing, sectorBand, slab2d, slabRegion, stairDetail, stairRisers, stairSolid, storeyTrim, t0LocalParts, t0Shells, um, umPoint, validateScene3D, wallOwnership };
|