@chanmeng666/archlang-3d 0.1.1 → 0.2.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 +59 -0
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +93 -48
- package/dist/{chunk-54YVSAVZ.js → chunk-2ZINQMUB.js} +18 -6
- package/dist/{chunk-4SDXG6GW.js → chunk-4AF5Q7M3.js} +104 -267
- package/dist/{chunk-CTFMM64C.js → chunk-EYEEIS4R.js} +128 -1
- package/dist/{chunk-YCMINRJA.js → chunk-KUK6ARJC.js} +52 -32
- package/dist/chunk-VUSBWX7N.js +4125 -0
- package/dist/cli.js +5 -5
- package/dist/{facts-DMBpeo-q.d.ts → facts-DHuCDilh.d.ts} +1 -1
- package/dist/index.d.ts +166 -64
- package/dist/index.js +51 -11
- package/dist/node.d.ts +10 -4
- package/dist/node.js +6 -4
- package/dist/replay.d.ts +12 -1
- package/dist/scene3d.schema.json +5 -1
- package/dist/{strip-BMxWrvYD.d.ts → strip-CdTeMoHA.d.ts} +103 -2
- package/dist/viewer.iife.js +175 -175
- package/package.json +1 -1
- package/dist/chunk-CIC5LCVH.js +0 -950
|
@@ -0,0 +1,4125 @@
|
|
|
1
|
+
// src/mesh/extrude.ts
|
|
2
|
+
import earcut from "earcut";
|
|
3
|
+
var area2 = (r) => {
|
|
4
|
+
let s = 0;
|
|
5
|
+
for (let i = 0; i < r.length; i++) {
|
|
6
|
+
const a = r[i];
|
|
7
|
+
const b = r[(i + 1) % r.length];
|
|
8
|
+
s += a[0] * b[1] - b[0] * a[1];
|
|
9
|
+
}
|
|
10
|
+
return s;
|
|
11
|
+
};
|
|
12
|
+
function clean(r) {
|
|
13
|
+
const out = [];
|
|
14
|
+
for (const p of r) {
|
|
15
|
+
const q = out[out.length - 1];
|
|
16
|
+
if (!q || q[0] !== p[0] || q[1] !== p[1]) out.push(p);
|
|
17
|
+
}
|
|
18
|
+
while (out.length > 1 && out[0]?.[0] === out[out.length - 1]?.[0] && out[0]?.[1] === out[out.length - 1]?.[1])
|
|
19
|
+
out.pop();
|
|
20
|
+
return out.length >= 3 && area2(out) !== 0 ? out : null;
|
|
21
|
+
}
|
|
22
|
+
var orient = (r, ccw) => area2(r) > 0 === ccw ? r : [...r].reverse();
|
|
23
|
+
var degenerateHoles = (poly) => (poly.holes ?? []).filter((h) => clean(h) === null).length;
|
|
24
|
+
function where(p, r) {
|
|
25
|
+
let c = false;
|
|
26
|
+
for (let i = 0, j = r.length - 1; i < r.length; j = i++) {
|
|
27
|
+
const a = r[i];
|
|
28
|
+
const b = r[j];
|
|
29
|
+
const cross2 = (b[0] - a[0]) * (p[1] - a[1]) - (b[1] - a[1]) * (p[0] - a[0]);
|
|
30
|
+
const within = Math.min(a[0], b[0]) <= p[0] && p[0] <= Math.max(a[0], b[0]) && Math.min(a[1], b[1]) <= p[1] && p[1] <= Math.max(a[1], b[1]);
|
|
31
|
+
if (cross2 === 0 && within) return null;
|
|
32
|
+
if (a[1] > p[1] !== b[1] > p[1] && p[0] < (b[0] - a[0]) * (p[1] - a[1]) / (b[1] - a[1]) + a[0]) c = !c;
|
|
33
|
+
}
|
|
34
|
+
return c;
|
|
35
|
+
}
|
|
36
|
+
function holesApart(outer, holes) {
|
|
37
|
+
const strictlyIn = (ps, r) => ps.every((p) => where(p, r) === true);
|
|
38
|
+
const strictlyOut = (ps, r) => ps.every((p) => where(p, r) === false);
|
|
39
|
+
return holes.every(
|
|
40
|
+
(h, i) => strictlyIn(h, outer) && strictlyOut(outer, h) && holes.every((g, j) => j === i || strictlyOut(h, g) && strictlyOut(g, h))
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
function prism(poly, z0, z1, splits) {
|
|
44
|
+
if (!(z1 > z0)) return null;
|
|
45
|
+
const outer = clean(poly.outer);
|
|
46
|
+
if (!outer) return null;
|
|
47
|
+
const rings = [orient(outer, true)];
|
|
48
|
+
for (const h of poly.holes ?? []) {
|
|
49
|
+
const c = clean(h);
|
|
50
|
+
if (c) rings.push(orient(c, false));
|
|
51
|
+
}
|
|
52
|
+
if (!holesApart(rings[0], rings.slice(1))) return null;
|
|
53
|
+
const flat = [];
|
|
54
|
+
const holes = [];
|
|
55
|
+
rings.forEach((r, i) => {
|
|
56
|
+
if (i > 0) holes.push(flat.length / 2);
|
|
57
|
+
for (const p of r) flat.push(p[0], p[1]);
|
|
58
|
+
});
|
|
59
|
+
const tris = earcut(flat, holes, 2);
|
|
60
|
+
const n = flat.length / 2;
|
|
61
|
+
const positions = [];
|
|
62
|
+
for (const z of [z0, z1])
|
|
63
|
+
for (let i = 0; i < n; i++) positions.push(flat[2 * i], z, flat[2 * i + 1]);
|
|
64
|
+
const indices = [];
|
|
65
|
+
const v = (i) => [
|
|
66
|
+
positions[3 * i],
|
|
67
|
+
positions[3 * i + 1],
|
|
68
|
+
positions[3 * i + 2]
|
|
69
|
+
];
|
|
70
|
+
const face = (a, b, c, want) => {
|
|
71
|
+
const [A, B, C] = [v(a), v(b), v(c)];
|
|
72
|
+
const u = [B[0] - A[0], B[1] - A[1], B[2] - A[2]];
|
|
73
|
+
const w = [C[0] - A[0], C[1] - A[1], C[2] - A[2]];
|
|
74
|
+
const nrm = [
|
|
75
|
+
u[1] * w[2] - u[2] * w[1],
|
|
76
|
+
u[2] * w[0] - u[0] * w[2],
|
|
77
|
+
u[0] * w[1] - u[1] * w[0]
|
|
78
|
+
];
|
|
79
|
+
const dot = nrm[0] * want[0] + nrm[1] * want[1] + nrm[2] * want[2];
|
|
80
|
+
if (dot >= 0) indices.push(a, b, c);
|
|
81
|
+
else indices.push(a, c, b);
|
|
82
|
+
};
|
|
83
|
+
for (let t = 0; t < tris.length; t += 3) {
|
|
84
|
+
const [a, b, c] = [tris[t], tris[t + 1], tris[t + 2]];
|
|
85
|
+
face(n + a, n + b, n + c, [0, 1, 0]);
|
|
86
|
+
face(a, b, c, [0, -1, 0]);
|
|
87
|
+
}
|
|
88
|
+
const column = [];
|
|
89
|
+
for (let i = 0; i < n; i++) {
|
|
90
|
+
const p = [flat[2 * i], flat[2 * i + 1]];
|
|
91
|
+
const hs = splits ? [...new Set(splits(p))].filter((h) => h > z0 && h < z1).sort((x, y) => x - y) : [];
|
|
92
|
+
const col = [i];
|
|
93
|
+
for (const h of hs) {
|
|
94
|
+
col.push(positions.length / 3);
|
|
95
|
+
positions.push(p[0], h, p[1]);
|
|
96
|
+
}
|
|
97
|
+
col.push(n + i);
|
|
98
|
+
column.push(col);
|
|
99
|
+
}
|
|
100
|
+
const height = (v2) => positions[3 * v2 + 1];
|
|
101
|
+
let base = 0;
|
|
102
|
+
for (const r of rings) {
|
|
103
|
+
for (let k = 0; k < r.length; k++) {
|
|
104
|
+
const i = base + k;
|
|
105
|
+
const j = base + (k + 1) % r.length;
|
|
106
|
+
const a = r[k];
|
|
107
|
+
const b = r[(k + 1) % r.length];
|
|
108
|
+
const out = [b[1] - a[1], 0, -(b[0] - a[0])];
|
|
109
|
+
const ci = column[i];
|
|
110
|
+
const cj = column[j];
|
|
111
|
+
if (ci.length === 2 && cj.length === 2) {
|
|
112
|
+
face(i, j, n + j, out);
|
|
113
|
+
face(i, n + j, n + i, out);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
let u = 0;
|
|
117
|
+
let w = 0;
|
|
118
|
+
while (u < ci.length - 1 || w < cj.length - 1) {
|
|
119
|
+
const hu = u < ci.length - 1 ? height(ci[u + 1]) : Number.POSITIVE_INFINITY;
|
|
120
|
+
const hw = w < cj.length - 1 ? height(cj[w + 1]) : Number.POSITIVE_INFINITY;
|
|
121
|
+
if (hu <= hw) {
|
|
122
|
+
face(ci[u], cj[w], ci[u + 1], out);
|
|
123
|
+
u++;
|
|
124
|
+
} else {
|
|
125
|
+
face(ci[u], cj[w], cj[w + 1], out);
|
|
126
|
+
w++;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
base += r.length;
|
|
131
|
+
}
|
|
132
|
+
return { positions, indices };
|
|
133
|
+
}
|
|
134
|
+
function rect(x0, y0, x1, y1) {
|
|
135
|
+
return {
|
|
136
|
+
outer: [
|
|
137
|
+
[x0, y0],
|
|
138
|
+
[x1, y0],
|
|
139
|
+
[x1, y1],
|
|
140
|
+
[x0, y1]
|
|
141
|
+
]
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function slab2d(a, b, depth) {
|
|
145
|
+
const dx = b[0] - a[0];
|
|
146
|
+
const dy = b[1] - a[1];
|
|
147
|
+
const len = Math.hypot(dx, dy) || 1;
|
|
148
|
+
const nx = -dy / len * (depth / 2);
|
|
149
|
+
const ny = dx / len * (depth / 2);
|
|
150
|
+
const p = (x, y) => [Math.round(x), Math.round(y)];
|
|
151
|
+
return {
|
|
152
|
+
outer: [p(a[0] + nx, a[1] + ny), p(b[0] + nx, b[1] + ny), p(b[0] - nx, b[1] - ny), p(a[0] - nx, a[1] - ny)]
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function clipToConvex(ring3, convex) {
|
|
156
|
+
const c = area2(convex) > 0 ? [...convex] : [...convex].reverse();
|
|
157
|
+
let out = ring3.map((p) => [p[0], p[1]]);
|
|
158
|
+
for (let k = 0; k < c.length && out.length > 0; k++) {
|
|
159
|
+
const a = c[k];
|
|
160
|
+
const b = c[(k + 1) % c.length];
|
|
161
|
+
const side = (p) => (b[0] - a[0]) * (p[1] - a[1]) - (b[1] - a[1]) * (p[0] - a[0]);
|
|
162
|
+
const input = out;
|
|
163
|
+
out = [];
|
|
164
|
+
for (let i = 0; i < input.length; i++) {
|
|
165
|
+
const p = input[i];
|
|
166
|
+
const q = input[(i + 1) % input.length];
|
|
167
|
+
const sp = side(p);
|
|
168
|
+
const sq = side(q);
|
|
169
|
+
if (sp >= 0) out.push(p);
|
|
170
|
+
if (sp >= 0 !== sq >= 0) {
|
|
171
|
+
const t = sp / (sp - sq);
|
|
172
|
+
out.push([p[0] + (q[0] - p[0]) * t, p[1] + (q[1] - p[1]) * t]);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const rounded = clean(out.map((p) => [Math.round(p[0]), Math.round(p[1])]));
|
|
177
|
+
return rounded ? { outer: rounded } : null;
|
|
178
|
+
}
|
|
179
|
+
function insideCut(poly, ring3) {
|
|
180
|
+
if (poly.outer.every((p) => where(p, ring3) !== false)) return poly;
|
|
181
|
+
return clipToConvex(ring3, poly.outer);
|
|
182
|
+
}
|
|
183
|
+
var TAU = 2 * Math.PI;
|
|
184
|
+
var mod2pi = (x) => (x % TAU + TAU) % TAU;
|
|
185
|
+
function cutSector(cut, jambs, centre) {
|
|
186
|
+
const ring3 = clean(cut);
|
|
187
|
+
if (!ring3 || ring3.length <= 4) return null;
|
|
188
|
+
const n = ring3.length;
|
|
189
|
+
const turn = ring3.map((p, i) => {
|
|
190
|
+
const a = ring3[(i + n - 1) % n];
|
|
191
|
+
const b = ring3[(i + 1) % n];
|
|
192
|
+
const u2 = [p[0] - a[0], p[1] - a[1]];
|
|
193
|
+
const v2 = [b[0] - p[0], b[1] - p[1]];
|
|
194
|
+
return Math.abs(
|
|
195
|
+
Math.atan2(
|
|
196
|
+
u2[0] * v2[1] - u2[1] * v2[0],
|
|
197
|
+
u2[0] * v2[0] + u2[1] * v2[1]
|
|
198
|
+
)
|
|
199
|
+
);
|
|
200
|
+
});
|
|
201
|
+
const corners = turn.map((t, i) => [t, i]).sort((a, b) => b[0] - a[0] || a[1] - b[1]).slice(0, 4).map(([, i]) => i).sort((a, b) => a - b);
|
|
202
|
+
const paths = corners.map((ci, k) => {
|
|
203
|
+
const cj = corners[(k + 1) % 4];
|
|
204
|
+
return { a: ring3[ci], b: ring3[cj], edges: (cj - ci + n) % n };
|
|
205
|
+
});
|
|
206
|
+
const mid = (p) => [(p.a[0] + p.b[0]) / 2, (p.a[1] + p.b[1]) / 2];
|
|
207
|
+
const d = (p, q) => Math.hypot(p[0] - q[0], p[1] - q[1]);
|
|
208
|
+
let best = null;
|
|
209
|
+
for (const [i, j] of [
|
|
210
|
+
[0, 2],
|
|
211
|
+
[1, 3]
|
|
212
|
+
]) {
|
|
213
|
+
const [p, q] = [paths[i], paths[j]];
|
|
214
|
+
const arcs = Math.max(
|
|
215
|
+
paths[(i + 1) % 4].edges,
|
|
216
|
+
paths[(j + 1) % 4].edges
|
|
217
|
+
);
|
|
218
|
+
const straight = d(mid(p), jambs[0]) + d(mid(q), jambs[1]);
|
|
219
|
+
const swapped = d(mid(q), jambs[0]) + d(mid(p), jambs[1]);
|
|
220
|
+
const cand = straight <= swapped ? { cost: straight, f0: p, f1: q, arcs } : { cost: swapped, f0: q, f1: p, arcs };
|
|
221
|
+
if (!best || cand.cost < best.cost) best = cand;
|
|
222
|
+
}
|
|
223
|
+
if (!best) return null;
|
|
224
|
+
const { f0, f1 } = best;
|
|
225
|
+
const u = [f0.b[0] - f0.a[0], f0.b[1] - f0.a[1]];
|
|
226
|
+
const v = [f1.b[0] - f1.a[0], f1.b[1] - f1.a[1]];
|
|
227
|
+
const den = u[0] * v[1] - u[1] * v[0];
|
|
228
|
+
if (Math.abs(den) <= 1e-9 * Math.hypot(...u) * Math.hypot(...v)) return null;
|
|
229
|
+
const s = ((f1.a[0] - f0.a[0]) * v[1] - (f1.a[1] - f0.a[1]) * v[0]) / den;
|
|
230
|
+
const c = [f0.a[0] + s * u[0], f0.a[1] + s * u[1]];
|
|
231
|
+
const m0 = mid(f0);
|
|
232
|
+
const m1 = mid(f1);
|
|
233
|
+
const r = (d(m0, c) + d(m1, c)) / 2;
|
|
234
|
+
const t0 = Math.atan2(m0[1] - c[1], m0[0] - c[0]);
|
|
235
|
+
const t1 = Math.atan2(m1[1] - c[1], m1[0] - c[0]);
|
|
236
|
+
const tc = Math.atan2(centre[1] - c[1], centre[0] - c[0]);
|
|
237
|
+
const ccw = mod2pi(t1 - t0);
|
|
238
|
+
const sweep = mod2pi(tc - t0) <= ccw ? ccw : ccw - TAU;
|
|
239
|
+
return { c, r, t0, sweep, steps: Math.max(1, best.arcs) };
|
|
240
|
+
}
|
|
241
|
+
function sectorBand(sector, d0, d1, f0 = 0, f1 = 1) {
|
|
242
|
+
const k = Math.max(1, Math.ceil(sector.steps * (f1 - f0)));
|
|
243
|
+
const at = (rr, f) => {
|
|
244
|
+
const t = sector.t0 + sector.sweep * f;
|
|
245
|
+
return [Math.round(sector.c[0] + rr * Math.cos(t)), Math.round(sector.c[1] + rr * Math.sin(t))];
|
|
246
|
+
};
|
|
247
|
+
const outer = [];
|
|
248
|
+
for (let i = 0; i <= k; i++) outer.push(at(sector.r + d1, f0 + (f1 - f0) * i / k));
|
|
249
|
+
for (let i = k; i >= 0; i--) outer.push(at(sector.r + d0, f0 + (f1 - f0) * i / k));
|
|
250
|
+
return { outer };
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// src/mesh/t0-kit.ts
|
|
254
|
+
var clamp = (x, lo, hi) => Math.max(lo, Math.min(hi, x));
|
|
255
|
+
var snap64 = (v) => Math.round(v * 64) / 64;
|
|
256
|
+
var MAX_DOORS = 64;
|
|
257
|
+
var P = (mat, x0, x1, z0, z1, y0, y1, more = {}) => ({ x0, x1, z0, z1, y0, y1, mat, ...more });
|
|
258
|
+
function span(n, half, gap) {
|
|
259
|
+
const each = (2 * half - (n - 1) * gap) / n;
|
|
260
|
+
const out = new Array(n);
|
|
261
|
+
for (let k = 0; k < Math.floor(n / 2); k++) {
|
|
262
|
+
const a = -half + k * (each + gap);
|
|
263
|
+
const b = a + each;
|
|
264
|
+
out[k] = [a, b];
|
|
265
|
+
out[n - 1 - k] = [-b, -a];
|
|
266
|
+
}
|
|
267
|
+
if (n % 2 === 1) out[(n - 1) / 2] = [-each / 2, each / 2];
|
|
268
|
+
return out;
|
|
269
|
+
}
|
|
270
|
+
var pair = (p) => [p, { ...p, x0: -p.x1, x1: -p.x0 }];
|
|
271
|
+
function upholstered(W, D, arm, seats) {
|
|
272
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
273
|
+
const back = clamp(D * 0.18, 110, 220);
|
|
274
|
+
const legH = 80;
|
|
275
|
+
const seat = 280;
|
|
276
|
+
const inner = hw - arm;
|
|
277
|
+
const n = seats ?? clamp(Math.round(2 * inner / (0.62 * Math.min(D, 1e3))), 1, 4);
|
|
278
|
+
const cushions = span(n, inner - 6, 12);
|
|
279
|
+
const backCush = clamp((hd * 2 - back) * 0.24, 90, 200);
|
|
280
|
+
const leg = 40;
|
|
281
|
+
const legs = [-hd + 30, hd - 30 - leg].flatMap(
|
|
282
|
+
(z) => pair(P("wood_dark", -hw + 30, -hw + 30 + leg, z, z + leg, 0, legH))
|
|
283
|
+
);
|
|
284
|
+
return [
|
|
285
|
+
...legs,
|
|
286
|
+
P("fabric", -inner, inner, -hd, hd - 10, legH, seat),
|
|
287
|
+
...pair(P("fabric", -hw, -inner, -hd, hd, legH, 620, { axis: "z", radius: Math.min(arm * 0.45, 70) })),
|
|
288
|
+
P("fabric", -inner, inner, -hd, -hd + back, legH, 800, { axis: "x", radius: Math.min(back * 0.45, 70) }),
|
|
289
|
+
...cushions.map(
|
|
290
|
+
([a, b]) => P("cushion", a, b, -hd + back + 4, hd - 4, seat, seat + 150, { axis: "x", radius: 50 })
|
|
291
|
+
),
|
|
292
|
+
...cushions.map(
|
|
293
|
+
([a, b]) => P("cushion", a, b, -hd + back, -hd + back + backCush, seat + 150, 760, {
|
|
294
|
+
axis: "x",
|
|
295
|
+
profile: BACK_CUSHION
|
|
296
|
+
})
|
|
297
|
+
)
|
|
298
|
+
];
|
|
299
|
+
}
|
|
300
|
+
var BACK_CUSHION = [
|
|
301
|
+
[0, 0],
|
|
302
|
+
[1, 0],
|
|
303
|
+
[0.55, 0.96],
|
|
304
|
+
[0.35, 1],
|
|
305
|
+
[0, 0.9]
|
|
306
|
+
];
|
|
307
|
+
var SIDE_CHAIR = [
|
|
308
|
+
[0, 0],
|
|
309
|
+
[6 / 64, 0],
|
|
310
|
+
[6 / 64, 29 / 64],
|
|
311
|
+
[58 / 64, 29 / 64],
|
|
312
|
+
[58 / 64, 0],
|
|
313
|
+
[1, 0],
|
|
314
|
+
[1, 34 / 64],
|
|
315
|
+
[6 / 64, 34 / 64],
|
|
316
|
+
[6 / 64, 1],
|
|
317
|
+
[0, 1]
|
|
318
|
+
];
|
|
319
|
+
function sideways(mat, box3, y0, y1, back, profile) {
|
|
320
|
+
const flip = back === "+z" || back === "+x";
|
|
321
|
+
return P(mat, box3.x0, box3.x1, box3.z0, box3.z1, y0, y1, {
|
|
322
|
+
axis: back === "-z" || back === "+z" ? "x" : "z",
|
|
323
|
+
profile: flip ? profile.map(([u, v]) => [1 - u, v]) : profile
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
function tableSeats(W, D, round, perSide, chair) {
|
|
327
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
328
|
+
const band = snap64(Math.min(W, D) * 0.22);
|
|
329
|
+
const cw = snap64(band * 0.9);
|
|
330
|
+
const out = [];
|
|
331
|
+
const zSide = (x) => {
|
|
332
|
+
out.push(...chair({ x0: x - cw / 2, x1: x + cw / 2, z0: -hd, z1: -hd + band }, "-z"));
|
|
333
|
+
out.push(...chair({ x0: x - cw / 2, x1: x + cw / 2, z0: hd - band, z1: hd }, "+z"));
|
|
334
|
+
};
|
|
335
|
+
const xSide = (z) => {
|
|
336
|
+
out.push(...chair({ x0: -hw, x1: -hw + band, z0: z - cw / 2, z1: z + cw / 2 }, "-x"));
|
|
337
|
+
out.push(...chair({ x0: hw - band, x1: hw, z0: z - cw / 2, z1: z + cw / 2 }, "+x"));
|
|
338
|
+
};
|
|
339
|
+
if (round) {
|
|
340
|
+
zSide(0);
|
|
341
|
+
xSide(0);
|
|
342
|
+
return out;
|
|
343
|
+
}
|
|
344
|
+
const horizontal = W >= D;
|
|
345
|
+
const run2 = horizontal ? W - 2 * band : D - 2 * band;
|
|
346
|
+
for (let i = 0; i < perSide; i++) {
|
|
347
|
+
const c = run2 * (2 * i + 1 - perSide) / (2 * perSide);
|
|
348
|
+
if (horizontal) zSide(c);
|
|
349
|
+
else xSide(c);
|
|
350
|
+
}
|
|
351
|
+
if (horizontal) xSide(0);
|
|
352
|
+
else zSide(0);
|
|
353
|
+
return out;
|
|
354
|
+
}
|
|
355
|
+
var MOUND = [
|
|
356
|
+
[0.161, 0.932],
|
|
357
|
+
[0.333, 1],
|
|
358
|
+
[0.506, 1],
|
|
359
|
+
[0.667, 0.932],
|
|
360
|
+
[0.805, 0.8],
|
|
361
|
+
[0.911, 0.614],
|
|
362
|
+
[0.977, 0.386],
|
|
363
|
+
[1, 0.132]
|
|
364
|
+
];
|
|
365
|
+
var HEMI = [
|
|
366
|
+
[0.259, 1],
|
|
367
|
+
[0.5, 0.932],
|
|
368
|
+
[Math.SQRT1_2, 0.8],
|
|
369
|
+
[0.866, 0.614],
|
|
370
|
+
[0.966, 0.386],
|
|
371
|
+
[1, 0.132]
|
|
372
|
+
];
|
|
373
|
+
function dome(mat, cx, cz, rx, rz, y0, y1, table) {
|
|
374
|
+
let lo = y0;
|
|
375
|
+
return table.map(([t, f], k) => {
|
|
376
|
+
const hi = k === table.length - 1 ? y1 : y0 + (y1 - y0) * t;
|
|
377
|
+
const p = P(mat, cx - rx * f, cx + rx * f, cz - rz * f, cz + rz * f, lo, hi, { round: true });
|
|
378
|
+
lo = hi;
|
|
379
|
+
return p;
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
function cabinet(W, D, opts = {}) {
|
|
383
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
384
|
+
const top = 870;
|
|
385
|
+
const fz = hd - 22;
|
|
386
|
+
const out = [
|
|
387
|
+
P("rubber", -hw, hw, -hd, hd - 70, 0, 100),
|
|
388
|
+
P("paint", -hw, hw, -hd, hd - 40, 100, opts.carcassTop ?? top),
|
|
389
|
+
P("stone", -hw, hw, -hd, hd, top, 900, opts.hole ? { holes: opts.hole } : {})
|
|
390
|
+
];
|
|
391
|
+
if (opts.fronts === false) return out;
|
|
392
|
+
const n = clamp(Math.round(W / 600), 1, MAX_DOORS);
|
|
393
|
+
for (const [a, b] of span(n, hw - 2, 4)) {
|
|
394
|
+
out.push(P("paint", a, b, hd - 40, fz, 106, top - 8));
|
|
395
|
+
const pw = Math.min((b - a) * 0.45, 160) / 2;
|
|
396
|
+
const c = (a + b) / 2;
|
|
397
|
+
out.push(P("metal", c - pw, c + pw, fz, hd - 8, top - 60, top - 46, { axis: "x", round: true }));
|
|
398
|
+
}
|
|
399
|
+
return out;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// src/mesh/t0-living.ts
|
|
403
|
+
function run(from, to, n, gap) {
|
|
404
|
+
const len = (to - from - (n - 1) * gap) / n;
|
|
405
|
+
return Array.from({ length: n }, (_, i) => [from + i * (len + gap), from + i * (len + gap) + len]);
|
|
406
|
+
}
|
|
407
|
+
var sofaArm = (W, D) => Math.min(clamp(W * 0.08, D * 0.12, D * 0.22), W * 0.25);
|
|
408
|
+
var PIANO_CASE = [
|
|
409
|
+
[0, 0],
|
|
410
|
+
[1, 0],
|
|
411
|
+
[1, 0.82],
|
|
412
|
+
[0.995, 0.88],
|
|
413
|
+
[0.975, 0.93],
|
|
414
|
+
[0.94, 0.97],
|
|
415
|
+
[0.89, 0.995],
|
|
416
|
+
[0.83, 1],
|
|
417
|
+
[0.76, 0.985],
|
|
418
|
+
[0.68, 0.92],
|
|
419
|
+
[0.58, 0.82],
|
|
420
|
+
[0.47, 0.72],
|
|
421
|
+
[0.36, 0.64],
|
|
422
|
+
[0.25, 0.58],
|
|
423
|
+
[0.15, 0.535],
|
|
424
|
+
[0.07, 0.49],
|
|
425
|
+
[0.025, 0.44],
|
|
426
|
+
[5e-3, 0.37],
|
|
427
|
+
[0, 0.3]
|
|
428
|
+
];
|
|
429
|
+
var caseFrom = (v0) => [
|
|
430
|
+
[0, 0],
|
|
431
|
+
[1, 0],
|
|
432
|
+
...PIANO_CASE.slice(2).map(([u, v]) => [u, (v - v0) / (1 - v0)])
|
|
433
|
+
];
|
|
434
|
+
var pull = (c, half, z0, z1, y) => P("metal", c - half, c + half, z0, z1, y - 6, y + 6, { axis: "x", round: true });
|
|
435
|
+
var T0_LIVING = {
|
|
436
|
+
nightstand: {
|
|
437
|
+
names: ["nightstand", "bedside_table"],
|
|
438
|
+
heightMm: 550,
|
|
439
|
+
materials: ["wood", "metal"],
|
|
440
|
+
gen(W, D) {
|
|
441
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
442
|
+
const leg = clamp(Math.min(W, D) * 0.07, 22, 40);
|
|
443
|
+
const legH = 130;
|
|
444
|
+
const fz = hd - 30;
|
|
445
|
+
const legs = [-hd + 10, fz - leg - 6].flatMap(
|
|
446
|
+
(z) => pair(P("wood", -hw + 10, -hw + 10 + leg, z, z + leg, 0, legH + 4, { radius: leg * 0.3 }))
|
|
447
|
+
);
|
|
448
|
+
const drawers = [
|
|
449
|
+
[legH + 6, 328],
|
|
450
|
+
[334, 519]
|
|
451
|
+
];
|
|
452
|
+
return [
|
|
453
|
+
...legs,
|
|
454
|
+
P("wood", -hw + 4, hw - 4, -hd, fz, legH, 525),
|
|
455
|
+
P("wood", -hw, hw, -hd, hd, 525, 550, { radius: clamp(Math.min(W, D) * 0.04, 4, 15) }),
|
|
456
|
+
...drawers.map(([a, b]) => P("wood", -hw + 8, hw - 8, fz, hd - 12, a, b, { radius: 3 })),
|
|
457
|
+
...drawers.map(
|
|
458
|
+
([a, b]) => P("metal", -11, 11, hd - 12, hd, (a + b) / 2 - 11, (a + b) / 2 + 11, { axis: "z", round: true })
|
|
459
|
+
)
|
|
460
|
+
];
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
// `seatBody(r, g, 1, r.w * 0.16)`: one cushion, broader arms.
|
|
464
|
+
armchair: {
|
|
465
|
+
names: ["armchair"],
|
|
466
|
+
heightMm: 800,
|
|
467
|
+
materials: ["wood_dark", "fabric", "cushion"],
|
|
468
|
+
gen: (W, D) => upholstered(W, D, Math.min(W * 0.16, W * 0.25), 1)
|
|
469
|
+
},
|
|
470
|
+
// `drawLoveseat`: the sofa with two cushions on any length.
|
|
471
|
+
loveseat: {
|
|
472
|
+
names: ["loveseat", "sofa_2"],
|
|
473
|
+
heightMm: 800,
|
|
474
|
+
materials: ["wood_dark", "fabric", "cushion"],
|
|
475
|
+
gen: (W, D) => upholstered(W, D, sofaArm(W, D), 2)
|
|
476
|
+
},
|
|
477
|
+
coffee_table: {
|
|
478
|
+
names: ["coffee_table"],
|
|
479
|
+
heightMm: 420,
|
|
480
|
+
materials: ["wood", "metal", "glass"],
|
|
481
|
+
gen(W, D) {
|
|
482
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
483
|
+
const s = Math.min(W, D);
|
|
484
|
+
const r = clamp(s * 0.04, 4, 30);
|
|
485
|
+
const inset = clamp(s * 0.1, 25, 120);
|
|
486
|
+
const leg = clamp(s * 0.05, 20, 40);
|
|
487
|
+
const legIn = clamp(s * 0.05, 15, 60);
|
|
488
|
+
const legs = [-hd + legIn, hd - legIn - leg].flatMap(
|
|
489
|
+
(z) => pair(P("metal", -hw + legIn, -hw + legIn + leg, z, z + leg, 0, 395, { radius: leg * 0.5 }))
|
|
490
|
+
);
|
|
491
|
+
const framed = hw - inset >= 10 && hd - inset >= 10;
|
|
492
|
+
const pane = { x0: -hw + inset, x1: hw - inset, z0: -hd + inset, z1: hd - inset, radius: Math.max(1, r * 0.6) };
|
|
493
|
+
return [
|
|
494
|
+
...legs,
|
|
495
|
+
P("wood", -hw + legIn, hw - legIn, -hd + legIn, hd - legIn, 110, 128, { radius: 6 }),
|
|
496
|
+
P("wood", -hw, hw, -hd, hd, 390, 420, { radius: r, ...framed ? { holes: [pane] } : {} }),
|
|
497
|
+
...framed ? [P("glass", pane.x0 + 2, pane.x1 - 2, pane.z0 + 2, pane.z1 - 2, 398, 414, { radius: 1 })] : []
|
|
498
|
+
];
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
tv_unit: {
|
|
502
|
+
names: ["tv_unit"],
|
|
503
|
+
heightMm: 1180,
|
|
504
|
+
materials: ["wood", "wood_dark", "metal", "screen"],
|
|
505
|
+
gen(W, D) {
|
|
506
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
507
|
+
const [legH, top, H] = [120, 500, 1180];
|
|
508
|
+
const leg = 30;
|
|
509
|
+
const legs = [-hd + 30, hd - 50 - leg].flatMap(
|
|
510
|
+
(z) => pair(P("metal", -hw + 40, -hw + 40 + leg, z, z + leg, 0, legH + 4, { round: true }))
|
|
511
|
+
);
|
|
512
|
+
const doors = span(clamp(Math.round(W / D), 2, 5), hw - 4, 4);
|
|
513
|
+
const pw = Math.min(W * 0.74, 1100);
|
|
514
|
+
const ph = pw * 0.5625;
|
|
515
|
+
const pz = -hd + 30;
|
|
516
|
+
return [
|
|
517
|
+
...legs,
|
|
518
|
+
P("wood_dark", -hw, hw, -hd, hd - 20, legH, top - 20),
|
|
519
|
+
P("wood_dark", -hw, hw, -hd, hd, top - 20, top, { radius: 8 }),
|
|
520
|
+
...doors.map(([a, b]) => P("wood", a, b, hd - 20, hd - 6, legH + 6, top - 26)),
|
|
521
|
+
...doors.map(([a, b]) => pull((a + b) / 2, Math.min((b - a) * 0.3, 90) / 2, hd - 6, hd, top - 64)),
|
|
522
|
+
P("metal", -Math.min(pw * 0.2, 160), Math.min(pw * 0.2, 160), pz - 20, pz + 120, top, top + 12, { radius: 6 }),
|
|
523
|
+
P("metal", -30, 30, pz + 40, pz + 70, top + 12, H - ph + 60),
|
|
524
|
+
P("screen", -pw / 2, pw / 2, pz, pz + 40, H - ph, H, { axis: "z", radius: 6 })
|
|
525
|
+
];
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
chair: {
|
|
529
|
+
names: ["chair"],
|
|
530
|
+
heightMm: 880,
|
|
531
|
+
materials: ["wood", "fabric"],
|
|
532
|
+
gen(W, D) {
|
|
533
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
534
|
+
const s = Math.min(W, D);
|
|
535
|
+
const leg = clamp(s * 0.07, 20, 38);
|
|
536
|
+
const seat = 450;
|
|
537
|
+
return [
|
|
538
|
+
// The back legs run up into the back posts; the backrest is the core's back bar.
|
|
539
|
+
...pair(P("wood", -hw, -hw + leg, -hd, -hd + leg, 0, 880, { radius: leg * 0.3 })),
|
|
540
|
+
...pair(P("wood", -hw + 4, -hw + 4 + leg, hd - leg, hd, 0, seat - 25, { radius: leg * 0.3 })),
|
|
541
|
+
...pair(P("wood", -hw + 4, -hw + 4 + leg * 0.6, -hd + leg, hd - leg, 150, 170, { axis: "z", round: true })),
|
|
542
|
+
P("wood", -hw, hw, -hd, hd, seat - 25, seat, { radius: clamp(s * 0.05, 5, 30) }),
|
|
543
|
+
P("fabric", -hw + 15, hw - 15, -hd + leg + 10, hd - 12, seat, seat + 35, { radius: clamp(s * 0.08, 5, 50) }),
|
|
544
|
+
P("wood", -hw + leg, hw - leg, -hd + 4, -hd + 4 + clamp(D * 0.05, 15, 25), 620, 860, {
|
|
545
|
+
axis: "z",
|
|
546
|
+
radius: 40
|
|
547
|
+
})
|
|
548
|
+
];
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
stool: {
|
|
552
|
+
names: ["stool", "barstool"],
|
|
553
|
+
heightMm: 650,
|
|
554
|
+
materials: ["wood", "cushion", "metal"],
|
|
555
|
+
gen(W, D) {
|
|
556
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
557
|
+
const r = clamp(Math.min(W, D) * 0.05, 12, 22);
|
|
558
|
+
const legs = [-1, 1].flatMap(
|
|
559
|
+
(sz) => pair(P("wood", -W * 0.32 - r, -W * 0.32 + r, sz * D * 0.32 - r, sz * D * 0.32 + r, 0, 600, { round: true }))
|
|
560
|
+
);
|
|
561
|
+
return [
|
|
562
|
+
...legs,
|
|
563
|
+
P("metal", -W * 0.36, W * 0.36, -D * 0.36, D * 0.36, 230, 245, {
|
|
564
|
+
round: true,
|
|
565
|
+
holes: [{ x0: -W * 0.31, x1: W * 0.31, z0: -D * 0.31, z1: D * 0.31, round: true }]
|
|
566
|
+
}),
|
|
567
|
+
P("wood", -hw, hw, -hd, hd, 600, 625, { round: true }),
|
|
568
|
+
P("cushion", -hw + 14, hw - 14, -hd + 14, hd - 14, 625, 650, { round: true })
|
|
569
|
+
];
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
bench: {
|
|
573
|
+
names: ["bench"],
|
|
574
|
+
heightMm: 450,
|
|
575
|
+
materials: ["wood", "wood_dark"],
|
|
576
|
+
gen(W, D) {
|
|
577
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
578
|
+
const inset = clamp(W * 0.06, 15, 120);
|
|
579
|
+
const t = clamp(W * 0.03, 18, 40);
|
|
580
|
+
return [
|
|
581
|
+
...pair(P("wood_dark", -hw + inset, -hw + inset + t, -hd + 20, hd - 20, 0, 410)),
|
|
582
|
+
P("wood_dark", -hw + inset + t, hw - inset - t, -15, 15, 250, 290),
|
|
583
|
+
P("wood", -hw, hw, -hd, hd, 410, 450, { radius: clamp(Math.min(W, D) * 0.04, 4, 20) })
|
|
584
|
+
];
|
|
585
|
+
}
|
|
586
|
+
},
|
|
587
|
+
desk: {
|
|
588
|
+
names: ["desk"],
|
|
589
|
+
heightMm: 1200,
|
|
590
|
+
materials: ["wood", "metal", "appliance", "screen"],
|
|
591
|
+
gen(W, D) {
|
|
592
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
593
|
+
const [top, H] = [750, 1200];
|
|
594
|
+
const panel = clamp(W * 0.025, 18, 30);
|
|
595
|
+
const zm = -hd + D * 0.12;
|
|
596
|
+
const mw = Math.min(560, W * 0.6);
|
|
597
|
+
const mz = -hd + D * 0.15;
|
|
598
|
+
return [
|
|
599
|
+
...pair(P("wood", -hw + 20, -hw + 20 + panel, -hd + 30, hd - 30, 0, top - 28)),
|
|
600
|
+
P("wood", -hw + 20 + panel, hw - 20 - panel, zm - 9, zm + 9, 380, top - 28),
|
|
601
|
+
P("wood", -hw, hw, -hd, hd, top - 28, top, { radius: clamp(Math.min(W, D) * 0.015, 3, 12) }),
|
|
602
|
+
P("metal", -Math.min(110, mw * 0.3), Math.min(110, mw * 0.3), mz - 60, mz + 70, top, top + 10, { radius: 20 }),
|
|
603
|
+
P("metal", -22, 22, mz - 14, mz + 4, top + 10, H - 270),
|
|
604
|
+
P("screen", -mw / 2, mw / 2, mz + 4, mz + 26, H - 330, H, { axis: "z", radius: 8 }),
|
|
605
|
+
P("appliance", -Math.min(220, W * 0.2), Math.min(220, W * 0.2), mz + 150, mz + 290, top, top + 14, {
|
|
606
|
+
radius: 6
|
|
607
|
+
})
|
|
608
|
+
];
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
office_chair: {
|
|
612
|
+
names: ["office_chair"],
|
|
613
|
+
heightMm: 1e3,
|
|
614
|
+
materials: ["fabric", "cushion", "metal", "rubber"],
|
|
615
|
+
gen(W, D) {
|
|
616
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
617
|
+
const s = Math.min(W, D);
|
|
618
|
+
const c = clamp(s * 0.05, 14, 30);
|
|
619
|
+
const base = 2 * c;
|
|
620
|
+
return [
|
|
621
|
+
P("metal", -hw, hw, -16, 16, base, base + 28, { axis: "x", radius: 10 }),
|
|
622
|
+
P("metal", -16, 16, -hd, hd, base, base + 28, { axis: "z", radius: 10 }),
|
|
623
|
+
...pair(P("rubber", -hw, -hw + 2 * c, -c, c, 0, base, { round: true })),
|
|
624
|
+
P("rubber", -c, c, -hd, -hd + 2 * c, 0, base, { round: true }),
|
|
625
|
+
P("rubber", -c, c, hd - 2 * c, hd, 0, base, { round: true }),
|
|
626
|
+
P("metal", -22, 22, -22, 22, base + 28, 420, { round: true }),
|
|
627
|
+
P("fabric", -hw * 0.86, hw * 0.86, -hd * 0.8, hd * 0.9, 420, 465, { radius: s * 0.12 }),
|
|
628
|
+
P("cushion", -hw * 0.8, hw * 0.8, -hd * 0.72, hd * 0.84, 465, 500, { radius: s * 0.1 }),
|
|
629
|
+
P("metal", -25, 25, -hd * 0.86, -hd * 0.86 + 22, 430, 640),
|
|
630
|
+
P("fabric", -hw * 0.78, hw * 0.78, -hd * 0.94, -hd * 0.94 + 60, 560, 1e3, {
|
|
631
|
+
axis: "z",
|
|
632
|
+
radius: Math.min(hw * 0.7, 120)
|
|
633
|
+
}),
|
|
634
|
+
...pair(P("metal", -hw * 0.9, -hw * 0.9 + 22, -12, 12, 470, 650)),
|
|
635
|
+
...pair(P("rubber", -hw * 0.94, -hw * 0.94 + 60, -hd * 0.45, hd * 0.3, 650, 675, { radius: 14 }))
|
|
636
|
+
];
|
|
637
|
+
}
|
|
638
|
+
},
|
|
639
|
+
bookshelf: {
|
|
640
|
+
names: ["bookshelf", "bookcase", "shelf"],
|
|
641
|
+
heightMm: 1800,
|
|
642
|
+
materials: ["wood", "wood_dark", "linen", "wool"],
|
|
643
|
+
gen(W, D) {
|
|
644
|
+
const [hw, hd, H] = [W / 2, D / 2, 1800];
|
|
645
|
+
const t = 18;
|
|
646
|
+
const plinth = 70;
|
|
647
|
+
const floor = plinth + t;
|
|
648
|
+
const c = (H - t - floor - 4 * t) / 5;
|
|
649
|
+
const base = (k) => floor + k * (c + t);
|
|
650
|
+
const g = clamp(Math.floor((W - 2 * t) / 160), 1, 3);
|
|
651
|
+
const bw = clamp((W - 2 * t) * 0.055, 22, 50);
|
|
652
|
+
const bz0 = -hd + 14;
|
|
653
|
+
const bz1 = hd - Math.min(40, D * 0.12);
|
|
654
|
+
const tall = [0.84, 0.92, 0.76];
|
|
655
|
+
const covers = ["wood_dark", "wool", "linen"];
|
|
656
|
+
const books = [];
|
|
657
|
+
for (const k of [1, 3]) {
|
|
658
|
+
for (let j = 0; j < g; j++) {
|
|
659
|
+
const x0 = -hw + t + 4 + j * (bw + 3);
|
|
660
|
+
const top = base(k) + c * tall[(j + k) % 3];
|
|
661
|
+
books.push(...pair(P(covers[(j + k) % 3] ?? "linen", x0, x0 + bw, bz0, bz1, base(k), top)));
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
const wide = Math.min((W - 2 * t) * 0.45, 260);
|
|
665
|
+
return [
|
|
666
|
+
...pair(P("wood", -hw, -hw + t, -hd, hd, 0, H)),
|
|
667
|
+
P("wood", -hw + t, hw - t, -hd, hd, H - t, H),
|
|
668
|
+
P("wood", -hw + t, hw - t, -hd, hd - 20, 0, floor),
|
|
669
|
+
P("wood_dark", -hw + t, hw - t, -hd, -hd + 8, floor, H - t),
|
|
670
|
+
...[1, 2, 3, 4].map((k) => P("wood", -hw + t, hw - t, -hd + 8, hd - 6, base(k) - t, base(k))),
|
|
671
|
+
...books,
|
|
672
|
+
P("wool", -wide / 2, wide / 2, bz0, bz1, base(2), base(2) + 38),
|
|
673
|
+
P("linen", -wide * 0.42, wide * 0.42, bz0 + 10, bz1 - 10, base(2) + 38, base(2) + 72)
|
|
674
|
+
];
|
|
675
|
+
}
|
|
676
|
+
},
|
|
677
|
+
sofa_l: {
|
|
678
|
+
names: ["sofa_l", "corner_sofa"],
|
|
679
|
+
heightMm: 800,
|
|
680
|
+
materials: ["wood_dark", "fabric", "cushion"],
|
|
681
|
+
handed: true,
|
|
682
|
+
gen(W, D) {
|
|
683
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
684
|
+
const R = Math.min(D * 0.56, W * 0.35);
|
|
685
|
+
const back = clamp(R * 0.2, 90, 200);
|
|
686
|
+
const arm = R * 0.18;
|
|
687
|
+
const [legH, seat] = [80, 280];
|
|
688
|
+
const L = (u, v) => [
|
|
689
|
+
[0, 0],
|
|
690
|
+
[1, 0],
|
|
691
|
+
[1, v],
|
|
692
|
+
[u, v],
|
|
693
|
+
[u, 1],
|
|
694
|
+
[0, 1]
|
|
695
|
+
];
|
|
696
|
+
const backCush = clamp((R - back) * 0.24, 70, 180);
|
|
697
|
+
const count = (len) => clamp(Math.round(len / (0.62 * R)), 1, 3);
|
|
698
|
+
const topRun = [-hw + R + 6, hw - arm - 6];
|
|
699
|
+
const retRun = [-hd + R + 6, hd - arm - 6];
|
|
700
|
+
const tops = topRun[1] - topRun[0] >= 20 ? run(topRun[0], topRun[1], count(topRun[1] - topRun[0]), 12) : [];
|
|
701
|
+
const rets = retRun[1] - retRun[0] >= 20 ? run(retRun[0], retRun[1], count(retRun[1] - retRun[0]), 12) : [];
|
|
702
|
+
const [s0, s1] = [-hd + back + 4, -hd + R - 4];
|
|
703
|
+
const [r0, r1] = [-hw + back + 4, -hw + R - 4];
|
|
704
|
+
const plinth = R > 80 && W > 120 && D > 120 ? [
|
|
705
|
+
P("wood_dark", -hw + 30, hw - 30, -hd + 30, hd - 30, 0, legH, {
|
|
706
|
+
profile: L((R - 60) / (W - 60), (R - 60) / (D - 60))
|
|
707
|
+
})
|
|
708
|
+
] : [];
|
|
709
|
+
return [
|
|
710
|
+
...plinth,
|
|
711
|
+
P("fabric", -hw, hw, -hd, hd, legH, seat, { profile: L(R / W, R / D) }),
|
|
712
|
+
P("fabric", -hw, hw - arm, -hd, -hd + back, legH, 800, { axis: "x", radius: Math.min(back * 0.45, 70) }),
|
|
713
|
+
P("fabric", -hw, -hw + back, -hd + back, hd - arm, legH, 800, { axis: "z", radius: Math.min(back * 0.45, 70) }),
|
|
714
|
+
P("fabric", hw - arm, hw, -hd, -hd + R, legH, 620, { axis: "z", radius: Math.min(arm * 0.45, 70) }),
|
|
715
|
+
P("fabric", -hw, -hw + R, hd - arm, hd, legH, 620, { axis: "x", radius: Math.min(arm * 0.45, 70) }),
|
|
716
|
+
// Seats: the square corner seat, the back run's, the return's.
|
|
717
|
+
P("cushion", r0, r1, s0, s1, seat, seat + 150, { radius: 50 }),
|
|
718
|
+
...tops.map(([a, b]) => P("cushion", a, b, s0, s1, seat, seat + 150, { axis: "x", radius: 50 })),
|
|
719
|
+
...rets.map(([a, b]) => P("cushion", r0, r1, a, b, seat, seat + 150, { axis: "z", radius: 50 })),
|
|
720
|
+
// Back cushions: the corner's pinwheel (along the back into the corner, then down the
|
|
721
|
+
// left below it), then one behind every run seat.
|
|
722
|
+
P("cushion", -hw + back, -hw + R, -hd + back, -hd + back + backCush, seat + 150, 760, {
|
|
723
|
+
axis: "x",
|
|
724
|
+
profile: BACK_CUSHION
|
|
725
|
+
}),
|
|
726
|
+
P("cushion", -hw + back, -hw + back + backCush, -hd + back + backCush, -hd + R, seat + 150, 760, {
|
|
727
|
+
axis: "z",
|
|
728
|
+
profile: BACK_CUSHION
|
|
729
|
+
}),
|
|
730
|
+
...tops.map(
|
|
731
|
+
([a, b]) => P("cushion", a, b, -hd + back, -hd + back + backCush, seat + 150, 760, { axis: "x", profile: BACK_CUSHION })
|
|
732
|
+
),
|
|
733
|
+
...rets.map(
|
|
734
|
+
([a, b]) => P("cushion", -hw + back, -hw + back + backCush, a, b, seat + 150, 760, { axis: "z", profile: BACK_CUSHION })
|
|
735
|
+
)
|
|
736
|
+
];
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
chaise: {
|
|
740
|
+
names: ["chaise"],
|
|
741
|
+
heightMm: 800,
|
|
742
|
+
materials: ["wood_dark", "fabric", "cushion"],
|
|
743
|
+
handed: true,
|
|
744
|
+
gen(W, D) {
|
|
745
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
746
|
+
const arm = sofaArm(W, D);
|
|
747
|
+
const back = clamp(D * 0.18, 110, 220);
|
|
748
|
+
const [legH, seat] = [80, 280];
|
|
749
|
+
const leg = 40;
|
|
750
|
+
const backCush = clamp((D - back) * 0.24, 90, 200);
|
|
751
|
+
const rowX = -hw + arm + 6;
|
|
752
|
+
const rowEnd = hw - Math.min(W, D) * 0.045;
|
|
753
|
+
const n = clamp(Math.round((rowEnd - rowX) / (0.62 * D)), 1, 4);
|
|
754
|
+
const legs = [-hd + 30, hd - 30 - leg].flatMap(
|
|
755
|
+
(z) => pair(P("wood_dark", -hw + 30, -hw + 30 + leg, z, z + leg, 0, legH))
|
|
756
|
+
);
|
|
757
|
+
return [
|
|
758
|
+
...legs,
|
|
759
|
+
P("fabric", -hw + arm, hw, -hd, hd - 10, legH, seat, { radius: 30 }),
|
|
760
|
+
P("fabric", -hw, -hw + arm, -hd, hd, legH, 620, { axis: "z", radius: Math.min(arm * 0.45, 70) }),
|
|
761
|
+
P("fabric", -hw + arm, hw, -hd, -hd + back, legH, 800, { axis: "x", radius: Math.min(back * 0.45, 70) }),
|
|
762
|
+
P("cushion", rowX, rowEnd, -hd + back + 4, hd - 4, seat, seat + 150, { radius: 60 }),
|
|
763
|
+
...run(rowX, rowEnd, n, 12).map(
|
|
764
|
+
([a, b]) => P("cushion", a, b, -hd + back, -hd + back + backCush, seat + 150, 760, { axis: "x", profile: BACK_CUSHION })
|
|
765
|
+
)
|
|
766
|
+
];
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
piano: {
|
|
770
|
+
names: ["piano", "grand_piano"],
|
|
771
|
+
heightMm: 1250,
|
|
772
|
+
materials: ["wood_dark", "linen", "metal", "rubber"],
|
|
773
|
+
handed: true,
|
|
774
|
+
gen(W, D) {
|
|
775
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
776
|
+
const bench = D >= W * 1.3;
|
|
777
|
+
const z0 = bench ? -hd + W * 0.3 : -hd;
|
|
778
|
+
const L = hd - z0;
|
|
779
|
+
const kb = 0.13;
|
|
780
|
+
const kz1 = z0 + L * kb;
|
|
781
|
+
const at = (u, v) => [-hw + u * W, z0 + v * L];
|
|
782
|
+
const leg = (u, v) => {
|
|
783
|
+
const [x, z] = at(u, v);
|
|
784
|
+
return P("wood_dark", x - 32, x + 32, z - 32, z + 32, 0, 620, { round: true });
|
|
785
|
+
};
|
|
786
|
+
const cheek = W * 0.06;
|
|
787
|
+
const [mx, mz] = [Math.min(hw * 0.55, 360), kz1 + Math.min(L * 0.06, 90)];
|
|
788
|
+
return [
|
|
789
|
+
leg(0.09, kb + 0.06),
|
|
790
|
+
leg(0.9, kb + 0.06),
|
|
791
|
+
leg(0.85, 0.9),
|
|
792
|
+
// The case: its bottom board under the keys, the rim round the strings, the lid closed.
|
|
793
|
+
P("wood_dark", -hw, hw, z0, hd, 600, 700, { profile: PIANO_CASE }),
|
|
794
|
+
P("wood_dark", -hw, hw, kz1, hd, 700, 985, { profile: caseFrom(kb) }),
|
|
795
|
+
P("wood_dark", -hw + 6, hw - 6, kz1 + 6, hd - 6, 985, 1e3, { profile: caseFrom(kb) }),
|
|
796
|
+
// The keyboard between its cheek blocks, the key slip's felt and the open fall board.
|
|
797
|
+
...pair(P("wood_dark", -hw, -hw + cheek, z0, kz1, 700, 780)),
|
|
798
|
+
P("linen", -hw + cheek, hw - cheek, z0 + 12, kz1 - 24, 700, 722),
|
|
799
|
+
P("rubber", -hw + cheek, hw - cheek, z0, z0 + 12, 690, 716),
|
|
800
|
+
P("wood_dark", -hw + cheek, hw - cheek, kz1 - 24, kz1, 700, 840),
|
|
801
|
+
// The music desk, leaning back over the lid; the lyre and its pedals under the keys.
|
|
802
|
+
P("wood_dark", -mx, mx, mz, mz + 90, 1e3, 1250, {
|
|
803
|
+
axis: "x",
|
|
804
|
+
profile: [
|
|
805
|
+
[0, 0],
|
|
806
|
+
[0.2, 0],
|
|
807
|
+
[1, 1],
|
|
808
|
+
[0.8, 1]
|
|
809
|
+
]
|
|
810
|
+
}),
|
|
811
|
+
P("wood_dark", -45, 45, z0 + L * 0.06, z0 + L * 0.06 + 40, 60, 600),
|
|
812
|
+
P("metal", -70, 70, z0 + L * 0.02, z0 + L * 0.06 + 40, 40, 60),
|
|
813
|
+
...bench ? [
|
|
814
|
+
...pair(P("wood_dark", -W * 0.25, -W * 0.25 + 40, -hd, -hd + W * 0.2, 0, 470)),
|
|
815
|
+
P("rubber", -W * 0.25, W * 0.25, -hd, -hd + W * 0.2, 470, 520, { radius: 10 })
|
|
816
|
+
] : []
|
|
817
|
+
];
|
|
818
|
+
}
|
|
819
|
+
},
|
|
820
|
+
bunk_bed: {
|
|
821
|
+
names: ["bunk_bed"],
|
|
822
|
+
heightMm: 1700,
|
|
823
|
+
materials: ["wood", "linen", "wool"],
|
|
824
|
+
gen(W, D) {
|
|
825
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
826
|
+
const post = clamp(Math.min(W, D) * 0.05, 40, 60);
|
|
827
|
+
const rail = post * 0.6;
|
|
828
|
+
const pd = clamp(D * 0.15, 100, 300);
|
|
829
|
+
const deck = (y) => [
|
|
830
|
+
P("wood", -hw, hw, -hd, hd, y, y + 100),
|
|
831
|
+
P("linen", -hw + rail, hw - rail, -hd + post, hd - post, y + 100, y + 250, { radius: 40 }),
|
|
832
|
+
P("linen", -hw + rail + 60, hw - rail - 60, -hd + post + 30, -hd + post + 30 + pd, y + 250, y + 350, {
|
|
833
|
+
axis: "x",
|
|
834
|
+
radius: 50
|
|
835
|
+
}),
|
|
836
|
+
P("wool", -hw + rail - 6, hw - rail + 6, -hd + post + pd + 80, hd - post, y + 160, y + 280, {
|
|
837
|
+
axis: "x",
|
|
838
|
+
radius: 40
|
|
839
|
+
})
|
|
840
|
+
];
|
|
841
|
+
const lw = Math.min(200, hw * 0.5);
|
|
842
|
+
return [
|
|
843
|
+
...[-hd, hd - post].flatMap((z) => pair(P("wood", -hw, -hw + post, z, z + post, 0, 1700, { radius: 6 }))),
|
|
844
|
+
...deck(220),
|
|
845
|
+
...deck(1150),
|
|
846
|
+
P("wood", -hw + post, hw - post, -hd + post * 0.2, -hd + post * 0.7, 220, 1650),
|
|
847
|
+
P("wood", -hw + post, hw - post, hd - post * 0.7, hd - post * 0.2, 220, 600),
|
|
848
|
+
...pair(P("wood", -hw, -hw + rail, -hd + post, hd - post, 1540, 1600, { axis: "z", radius: 12 })),
|
|
849
|
+
P("wood", -hw + post, hw - post, hd - rail, hd, 1540, 1600, { axis: "x", radius: 12 }),
|
|
850
|
+
...pair(P("wood", -lw - 36, -lw, hd - 34, hd, 320, 1600, { radius: 6 })),
|
|
851
|
+
...[560, 800, 1040].map((y) => P("wood", -lw, lw, hd - 30, hd - 6, y, y + 30, { axis: "x", round: true }))
|
|
852
|
+
];
|
|
853
|
+
}
|
|
854
|
+
},
|
|
855
|
+
crib: {
|
|
856
|
+
names: ["crib", "cot"],
|
|
857
|
+
heightMm: 900,
|
|
858
|
+
materials: ["wood", "linen", "wool"],
|
|
859
|
+
gen(W, D) {
|
|
860
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
861
|
+
const post = clamp(Math.min(W, D) * 0.05, 30, 45);
|
|
862
|
+
const deep = D >= W;
|
|
863
|
+
const long = (deep ? D : W) - 2 * post;
|
|
864
|
+
const n = clamp(Math.round(long / 150), 3, 6);
|
|
865
|
+
const bars = span(n, long / 2 - 30, 0).map(([a, b]) => (a + b) / 2);
|
|
866
|
+
const end = post * 0.6;
|
|
867
|
+
const sides = deep ? [
|
|
868
|
+
P("wood", -hw + post, hw - post, -hd, -hd + end, 290, 860),
|
|
869
|
+
P("wood", -hw + post, hw - post, hd - end, hd, 290, 860),
|
|
870
|
+
...pair(P("wood", -hw, -hw + post * 0.7, -hd + post, hd - post, 840, 880, { axis: "z", radius: 10 })),
|
|
871
|
+
...bars.flatMap((z) => pair(P("wood", -hw + 6, -hw + 26, z - 10, z + 10, 290, 840, { round: true })))
|
|
872
|
+
] : [
|
|
873
|
+
...pair(P("wood", -hw, -hw + end, -hd + post, hd - post, 290, 860)),
|
|
874
|
+
P("wood", -hw + post, hw - post, -hd, -hd + post * 0.7, 840, 880, { axis: "x", radius: 10 }),
|
|
875
|
+
P("wood", -hw + post, hw - post, hd - post * 0.7, hd, 840, 880, { axis: "x", radius: 10 }),
|
|
876
|
+
...bars.flatMap((x) => [
|
|
877
|
+
P("wood", x - 10, x + 10, -hd + 6, -hd + 26, 290, 840, { round: true }),
|
|
878
|
+
P("wood", x - 10, x + 10, hd - 26, hd - 6, 290, 840, { round: true })
|
|
879
|
+
])
|
|
880
|
+
];
|
|
881
|
+
return [
|
|
882
|
+
...[-hd, hd - post].flatMap((z) => pair(P("wood", -hw, -hw + post, z, z + post, 0, 900, { radius: 6 }))),
|
|
883
|
+
P("wood", -hw, hw, -hd, hd, 240, 290),
|
|
884
|
+
P("linen", -hw + post, hw - post, -hd + post, hd - post, 290, 400, { radius: 30 }),
|
|
885
|
+
P("wool", -hw + post - 4, hw - post + 4, -hd + D * 0.38, hd - post, 330, 420, { axis: "x", radius: 30 }),
|
|
886
|
+
...sides
|
|
887
|
+
];
|
|
888
|
+
}
|
|
889
|
+
},
|
|
890
|
+
dresser: {
|
|
891
|
+
names: ["dresser", "chest_of_drawers"],
|
|
892
|
+
heightMm: 900,
|
|
893
|
+
materials: ["wood", "wood_dark", "metal"],
|
|
894
|
+
gen(W, D) {
|
|
895
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
896
|
+
const cols = span(W >= 1e3 ? 2 : 1, hw - 4, 4);
|
|
897
|
+
const rows = run(86, 874, 4, 4);
|
|
898
|
+
return [
|
|
899
|
+
P("wood_dark", -hw + 20, hw - 20, -hd, hd - 40, 0, 80),
|
|
900
|
+
P("wood", -hw, hw, -hd, hd - 18, 80, 880),
|
|
901
|
+
P("wood", -hw, hw, -hd, hd, 880, 900, { radius: 6 }),
|
|
902
|
+
...cols.flatMap(([a, b]) => rows.map(([y0, y1]) => P("wood", a, b, hd - 18, hd - 6, y0, y1, { radius: 3 }))),
|
|
903
|
+
...cols.flatMap(
|
|
904
|
+
([a, b]) => rows.map(([y0, y1]) => pull((a + b) / 2, Math.min((b - a) * 0.18, 80), hd - 6, hd, (y0 + y1) / 2))
|
|
905
|
+
)
|
|
906
|
+
];
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
vanity: {
|
|
910
|
+
names: ["vanity", "dressing_table"],
|
|
911
|
+
heightMm: 1450,
|
|
912
|
+
materials: ["wood", "cushion", "metal", "glass"],
|
|
913
|
+
gen(W, D) {
|
|
914
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
915
|
+
const top = 760;
|
|
916
|
+
const p = Math.min(clamp(W * 0.25, 150, 400), W * 0.3);
|
|
917
|
+
const rows = run(30, top - 31, 2, 6);
|
|
918
|
+
const r = Math.min(hw - p - 20, 200, D * 0.35);
|
|
919
|
+
const mw = Math.min(W * 0.28, 330);
|
|
920
|
+
return [
|
|
921
|
+
...pair(P("wood", -hw, -hw + p, -hd, hd - 18, 0, top - 25)),
|
|
922
|
+
...rows.flatMap(([y0, y1]) => pair(P("wood", -hw + 4, -hw + p - 4, hd - 18, hd - 6, y0, y1, { radius: 3 }))),
|
|
923
|
+
...rows.flatMap(([y0, y1]) => pair(pull(-hw + p / 2, Math.min(p * 0.2, 60), hd - 6, hd, (y0 + y1) / 2))),
|
|
924
|
+
P("wood", -hw, hw, -hd, hd, top - 25, top, { radius: 6 }),
|
|
925
|
+
P("metal", -mw, mw, -hd, -hd + 12, top, 1450, { axis: "z", radius: mw }),
|
|
926
|
+
P("glass", -mw + 12, mw - 12, -hd + 12, -hd + 18, top + 12, 1438, { axis: "z", radius: Math.max(1, mw - 12) }),
|
|
927
|
+
P("cushion", -r, r, hd - 2 * r, hd, 420, 460, { round: true }),
|
|
928
|
+
P("metal", -18, 18, hd - r - 18, hd - r + 18, 0, 420, { round: true })
|
|
929
|
+
];
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
fireplace: {
|
|
933
|
+
names: ["fireplace"],
|
|
934
|
+
heightMm: 1200,
|
|
935
|
+
materials: ["wood", "stone", "metal", "rubber", "bark"],
|
|
936
|
+
gen(W, D) {
|
|
937
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
938
|
+
const zb = -hd + D * 0.62;
|
|
939
|
+
const fw = Math.min(W * 0.5, 900) / 2;
|
|
940
|
+
const fh = 620;
|
|
941
|
+
const zr = zb - D * 0.62 * 0.55;
|
|
942
|
+
const zl = (zr + zb) / 2;
|
|
943
|
+
return [
|
|
944
|
+
P("stone", -hw + W * 0.08, hw - W * 0.08, -hd, hd, 0, 50),
|
|
945
|
+
...pair(P("stone", -hw, -fw, -hd, zb, 0, 1140)),
|
|
946
|
+
P("stone", -fw, fw, -hd, zb, 50 + fh, 1140),
|
|
947
|
+
P("rubber", -fw, fw, -hd, zr, 50, 50 + fh),
|
|
948
|
+
P("metal", -fw * 0.7, fw * 0.7, zr + 10, zb - 20, 50, 100),
|
|
949
|
+
P("bark", -fw * 0.56, fw * 0.56, zl - 40, zl + 20, 100, 160, { axis: "x", round: true }),
|
|
950
|
+
P("bark", -fw * 0.46, fw * 0.46, zl - 10, zl + 50, 150, 205, { axis: "x", round: true }),
|
|
951
|
+
P("wood", -hw, hw, -hd, zb + clamp(D * 0.08, 20, 60), 1140, 1200, { radius: 6 })
|
|
952
|
+
];
|
|
953
|
+
}
|
|
954
|
+
},
|
|
955
|
+
radiator: {
|
|
956
|
+
names: ["radiator"],
|
|
957
|
+
heightMm: 600,
|
|
958
|
+
materials: ["metal"],
|
|
959
|
+
gen(W, D) {
|
|
960
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
961
|
+
const [y0, y1] = [150, 600];
|
|
962
|
+
const n = clamp(Math.round(W / 70), 3, 16);
|
|
963
|
+
const cols = span(n, hw, Math.max(4, W / n * 0.3));
|
|
964
|
+
const pz = Math.min(15, hd * 0.6);
|
|
965
|
+
return [
|
|
966
|
+
...cols.map(([a, b]) => P("metal", a, b, -hd, hd, y0, y1, { radius: Math.min((b - a) * 0.45, D * 0.4, 20) })),
|
|
967
|
+
P("metal", -hw, hw, -D * 0.15, D * 0.15, y0 + 20, y0 + 50, { axis: "x", round: true }),
|
|
968
|
+
P("metal", -hw, hw, -D * 0.15, D * 0.15, y1 - 50, y1 - 20, { axis: "x", round: true }),
|
|
969
|
+
...pair(P("metal", -hw + 8, -hw + 30, -pz, pz, 0, y0 + 30, { round: true })),
|
|
970
|
+
...pair(P("metal", -hw + 2, -hw + 36, -pz - 6, pz + 6, 80, 125, { round: true }))
|
|
971
|
+
];
|
|
972
|
+
}
|
|
973
|
+
},
|
|
974
|
+
sideboard: {
|
|
975
|
+
names: ["sideboard", "buffet"],
|
|
976
|
+
heightMm: 800,
|
|
977
|
+
materials: ["wood", "wood_dark", "metal"],
|
|
978
|
+
gen(W, D) {
|
|
979
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
980
|
+
const leg = clamp(Math.min(W, D) * 0.06, 25, 40);
|
|
981
|
+
const legs = [-hd + 30, hd - 50 - leg].flatMap(
|
|
982
|
+
(z) => pair(P("wood_dark", -hw + 30, -hw + 30 + leg, z, z + leg, 0, 164, { radius: leg * 0.3 }))
|
|
983
|
+
);
|
|
984
|
+
const doors = span(clamp(Math.round(W / 450), 2, 4), hw - 4, 4);
|
|
985
|
+
return [
|
|
986
|
+
...legs,
|
|
987
|
+
P("wood", -hw, hw, -hd, hd - 18, 160, 780),
|
|
988
|
+
P("wood", -hw, hw, -hd, hd, 780, 800, { radius: 6 }),
|
|
989
|
+
...doors.map(([a, b]) => P("wood_dark", a, b, hd - 18, hd - 6, 166, 774, { radius: 3 })),
|
|
990
|
+
...doors.map(([a, b]) => {
|
|
991
|
+
const c = (a + b) / 2;
|
|
992
|
+
return P("metal", c - 6, c + 6, hd - 6, hd, 470 - 90, 470 + 90, { radius: 3 });
|
|
993
|
+
})
|
|
994
|
+
];
|
|
995
|
+
}
|
|
996
|
+
},
|
|
997
|
+
tv: {
|
|
998
|
+
names: ["tv"],
|
|
999
|
+
heightMm: 1700,
|
|
1000
|
+
hungFromTop: true,
|
|
1001
|
+
materials: ["metal", "screen", "rubber"],
|
|
1002
|
+
gen(W, D) {
|
|
1003
|
+
const [hw, hd, H] = [W / 2, D / 2, 1700];
|
|
1004
|
+
const slab = Math.min(D * 0.55, W * 0.06);
|
|
1005
|
+
const ph = clamp(W * 0.5625, 120, 760);
|
|
1006
|
+
const yc = H - ph / 2;
|
|
1007
|
+
const bh = Math.min(ph * 0.3, 150);
|
|
1008
|
+
return [
|
|
1009
|
+
P("metal", -W * 0.15, W * 0.15, -hd, hd - slab, yc - bh, yc + bh),
|
|
1010
|
+
P("rubber", -hw, hw, hd - slab, hd - 4, H - ph, H, { axis: "z", radius: 6 }),
|
|
1011
|
+
P("screen", -hw + 8, hw - 8, hd - 4, hd, H - ph + 8, H - 8, { axis: "z", radius: 3 })
|
|
1012
|
+
];
|
|
1013
|
+
}
|
|
1014
|
+
},
|
|
1015
|
+
coat_rack: {
|
|
1016
|
+
names: ["coat_rack"],
|
|
1017
|
+
heightMm: 1800,
|
|
1018
|
+
materials: ["wood", "wood_dark", "metal"],
|
|
1019
|
+
gen(W, D) {
|
|
1020
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1021
|
+
const s = Math.min(W, D);
|
|
1022
|
+
const r = clamp(s * 0.045, 12, 22);
|
|
1023
|
+
const b = s * 0.22;
|
|
1024
|
+
return [
|
|
1025
|
+
P("wood_dark", -b, b, -b, b, 0, 25, { round: true }),
|
|
1026
|
+
P("wood", -r, r, -r, r, 25, 1760, { round: true }),
|
|
1027
|
+
P("wood", -r * 1.6, r * 1.6, -r * 1.6, r * 1.6, 1760, 1800, { round: true }),
|
|
1028
|
+
P("metal", -hw, hw, -7, 7, 1640, 1654, { axis: "x", round: true }),
|
|
1029
|
+
P("metal", -7, 7, -hd, hd, 1600, 1614, { axis: "z", round: true }),
|
|
1030
|
+
...pair(P("wood_dark", -hw, -hw + 24, -12, 12, 1650, 1674, { round: true })),
|
|
1031
|
+
P("wood_dark", -12, 12, -hd, -hd + 24, 1610, 1634, { round: true }),
|
|
1032
|
+
P("wood_dark", -12, 12, hd - 24, hd, 1610, 1634, { round: true })
|
|
1033
|
+
];
|
|
1034
|
+
}
|
|
1035
|
+
},
|
|
1036
|
+
shoe_cabinet: {
|
|
1037
|
+
names: ["shoe_cabinet"],
|
|
1038
|
+
heightMm: 1e3,
|
|
1039
|
+
materials: ["wood", "wood_dark", "metal"],
|
|
1040
|
+
gen(W, D) {
|
|
1041
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1042
|
+
const cols = span(clamp(Math.round(W / 600), 1, 5), hw - 4, 4);
|
|
1043
|
+
const rows = run(66, 974, 2, 4);
|
|
1044
|
+
return [
|
|
1045
|
+
P("wood_dark", -hw + 15, hw - 15, -hd, hd - 30, 0, 60),
|
|
1046
|
+
P("wood", -hw, hw, -hd, hd - 18, 60, 980),
|
|
1047
|
+
P("wood", -hw, hw, -hd, hd, 980, 1e3, { radius: 4 }),
|
|
1048
|
+
...cols.flatMap(([a, b]) => rows.map(([y0, y1]) => P("wood", a, b, hd - 18, hd - 6, y0, y1, { radius: 3 }))),
|
|
1049
|
+
...cols.flatMap(([a, b]) => rows.map(([, y1]) => pull((a + b) / 2, (b - a) * 0.38, hd - 6, hd, y1 - 34)))
|
|
1050
|
+
];
|
|
1051
|
+
}
|
|
1052
|
+
},
|
|
1053
|
+
mirror: {
|
|
1054
|
+
names: ["mirror"],
|
|
1055
|
+
heightMm: 1900,
|
|
1056
|
+
mountMm: 1100,
|
|
1057
|
+
materials: ["metal", "glass"],
|
|
1058
|
+
gen(W, D) {
|
|
1059
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1060
|
+
const rad = clamp(W * 0.04, 6, 60);
|
|
1061
|
+
const e = clamp(W * 0.015, 4, 20);
|
|
1062
|
+
const zg = -hd + D * 0.4;
|
|
1063
|
+
return [
|
|
1064
|
+
P("metal", -hw, hw, -hd, zg, 1100, 1900, { axis: "z", radius: rad }),
|
|
1065
|
+
P("glass", -hw + e, hw - e, zg, hd, 1100 + e, 1900 - e, { axis: "z", radius: Math.max(1, rad - e) })
|
|
1066
|
+
];
|
|
1067
|
+
}
|
|
1068
|
+
},
|
|
1069
|
+
floor_lamp: {
|
|
1070
|
+
names: ["floor_lamp"],
|
|
1071
|
+
heightMm: 1650,
|
|
1072
|
+
materials: ["fabric", "metal"],
|
|
1073
|
+
gen(W, D) {
|
|
1074
|
+
const [rx, rz] = [W / 2, D / 2];
|
|
1075
|
+
const p = clamp(Math.min(W, D) * 0.025, 6, 14);
|
|
1076
|
+
const top = { x0: -rx * 0.92, x1: rx * 0.92, z0: -rz * 0.92, z1: rz * 0.92, round: true };
|
|
1077
|
+
return [
|
|
1078
|
+
P("metal", -rx * 0.62, rx * 0.62, -rz * 0.62, rz * 0.62, 0, 22, { round: true }),
|
|
1079
|
+
P("metal", -p, p, -p, p, 22, 1600, { round: true }),
|
|
1080
|
+
P("fabric", -rx, rx, -rz, rz, 1330, 1650, { round: true, holes: [top] }),
|
|
1081
|
+
P("metal", -rx * 0.92, rx * 0.92, -4, 4, 1612, 1620, { axis: "x", round: true }),
|
|
1082
|
+
P("metal", -4, 4, -rz * 0.92, rz * 0.92, 1612, 1620, { axis: "z", round: true }),
|
|
1083
|
+
P("metal", -rx * 0.13, rx * 0.13, -rz * 0.13, rz * 0.13, 1606, 1630, { round: true })
|
|
1084
|
+
];
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
side_table: {
|
|
1088
|
+
names: ["side_table", "end_table"],
|
|
1089
|
+
heightMm: 550,
|
|
1090
|
+
materials: ["wood"],
|
|
1091
|
+
gen(W, D) {
|
|
1092
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1093
|
+
const s = Math.min(W, D);
|
|
1094
|
+
const leg = clamp(s * 0.06, 15, 40);
|
|
1095
|
+
const li = s * 0.06;
|
|
1096
|
+
return [
|
|
1097
|
+
...[-hd + li, hd - li - leg].flatMap(
|
|
1098
|
+
(z) => pair(P("wood", -hw + li, -hw + li + leg, z, z + leg, 0, 525, { radius: leg * 0.3 }))
|
|
1099
|
+
),
|
|
1100
|
+
P("wood", -hw + li + 4, hw - li - 4, -hd + li + 4, hd - li - 4, 150, 170, { radius: s * 0.03 }),
|
|
1101
|
+
P("wood", -hw, hw, -hd, hd, 525, 550, { radius: s * 0.08 })
|
|
1102
|
+
];
|
|
1103
|
+
}
|
|
1104
|
+
},
|
|
1105
|
+
console_table: {
|
|
1106
|
+
names: ["console_table"],
|
|
1107
|
+
heightMm: 800,
|
|
1108
|
+
materials: ["wood", "wood_dark"],
|
|
1109
|
+
gen(W, D) {
|
|
1110
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1111
|
+
const s = Math.min(W, D);
|
|
1112
|
+
const leg = clamp(s * 0.08, 15, 40);
|
|
1113
|
+
const li = s * 0.04;
|
|
1114
|
+
return [
|
|
1115
|
+
...[-hd + li, hd - li - leg].flatMap(
|
|
1116
|
+
(z) => pair(P("wood_dark", -hw + li, -hw + li + leg, z, z + leg, 0, 775, { radius: leg * 0.3 }))
|
|
1117
|
+
),
|
|
1118
|
+
P("wood_dark", -hw + li + leg, hw - li - leg, -hd + li, -hd + li + 20, 680, 775),
|
|
1119
|
+
P("wood", -hw + W * 0.12, hw - W * 0.12, -hd + D * 0.36, -hd + D * 0.78, 160, 180, { radius: 6 }),
|
|
1120
|
+
P("wood_dark", -hw + li + leg, hw - li - leg, -6, 6, 150, 160),
|
|
1121
|
+
P("wood", -hw, hw, -hd, hd, 775, 800, { radius: s * 0.04 })
|
|
1122
|
+
];
|
|
1123
|
+
}
|
|
1124
|
+
},
|
|
1125
|
+
ottoman: {
|
|
1126
|
+
names: ["ottoman", "pouf", "footstool"],
|
|
1127
|
+
heightMm: 450,
|
|
1128
|
+
materials: ["fabric", "cushion"],
|
|
1129
|
+
gen(W, D) {
|
|
1130
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1131
|
+
const s = Math.min(W, D);
|
|
1132
|
+
const t = s * 0.09;
|
|
1133
|
+
const [tw, td] = [W - 2 * t, D - 2 * t];
|
|
1134
|
+
const nx = clamp(Math.round(2 * W / s), 2, 6);
|
|
1135
|
+
const nz = clamp(Math.round(2 * D / s), 2, 6);
|
|
1136
|
+
const b = clamp(s * 0.025, 4, 14);
|
|
1137
|
+
const buttons = [];
|
|
1138
|
+
for (let i = 0; i < nx; i++) {
|
|
1139
|
+
for (let j = 0; j < nz; j++) {
|
|
1140
|
+
const ox = tw * 0.8 * (2 * i + 1 - nx) / (2 * nx);
|
|
1141
|
+
const oz = td * 0.8 * (2 * j + 1 - nz) / (2 * nz);
|
|
1142
|
+
buttons.push(P("fabric", ox - b, ox + b, oz - b, oz + b, 430, 450, { round: true }));
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
return [
|
|
1146
|
+
P("fabric", -hw + 20, hw - 20, -hd + 20, hd - 20, 0, 40, { radius: Math.max(1, s * 0.16 - 20) }),
|
|
1147
|
+
P("fabric", -hw, hw, -hd, hd, 40, 400, { radius: s * 0.16 }),
|
|
1148
|
+
P("cushion", -hw + t * 0.5, hw - t * 0.5, -hd + t * 0.5, hd - t * 0.5, 400, 440, { radius: s * 0.12 }),
|
|
1149
|
+
...buttons
|
|
1150
|
+
];
|
|
1151
|
+
}
|
|
1152
|
+
},
|
|
1153
|
+
bean_bag: {
|
|
1154
|
+
names: ["bean_bag"],
|
|
1155
|
+
heightMm: 750,
|
|
1156
|
+
materials: ["fabric", "cushion"],
|
|
1157
|
+
gen(W, D) {
|
|
1158
|
+
const [rx, rz] = [W / 2, D / 2];
|
|
1159
|
+
const zb = -rz + D * 0.28;
|
|
1160
|
+
const zs = -rz + D * 0.6;
|
|
1161
|
+
return [
|
|
1162
|
+
...dome("fabric", 0, 0, rx, rz, 0, 400, MOUND),
|
|
1163
|
+
...dome("fabric", 0, zb, rx * 0.76, D * 0.24, 280, 750, HEMI),
|
|
1164
|
+
P("cushion", -rx * 0.42, rx * 0.42, zs - D * 0.15, zs + D * 0.15, 372, 410, { round: true })
|
|
1165
|
+
];
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
};
|
|
1169
|
+
|
|
1170
|
+
// src/mesh/t0-office.ts
|
|
1171
|
+
var SHELL = [
|
|
1172
|
+
[0, 0],
|
|
1173
|
+
[1, 0],
|
|
1174
|
+
[1, 7 / 64],
|
|
1175
|
+
[9 / 64, 7 / 64],
|
|
1176
|
+
[9 / 64, 1],
|
|
1177
|
+
[0, 1]
|
|
1178
|
+
];
|
|
1179
|
+
var SLED = [
|
|
1180
|
+
[0, 0],
|
|
1181
|
+
[4 / 64, 0],
|
|
1182
|
+
[4 / 64, 56 / 64],
|
|
1183
|
+
[60 / 64, 56 / 64],
|
|
1184
|
+
[60 / 64, 0],
|
|
1185
|
+
[1, 0],
|
|
1186
|
+
[1, 1],
|
|
1187
|
+
[0, 1]
|
|
1188
|
+
];
|
|
1189
|
+
var RECEPTION_L = [
|
|
1190
|
+
[0, 0],
|
|
1191
|
+
[1, 0],
|
|
1192
|
+
[1, 0.42],
|
|
1193
|
+
[0.3, 0.42],
|
|
1194
|
+
[0.3, 1],
|
|
1195
|
+
[0, 1]
|
|
1196
|
+
];
|
|
1197
|
+
function stack(n, y0, y1, gap) {
|
|
1198
|
+
const h = (y1 - y0 - (n - 1) * gap) / n;
|
|
1199
|
+
return Array.from({ length: n }, (_, i) => [y0 + i * (h + gap), y0 + i * (h + gap) + h]);
|
|
1200
|
+
}
|
|
1201
|
+
var T0_OFFICE = {
|
|
1202
|
+
meeting_table: {
|
|
1203
|
+
names: ["meeting_table"],
|
|
1204
|
+
heightMm: 820,
|
|
1205
|
+
materials: ["wood", "fabric", "metal"],
|
|
1206
|
+
gen(W, D) {
|
|
1207
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1208
|
+
const s = Math.min(W, D);
|
|
1209
|
+
const band = snap64(s * 0.22);
|
|
1210
|
+
const [tx, tz] = [hw - band, hd - band];
|
|
1211
|
+
const horizontal = W >= D;
|
|
1212
|
+
const run2 = horizontal ? 2 * tx : 2 * tz;
|
|
1213
|
+
const cb = s * 0.22;
|
|
1214
|
+
const perSide = clamp(Math.round((horizontal ? W - 2 * cb : D - 2 * cb) / (2.2 * cb)), 1, 6);
|
|
1215
|
+
const c = clamp(s * 0.03, 12, 45);
|
|
1216
|
+
const o = run2 * 0.3;
|
|
1217
|
+
const f = Math.min(tx, tz) * 0.6;
|
|
1218
|
+
const pedestals = horizontal ? [
|
|
1219
|
+
...pair(P("metal", -o - c, -o + c, -c, c, 30, 715, { round: true })),
|
|
1220
|
+
...pair(P("metal", -o - 2 * c, -o + 2 * c, -f, f, 0, 30, { radius: 8 }))
|
|
1221
|
+
] : [-o, o].flatMap((z) => [
|
|
1222
|
+
P("metal", -c, c, z - c, z + c, 30, 715, { round: true }),
|
|
1223
|
+
P("metal", -f, f, z - 2 * c, z + 2 * c, 0, 30, { radius: 8 })
|
|
1224
|
+
]);
|
|
1225
|
+
const chair = (b, back) => perSide <= 3 ? [sideways("metal", b, 0, 430, back, SLED), sideways("fabric", b, 400, 820, back, SHELL)] : [sideways("fabric", b, 0, 820, back, SIDE_CHAIR)];
|
|
1226
|
+
return [
|
|
1227
|
+
P("wood", -tx, tx, -tz, tz, 715, 745, { radius: Math.min(tx, tz) * 0.28 }),
|
|
1228
|
+
...pedestals,
|
|
1229
|
+
...tableSeats(W, D, false, perSide, chair)
|
|
1230
|
+
];
|
|
1231
|
+
}
|
|
1232
|
+
},
|
|
1233
|
+
reception_desk: {
|
|
1234
|
+
names: ["reception_desk"],
|
|
1235
|
+
heightMm: 1100,
|
|
1236
|
+
materials: ["wood", "wood_dark", "fabric", "stone", "metal", "screen"],
|
|
1237
|
+
handed: true,
|
|
1238
|
+
gen(W, D) {
|
|
1239
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1240
|
+
const s = Math.min(W, D);
|
|
1241
|
+
const led = s * 0.12;
|
|
1242
|
+
const lw = led * 1.4;
|
|
1243
|
+
const cx = -hw + W * 0.62;
|
|
1244
|
+
const cz = -hd + D * 0.42 + D * 0.58 * 0.58;
|
|
1245
|
+
const cs = Math.max(0, Math.min(D * 0.34, W * 0.14)) / 2;
|
|
1246
|
+
const mw = Math.min(W * 0.12, 280);
|
|
1247
|
+
const mz = -hd + led + 30;
|
|
1248
|
+
return [
|
|
1249
|
+
P("wood_dark", -hw + 20, hw - 20, -hd + 20, hd - 20, 0, 60, { profile: RECEPTION_L }),
|
|
1250
|
+
P("wood", -hw, hw, -hd, hd, 60, 740, { profile: RECEPTION_L }),
|
|
1251
|
+
P("stone", -hw, hw, -hd, hd, 740, 770, { profile: RECEPTION_L }),
|
|
1252
|
+
P("wood", -hw, hw, -hd, -hd + led, 770, 1075),
|
|
1253
|
+
P("wood", -hw, -hw + led, -hd + led, hd, 770, 1075),
|
|
1254
|
+
P("stone", -hw, hw, -hd, -hd + lw, 1075, 1100, { radius: 6 }),
|
|
1255
|
+
P("stone", -hw, -hw + lw, -hd + lw, hd, 1075, 1100, { radius: 6 }),
|
|
1256
|
+
P("metal", cx - mw * 0.3, cx + mw * 0.3, mz, mz + 40, 770, 800, { radius: 6 }),
|
|
1257
|
+
P("screen", cx - mw, cx + mw, mz + 12, mz + 32, 800, 1060, { axis: "z", radius: 8 }),
|
|
1258
|
+
P("metal", cx - cs * 0.9, cx + cs * 0.9, cz - cs * 0.9, cz + cs * 0.9, 0, 30, { round: true }),
|
|
1259
|
+
P("metal", cx - 20, cx + 20, cz - 20, cz + 20, 30, 430, { round: true }),
|
|
1260
|
+
P("fabric", cx - cs, cx + cs, cz - cs, cz + cs, 430, 480, { radius: cs * 0.3 }),
|
|
1261
|
+
P("fabric", cx - cs * 0.9, cx + cs * 0.9, cz + cs - Math.min(60, cs * 0.4), cz + cs, 480, 860, {
|
|
1262
|
+
axis: "z",
|
|
1263
|
+
radius: Math.min(cs * 0.6, 100)
|
|
1264
|
+
})
|
|
1265
|
+
];
|
|
1266
|
+
}
|
|
1267
|
+
},
|
|
1268
|
+
filing_cabinet: {
|
|
1269
|
+
names: ["filing_cabinet"],
|
|
1270
|
+
heightMm: 1320,
|
|
1271
|
+
materials: ["metal", "rubber"],
|
|
1272
|
+
gen(W, D) {
|
|
1273
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1274
|
+
const drawers = stack(4, 70, 1312, 6);
|
|
1275
|
+
const pw = Math.min(W * 0.18, 70);
|
|
1276
|
+
return [
|
|
1277
|
+
P("rubber", -hw + 20, hw - 20, -hd + 20, hd - 40, 0, 60),
|
|
1278
|
+
P("metal", -hw, hw, -hd, hd - 20, 60, 1320, { radius: 4 }),
|
|
1279
|
+
...drawers.map(([a, b]) => P("metal", -hw + 6, hw - 6, hd - 20, hd - 10, a, b, { radius: 3 })),
|
|
1280
|
+
...drawers.map(([, b]) => P("rubber", -pw, pw, hd - 10, hd, b - 70, b - 54, { axis: "x", radius: 6 }))
|
|
1281
|
+
];
|
|
1282
|
+
}
|
|
1283
|
+
},
|
|
1284
|
+
locker: {
|
|
1285
|
+
names: ["locker"],
|
|
1286
|
+
heightMm: 1800,
|
|
1287
|
+
materials: ["metal", "screen", "paint", "rubber"],
|
|
1288
|
+
gen(W, D) {
|
|
1289
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1290
|
+
const n = clamp(Math.round(W / D), 2, 6);
|
|
1291
|
+
const doors = span(n, hw - 3, 6);
|
|
1292
|
+
return [
|
|
1293
|
+
P("rubber", -hw + 15, hw - 15, -hd + 15, hd - 50, 0, 80),
|
|
1294
|
+
P("metal", -hw, hw, -hd, hd - 22, 80, 1800, { radius: 3 }),
|
|
1295
|
+
...doors.map(([a, b]) => P("paint", a, b, hd - 22, hd - 6, 95, 1785, { radius: 3 })),
|
|
1296
|
+
...doors.map(([a, b]) => {
|
|
1297
|
+
const [c, h] = [(a + b) / 2, (b - a) * 0.3];
|
|
1298
|
+
return P("screen", c - h, c + h, hd - 6, hd - 4, 1560, 1660, { radius: 4 });
|
|
1299
|
+
}),
|
|
1300
|
+
...doors.map(([a, b]) => {
|
|
1301
|
+
const [c, h] = [(a + b) / 2, (b - a) * 0.14];
|
|
1302
|
+
return P("metal", c - h, c + h, hd - 6, hd, 1e3, 1020, { axis: "x", round: true });
|
|
1303
|
+
})
|
|
1304
|
+
];
|
|
1305
|
+
}
|
|
1306
|
+
},
|
|
1307
|
+
pool_table: {
|
|
1308
|
+
names: ["pool_table"],
|
|
1309
|
+
heightMm: 800,
|
|
1310
|
+
materials: ["wood_dark", "fabric", "rubber"],
|
|
1311
|
+
gen(W, D) {
|
|
1312
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1313
|
+
const s = Math.min(W, D);
|
|
1314
|
+
const [e1, e2] = [s * 0.065, s * 0.12];
|
|
1315
|
+
const leg = clamp(s * 0.07, 25, 140);
|
|
1316
|
+
const li = s * 0.06;
|
|
1317
|
+
const legs = [-hd + li, hd - li - leg].flatMap(
|
|
1318
|
+
(z) => pair(P("wood_dark", -hw + li, -hw + li + leg, z, z + leg, 0, 620, { radius: leg * 0.2 }))
|
|
1319
|
+
);
|
|
1320
|
+
const [cx, cz] = [hw - e2, hd - e2];
|
|
1321
|
+
const pr = s * 0.036 * 1.2;
|
|
1322
|
+
const pocket = (x, z) => P("rubber", x - pr, x + pr, z - pr, z + pr, 756, 764, { round: true });
|
|
1323
|
+
const mids = W >= D ? [pocket(0, -cz), pocket(0, cz)] : pair(pocket(-cx, 0));
|
|
1324
|
+
return [
|
|
1325
|
+
...legs,
|
|
1326
|
+
P("wood_dark", -hw + s * 0.04, hw - s * 0.04, -hd + s * 0.04, hd - s * 0.04, 560, 720, { radius: s * 0.03 }),
|
|
1327
|
+
P("wood_dark", -hw, hw, -hd, hd, 720, 800, {
|
|
1328
|
+
radius: s * 0.035,
|
|
1329
|
+
holes: [{ x0: -hw + e1, x1: hw - e1, z0: -hd + e1, z1: hd - e1, radius: s * 0.02 }]
|
|
1330
|
+
}),
|
|
1331
|
+
P("fabric", -hw + e1 - 10, hw - e1 + 10, -hd + e1 - 10, hd - e1 + 10, 740, 790, {
|
|
1332
|
+
radius: s * 0.02 + 10,
|
|
1333
|
+
holes: [{ x0: -cx, x1: cx, z0: -cz, z1: cz, radius: s * 0.012 }]
|
|
1334
|
+
}),
|
|
1335
|
+
P("fabric", -cx - 10, cx + 10, -cz - 10, cz + 10, 720, 760, { radius: s * 0.012 + 10 }),
|
|
1336
|
+
...pair(pocket(-cx, -cz)),
|
|
1337
|
+
...pair(pocket(-cx, cz)),
|
|
1338
|
+
...mids
|
|
1339
|
+
];
|
|
1340
|
+
}
|
|
1341
|
+
},
|
|
1342
|
+
treadmill: {
|
|
1343
|
+
names: ["treadmill"],
|
|
1344
|
+
heightMm: 1400,
|
|
1345
|
+
materials: ["metal", "appliance", "screen", "rubber"],
|
|
1346
|
+
gen(W, D) {
|
|
1347
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1348
|
+
const s = Math.min(W, D);
|
|
1349
|
+
const deck = -hd + D * 0.21;
|
|
1350
|
+
const end = -hd + D * 0.95;
|
|
1351
|
+
const u = clamp(s * 0.05, 20, 50);
|
|
1352
|
+
const f = clamp(s * 0.06, 15, 50);
|
|
1353
|
+
const feet = [-hd, hd - f].flatMap(
|
|
1354
|
+
(z) => pair(P("rubber", -hw + 20, -hw + 20 + f, z, z + f, 0, 40, { radius: 6 }))
|
|
1355
|
+
);
|
|
1356
|
+
const bw = W * 0.245;
|
|
1357
|
+
return [
|
|
1358
|
+
...feet,
|
|
1359
|
+
P("appliance", -hw, hw, -hd + D * 0.1, hd, 40, 185, { radius: s * 0.05 }),
|
|
1360
|
+
P("appliance", -W * 0.4, W * 0.4, -hd + D * 0.04, deck, 40, 330, { axis: "x", radius: 60 }),
|
|
1361
|
+
...pair(P("appliance", -hw + W * 0.075, -hw + W * 0.205, deck, end, 185, 212, { radius: s * 0.03 })),
|
|
1362
|
+
P("rubber", -bw, bw, deck, end, 180, 205, { radius: bw }),
|
|
1363
|
+
...pair(
|
|
1364
|
+
P("appliance", -hw + W * 0.04, -hw + W * 0.04 + u, -hd + D * 0.1, -hd + D * 0.1 + u, 185, 1250, {
|
|
1365
|
+
radius: 6
|
|
1366
|
+
})
|
|
1367
|
+
),
|
|
1368
|
+
P("appliance", -W * 0.4, W * 0.4, -hd + D * 0.035, -hd + D * 0.165, 1200, 1400, { axis: "x", radius: 40 }),
|
|
1369
|
+
P("screen", -W * 0.29, W * 0.29, -hd + D * 0.165, -hd + D * 0.165 + 6, 1240, 1370, { axis: "z", radius: 10 }),
|
|
1370
|
+
...pair(
|
|
1371
|
+
P("metal", -hw + W * 0.04, -hw + W * 0.04 + 30, -hd + D * 0.1, -hd + D * 0.42, 1e3, 1030, {
|
|
1372
|
+
axis: "z",
|
|
1373
|
+
round: true
|
|
1374
|
+
})
|
|
1375
|
+
)
|
|
1376
|
+
];
|
|
1377
|
+
}
|
|
1378
|
+
},
|
|
1379
|
+
// ── office and care pieces added with the new families ──
|
|
1380
|
+
whiteboard: {
|
|
1381
|
+
names: ["whiteboard"],
|
|
1382
|
+
heightMm: 2e3,
|
|
1383
|
+
mountMm: 900,
|
|
1384
|
+
materials: ["metal", "paint"],
|
|
1385
|
+
gen(W, D) {
|
|
1386
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1387
|
+
const zb = -hd + D * 0.45;
|
|
1388
|
+
const cap = Math.max(W * 0.012, 6);
|
|
1389
|
+
return [
|
|
1390
|
+
P("paint", -hw + cap, hw - cap, -hd, zb, 940, 1985, { axis: "z", radius: 4 }),
|
|
1391
|
+
...pair(P("metal", -hw, -hw + cap, -hd, zb + 4, 935, 2e3)),
|
|
1392
|
+
P("metal", -hw + cap, hw - cap, -hd, zb + 2, 1985, 2e3),
|
|
1393
|
+
P("metal", -hw + W * 0.04, hw - W * 0.04, -hd, hd, 900, 940, { radius: 8 })
|
|
1394
|
+
];
|
|
1395
|
+
}
|
|
1396
|
+
},
|
|
1397
|
+
printer: {
|
|
1398
|
+
names: ["printer", "copier"],
|
|
1399
|
+
heightMm: 1150,
|
|
1400
|
+
materials: ["metal", "appliance", "screen", "rubber"],
|
|
1401
|
+
gen(W, D) {
|
|
1402
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1403
|
+
const s = Math.min(W, D);
|
|
1404
|
+
const c = clamp(s * 0.06, 15, 45);
|
|
1405
|
+
const casters = [-hd + 30, hd - 30 - c].flatMap(
|
|
1406
|
+
(z) => pair(P("rubber", -hw + 30, -hw + 30 + c, z, z + c, 0, 70, { round: true }))
|
|
1407
|
+
);
|
|
1408
|
+
const trays = [
|
|
1409
|
+
[90, 350],
|
|
1410
|
+
[362, 622]
|
|
1411
|
+
];
|
|
1412
|
+
return [
|
|
1413
|
+
...casters,
|
|
1414
|
+
P("appliance", -hw, hw, -hd, hd - 16, 70, 1050, { radius: s * 0.05 }),
|
|
1415
|
+
...trays.map(([y0, y1]) => P("appliance", -hw + 10, hw - 10, hd - 16, hd - 6, y0, y1, { radius: 4 })),
|
|
1416
|
+
...trays.map(([, y1]) => P("metal", -W * 0.2, W * 0.2, hd - 6, hd, y1 - 50, y1 - 36, { axis: "x", radius: 6 })),
|
|
1417
|
+
P("screen", -W * 0.4, W * 0.4, hd - 16, hd - 12, 930, 990, { radius: 4 }),
|
|
1418
|
+
P("appliance", -hw + W * 0.07, hw - W * 0.07, -hd + D * 0.06, -hd + D * 0.66, 1050, 1110, {
|
|
1419
|
+
radius: s * 0.025
|
|
1420
|
+
}),
|
|
1421
|
+
P("appliance", -W * 0.3, W * 0.3, hd - D * 0.22, hd - D * 0.07, 1050, 1130, { radius: 8 }),
|
|
1422
|
+
P("screen", -W * 0.14, W * 0.14, hd - D * 0.19, hd - D * 0.1, 1130, 1150, { radius: 4 })
|
|
1423
|
+
];
|
|
1424
|
+
}
|
|
1425
|
+
},
|
|
1426
|
+
server_rack: {
|
|
1427
|
+
names: ["server_rack"],
|
|
1428
|
+
heightMm: 2e3,
|
|
1429
|
+
materials: ["metal", "screen", "rubber"],
|
|
1430
|
+
gen(W, D) {
|
|
1431
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1432
|
+
const bays = span(clamp(Math.round(W / (D * 0.6)), 1, 8), hw - 2, 4);
|
|
1433
|
+
return [
|
|
1434
|
+
P("rubber", -hw + 20, hw - 20, -hd + 20, hd - 40, 0, 60),
|
|
1435
|
+
P("metal", -hw, hw, -hd, hd - 20, 60, 2e3, { radius: 3 }),
|
|
1436
|
+
...bays.map(([a, b]) => P("screen", a, b, hd - 20, hd - 6, 80, 1980, { radius: 3 })),
|
|
1437
|
+
...bays.map(([a, b]) => {
|
|
1438
|
+
const [c, h] = [(a + b) / 2, (b - a) * 0.14];
|
|
1439
|
+
return P("metal", c - h, c + h, hd - 6, hd, 1e3, 1016, { axis: "x", round: true });
|
|
1440
|
+
})
|
|
1441
|
+
];
|
|
1442
|
+
}
|
|
1443
|
+
},
|
|
1444
|
+
hospital_bed: {
|
|
1445
|
+
names: ["hospital_bed"],
|
|
1446
|
+
heightMm: 1e3,
|
|
1447
|
+
materials: ["linen", "metal", "paint", "rubber"],
|
|
1448
|
+
gen(W, D) {
|
|
1449
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1450
|
+
const s = Math.min(W, D);
|
|
1451
|
+
const c = clamp(s * 0.05, 15, 50);
|
|
1452
|
+
const casters = [-hd + D * 0.08, hd - D * 0.08 - c].flatMap(
|
|
1453
|
+
(z) => pair(P("rubber", -hw + W * 0.1, -hw + W * 0.1 + c, z, z + c, 0, 120, { round: true }))
|
|
1454
|
+
);
|
|
1455
|
+
const rails = [
|
|
1456
|
+
[0.1, 0.46],
|
|
1457
|
+
[0.54, 0.86]
|
|
1458
|
+
].flatMap(
|
|
1459
|
+
([f0, f1]) => pair(
|
|
1460
|
+
P("metal", -hw + W * 0.015, -hw + W * 0.065, -hd + D * f0, -hd + D * f1, 520, 860, {
|
|
1461
|
+
axis: "x",
|
|
1462
|
+
radius: 12
|
|
1463
|
+
})
|
|
1464
|
+
)
|
|
1465
|
+
);
|
|
1466
|
+
return [
|
|
1467
|
+
...casters,
|
|
1468
|
+
P("metal", -hw + W * 0.12, hw - W * 0.12, -hd + D * 0.1, hd - D * 0.1, 120, 380, { radius: 20 }),
|
|
1469
|
+
P("metal", -hw + W * 0.07, hw - W * 0.07, -hd + D * 0.05, hd - D * 0.05, 380, 450, { radius: s * 0.04 }),
|
|
1470
|
+
P("paint", -hw, hw, -hd, -hd + D * 0.045, 300, 1e3, { axis: "z", radius: 20 }),
|
|
1471
|
+
P("paint", -hw, hw, hd - D * 0.045, hd, 300, 820, { axis: "z", radius: 20 }),
|
|
1472
|
+
P("linen", -hw + W * 0.09, hw - W * 0.09, -hd + D * 0.06, hd - D * 0.06, 450, 600, { radius: s * 0.05 }),
|
|
1473
|
+
P("linen", -W * 0.28, W * 0.28, -hd + D * 0.09, -hd + D * 0.21, 600, 680, { axis: "x", radius: 30 }),
|
|
1474
|
+
...rails
|
|
1475
|
+
];
|
|
1476
|
+
}
|
|
1477
|
+
},
|
|
1478
|
+
workstation: {
|
|
1479
|
+
names: ["workstation", "desk_pod"],
|
|
1480
|
+
heightMm: 1200,
|
|
1481
|
+
materials: ["wood", "fabric", "screen"],
|
|
1482
|
+
gen(W, D) {
|
|
1483
|
+
const s = Math.min(W, D);
|
|
1484
|
+
const band = snap64(s * 0.26);
|
|
1485
|
+
const horizontal = W >= D;
|
|
1486
|
+
const run2 = horizontal ? W : D;
|
|
1487
|
+
const depth = (horizontal ? D : W) - 2 * band;
|
|
1488
|
+
const n = clamp(Math.round(run2 / (2.2 * (s * 0.26))), 1, 4);
|
|
1489
|
+
const scr = Math.max(depth * 0.025, 8);
|
|
1490
|
+
const box3 = (u0, u1, v0, v1) => horizontal ? { x0: u0, x1: u1, z0: v0, z1: v1 } : { x0: v0, x1: v1, z0: u0, z1: u1 };
|
|
1491
|
+
const at = (mat, b, y0, y1, more = {}) => P(mat, b.x0, b.x1, b.z0, b.z1, y0, y1, more);
|
|
1492
|
+
const off = scr + depth * 0.06;
|
|
1493
|
+
const mh = Math.max(depth * 0.04, 12);
|
|
1494
|
+
const mw = run2 / n * 0.38;
|
|
1495
|
+
const cw = snap64(band * 0.9);
|
|
1496
|
+
const desks = Array.from({ length: n }, (_, i) => run2 * (2 * i + 1 - n) / (2 * n)).flatMap(
|
|
1497
|
+
(u) => [-1, 1].flatMap((sgn) => {
|
|
1498
|
+
const v = sgn * (off + mh / 2);
|
|
1499
|
+
const side = horizontal ? sgn < 0 ? "-z" : "+z" : sgn < 0 ? "-x" : "+x";
|
|
1500
|
+
const chair = sgn < 0 ? box3(u - cw / 2, u + cw / 2, -depth / 2 - band, -depth / 2) : box3(u - cw / 2, u + cw / 2, depth / 2, depth / 2 + band);
|
|
1501
|
+
return [
|
|
1502
|
+
at("screen", box3(u - mw / 2, u + mw / 2, v - mh / 2, v + mh / 2), 745, 1080, { radius: 4 }),
|
|
1503
|
+
sideways("fabric", chair, 0, 820, side, SIDE_CHAIR)
|
|
1504
|
+
];
|
|
1505
|
+
})
|
|
1506
|
+
);
|
|
1507
|
+
const leg = box3(-run2 / 2 + 10, -run2 / 2 + 40, -depth / 2 + 20, depth / 2 - 20);
|
|
1508
|
+
const legs = horizontal ? pair(at("wood", leg, 0, 720)) : [
|
|
1509
|
+
at("wood", leg, 0, 720),
|
|
1510
|
+
at("wood", box3(run2 / 2 - 40, run2 / 2 - 10, -depth / 2 + 20, depth / 2 - 20), 0, 720)
|
|
1511
|
+
];
|
|
1512
|
+
return [
|
|
1513
|
+
at("wood", box3(-run2 / 2, run2 / 2, -depth / 2, depth / 2), 720, 745, { radius: 6 }),
|
|
1514
|
+
...legs,
|
|
1515
|
+
at("fabric", box3(-run2 * 0.49, run2 * 0.49, -scr, scr), 745, 1200, { radius: scr }),
|
|
1516
|
+
...desks
|
|
1517
|
+
];
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1522
|
+
// src/mesh/t0-outdoor.ts
|
|
1523
|
+
function tiers(mat, rx, rz, y0, y1, fr) {
|
|
1524
|
+
const h = (y1 - y0) / fr.length;
|
|
1525
|
+
return fr.map(
|
|
1526
|
+
(f, k) => P(mat, -rx * f, rx * f, -rz * f, rz * f, y0 + h * k, k === fr.length - 1 ? y1 : y0 + h * (k + 1), {
|
|
1527
|
+
round: true
|
|
1528
|
+
})
|
|
1529
|
+
);
|
|
1530
|
+
}
|
|
1531
|
+
var CROWN = [
|
|
1532
|
+
[0.085, 0.614],
|
|
1533
|
+
[0.196, 0.8],
|
|
1534
|
+
[0.325, 0.932],
|
|
1535
|
+
[0.464, 1],
|
|
1536
|
+
[0.603, 1],
|
|
1537
|
+
[0.732, 0.932],
|
|
1538
|
+
[0.843, 0.8],
|
|
1539
|
+
[0.928, 0.614],
|
|
1540
|
+
[0.982, 0.386],
|
|
1541
|
+
[1, 0.132]
|
|
1542
|
+
];
|
|
1543
|
+
var LOBE = [
|
|
1544
|
+
[0.45, 1],
|
|
1545
|
+
[0.78, 0.8],
|
|
1546
|
+
[1, 0.45]
|
|
1547
|
+
];
|
|
1548
|
+
function longFrame(W, D) {
|
|
1549
|
+
const horizontal = W >= D;
|
|
1550
|
+
const [L, S] = horizontal ? [W, D] : [D, W];
|
|
1551
|
+
const part = (mat, a0, a1, b0, b1, y0, y1, more = {}, ext) => {
|
|
1552
|
+
const m = ext ? { ...more, axis: ext === "along" === horizontal ? "x" : "z" } : more;
|
|
1553
|
+
return horizontal ? P(mat, a0, a1, b0, b1, y0, y1, m) : P(mat, b0, b1, a0, a1, y0, y1, m);
|
|
1554
|
+
};
|
|
1555
|
+
const flipZ = (p) => ({ ...p, z0: -p.z1, z1: -p.z0 });
|
|
1556
|
+
return {
|
|
1557
|
+
horizontal,
|
|
1558
|
+
L,
|
|
1559
|
+
S,
|
|
1560
|
+
part,
|
|
1561
|
+
ends: (p) => horizontal ? pair(p) : [p, flipZ(p)],
|
|
1562
|
+
sides: (p) => horizontal ? [p, flipZ(p)] : pair(p)
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
function tube(fr, mat, a0, y0, a1, y1, t, b) {
|
|
1566
|
+
const [da, dy] = [a1 - a0, y1 - y0];
|
|
1567
|
+
const len = Math.sqrt(da * da + dy * dy) || 1;
|
|
1568
|
+
const [na, ny] = [-dy / len * t / 2, da / len * t / 2];
|
|
1569
|
+
const pts = [
|
|
1570
|
+
[a0 + na, y0 + ny],
|
|
1571
|
+
[a0 - na, y0 - ny],
|
|
1572
|
+
[a1 - na, y1 - ny],
|
|
1573
|
+
[a1 + na, y1 + ny]
|
|
1574
|
+
];
|
|
1575
|
+
const [amin, amax] = [Math.min(...pts.map((p) => p[0])), Math.max(...pts.map((p) => p[0]))];
|
|
1576
|
+
const [ymin, ymax] = [Math.min(...pts.map((p) => p[1])), Math.max(...pts.map((p) => p[1]))];
|
|
1577
|
+
const profile = pts.map(([a, y]) => [
|
|
1578
|
+
amax > amin ? (a - amin) / (amax - amin) : 0,
|
|
1579
|
+
ymax > ymin ? (y - ymin) / (ymax - ymin) : 0
|
|
1580
|
+
]);
|
|
1581
|
+
return fr.part(mat, amin, amax, -b, b, Math.max(0, ymin), ymax, { profile }, "across");
|
|
1582
|
+
}
|
|
1583
|
+
function clumpTable(n, three, two) {
|
|
1584
|
+
if (n <= three) return LOBE;
|
|
1585
|
+
if (n <= two)
|
|
1586
|
+
return [
|
|
1587
|
+
[0.6, 1],
|
|
1588
|
+
[1, 0.6]
|
|
1589
|
+
];
|
|
1590
|
+
return [[1, 1]];
|
|
1591
|
+
}
|
|
1592
|
+
function clump(fr, a, b, rho, y0, y1, table) {
|
|
1593
|
+
let lo = y0;
|
|
1594
|
+
return table.flatMap(([t, f], k) => {
|
|
1595
|
+
const hi = k === table.length - 1 ? y1 : y0 + (y1 - y0) * t;
|
|
1596
|
+
const p = fr.part("foliage", a - rho * f, a + rho * f, b - rho * f, b + rho * f, lo, hi, { round: true });
|
|
1597
|
+
lo = hi;
|
|
1598
|
+
return fr.sides(p);
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
function wheel(fr, a, r, w) {
|
|
1602
|
+
return [
|
|
1603
|
+
fr.part("rubber", a - r, a + r, -w / 2, w / 2, 0, 2 * r, { round: true }, "across"),
|
|
1604
|
+
fr.part("metal", a - r * 0.78, a + r * 0.78, -w / 2 - 3, w / 2 + 3, r * 0.22, r * 1.78, { round: true }, "across"),
|
|
1605
|
+
fr.part(
|
|
1606
|
+
"metal",
|
|
1607
|
+
a - r * 0.16,
|
|
1608
|
+
a + r * 0.16,
|
|
1609
|
+
-w / 2 - 12,
|
|
1610
|
+
w / 2 + 12,
|
|
1611
|
+
r * 0.84,
|
|
1612
|
+
r * 1.16,
|
|
1613
|
+
{ round: true },
|
|
1614
|
+
"across"
|
|
1615
|
+
)
|
|
1616
|
+
];
|
|
1617
|
+
}
|
|
1618
|
+
var A_FRAME = [
|
|
1619
|
+
[0, 0],
|
|
1620
|
+
[6 / 64, 0],
|
|
1621
|
+
[32 / 64, 56 / 64],
|
|
1622
|
+
[58 / 64, 0],
|
|
1623
|
+
[1, 0],
|
|
1624
|
+
[36 / 64, 1],
|
|
1625
|
+
[28 / 64, 1]
|
|
1626
|
+
];
|
|
1627
|
+
var TUNNEL = [
|
|
1628
|
+
[0, 0],
|
|
1629
|
+
[1, 0],
|
|
1630
|
+
[1, 38 / 64],
|
|
1631
|
+
[61 / 64, 50 / 64],
|
|
1632
|
+
[52 / 64, 59 / 64],
|
|
1633
|
+
[40 / 64, 1],
|
|
1634
|
+
[24 / 64, 1],
|
|
1635
|
+
[12 / 64, 59 / 64],
|
|
1636
|
+
[3 / 64, 50 / 64],
|
|
1637
|
+
[0, 38 / 64]
|
|
1638
|
+
];
|
|
1639
|
+
var HOOD = [
|
|
1640
|
+
[0, 0],
|
|
1641
|
+
[1, 0],
|
|
1642
|
+
[1, 0.4],
|
|
1643
|
+
[0.94, 0.72],
|
|
1644
|
+
[0.78, 0.93],
|
|
1645
|
+
[0.55, 1],
|
|
1646
|
+
[0.3, 0.96],
|
|
1647
|
+
[0.1, 0.8],
|
|
1648
|
+
[0, 0.55]
|
|
1649
|
+
];
|
|
1650
|
+
var GLASSHOUSE = [
|
|
1651
|
+
[0, 0],
|
|
1652
|
+
[1, 0],
|
|
1653
|
+
[0.8, 1],
|
|
1654
|
+
[0.26, 1]
|
|
1655
|
+
];
|
|
1656
|
+
var SHOULDER = [
|
|
1657
|
+
[0, 0],
|
|
1658
|
+
[1, 0],
|
|
1659
|
+
[1, 0.55],
|
|
1660
|
+
[0.95, 0.85],
|
|
1661
|
+
[0.8, 1],
|
|
1662
|
+
[0.24, 1],
|
|
1663
|
+
[0.08, 0.72],
|
|
1664
|
+
[0, 0.42]
|
|
1665
|
+
];
|
|
1666
|
+
var RECLINE = [
|
|
1667
|
+
[0.78, 0],
|
|
1668
|
+
[1, 0],
|
|
1669
|
+
[0.22, 1],
|
|
1670
|
+
[0, 1]
|
|
1671
|
+
];
|
|
1672
|
+
var ARM_FRAME = [
|
|
1673
|
+
[0, 0],
|
|
1674
|
+
[5 / 64, 0],
|
|
1675
|
+
[5 / 64, 55 / 64],
|
|
1676
|
+
[59 / 64, 55 / 64],
|
|
1677
|
+
[59 / 64, 0],
|
|
1678
|
+
[1, 0],
|
|
1679
|
+
[1, 1],
|
|
1680
|
+
[0, 1]
|
|
1681
|
+
];
|
|
1682
|
+
var T0_OUTDOOR = {
|
|
1683
|
+
// ── planting ──
|
|
1684
|
+
plant: {
|
|
1685
|
+
names: ["plant", "planter"],
|
|
1686
|
+
heightMm: 1100,
|
|
1687
|
+
materials: ["ceramic", "foliage"],
|
|
1688
|
+
gen(W, D) {
|
|
1689
|
+
const [rx, rz] = [W / 2, D / 2];
|
|
1690
|
+
return [
|
|
1691
|
+
P("ceramic", -rx * 0.34, rx * 0.34, -rz * 0.34, rz * 0.34, 0, 50, { round: true }),
|
|
1692
|
+
P("ceramic", -rx * 0.4, rx * 0.4, -rz * 0.4, rz * 0.4, 50, 400, { round: true }),
|
|
1693
|
+
P("ceramic", -rx * 0.44, rx * 0.44, -rz * 0.44, rz * 0.44, 400, 440, { round: true }),
|
|
1694
|
+
...dome("foliage", 0, 0, rx, rz, 430, 1100, CROWN)
|
|
1695
|
+
];
|
|
1696
|
+
}
|
|
1697
|
+
},
|
|
1698
|
+
tree: {
|
|
1699
|
+
names: ["tree", "deciduous_tree"],
|
|
1700
|
+
heightMm: 4500,
|
|
1701
|
+
materials: ["foliage", "bark"],
|
|
1702
|
+
gen(W, D) {
|
|
1703
|
+
const [rx, rz] = [W / 2, D / 2];
|
|
1704
|
+
const rt = clamp(Math.min(W, D) * 0.045, 25, 180);
|
|
1705
|
+
const yb = 1800;
|
|
1706
|
+
return [
|
|
1707
|
+
P("bark", -rt * 1.5, rt * 1.5, -rt * 1.5, rt * 1.5, 0, 90, { round: true }),
|
|
1708
|
+
P("bark", -rt, rt, -rt, rt, 0, yb + 900, { round: true }),
|
|
1709
|
+
...dome("foliage", 0, 0, rx, rz, yb, 4500, CROWN)
|
|
1710
|
+
];
|
|
1711
|
+
}
|
|
1712
|
+
},
|
|
1713
|
+
conifer: {
|
|
1714
|
+
names: ["conifer", "pine"],
|
|
1715
|
+
heightMm: 5e3,
|
|
1716
|
+
materials: ["foliage", "bark"],
|
|
1717
|
+
gen(W, D) {
|
|
1718
|
+
const [rx, rz] = [W / 2, D / 2];
|
|
1719
|
+
const rt = clamp(Math.min(W, D) * 0.05, 20, 120);
|
|
1720
|
+
const n = 16;
|
|
1721
|
+
return [
|
|
1722
|
+
P("bark", -rt, rt, -rt, rt, 0, 900, { round: true }),
|
|
1723
|
+
...tiers(
|
|
1724
|
+
"foliage",
|
|
1725
|
+
rx,
|
|
1726
|
+
rz,
|
|
1727
|
+
350,
|
|
1728
|
+
5e3,
|
|
1729
|
+
Array.from({ length: n }, (_, k) => (n - k) / n)
|
|
1730
|
+
)
|
|
1731
|
+
];
|
|
1732
|
+
}
|
|
1733
|
+
},
|
|
1734
|
+
shrub: {
|
|
1735
|
+
names: ["shrub", "bush"],
|
|
1736
|
+
heightMm: 900,
|
|
1737
|
+
materials: ["foliage"],
|
|
1738
|
+
gen(W, D) {
|
|
1739
|
+
const [rx, rz] = [W / 2, D / 2];
|
|
1740
|
+
const lobe = (cx, cz) => dome("foliage", cx, cz, rx * 0.4, rz * 0.4, 0, 560, LOBE);
|
|
1741
|
+
return [
|
|
1742
|
+
...dome("foliage", 0, 0, rx * 0.8, rz * 0.8, 0, 900, MOUND),
|
|
1743
|
+
...lobe(-rx * 0.6, 0).flatMap(pair),
|
|
1744
|
+
...lobe(0, -rz * 0.6),
|
|
1745
|
+
...lobe(0, rz * 0.6)
|
|
1746
|
+
];
|
|
1747
|
+
}
|
|
1748
|
+
},
|
|
1749
|
+
hedge: {
|
|
1750
|
+
names: ["hedge"],
|
|
1751
|
+
heightMm: 1500,
|
|
1752
|
+
materials: ["foliage"],
|
|
1753
|
+
gen(W, D) {
|
|
1754
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1755
|
+
const s = Math.min(W, D);
|
|
1756
|
+
const band = (inset, y0, y1) => P("foliage", -hw + inset, hw - inset, -hd + inset, hd - inset, y0, y1, { radius: s / 2 });
|
|
1757
|
+
return [band(0, 0, 520), band(s * 0.025, 520, 1230), band(s * 0.06, 1230, 1400), band(s * 0.14, 1400, 1500)];
|
|
1758
|
+
}
|
|
1759
|
+
},
|
|
1760
|
+
// ── garden furniture ──
|
|
1761
|
+
bbq: {
|
|
1762
|
+
names: ["bbq", "grill", "barbecue"],
|
|
1763
|
+
heightMm: 1150,
|
|
1764
|
+
materials: ["wood", "metal", "screen"],
|
|
1765
|
+
gen(W, D) {
|
|
1766
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1767
|
+
const s = Math.min(W, D);
|
|
1768
|
+
const fx = W * 0.3;
|
|
1769
|
+
const zs = D * 0.12;
|
|
1770
|
+
const leg = clamp(s * 0.05, 20, 35);
|
|
1771
|
+
const legs = [-hd + zs, hd - zs - leg].flatMap(
|
|
1772
|
+
(z) => pair(P("metal", -fx + 8, -fx + 8 + leg, z, z + leg, 0, 820, { radius: leg * 0.3 }))
|
|
1773
|
+
);
|
|
1774
|
+
const knob = clamp(s * 0.035, 10, 22);
|
|
1775
|
+
return [
|
|
1776
|
+
...legs,
|
|
1777
|
+
P("wood", -fx + 8, fx - 8, -hd + zs, hd - zs, 200, 222),
|
|
1778
|
+
P("metal", -fx, fx, -hd, hd - 30, 820, 930, { radius: clamp(s * 0.06, 4, 30) }),
|
|
1779
|
+
P("screen", -fx + 12, fx - 12, hd - 30, hd - 18, 835, 905, { radius: 4 }),
|
|
1780
|
+
...pair(
|
|
1781
|
+
P("metal", -W * 0.12 - knob, -W * 0.12 + knob, hd - 18, hd, 870 - knob, 870 + knob, {
|
|
1782
|
+
axis: "z",
|
|
1783
|
+
round: true
|
|
1784
|
+
})
|
|
1785
|
+
),
|
|
1786
|
+
P("metal", -knob, knob, hd - 18, hd, 870 - knob, 870 + knob, { axis: "z", round: true }),
|
|
1787
|
+
P("metal", -fx, fx, -hd, hd - zs, 930, 1150, { axis: "x", profile: HOOD }),
|
|
1788
|
+
P("metal", -W * 0.2, W * 0.2, hd - zs, hd - zs + 24, 1030, 1050, { axis: "x", round: true }),
|
|
1789
|
+
...pair(P("wood", -hw, -fx, -hd + zs, hd - zs, 880, 904, { radius: 6 }))
|
|
1790
|
+
];
|
|
1791
|
+
}
|
|
1792
|
+
},
|
|
1793
|
+
outdoor_table: {
|
|
1794
|
+
names: ["outdoor_table", "patio_table"],
|
|
1795
|
+
heightMm: 820,
|
|
1796
|
+
materials: ["wood", "cushion"],
|
|
1797
|
+
gen(W, D) {
|
|
1798
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1799
|
+
const s = Math.min(W, D);
|
|
1800
|
+
const band = snap64(s * 0.22);
|
|
1801
|
+
const [tx, tz] = [hw - band, hd - band];
|
|
1802
|
+
const round = Math.abs(W - D) <= 0.2 * Math.max(W, D);
|
|
1803
|
+
const hole = { x0: -s * 0.025, x1: s * 0.025, z0: -s * 0.025, z1: s * 0.025, round: true };
|
|
1804
|
+
const top = P(
|
|
1805
|
+
"wood",
|
|
1806
|
+
-tx,
|
|
1807
|
+
tx,
|
|
1808
|
+
-tz,
|
|
1809
|
+
tz,
|
|
1810
|
+
710,
|
|
1811
|
+
740,
|
|
1812
|
+
round ? { round: true, holes: [hole] } : {
|
|
1813
|
+
radius: Math.min(tx, tz) * 0.06,
|
|
1814
|
+
holes: [hole]
|
|
1815
|
+
}
|
|
1816
|
+
);
|
|
1817
|
+
const t = clamp(s * 0.03, 15, 45);
|
|
1818
|
+
const base = round ? [
|
|
1819
|
+
P("wood", -t, t, -t, t, 50, 710, { round: true }),
|
|
1820
|
+
P(
|
|
1821
|
+
"wood",
|
|
1822
|
+
-Math.min(tx, tz) * 0.5,
|
|
1823
|
+
Math.min(tx, tz) * 0.5,
|
|
1824
|
+
-Math.min(tx, tz) * 0.5,
|
|
1825
|
+
Math.min(tx, tz) * 0.5,
|
|
1826
|
+
0,
|
|
1827
|
+
50,
|
|
1828
|
+
{
|
|
1829
|
+
round: true
|
|
1830
|
+
}
|
|
1831
|
+
)
|
|
1832
|
+
] : W >= D ? pair(P("wood", -tx * 0.8, -tx * 0.8 + t, -tz + 20, tz - 20, 0, 710)) : [-1, 1].map(
|
|
1833
|
+
(k) => P("wood", -tx + 20, tx - 20, k < 0 ? -tz * 0.8 : tz * 0.8 - t, k < 0 ? -tz * 0.8 + t : tz * 0.8, 0, 710)
|
|
1834
|
+
);
|
|
1835
|
+
const cb = s * 0.22;
|
|
1836
|
+
const perSide = clamp(Math.round((W >= D ? W - 2 * cb : D - 2 * cb) / (2.2 * cb)), 1, 4);
|
|
1837
|
+
const chair = (b, back) => {
|
|
1838
|
+
const depthAlong = back === "-z" || back === "+z";
|
|
1839
|
+
const [u0, u1] = depthAlong ? [b.z0, b.z1] : [b.x0, b.x1];
|
|
1840
|
+
const d = u1 - u0;
|
|
1841
|
+
const [c0, c1] = back === "-z" || back === "-x" ? [u0 + d * 6 / 64, u1 - d * 4 / 64] : [u0 + d * 4 / 64, u1 - d * 6 / 64];
|
|
1842
|
+
const pad = depthAlong ? P("cushion", b.x0 + 4, b.x1 - 4, c0, c1, 435, 470, { radius: 12 }) : P("cushion", c0, c1, b.z0 + 4, b.z1 - 4, 435, 470, { radius: 12 });
|
|
1843
|
+
return [sideways("wood", b, 0, 820, back, SIDE_CHAIR), pad];
|
|
1844
|
+
};
|
|
1845
|
+
return [top, ...base, ...tableSeats(W, D, round, perSide, chair)];
|
|
1846
|
+
}
|
|
1847
|
+
},
|
|
1848
|
+
outdoor_chair: {
|
|
1849
|
+
names: ["outdoor_chair", "patio_chair"],
|
|
1850
|
+
heightMm: 850,
|
|
1851
|
+
materials: ["wood", "cushion"],
|
|
1852
|
+
gen(W, D) {
|
|
1853
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1854
|
+
const aw = clamp(W * 0.11, 25, 90);
|
|
1855
|
+
const zb = -hd + D * 0.2;
|
|
1856
|
+
const slats = span(4, D * 0.82 / 2, clamp(D * 0.02, 4, 14)).map(
|
|
1857
|
+
([a, b]) => P("wood", -hw + aw, hw - aw, a + D * 0.07, b + D * 0.07, 380, 405, { radius: 4 })
|
|
1858
|
+
);
|
|
1859
|
+
return [
|
|
1860
|
+
...pair(P("wood", -hw, -hw + aw, -hd + D * 0.06, hd, 0, 640, { axis: "x", profile: ARM_FRAME })),
|
|
1861
|
+
...slats,
|
|
1862
|
+
P("wood", -hw + aw, hw - aw, -hd, zb, 405, 850, { axis: "x", profile: RECLINE }),
|
|
1863
|
+
P("cushion", -hw + aw + 8, hw - aw - 8, zb - D * 0.04, hd - D * 0.05, 405, 465, { radius: 25 }),
|
|
1864
|
+
P("cushion", -hw + aw + 8, hw - aw - 8, -hd + D * 0.07, zb + D * 0.02, 465, 800, {
|
|
1865
|
+
axis: "x",
|
|
1866
|
+
profile: [
|
|
1867
|
+
[0, 0.86],
|
|
1868
|
+
[0.62, 0],
|
|
1869
|
+
[1, 0],
|
|
1870
|
+
[0.38, 1],
|
|
1871
|
+
[0.1, 1]
|
|
1872
|
+
]
|
|
1873
|
+
})
|
|
1874
|
+
];
|
|
1875
|
+
}
|
|
1876
|
+
},
|
|
1877
|
+
umbrella: {
|
|
1878
|
+
names: ["umbrella", "parasol"],
|
|
1879
|
+
heightMm: 2400,
|
|
1880
|
+
materials: ["fabric", "stone", "metal"],
|
|
1881
|
+
gen(W, D) {
|
|
1882
|
+
const [rx, rz] = [W / 2, D / 2];
|
|
1883
|
+
const s = Math.min(W, D);
|
|
1884
|
+
const p = clamp(s * 0.012, 10, 25);
|
|
1885
|
+
const b = clamp(s * 0.12, 40, 250);
|
|
1886
|
+
return [
|
|
1887
|
+
P("stone", -b, b, -b, b, 0, 80, { round: true }),
|
|
1888
|
+
P("metal", -p, p, -p, p, 80, 2330, { round: true }),
|
|
1889
|
+
P("metal", -p * 1.8, p * 1.8, -p * 1.8, p * 1.8, 2330, 2400, { round: true }),
|
|
1890
|
+
P("metal", -p * 2, p * 2, -p * 2, p * 2, 1650, 1720, { round: true }),
|
|
1891
|
+
P("metal", -rx * 0.97, rx * 0.97, -6, 6, 1930, 1950, { axis: "x", round: true }),
|
|
1892
|
+
P("metal", -6, 6, -rz * 0.97, rz * 0.97, 1930, 1950, { axis: "z", round: true }),
|
|
1893
|
+
P("fabric", -rx, rx, -rz, rz, 1950, 2010, { round: true }),
|
|
1894
|
+
// A shallow cone, eight tiers, each a tenth narrower.
|
|
1895
|
+
...tiers("fabric", rx, rz, 2010, 2330, [0.92, 0.82, 0.72, 0.62, 0.52, 0.42, 0.31, 0.2])
|
|
1896
|
+
];
|
|
1897
|
+
}
|
|
1898
|
+
},
|
|
1899
|
+
sun_lounger: {
|
|
1900
|
+
names: ["sun_lounger", "lounger"],
|
|
1901
|
+
heightMm: 800,
|
|
1902
|
+
materials: ["wood", "cushion"],
|
|
1903
|
+
gen(W, D) {
|
|
1904
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1905
|
+
const s = Math.min(W, D);
|
|
1906
|
+
const leg = clamp(s * 0.06, 20, 45);
|
|
1907
|
+
const legs = [-hd + D * 0.04, hd - D * 0.04 - leg].flatMap(
|
|
1908
|
+
(z) => pair(P("wood", -hw + W * 0.05, -hw + W * 0.05 + leg, z, z + leg, 0, 270, { radius: leg * 0.3 }))
|
|
1909
|
+
);
|
|
1910
|
+
const i = s * 0.09;
|
|
1911
|
+
const pad = (f0, f1) => P("cushion", -hw + i, hw - i, -hd + D * f0, -hd + D * f1, 300, 365, { radius: s * 0.04 });
|
|
1912
|
+
const [b0, b1] = [-hd + D * 0.035, -hd + D * 0.31];
|
|
1913
|
+
return [
|
|
1914
|
+
...legs,
|
|
1915
|
+
P("wood", -hw, hw, -hd, hd, 260, 300, { radius: s * 0.08 }),
|
|
1916
|
+
pad(0.325, 0.56),
|
|
1917
|
+
pad(0.575, 0.965),
|
|
1918
|
+
P("wood", -hw + i * 0.6, hw - i * 0.6, b0 + (b1 - b0) * 0.1, b1 - (b1 - b0) * 0.1, 300, 700, {
|
|
1919
|
+
axis: "x",
|
|
1920
|
+
profile: RECLINE
|
|
1921
|
+
}),
|
|
1922
|
+
P("cushion", -hw + i, hw - i, b0, b1, 300, 780, { axis: "x", profile: RECLINE }),
|
|
1923
|
+
P("cushion", -hw + i + (W - 2 * i) * 0.18, hw - i - (W - 2 * i) * 0.18, b0, b0 + (b1 - b0) * 0.3, 720, 800, {
|
|
1924
|
+
axis: "x",
|
|
1925
|
+
round: true
|
|
1926
|
+
})
|
|
1927
|
+
];
|
|
1928
|
+
}
|
|
1929
|
+
},
|
|
1930
|
+
// ── parked things ──
|
|
1931
|
+
car: {
|
|
1932
|
+
names: ["car"],
|
|
1933
|
+
heightMm: 1450,
|
|
1934
|
+
materials: ["metal", "glass", "screen", "paint", "rubber"],
|
|
1935
|
+
gen(W, D) {
|
|
1936
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1937
|
+
const bw = W * 0.91 / 2;
|
|
1938
|
+
const r = clamp(D * 0.075, 120, 340);
|
|
1939
|
+
const tw = clamp(W * 0.11, 30, 230);
|
|
1940
|
+
const axles = [-hd + D * 0.17, hd - D * 0.19];
|
|
1941
|
+
const wheels = axles.flatMap((z) => [
|
|
1942
|
+
...pair(P("rubber", -bw + 6, -bw + 6 + tw, z - r, z + r, 0, 2 * r, { axis: "x", round: true })),
|
|
1943
|
+
...pair(
|
|
1944
|
+
P("metal", -bw + 2, -bw + 12, z - r * 0.62, z + r * 0.62, r * 0.38, r * 1.62, { axis: "x", round: true })
|
|
1945
|
+
)
|
|
1946
|
+
]);
|
|
1947
|
+
const belt = 900;
|
|
1948
|
+
const zw = -hd + D * 0.245;
|
|
1949
|
+
const zr = hd - D * 0.255;
|
|
1950
|
+
const mz = -hd + D * 0.285;
|
|
1951
|
+
const mh = Math.min(D * 0.028, W * 0.09);
|
|
1952
|
+
const lamp = (x0, x1, front, mat) => P(mat, x0, x1, front ? -hd : hd - 15, front ? -hd + 15 : hd, 560, 640, { radius: 10 });
|
|
1953
|
+
return [
|
|
1954
|
+
...wheels,
|
|
1955
|
+
P("rubber", -bw + tw + 30, bw - tw - 30, -hd + D * 0.1, hd - D * 0.1, r * 0.45, r + 20),
|
|
1956
|
+
P("paint", -bw, bw, -hd + 15, hd - 15, r * 0.95, 700, { radius: Math.min(bw * 0.6, D * 0.1) }),
|
|
1957
|
+
P("paint", -bw * 0.93, bw * 0.93, -hd + D * 0.06, hd - D * 0.05, 680, belt, { axis: "x", profile: SHOULDER }),
|
|
1958
|
+
P("glass", -bw * 0.82, bw * 0.82, zw, zr, belt - 10, 1385, { axis: "x", profile: GLASSHOUSE }),
|
|
1959
|
+
P("screen", -bw * 0.82 + 25, bw * 0.82 - 25, zw + 30, zr - 30, belt - 5, 1360, {
|
|
1960
|
+
axis: "x",
|
|
1961
|
+
profile: GLASSHOUSE
|
|
1962
|
+
}),
|
|
1963
|
+
P("paint", -bw * 0.78, bw * 0.78, -hd + D * 0.37, -hd + D * 0.645, 1380, 1450, { radius: bw * 0.12 }),
|
|
1964
|
+
...pair(P("paint", -hw, -hw + W * 0.07, mz, mz + mh, belt - 30, belt + 50, { radius: mh * 0.4 })),
|
|
1965
|
+
...pair(lamp(-bw * 0.82, -bw * 0.5, true, "glass")),
|
|
1966
|
+
lamp(-bw * 0.3, bw * 0.3, true, "screen"),
|
|
1967
|
+
...pair(lamp(-bw * 0.86, -bw * 0.56, false, "screen"))
|
|
1968
|
+
];
|
|
1969
|
+
}
|
|
1970
|
+
},
|
|
1971
|
+
bicycle: {
|
|
1972
|
+
names: ["bicycle", "bike"],
|
|
1973
|
+
heightMm: 1050,
|
|
1974
|
+
materials: ["metal", "rubber"],
|
|
1975
|
+
handed: (W, D) => W >= D,
|
|
1976
|
+
gen(W, D) {
|
|
1977
|
+
const fr = longFrame(W, D);
|
|
1978
|
+
const { L, S, part, sides } = fr;
|
|
1979
|
+
const r = Math.min(L * 0.19, 340);
|
|
1980
|
+
const w = Math.min(S * 0.1, L * 0.06);
|
|
1981
|
+
const [ar, af] = [-L / 2 + r, L / 2 - r];
|
|
1982
|
+
const t = clamp(S * 0.05, 12, 36);
|
|
1983
|
+
const bb = [-L * 0.04, r * 0.85];
|
|
1984
|
+
const seat = [-L * 0.2, 940];
|
|
1985
|
+
const head = [L * 0.2, 1030];
|
|
1986
|
+
const headLow = [L * 0.22, 820];
|
|
1987
|
+
const p = clamp(L * 0.02, 8, 40);
|
|
1988
|
+
return [
|
|
1989
|
+
...wheel(fr, ar, r, w),
|
|
1990
|
+
...wheel(fr, af, r, w),
|
|
1991
|
+
tube(fr, "metal", ar, r, bb[0], bb[1], t * 0.8, t / 2),
|
|
1992
|
+
tube(fr, "metal", ar, r, seat[0], seat[1] - 100, t * 0.8, t / 2),
|
|
1993
|
+
tube(fr, "metal", bb[0], bb[1], seat[0], seat[1], t, t / 2),
|
|
1994
|
+
tube(fr, "metal", seat[0], seat[1] - 120, headLow[0], headLow[1], t, t / 2),
|
|
1995
|
+
tube(fr, "metal", bb[0], bb[1], headLow[0], headLow[1] - 30, t * 1.2, t / 2),
|
|
1996
|
+
tube(fr, "metal", af, r, head[0], head[1], t, t / 2),
|
|
1997
|
+
part(
|
|
1998
|
+
"rubber",
|
|
1999
|
+
seat[0] - L * 0.065,
|
|
2000
|
+
seat[0] + L * 0.065,
|
|
2001
|
+
-Math.min(S * 0.12, L * 0.042),
|
|
2002
|
+
Math.min(S * 0.12, L * 0.042),
|
|
2003
|
+
seat[1],
|
|
2004
|
+
990,
|
|
2005
|
+
{
|
|
2006
|
+
radius: 20
|
|
2007
|
+
}
|
|
2008
|
+
),
|
|
2009
|
+
part("metal", head[0] - 14, head[0] + 14, -S * 0.42, S * 0.42, 1022, 1050, { round: true }, "across"),
|
|
2010
|
+
...sides(part("rubber", head[0] - 18, head[0] + 18, S * 0.36, S / 2, 1018, 1050, { round: true }, "across")),
|
|
2011
|
+
part("metal", bb[0] - p, bb[0] + p, -S * 0.2, S * 0.2, bb[1] - p, bb[1] + p, { round: true }, "across"),
|
|
2012
|
+
...sides(
|
|
2013
|
+
part("rubber", bb[0] - L * 0.02, bb[0] + L * 0.02, S * 0.2, S * 0.3, bb[1] - 12, bb[1] + 12, { radius: 4 })
|
|
2014
|
+
)
|
|
2015
|
+
];
|
|
2016
|
+
}
|
|
2017
|
+
},
|
|
2018
|
+
motorcycle: {
|
|
2019
|
+
names: ["motorcycle"],
|
|
2020
|
+
heightMm: 1150,
|
|
2021
|
+
materials: ["metal", "glass", "paint", "rubber"],
|
|
2022
|
+
handed: (W, D) => W >= D,
|
|
2023
|
+
gen(W, D) {
|
|
2024
|
+
const fr = longFrame(W, D);
|
|
2025
|
+
const { L, S, part, sides } = fr;
|
|
2026
|
+
const [rr, rf] = [Math.min(L * 0.15, 330), Math.min(L * 0.14, 320)];
|
|
2027
|
+
const [ar, af] = [-L / 2 + rr, L / 2 - rf];
|
|
2028
|
+
const t = clamp(S * 0.06, 20, 50);
|
|
2029
|
+
return [
|
|
2030
|
+
part("rubber", ar - rr, ar + rr, -S * 0.11, S * 0.11, 0, 2 * rr, { round: true }, "across"),
|
|
2031
|
+
part(
|
|
2032
|
+
"metal",
|
|
2033
|
+
ar - rr * 0.68,
|
|
2034
|
+
ar + rr * 0.68,
|
|
2035
|
+
-S * 0.11 - 3,
|
|
2036
|
+
S * 0.11 + 3,
|
|
2037
|
+
rr * 0.32,
|
|
2038
|
+
rr * 1.68,
|
|
2039
|
+
{ round: true },
|
|
2040
|
+
"across"
|
|
2041
|
+
),
|
|
2042
|
+
part("rubber", af - rf, af + rf, -S * 0.08, S * 0.08, 0, 2 * rf, { round: true }, "across"),
|
|
2043
|
+
part(
|
|
2044
|
+
"metal",
|
|
2045
|
+
af - rf * 0.68,
|
|
2046
|
+
af + rf * 0.68,
|
|
2047
|
+
-S * 0.08 - 3,
|
|
2048
|
+
S * 0.08 + 3,
|
|
2049
|
+
rf * 0.32,
|
|
2050
|
+
rf * 1.68,
|
|
2051
|
+
{ round: true },
|
|
2052
|
+
"across"
|
|
2053
|
+
),
|
|
2054
|
+
tube(fr, "metal", ar, rr, -L * 0.06, 380, t, S * 0.05),
|
|
2055
|
+
tube(fr, "metal", af, rf, L * 0.258, 1010, t, S * 0.07),
|
|
2056
|
+
part("metal", -L * 0.1, L * 0.18, -S * 0.16, S * 0.16, 220, 580, { radius: 40 }, "across"),
|
|
2057
|
+
...sides(part("metal", -L * 0.44, -L * 0.04, S * 0.1, S * 0.18, 260, 340, { round: true }, "along")),
|
|
2058
|
+
part("paint", L * 0.04, L * 0.27, -S * 0.2, S * 0.2, 600, 860, { radius: 90 }, "across"),
|
|
2059
|
+
part("rubber", -L * 0.28, L * 0.06, -S * 0.13, S * 0.13, 700, 800, { radius: 30 }, "across"),
|
|
2060
|
+
part("paint", -L * 0.42, -L * 0.24, -S * 0.09, S * 0.09, 640, 790, { radius: 40 }, "across"),
|
|
2061
|
+
part("glass", L * 0.3, L * 0.36, -S * 0.07, S * 0.07, 800, 920, { round: true }, "along"),
|
|
2062
|
+
part("metal", L * 0.245, L * 0.27, -S * 0.42, S * 0.42, 1e3, 1024, { round: true }, "across"),
|
|
2063
|
+
...sides(part("rubber", L * 0.24, L * 0.275, S * 0.36, S / 2, 996, 1028, { round: true }, "across")),
|
|
2064
|
+
...sides(part("metal", L * 0.23, L * 0.24, S * 0.395 - 5, S * 0.395 + 5, 1010, 1100, { round: true })),
|
|
2065
|
+
...sides(part("metal", L * 0.22, L * 0.25, S * 0.37, S * 0.43, 1090, 1150, { round: true }))
|
|
2066
|
+
];
|
|
2067
|
+
}
|
|
2068
|
+
},
|
|
2069
|
+
// ── terrace & lawn ──
|
|
2070
|
+
hot_tub: {
|
|
2071
|
+
names: ["hot_tub", "spa"],
|
|
2072
|
+
heightMm: 900,
|
|
2073
|
+
materials: ["wood", "wood_dark", "ceramic", "water"],
|
|
2074
|
+
gen(W, D) {
|
|
2075
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2076
|
+
const s = Math.min(W, D);
|
|
2077
|
+
const r = s * 0.16;
|
|
2078
|
+
const e = s * 0.09;
|
|
2079
|
+
const water = { x0: -hw + e, x1: hw - e, z0: -hd + e, z1: hd - e, radius: s * 0.1 };
|
|
2080
|
+
return [
|
|
2081
|
+
P("wood_dark", -hw + 25, hw - 25, -hd + 25, hd - 25, 0, 80, { radius: Math.max(1, r - 25) }),
|
|
2082
|
+
P("wood", -hw, hw, -hd, hd, 80, 800, { radius: r }),
|
|
2083
|
+
P("wood", -hw, hw, -hd, hd, 800, 900, { radius: r, holes: [water] }),
|
|
2084
|
+
P("ceramic", water.x0 - 10, water.x1 + 10, water.z0 - 10, water.z1 + 10, 790, 812, {
|
|
2085
|
+
radius: water.radius + 10
|
|
2086
|
+
}),
|
|
2087
|
+
P("water", water.x0 - 10, water.x1 + 10, water.z0 - 10, water.z1 + 10, 812, 860, { radius: water.radius + 10 })
|
|
2088
|
+
];
|
|
2089
|
+
}
|
|
2090
|
+
},
|
|
2091
|
+
swing: {
|
|
2092
|
+
names: ["swing", "swing_set"],
|
|
2093
|
+
heightMm: 2100,
|
|
2094
|
+
materials: ["wood", "metal"],
|
|
2095
|
+
gen(W, D) {
|
|
2096
|
+
const fr = longFrame(W, D);
|
|
2097
|
+
const { L, S, part, ends } = fr;
|
|
2098
|
+
const bb = clamp(S * 0.03, 25, 55);
|
|
2099
|
+
const t = clamp(S * 0.04, 30, 80);
|
|
2100
|
+
const a0 = -L / 2 + L * 0.03;
|
|
2101
|
+
const sv = Math.min(S * 0.08, L * 0.05);
|
|
2102
|
+
const rope = (a) => part("metal", a - 7, a + 7, -7, 7, 420, 2100 - bb * 2, { round: true });
|
|
2103
|
+
return [
|
|
2104
|
+
part("wood", -L / 2, L / 2, -bb, bb, 2100 - bb * 2, 2100, { radius: 8 }, "along"),
|
|
2105
|
+
...ends(part("wood", a0, a0 + t, -S / 2, S / 2, 0, 2100 - bb, { profile: A_FRAME }, "along")),
|
|
2106
|
+
...ends(part("wood", a0, a0 + t, -S * 0.3, S * 0.3, 680, 680 + bb * 1.2, { round: true }, "across")),
|
|
2107
|
+
...ends(part("wood", -L * 0.24, -L * 0.08, -sv, sv, 380, 420, { radius: 10 })),
|
|
2108
|
+
...ends(rope(-L * 0.225)),
|
|
2109
|
+
...ends(rope(-L * 0.095))
|
|
2110
|
+
];
|
|
2111
|
+
}
|
|
2112
|
+
},
|
|
2113
|
+
trampoline: {
|
|
2114
|
+
names: ["trampoline"],
|
|
2115
|
+
heightMm: 900,
|
|
2116
|
+
materials: ["fabric", "metal", "rubber"],
|
|
2117
|
+
gen(W, D) {
|
|
2118
|
+
const [rx, rz] = [W / 2, D / 2];
|
|
2119
|
+
const s = Math.min(W, D);
|
|
2120
|
+
const lg = clamp(s * 0.012, 12, 30);
|
|
2121
|
+
const at = (cx, cz) => P("metal", cx - lg, cx + lg, cz - lg, cz + lg, 0, 840, { round: true });
|
|
2122
|
+
const [lx, lz] = [rx * 0.6, rz * 0.6];
|
|
2123
|
+
const inner = (f) => ({ x0: -rx * f, x1: rx * f, z0: -rz * f, z1: rz * f, round: true });
|
|
2124
|
+
return [
|
|
2125
|
+
...pair(at(-lx, -lz)),
|
|
2126
|
+
...pair(at(-lx, lz)),
|
|
2127
|
+
P("metal", -rx * 0.66, rx * 0.66, -rz * 0.66, rz * 0.66, 0, 30, { round: true, holes: [inner(0.58)] }),
|
|
2128
|
+
P("metal", -rx * 0.98, rx * 0.98, -rz * 0.98, rz * 0.98, 820, 850, { round: true, holes: [inner(0.86)] }),
|
|
2129
|
+
P("rubber", -rx * 0.82, rx * 0.82, -rz * 0.82, rz * 0.82, 840, 856, { round: true }),
|
|
2130
|
+
P("fabric", -rx, rx, -rz, rz, 850, 900, { round: true, holes: [inner(0.79)] })
|
|
2131
|
+
];
|
|
2132
|
+
}
|
|
2133
|
+
},
|
|
2134
|
+
// ── the small standing objects ──
|
|
2135
|
+
bin: {
|
|
2136
|
+
names: ["bin", "wheelie_bin"],
|
|
2137
|
+
heightMm: 1070,
|
|
2138
|
+
materials: ["metal", "paint", "rubber"],
|
|
2139
|
+
gen(W, D) {
|
|
2140
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2141
|
+
const s = Math.min(W, D);
|
|
2142
|
+
const rw = clamp(D * 0.16, 30, 110);
|
|
2143
|
+
const r = s * 0.08;
|
|
2144
|
+
return [
|
|
2145
|
+
...pair(P("rubber", -hw, -hw + W * 0.1, -hd, -hd + 2 * rw, 0, 2 * rw, { axis: "x", round: true })),
|
|
2146
|
+
P("metal", -hw + W * 0.02, hw - W * 0.02, -hd + rw - 8, -hd + rw + 8, rw - 8, rw + 8, {
|
|
2147
|
+
axis: "x",
|
|
2148
|
+
round: true
|
|
2149
|
+
}),
|
|
2150
|
+
P("paint", -hw + W * 0.08, hw - W * 0.08, -hd + D * 0.06, hd - D * 0.1, 30, 500, { radius: r }),
|
|
2151
|
+
P("paint", -hw + W * 0.05, hw - W * 0.05, -hd + D * 0.04, hd - D * 0.06, 500, 960, { radius: r }),
|
|
2152
|
+
P("paint", -hw + W * 0.03, hw - W * 0.03, -hd, hd - D * 0.02, 960, 1e3, { radius: r }),
|
|
2153
|
+
P("paint", -hw + W * 0.12, hw - W * 0.12, -hd, -hd + clamp(D * 0.05, 10, 40), 1020, 1070, {
|
|
2154
|
+
axis: "x",
|
|
2155
|
+
round: true
|
|
2156
|
+
}),
|
|
2157
|
+
P("paint", -W * 0.15, W * 0.15, hd - D * 0.04, hd, 975, 1e3, { axis: "x", radius: 6 })
|
|
2158
|
+
];
|
|
2159
|
+
}
|
|
2160
|
+
},
|
|
2161
|
+
mailbox: {
|
|
2162
|
+
names: ["mailbox", "letterbox"],
|
|
2163
|
+
heightMm: 1200,
|
|
2164
|
+
materials: ["wood", "stone", "metal"],
|
|
2165
|
+
gen(W, D) {
|
|
2166
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2167
|
+
const p = clamp(Math.min(W, D) * 0.12, 15, 45);
|
|
2168
|
+
const bx = snap64(W * 0.34);
|
|
2169
|
+
const [z0, z1] = [-hd + D * 0.14, hd - D * 0.12];
|
|
2170
|
+
const k = clamp(Math.min(W, D) * 0.04, 4, 14);
|
|
2171
|
+
return [
|
|
2172
|
+
P("stone", -hw, hw, -hd, hd, 0, 40, { radius: 10 }),
|
|
2173
|
+
P("wood", -p, p, -p, p, 40, 940, { radius: 5 }),
|
|
2174
|
+
P("metal", -bx, bx, z0, z1 - 8, 930, 1200, { axis: "z", profile: TUNNEL }),
|
|
2175
|
+
P("metal", -bx + 6, bx - 6, z1 - 8, z1, 936, 1190, { axis: "z", profile: TUNNEL }),
|
|
2176
|
+
P("wood", -k, k, z1, Math.min(z1 + 2 * k, hd), 1100 - k, 1100 + k, { axis: "z", round: true })
|
|
2177
|
+
];
|
|
2178
|
+
}
|
|
2179
|
+
},
|
|
2180
|
+
ev_charger: {
|
|
2181
|
+
names: ["ev_charger"],
|
|
2182
|
+
heightMm: 1400,
|
|
2183
|
+
materials: ["stone", "metal", "appliance", "screen", "rubber"],
|
|
2184
|
+
gen(W, D) {
|
|
2185
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2186
|
+
const px = W * 0.25;
|
|
2187
|
+
const [z0, z1] = [-hd + D * 0.06, -hd + D * 0.56];
|
|
2188
|
+
const f = z1;
|
|
2189
|
+
return [
|
|
2190
|
+
P("stone", -hw, hw, -hd, hd, 0, 40, { radius: 10 }),
|
|
2191
|
+
P("appliance", -px, px, z0, z1, 40, 1400, { radius: Math.min(px, (z1 - z0) / 2) * 0.3 }),
|
|
2192
|
+
P("screen", -W * 0.15, W * 0.15, f, f + 6, 1060, 1260, { axis: "z", radius: 10 }),
|
|
2193
|
+
P("metal", -W * 0.08, W * 0.08, f, f + D * 0.1, 830, 930, { radius: 8 }),
|
|
2194
|
+
P("rubber", -W * 0.045, W * 0.045, f + D * 0.02, f + D * 0.14, 880, 990, { radius: 8 }),
|
|
2195
|
+
P("rubber", -W * 0.19, W * 0.19, f, f + D * 0.07, 420, 800, { axis: "z", round: true })
|
|
2196
|
+
];
|
|
2197
|
+
}
|
|
2198
|
+
},
|
|
2199
|
+
pergola: {
|
|
2200
|
+
names: ["pergola"],
|
|
2201
|
+
heightMm: 2600,
|
|
2202
|
+
materials: ["wood", "stone"],
|
|
2203
|
+
gen(W, D) {
|
|
2204
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2205
|
+
const s = Math.min(W, D);
|
|
2206
|
+
const [px, pz] = [hw - s * 0.08, hd - s * 0.08];
|
|
2207
|
+
const h = s * 0.03;
|
|
2208
|
+
const nx = clamp(Math.round(W / (s * 0.25)) - 1, 1, 9);
|
|
2209
|
+
const nz = clamp(Math.round(D / (s * 0.25)) - 1, 1, 9);
|
|
2210
|
+
const at = (n, len) => Array.from({ length: n }, (_, k) => len * (2 * (k + 1) - n - 1) / (2 * (n + 1)));
|
|
2211
|
+
const rw = clamp(s * 0.02, 12, 45);
|
|
2212
|
+
const posts = [-pz, pz].flatMap((z) => [
|
|
2213
|
+
...pair(P("stone", -px - h * 1.6, -px + h * 1.6, z - h * 1.6, z + h * 1.6, 0, 120, { radius: 4 })),
|
|
2214
|
+
...pair(P("wood", -px - h, -px + h, z - h, z + h, 0, 2420, { radius: 3 }))
|
|
2215
|
+
]);
|
|
2216
|
+
return [
|
|
2217
|
+
...posts,
|
|
2218
|
+
...[-pz, pz].map((z) => P("wood", -hw, hw, z - h, z + h, 2300, 2460, { radius: 3 })),
|
|
2219
|
+
...at(nx, W).map((x) => P("wood", x - rw / 2, x + rw / 2, -hd, hd, 2460, 2560, { radius: 2 })),
|
|
2220
|
+
...at(nz, D).map((z) => P("wood", -hw, hw, z - rw * 0.4, z + rw * 0.4, 2560, 2600, { radius: 2 }))
|
|
2221
|
+
];
|
|
2222
|
+
}
|
|
2223
|
+
},
|
|
2224
|
+
sandpit: {
|
|
2225
|
+
names: ["sandpit", "sandbox"],
|
|
2226
|
+
heightMm: 300,
|
|
2227
|
+
materials: ["wood", "soil"],
|
|
2228
|
+
gen(W, D) {
|
|
2229
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2230
|
+
const s = Math.min(W, D);
|
|
2231
|
+
const e = s * 0.08;
|
|
2232
|
+
const sand = { x0: -hw + e, x1: hw - e, z0: -hd + e, z1: hd - e, radius: s * 0.015 };
|
|
2233
|
+
const k = s * 0.2;
|
|
2234
|
+
const tri = [
|
|
2235
|
+
[0, 0],
|
|
2236
|
+
[1, 0],
|
|
2237
|
+
[0, 1]
|
|
2238
|
+
];
|
|
2239
|
+
const flipU = tri.map(([u, v]) => [1 - u, v]);
|
|
2240
|
+
const flipV = (p) => p.map(([u, v]) => [u, 1 - v]);
|
|
2241
|
+
const corner = (zBack) => {
|
|
2242
|
+
const [z0, z1] = zBack ? [sand.z0, sand.z0 + k] : [sand.z1 - k, sand.z1];
|
|
2243
|
+
const prof = zBack ? tri : flipV(tri);
|
|
2244
|
+
return [
|
|
2245
|
+
P("wood", sand.x0, sand.x0 + k, z0, z1, 268, 300, { profile: prof }),
|
|
2246
|
+
P("wood", -sand.x0 - k, -sand.x0, z0, z1, 268, 300, { profile: zBack ? flipU : flipV(flipU) })
|
|
2247
|
+
];
|
|
2248
|
+
};
|
|
2249
|
+
return [
|
|
2250
|
+
P("wood", -hw, hw, -hd, hd, 0, 280, { radius: s * 0.03, holes: [sand] }),
|
|
2251
|
+
P("soil", sand.x0 - 10, sand.x1 + 10, sand.z0 - 10, sand.z1 + 10, 0, 220, { radius: sand.radius + 10 }),
|
|
2252
|
+
...corner(true),
|
|
2253
|
+
...corner(false)
|
|
2254
|
+
];
|
|
2255
|
+
}
|
|
2256
|
+
},
|
|
2257
|
+
fire_pit: {
|
|
2258
|
+
names: ["fire_pit"],
|
|
2259
|
+
heightMm: 420,
|
|
2260
|
+
materials: ["wood_dark", "stone", "metal"],
|
|
2261
|
+
gen(W, D) {
|
|
2262
|
+
const [rx, rz] = [W / 2, D / 2];
|
|
2263
|
+
const bowl = { x0: -rx * 0.68, x1: rx * 0.68, z0: -rz * 0.68, z1: rz * 0.68, round: true };
|
|
2264
|
+
const ring3 = (f2) => ({ x0: -rx * f2, x1: rx * f2, z0: -rz * f2, z1: rz * f2, round: true });
|
|
2265
|
+
const lg = Math.min(rx, rz) * 0.08;
|
|
2266
|
+
const [n, f] = [0.12, 0.58];
|
|
2267
|
+
return [
|
|
2268
|
+
P("stone", -rx * 0.97, rx * 0.97, -rz * 0.97, rz * 0.97, 0, 360, { round: true, holes: [bowl] }),
|
|
2269
|
+
P("stone", -rx, rx, -rz, rz, 360, 420, { round: true, holes: [ring3(0.64)] }),
|
|
2270
|
+
P("metal", bowl.x0 - 10, bowl.x1 + 10, bowl.z0 - 10, bowl.z1 + 10, 0, 220, { round: true }),
|
|
2271
|
+
...pair(P("wood_dark", -rx * f, -rx * n, -lg, lg, 220, 220 + 2 * lg, { axis: "x", round: true })),
|
|
2272
|
+
P("wood_dark", -lg, lg, -rz * f, -rz * n, 220 + 2 * lg, 220 + 4 * lg, { axis: "z", round: true }),
|
|
2273
|
+
P("wood_dark", -lg, lg, rz * n, rz * f, 220 + 2 * lg, 220 + 4 * lg, { axis: "z", round: true })
|
|
2274
|
+
];
|
|
2275
|
+
}
|
|
2276
|
+
},
|
|
2277
|
+
shed: {
|
|
2278
|
+
names: ["shed", "garden_shed"],
|
|
2279
|
+
heightMm: 2300,
|
|
2280
|
+
materials: ["wood", "wood_dark", "metal", "glass"],
|
|
2281
|
+
gen(W, D) {
|
|
2282
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2283
|
+
const s = Math.min(W, D);
|
|
2284
|
+
const ov = clamp(s * 0.04, 10, 120);
|
|
2285
|
+
const [wx, wz] = [hw - ov, hd - ov];
|
|
2286
|
+
const eaves = 1900;
|
|
2287
|
+
const dw = Math.max(0, Math.min(W * 0.36, (D - 2 * ov) * 1.2)) / 2;
|
|
2288
|
+
const along = W >= D;
|
|
2289
|
+
const gable = [
|
|
2290
|
+
[0, 0],
|
|
2291
|
+
[1, 0],
|
|
2292
|
+
[0.5, 1]
|
|
2293
|
+
];
|
|
2294
|
+
const win = Math.min(wz * 0.5, 300);
|
|
2295
|
+
return [
|
|
2296
|
+
P("wood", -wx, wx, -wz, wz, 0, eaves),
|
|
2297
|
+
P("wood_dark", -hw, hw, -hd, hd, eaves - 20, eaves + 20),
|
|
2298
|
+
P("wood_dark", -hw, hw, -hd, hd, eaves + 20, 2300, { axis: along ? "x" : "z", profile: gable }),
|
|
2299
|
+
...span(2, dw, 6).map(([a, b]) => P("wood_dark", a, b, wz, Math.min(wz + 20, hd), 30, 1780)),
|
|
2300
|
+
...pair(P("metal", -26, -12, Math.min(wz + 20, hd) - 2, Math.min(wz + 40, hd), 950, 1100, { radius: 4 })),
|
|
2301
|
+
...pair(P("glass", -wx - 10, -wx, -win, win, 1150, 1550))
|
|
2302
|
+
];
|
|
2303
|
+
}
|
|
2304
|
+
},
|
|
2305
|
+
clothesline: {
|
|
2306
|
+
names: ["clothesline", "washing_line"],
|
|
2307
|
+
heightMm: 1900,
|
|
2308
|
+
materials: ["metal"],
|
|
2309
|
+
gen(W, D) {
|
|
2310
|
+
const fr = longFrame(W, D);
|
|
2311
|
+
const { L, S, part, ends, sides } = fr;
|
|
2312
|
+
const post = clamp(Math.min(S * 0.07, L * 0.02), 12, 40);
|
|
2313
|
+
const arm = clamp(Math.min(L * 0.012, S * 0.05), 10, 30);
|
|
2314
|
+
const a0 = -L / 2;
|
|
2315
|
+
return [
|
|
2316
|
+
...ends(part("metal", a0, a0 + 2 * post, -post, post, 0, 1900, { round: true })),
|
|
2317
|
+
...ends(part("metal", a0 + post - arm, a0 + post + arm, -S / 2, S / 2, 1820, 1860, { round: true }, "across")),
|
|
2318
|
+
...[0.1, 0.3].flatMap(
|
|
2319
|
+
(b) => sides(part("metal", a0 + post, -a0 - post, S * b - 4, S * b + 4, 1810, 1818, {}, "along"))
|
|
2320
|
+
)
|
|
2321
|
+
];
|
|
2322
|
+
}
|
|
2323
|
+
},
|
|
2324
|
+
// ── planting, play and street furniture added with the new families ──
|
|
2325
|
+
palm: {
|
|
2326
|
+
names: ["palm", "palm_tree"],
|
|
2327
|
+
heightMm: 5e3,
|
|
2328
|
+
materials: ["foliage", "bark"],
|
|
2329
|
+
gen(W, D) {
|
|
2330
|
+
const [rx, rz] = [W / 2, D / 2];
|
|
2331
|
+
const rt = clamp(Math.min(W, D) * 0.05, 40, 180);
|
|
2332
|
+
const layer = (f, y0, y1, turned) => P("foliage", -rx * f, rx * f, -rz * f, rz * f, y0, y1, { profile: turned ? STAR_TURNED : STAR });
|
|
2333
|
+
const trunk = Array.from({ length: 6 }, (_, k) => {
|
|
2334
|
+
const f = k % 2 === 0 ? 1 : 0.86;
|
|
2335
|
+
return P("bark", -rt * f, rt * f, -rt * f, rt * f, 280 + k * 690, 280 + (k + 1) * 690, { round: true });
|
|
2336
|
+
});
|
|
2337
|
+
return [
|
|
2338
|
+
P("bark", -rt * 1.35, rt * 1.35, -rt * 1.35, rt * 1.35, 0, 280, { round: true }),
|
|
2339
|
+
...trunk,
|
|
2340
|
+
layer(1, 4300, 4380, false),
|
|
2341
|
+
layer(0.84, 4380, 4500, true),
|
|
2342
|
+
layer(0.62, 4500, 4640, false),
|
|
2343
|
+
layer(0.4, 4640, 4790, true),
|
|
2344
|
+
P("foliage", -rx * 0.14, rx * 0.14, -rz * 0.14, rz * 0.14, 4790, 5e3, { round: true })
|
|
2345
|
+
];
|
|
2346
|
+
}
|
|
2347
|
+
},
|
|
2348
|
+
flower_bed: {
|
|
2349
|
+
names: ["flower_bed", "planting_bed"],
|
|
2350
|
+
heightMm: 360,
|
|
2351
|
+
materials: ["stone", "foliage", "soil"],
|
|
2352
|
+
gen(W, D) {
|
|
2353
|
+
const fr = longFrame(W, D);
|
|
2354
|
+
const { L, S } = fr;
|
|
2355
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2356
|
+
const s = Math.min(W, D);
|
|
2357
|
+
const e = s * 0.05;
|
|
2358
|
+
const inner = { x0: -hw + e, x1: hw - e, z0: -hd + e, z1: hd - e, radius: s * 0.1 };
|
|
2359
|
+
const n = clamp(Math.round(2 * L / S), 2, 8);
|
|
2360
|
+
const rho = Math.min(S * 0.19, L / n * 0.42);
|
|
2361
|
+
const plants = Array.from({ length: n }, (_, i) => L * (2 * i + 1 - n) / (2 * n)).flatMap(
|
|
2362
|
+
(a) => clump(fr, a, S * 0.22, rho, 100, 360, clumpTable(n, 3, 5))
|
|
2363
|
+
);
|
|
2364
|
+
return [
|
|
2365
|
+
P("stone", -hw, hw, -hd, hd, 0, 160, { radius: s * 0.14, holes: [inner] }),
|
|
2366
|
+
P("soil", inner.x0 - 10, inner.x1 + 10, inner.z0 - 10, inner.z1 + 10, 0, 120, { radius: inner.radius + 10 }),
|
|
2367
|
+
...plants
|
|
2368
|
+
];
|
|
2369
|
+
}
|
|
2370
|
+
},
|
|
2371
|
+
boulder: {
|
|
2372
|
+
names: ["boulder", "rock"],
|
|
2373
|
+
heightMm: 600,
|
|
2374
|
+
materials: ["stone"],
|
|
2375
|
+
gen(W, D) {
|
|
2376
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2377
|
+
const mass = (f, y0, y1) => {
|
|
2378
|
+
const z1 = hd - D * 0.2;
|
|
2379
|
+
const cz = (-hd + z1) / 2 - D * 0.1 * (1 - f);
|
|
2380
|
+
const h = (z1 + hd) / 2;
|
|
2381
|
+
return P("stone", -W * 0.36 * f, W * 0.36 * f, cz - h * f, cz + h * f, y0, y1, { profile: BOULDER });
|
|
2382
|
+
};
|
|
2383
|
+
const lump = (f, y0, y1) => {
|
|
2384
|
+
const [cx, cz, a, h] = [-hw + W * 0.24, hd - D * 0.34, W * 0.24, D * 0.34];
|
|
2385
|
+
const p = P("stone", cx - a * f, cx + a * f, cz - h * f, cz + h * f, y0, y1, { profile: ROCK });
|
|
2386
|
+
return [
|
|
2387
|
+
p,
|
|
2388
|
+
{ ...p, x0: -p.x1, x1: -p.x0, profile: ROCK.map(([u, v]) => [1 - u, v]) }
|
|
2389
|
+
];
|
|
2390
|
+
};
|
|
2391
|
+
return [mass(1, 0, 260), mass(0.8, 260, 450), mass(0.5, 450, 600), ...lump(1, 0, 210), ...lump(0.7, 210, 330)];
|
|
2392
|
+
}
|
|
2393
|
+
},
|
|
2394
|
+
picnic_table: {
|
|
2395
|
+
names: ["picnic_table"],
|
|
2396
|
+
heightMm: 750,
|
|
2397
|
+
materials: ["wood"],
|
|
2398
|
+
gen(W, D) {
|
|
2399
|
+
const { L, S, part, ends, sides } = longFrame(W, D);
|
|
2400
|
+
const t = clamp(S * 0.03, 20, 60);
|
|
2401
|
+
const a = L * 0.37;
|
|
2402
|
+
return [
|
|
2403
|
+
...span(3, S * 0.22, clamp(S * 8e-3, 2, 10)).map(
|
|
2404
|
+
([b0, b1]) => part("wood", -L / 2, L / 2, b0, b1, 720, 750, { radius: 4 })
|
|
2405
|
+
),
|
|
2406
|
+
...sides(part("wood", -L * 0.45, L * 0.45, S * 0.31, S * 0.48, 420, 450, { radius: 4 })),
|
|
2407
|
+
...ends(part("wood", a - t / 2, a + t / 2, -S / 2, S / 2, 0, 720, { profile: PICNIC_FRAME }, "along")),
|
|
2408
|
+
...ends(part("wood", a - t / 2, a + t / 2, -S * 0.48, S * 0.48, 380, 420))
|
|
2409
|
+
];
|
|
2410
|
+
}
|
|
2411
|
+
},
|
|
2412
|
+
slide: {
|
|
2413
|
+
names: ["slide", "playground_slide"],
|
|
2414
|
+
heightMm: 1750,
|
|
2415
|
+
materials: ["metal", "paint"],
|
|
2416
|
+
gen(W, D) {
|
|
2417
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2418
|
+
const [p0, p1] = [-hd + D * 0.13, -hd + D * 0.27];
|
|
2419
|
+
const zc = (y) => -hd + D * 0.13 * (0.15 + 0.7 * y / 1200);
|
|
2420
|
+
return [
|
|
2421
|
+
...pair(P("paint", -W * 0.27, -W * 0.27 + 40, -hd, p0, 0, 1200, { axis: "x", profile: LADDER })),
|
|
2422
|
+
...[300, 600, 900].map(
|
|
2423
|
+
(y) => P("metal", -W * 0.27, W * 0.27, zc(y) - 14, zc(y) + 14, y - 14, y + 14, { axis: "x", round: true })
|
|
2424
|
+
),
|
|
2425
|
+
P("paint", -hw, hw, p0, p1, 1150, 1200, { radius: 6 }),
|
|
2426
|
+
...[p0, p1 - 40].flatMap((z) => pair(P("paint", -hw + 20, -hw + 60, z, z + 40, 0, 1150))),
|
|
2427
|
+
...pair(P("paint", -hw, -hw + 30, p0, p1, 1200, 1750, { radius: 6 })),
|
|
2428
|
+
P("metal", -W * 0.2, W * 0.2, -hd + D * 0.24, hd, 0, 1260, { axis: "x", profile: CHUTE }),
|
|
2429
|
+
...pair(P("paint", -W * 0.28, -W * 0.2, -hd + D * 0.24, hd, 0, 1380, { axis: "x", profile: CHUTE }))
|
|
2430
|
+
];
|
|
2431
|
+
}
|
|
2432
|
+
},
|
|
2433
|
+
bollard: {
|
|
2434
|
+
names: ["bollard"],
|
|
2435
|
+
heightMm: 900,
|
|
2436
|
+
materials: ["metal", "rubber"],
|
|
2437
|
+
gen(W, D) {
|
|
2438
|
+
const [rx, rz] = [W / 2, D / 2];
|
|
2439
|
+
const at = (f, y0, y1, mat = "metal") => P(mat, -rx * f, rx * f, -rz * f, rz * f, y0, y1, { round: true });
|
|
2440
|
+
return [at(0.92, 0, 760), at(1, 600, 660, "rubber"), at(0.8, 760, 840), at(0.64, 840, 880), at(0.3, 880, 900)];
|
|
2441
|
+
}
|
|
2442
|
+
},
|
|
2443
|
+
bike_rack: {
|
|
2444
|
+
names: ["bike_rack", "cycle_stand"],
|
|
2445
|
+
heightMm: 800,
|
|
2446
|
+
materials: ["metal"],
|
|
2447
|
+
gen(W, D) {
|
|
2448
|
+
const { L, S, part, sides } = longFrame(W, D);
|
|
2449
|
+
const n = clamp(Math.round(L / S), 1, 10);
|
|
2450
|
+
const half = Math.min(S * 0.045, L / (4 * n));
|
|
2451
|
+
const reach = S * 0.42;
|
|
2452
|
+
const tu = Math.min(0.2, 2 * half / (2 * reach));
|
|
2453
|
+
const tv = Math.min(0.2, 2 * half / 800);
|
|
2454
|
+
const hoop = [
|
|
2455
|
+
[0, 0],
|
|
2456
|
+
[tu, 0],
|
|
2457
|
+
[tu, 0.86 - tv],
|
|
2458
|
+
[tu + 0.1, 1 - tv],
|
|
2459
|
+
[1 - tu - 0.1, 1 - tv],
|
|
2460
|
+
[1 - tu, 0.86 - tv],
|
|
2461
|
+
[1 - tu, 0],
|
|
2462
|
+
[1, 0],
|
|
2463
|
+
[1, 0.86],
|
|
2464
|
+
[0.9, 1],
|
|
2465
|
+
[0.1, 1],
|
|
2466
|
+
[0, 0.86]
|
|
2467
|
+
];
|
|
2468
|
+
const hoops = Array.from({ length: n }, (_, i) => L * (2 * i + 1 - n) / (2 * n)).map(
|
|
2469
|
+
(a) => part("metal", a - half, a + half, -reach, reach, 12, 800, { profile: hoop }, "along")
|
|
2470
|
+
);
|
|
2471
|
+
return [...hoops, ...sides(part("metal", -L / 2, L / 2, S * 0.36, S / 2, 0, 12, { radius: 4 }))];
|
|
2472
|
+
}
|
|
2473
|
+
},
|
|
2474
|
+
raised_bed: {
|
|
2475
|
+
names: ["raised_bed", "vegetable_bed"],
|
|
2476
|
+
heightMm: 500,
|
|
2477
|
+
materials: ["wood", "foliage", "soil"],
|
|
2478
|
+
gen(W, D) {
|
|
2479
|
+
const fr = longFrame(W, D);
|
|
2480
|
+
const { L, S } = fr;
|
|
2481
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2482
|
+
const s = Math.min(W, D);
|
|
2483
|
+
const k = s * 0.1;
|
|
2484
|
+
const soil = { x0: -hw + k, x1: hw - k, z0: -hd + k, z1: hd - k, radius: s * 0.01 };
|
|
2485
|
+
const run2 = L - 2 * k;
|
|
2486
|
+
const n = clamp(Math.round(run2 / (S * 0.3)), 2, 8);
|
|
2487
|
+
const rho = Math.min(S * 0.11, run2 / n * 0.4);
|
|
2488
|
+
const seedlings = Array.from({ length: n }, (_, i) => run2 * (2 * i + 1 - n) / (2 * n)).flatMap(
|
|
2489
|
+
(a) => clump(fr, a, S * 0.18, rho, 400, 490, clumpTable(n, 2, 4))
|
|
2490
|
+
);
|
|
2491
|
+
return [
|
|
2492
|
+
P("wood", -hw, hw, -hd, hd, 0, 450, { radius: s * 0.02, holes: [soil] }),
|
|
2493
|
+
...[-hd, hd - k].flatMap((z) => pair(P("wood", -hw, -hw + k, z, z + k, 0, 500))),
|
|
2494
|
+
P("soil", soil.x0 - 10, soil.x1 + 10, soil.z0 - 10, soil.z1 + 10, 0, 420, { radius: soil.radius + 10 }),
|
|
2495
|
+
...seedlings
|
|
2496
|
+
];
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
};
|
|
2500
|
+
var DIR16 = [
|
|
2501
|
+
[1, 0],
|
|
2502
|
+
[0.9238795325112867, 0.3826834323650898],
|
|
2503
|
+
[Math.SQRT1_2, Math.SQRT1_2],
|
|
2504
|
+
[0.3826834323650898, 0.9238795325112867],
|
|
2505
|
+
[0, 1],
|
|
2506
|
+
[-0.3826834323650898, 0.9238795325112867],
|
|
2507
|
+
[-Math.SQRT1_2, Math.SQRT1_2],
|
|
2508
|
+
[-0.9238795325112867, 0.3826834323650898],
|
|
2509
|
+
[-1, 0],
|
|
2510
|
+
[-0.9238795325112867, -0.3826834323650898],
|
|
2511
|
+
[-Math.SQRT1_2, -Math.SQRT1_2],
|
|
2512
|
+
[-0.3826834323650898, -0.9238795325112867],
|
|
2513
|
+
[0, -1],
|
|
2514
|
+
[0.3826834323650898, -0.9238795325112867],
|
|
2515
|
+
[Math.SQRT1_2, -Math.SQRT1_2],
|
|
2516
|
+
[0.9238795325112867, -0.3826834323650898]
|
|
2517
|
+
];
|
|
2518
|
+
var starOf = (turned) => {
|
|
2519
|
+
const pts = DIR16.map(([c, s], k) => {
|
|
2520
|
+
const r = k % 2 === 0 !== turned ? 1 : 0.28;
|
|
2521
|
+
return [r * c, r * s];
|
|
2522
|
+
});
|
|
2523
|
+
const m = Math.max(...pts.map(([u]) => u));
|
|
2524
|
+
return pts.map(([u, v]) => [0.5 + 0.5 * u / m, 0.5 + 0.5 * v / m]);
|
|
2525
|
+
};
|
|
2526
|
+
var STAR = starOf(false);
|
|
2527
|
+
var STAR_TURNED = starOf(true);
|
|
2528
|
+
var BOULDER = [
|
|
2529
|
+
[0.5, 0],
|
|
2530
|
+
[46 / 64, 0.04255],
|
|
2531
|
+
[57 / 64, 0.19149],
|
|
2532
|
+
[1, 0.46809],
|
|
2533
|
+
[59 / 64, 0.80851],
|
|
2534
|
+
[43 / 64, 1],
|
|
2535
|
+
[21 / 64, 1],
|
|
2536
|
+
[5 / 64, 0.80851],
|
|
2537
|
+
[0, 0.46809],
|
|
2538
|
+
[7 / 64, 0.19149],
|
|
2539
|
+
[18 / 64, 0.04255]
|
|
2540
|
+
];
|
|
2541
|
+
var ROCK = [
|
|
2542
|
+
[20 / 64, 0],
|
|
2543
|
+
[44 / 64, 4 / 64],
|
|
2544
|
+
[60 / 64, 18 / 64],
|
|
2545
|
+
[1, 38 / 64],
|
|
2546
|
+
[54 / 64, 58 / 64],
|
|
2547
|
+
[34 / 64, 1],
|
|
2548
|
+
[12 / 64, 60 / 64],
|
|
2549
|
+
[0, 40 / 64],
|
|
2550
|
+
[4 / 64, 16 / 64]
|
|
2551
|
+
];
|
|
2552
|
+
var PICNIC_FRAME = [
|
|
2553
|
+
[0, 0],
|
|
2554
|
+
[4 / 64, 0],
|
|
2555
|
+
[20 / 64, 58 / 64],
|
|
2556
|
+
[44 / 64, 58 / 64],
|
|
2557
|
+
[60 / 64, 0],
|
|
2558
|
+
[1, 0],
|
|
2559
|
+
[46 / 64, 1],
|
|
2560
|
+
[18 / 64, 1]
|
|
2561
|
+
];
|
|
2562
|
+
var LADDER = [
|
|
2563
|
+
[0, 0],
|
|
2564
|
+
[0.3, 0],
|
|
2565
|
+
[1, 1],
|
|
2566
|
+
[0.7, 1]
|
|
2567
|
+
];
|
|
2568
|
+
var CHUTE = [
|
|
2569
|
+
[0, 0.9],
|
|
2570
|
+
[0, 1],
|
|
2571
|
+
[0.78, 0.24],
|
|
2572
|
+
[1, 0.2],
|
|
2573
|
+
[1, 0],
|
|
2574
|
+
[0.95, 0],
|
|
2575
|
+
[0.95, 0.13],
|
|
2576
|
+
[0.76, 0.17]
|
|
2577
|
+
];
|
|
2578
|
+
|
|
2579
|
+
// src/mesh/t0-utility.ts
|
|
2580
|
+
var bar = (half, z0, z1, y) => P("metal", -half, half, z0, z1, y - 8, y + 8, { axis: "x", round: true });
|
|
2581
|
+
var URINAL = [
|
|
2582
|
+
[0, 0],
|
|
2583
|
+
[1, 0],
|
|
2584
|
+
[1, 28 / 64],
|
|
2585
|
+
[62 / 64, 42 / 64],
|
|
2586
|
+
[55 / 64, 53 / 64],
|
|
2587
|
+
[44 / 64, 61 / 64],
|
|
2588
|
+
[32 / 64, 1],
|
|
2589
|
+
[20 / 64, 61 / 64],
|
|
2590
|
+
[9 / 64, 53 / 64],
|
|
2591
|
+
[2 / 64, 42 / 64],
|
|
2592
|
+
[0, 28 / 64]
|
|
2593
|
+
];
|
|
2594
|
+
function laundry(W, D, dryer) {
|
|
2595
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2596
|
+
const R = Math.min(W * 0.31, 260);
|
|
2597
|
+
const cy = 380;
|
|
2598
|
+
const kx = W * 0.3;
|
|
2599
|
+
return [
|
|
2600
|
+
...[-hd + 30, hd - 60].flatMap((z) => pair(P("rubber", -hw + 30, -hw + 60, z, z + 30, 0, 20, { round: true }))),
|
|
2601
|
+
P("appliance", -hw, hw, -hd, hd - 20, 20, 850, { radius: 10 }),
|
|
2602
|
+
P("appliance", -hw + 4, hw - 4, hd - 20, hd - 8, 730, 840, { radius: 4 }),
|
|
2603
|
+
P("screen", -Math.min(70, W * 0.12), Math.min(70, W * 0.12), hd - 8, hd - 4, 770, 810, { radius: 3 }),
|
|
2604
|
+
...pair(P("metal", -kx - 22, -kx + 22, hd - 8, hd, 768, 812, { axis: "z", round: true })),
|
|
2605
|
+
P(dryer ? "appliance" : "metal", -R, R, hd - 20, hd - 10, cy - R, cy + R, { axis: "z", round: true }),
|
|
2606
|
+
P("rubber", -R * 0.78, R * 0.78, hd - 10, hd - 6, cy - R * 0.78, cy + R * 0.78, { axis: "z", round: true }),
|
|
2607
|
+
P("glass", -R * 0.62, R * 0.62, hd - 6, hd, cy - R * 0.62, cy + R * 0.62, { axis: "z", round: true })
|
|
2608
|
+
];
|
|
2609
|
+
}
|
|
2610
|
+
var T0_UTILITY = {
|
|
2611
|
+
bathtub: {
|
|
2612
|
+
names: ["bathtub", "tub", "bath"],
|
|
2613
|
+
heightMm: 640,
|
|
2614
|
+
materials: ["ceramic", "metal"],
|
|
2615
|
+
gen(W, D) {
|
|
2616
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2617
|
+
const s = Math.min(W, D);
|
|
2618
|
+
const side = clamp(s * 0.09, 30, 90);
|
|
2619
|
+
const deck = clamp(s * 0.2, 60, 200);
|
|
2620
|
+
const well = { x0: -hw + side, x1: hw - side, z0: -hd + deck, z1: hd - side };
|
|
2621
|
+
const wr = 0.42 * Math.min(well.x1 - well.x0, well.z1 - well.z0);
|
|
2622
|
+
const mz = -hd + deck * 0.5;
|
|
2623
|
+
const wz = well.z0 + Math.min(70, (well.z1 - well.z0) * 0.25);
|
|
2624
|
+
return [
|
|
2625
|
+
P("ceramic", -hw, hw, -hd, hd, 0, 180, { radius: clamp(s * 0.08, 6, 80) }),
|
|
2626
|
+
P("ceramic", -hw, hw, -hd, hd, 180, 560, {
|
|
2627
|
+
radius: clamp(s * 0.08, 6, 80),
|
|
2628
|
+
holes: [{ ...well, radius: wr }]
|
|
2629
|
+
}),
|
|
2630
|
+
P("metal", -22, 22, wz - 22, wz + 22, 180, 184, { round: true }),
|
|
2631
|
+
P("metal", -28, 28, mz - 28, mz + 28, 560, 600, { round: true }),
|
|
2632
|
+
P("metal", -13, 13, mz, mz + Math.min(170, deck * 0.5 + 90), 584, 604, { axis: "z", round: true }),
|
|
2633
|
+
...pair(P("metal", -95, -65, mz - 15, mz + 15, 560, 640, { round: true }))
|
|
2634
|
+
];
|
|
2635
|
+
}
|
|
2636
|
+
},
|
|
2637
|
+
oven: {
|
|
2638
|
+
names: ["oven"],
|
|
2639
|
+
heightMm: 910,
|
|
2640
|
+
materials: ["metal", "glass", "appliance", "screen", "rubber"],
|
|
2641
|
+
gen(W, D) {
|
|
2642
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2643
|
+
const range = W * 10 >= D * 16;
|
|
2644
|
+
const r = Math.min(W, D) * 0.1;
|
|
2645
|
+
const rings = range ? [-1, 1].flatMap(
|
|
2646
|
+
(sx) => [-1, 1].map((sz) => {
|
|
2647
|
+
const [x, z] = [sx * W * 0.22, sz * D * 0.18];
|
|
2648
|
+
return P("metal", x - r, x + r, z - r, z + r, 904, 908, {
|
|
2649
|
+
round: true,
|
|
2650
|
+
holes: [{ x0: x - r * 0.62, x1: x + r * 0.62, z0: z - r * 0.62, z1: z + r * 0.62, round: true }]
|
|
2651
|
+
});
|
|
2652
|
+
})
|
|
2653
|
+
) : [];
|
|
2654
|
+
return [
|
|
2655
|
+
P("rubber", -hw + 20, hw - 20, -hd, hd - 50, 0, 60),
|
|
2656
|
+
P("appliance", -hw, hw, -hd, hd - 24, 60, 900, { radius: 6 }),
|
|
2657
|
+
P("appliance", -hw + 4, hw - 4, hd - 24, hd - 6, 770, 890, { radius: 4 }),
|
|
2658
|
+
P("screen", -Math.min(80, W * 0.12), Math.min(80, W * 0.12), hd - 6, hd - 2, 810, 850, { radius: 3 }),
|
|
2659
|
+
...pair(P("metal", -W * 0.32 - 18, -W * 0.32 + 18, hd - 6, hd, 812, 848, { axis: "z", round: true })),
|
|
2660
|
+
P("appliance", -hw + 4, hw - 4, hd - 24, hd - 6, 90, 760, { axis: "z", radius: 8 }),
|
|
2661
|
+
// The door window: the dark oven behind a glass pane (the core gives an oven glass).
|
|
2662
|
+
P("screen", -hw + W * 0.12, hw - W * 0.12, hd - 6, hd - 4, 200, 620, { axis: "z", radius: 12 }),
|
|
2663
|
+
P("glass", -hw + W * 0.12 - 6, hw - W * 0.12 + 6, hd - 4, hd - 1, 194, 626, { axis: "z", radius: 14 }),
|
|
2664
|
+
bar(Math.min(W * 0.34, 260), hd - 6, hd, 712),
|
|
2665
|
+
P("appliance", -hw, hw, -hd, -hd + clamp(D * 0.06, 15, 40), 900, 910, { radius: 4 }),
|
|
2666
|
+
...range ? [P("screen", -hw + 20, hw - 20, -hd + 45, hd - 30, 900, 904, { radius: 10 }), ...rings] : []
|
|
2667
|
+
];
|
|
2668
|
+
}
|
|
2669
|
+
},
|
|
2670
|
+
dishwasher: {
|
|
2671
|
+
names: ["dishwasher"],
|
|
2672
|
+
heightMm: 900,
|
|
2673
|
+
materials: ["stone", "metal", "appliance", "paint", "rubber"],
|
|
2674
|
+
gen(W, D) {
|
|
2675
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2676
|
+
return [
|
|
2677
|
+
...cabinet(W, D, { fronts: false }),
|
|
2678
|
+
P("appliance", -hw + 2, hw - 2, hd - 40, hd - 8, 106, 786, { axis: "z", radius: 6 }),
|
|
2679
|
+
P("metal", -hw + 2, hw - 2, hd - 40, hd - 10, 790, 862),
|
|
2680
|
+
bar(Math.min(W * 0.14, 120), hd - 8, hd, 748)
|
|
2681
|
+
];
|
|
2682
|
+
}
|
|
2683
|
+
},
|
|
2684
|
+
island: {
|
|
2685
|
+
names: ["island"],
|
|
2686
|
+
heightMm: 900,
|
|
2687
|
+
materials: ["stone", "metal", "paint", "rubber"],
|
|
2688
|
+
gen(W, D) {
|
|
2689
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2690
|
+
const ov = D * 0.24;
|
|
2691
|
+
const doors = span(clamp(Math.round(W / 600), 1, MAX_DOORS), hw - 2, 4);
|
|
2692
|
+
return [
|
|
2693
|
+
P("rubber", -hw + 40, hw - 40, -hd + 70, hd - ov - 40, 0, 100),
|
|
2694
|
+
P("paint", -hw, hw, -hd + 30, hd - ov, 100, 870),
|
|
2695
|
+
P("stone", -hw, hw, -hd, hd, 870, 900, { radius: clamp(Math.min(W, D) * 0.015, 3, 15) }),
|
|
2696
|
+
...doors.map(([a, b]) => P("paint", a, b, -hd + 12, -hd + 30, 106, 862)),
|
|
2697
|
+
...doors.map(([a, b]) => {
|
|
2698
|
+
const pw = Math.min((b - a) * 0.45, 160) / 2;
|
|
2699
|
+
const c = (a + b) / 2;
|
|
2700
|
+
return P("metal", c - pw, c + pw, -hd, -hd + 12, 800, 814, { axis: "x", round: true });
|
|
2701
|
+
})
|
|
2702
|
+
];
|
|
2703
|
+
}
|
|
2704
|
+
},
|
|
2705
|
+
upper_cabinet: {
|
|
2706
|
+
names: ["upper_cabinet", "wall_cabinet"],
|
|
2707
|
+
heightMm: 2100,
|
|
2708
|
+
mountMm: 1400,
|
|
2709
|
+
materials: ["metal", "paint"],
|
|
2710
|
+
gen(W, D) {
|
|
2711
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2712
|
+
const doors = span(clamp(Math.round(W / 600), 1, MAX_DOORS), hw - 2, 4);
|
|
2713
|
+
return [
|
|
2714
|
+
P("paint", -hw, hw, -hd, hd - 20, 1400, 2100),
|
|
2715
|
+
...doors.map(([a, b]) => P("paint", a, b, hd - 20, hd - 4, 1404, 2096)),
|
|
2716
|
+
...doors.map(([a, b]) => {
|
|
2717
|
+
const pw = Math.min((b - a) * 0.35, 120);
|
|
2718
|
+
const c = (a + b) / 2;
|
|
2719
|
+
return P("metal", c - pw, c + pw, hd - 4, hd, 1420, 1434, { axis: "x", round: true });
|
|
2720
|
+
})
|
|
2721
|
+
];
|
|
2722
|
+
}
|
|
2723
|
+
},
|
|
2724
|
+
washer: {
|
|
2725
|
+
names: ["washer", "washing_machine"],
|
|
2726
|
+
heightMm: 850,
|
|
2727
|
+
materials: ["metal", "glass", "appliance", "screen", "rubber"],
|
|
2728
|
+
gen: (W, D) => laundry(W, D, false)
|
|
2729
|
+
},
|
|
2730
|
+
dryer: {
|
|
2731
|
+
names: ["dryer"],
|
|
2732
|
+
heightMm: 850,
|
|
2733
|
+
materials: ["metal", "glass", "appliance", "screen", "rubber"],
|
|
2734
|
+
gen: (W, D) => laundry(W, D, true)
|
|
2735
|
+
},
|
|
2736
|
+
bidet: {
|
|
2737
|
+
names: ["bidet"],
|
|
2738
|
+
heightMm: 480,
|
|
2739
|
+
materials: ["ceramic", "metal"],
|
|
2740
|
+
gen(W, D) {
|
|
2741
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2742
|
+
const hole = { x0: -hw * 0.62, x1: hw * 0.62, z0: -hd + D * 0.22, z1: hd - D * 0.1, round: true };
|
|
2743
|
+
const tz = -hd + D * 0.11;
|
|
2744
|
+
const cz = (hole.z0 + hole.z1) / 2;
|
|
2745
|
+
return [
|
|
2746
|
+
P("ceramic", -hw * 0.55, hw * 0.55, -hd + D * 0.12, hd - D * 0.2, 0, 300, { round: true }),
|
|
2747
|
+
P("ceramic", -hw, hw, -hd, hd, 300, 400, { radius: hw * 0.9, holes: [hole] }),
|
|
2748
|
+
P("metal", -20, 20, cz - 20, cz + 20, 300, 303, { round: true }),
|
|
2749
|
+
P("ceramic", -W * 0.17, W * 0.17, -hd + D * 0.04, -hd + D * 0.18, 400, 425, { radius: 15 }),
|
|
2750
|
+
P("metal", -16, 16, tz - 16, tz + 16, 425, 480, { round: true }),
|
|
2751
|
+
P("metal", -10, 10, tz, tz + Math.min(90, D * 0.12), 450, 468, { axis: "z", round: true })
|
|
2752
|
+
];
|
|
2753
|
+
}
|
|
2754
|
+
},
|
|
2755
|
+
urinal: {
|
|
2756
|
+
names: ["urinal"],
|
|
2757
|
+
heightMm: 1250,
|
|
2758
|
+
mountMm: 350,
|
|
2759
|
+
materials: ["ceramic", "metal"],
|
|
2760
|
+
gen(W, D) {
|
|
2761
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2762
|
+
const e = clamp(Math.min(W, D) * 0.1, 12, 50);
|
|
2763
|
+
const bowl = { x0: -hw + e, x1: hw - e, z0: -hd + e, z1: hd - e, profile: URINAL };
|
|
2764
|
+
const zb = -hd + Math.min(D * 0.3, 110);
|
|
2765
|
+
return [
|
|
2766
|
+
P("ceramic", -hw, hw, -hd, hd, 350, 430, { profile: URINAL }),
|
|
2767
|
+
P("ceramic", -hw, hw, -hd, hd, 430, 640, { profile: URINAL, holes: [bowl] }),
|
|
2768
|
+
P("ceramic", -hw + 10, hw - 10, -hd, zb, 430, 1080, { axis: "z", radius: Math.min(hw * 0.9, 160) }),
|
|
2769
|
+
P("metal", -20, 20, (bowl.z0 + bowl.z1) / 2 - 20, (bowl.z0 + bowl.z1) / 2 + 20, 430, 433, { round: true }),
|
|
2770
|
+
P("metal", -15, 15, -hd + 6, -hd + 36, 1e3, 1250, { round: true }),
|
|
2771
|
+
P("metal", -40, 40, -hd, -hd + 50, 1140, 1200, { radius: 8 })
|
|
2772
|
+
];
|
|
2773
|
+
}
|
|
2774
|
+
},
|
|
2775
|
+
laundry_sink: {
|
|
2776
|
+
names: ["laundry_sink", "laundry_tub"],
|
|
2777
|
+
heightMm: 1150,
|
|
2778
|
+
materials: ["ceramic", "metal", "paint", "rubber"],
|
|
2779
|
+
gen(W, D) {
|
|
2780
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2781
|
+
const hole = { x0: -hw + W * 0.1, x1: hw - W * 0.1, z0: -hd + D * 0.26, z1: hd - D * 0.08 };
|
|
2782
|
+
const r = clamp(Math.min(hole.x1 - hole.x0, hole.z1 - hole.z0) * 0.12, 5, 50);
|
|
2783
|
+
const tz = (-hd + hole.z0) / 2;
|
|
2784
|
+
return [
|
|
2785
|
+
P("rubber", -hw, hw, -hd, hd - 70, 0, 100),
|
|
2786
|
+
P("paint", -hw, hw, -hd, hd - 40, 100, 480),
|
|
2787
|
+
...span(2, hw - 2, 4).map(([a, b]) => P("paint", a, b, hd - 40, hd - 22, 106, 474)),
|
|
2788
|
+
...span(2, hw - 2, 4).map(([a, b]) => {
|
|
2789
|
+
const pw = Math.min((b - a) * 0.4, 120) / 2;
|
|
2790
|
+
const c = (a + b) / 2;
|
|
2791
|
+
return P("metal", c - pw, c + pw, hd - 22, hd - 8, 430, 444, { axis: "x", round: true });
|
|
2792
|
+
}),
|
|
2793
|
+
P("ceramic", -hw, hw, -hd, hd, 480, 520, { radius: 10 }),
|
|
2794
|
+
P("ceramic", -hw, hw, -hd, hd, 520, 900, { radius: 10, holes: [{ ...hole, radius: r }] }),
|
|
2795
|
+
P("metal", -18, 18, tz - 18, tz + 18, 900, 1150, { round: true }),
|
|
2796
|
+
P("metal", -12, 12, tz, tz + Math.min(200, (hole.z1 - hole.z0) * 0.55), 1116, 1140, {
|
|
2797
|
+
axis: "z",
|
|
2798
|
+
round: true
|
|
2799
|
+
})
|
|
2800
|
+
];
|
|
2801
|
+
}
|
|
2802
|
+
},
|
|
2803
|
+
water_heater: {
|
|
2804
|
+
names: ["water_heater", "boiler"],
|
|
2805
|
+
heightMm: 1600,
|
|
2806
|
+
materials: ["metal", "appliance", "rubber"],
|
|
2807
|
+
gen(W, D) {
|
|
2808
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2809
|
+
const s = Math.min(W, D);
|
|
2810
|
+
const R = 0.4 * s;
|
|
2811
|
+
const zc = hd - 0.5 * s;
|
|
2812
|
+
const px = 0.3 * R;
|
|
2813
|
+
const band = (y) => P("appliance", -R - 5, R + 5, zc - R - 5, zc + R + 5, y, y + 30, { round: true });
|
|
2814
|
+
return [
|
|
2815
|
+
P("rubber", -hw, hw, -hd, hd, 0, 30, { radius: 10 }),
|
|
2816
|
+
P("metal", -R, R, zc - R, zc + R, 30, 1450, { round: true }),
|
|
2817
|
+
band(250),
|
|
2818
|
+
band(1200),
|
|
2819
|
+
P("appliance", -R * 0.92, R * 0.92, zc - R * 0.92, zc + R * 0.92, 1450, 1500, { round: true }),
|
|
2820
|
+
P("appliance", -R * 0.6, R * 0.6, zc - R * 0.6, zc + R * 0.6, 1500, 1530, { round: true }),
|
|
2821
|
+
P("appliance", -R * 0.3, R * 0.3, zc + R * 0.85, Math.min(zc + R + 25, hd), 500, 620, { radius: 6 }),
|
|
2822
|
+
...pair(P("metal", -px - 14, -px + 14, -hd, zc, 1380, 1408, { axis: "z", round: true })),
|
|
2823
|
+
...pair(P("metal", -px - 14, -px + 14, -hd, -hd + 28, 1380, 1600, { round: true }))
|
|
2824
|
+
];
|
|
2825
|
+
}
|
|
2826
|
+
},
|
|
2827
|
+
range_hood: {
|
|
2828
|
+
names: ["range_hood"],
|
|
2829
|
+
heightMm: 2250,
|
|
2830
|
+
mountMm: 1600,
|
|
2831
|
+
materials: ["metal", "screen"],
|
|
2832
|
+
gen(W, D) {
|
|
2833
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2834
|
+
return [
|
|
2835
|
+
P("screen", -hw + 20, hw - 20, -hd + 20, hd - 20, 1600, 1606),
|
|
2836
|
+
P("metal", -hw, hw, -hd, hd, 1604, 1790, {
|
|
2837
|
+
axis: "x",
|
|
2838
|
+
profile: [
|
|
2839
|
+
[0, 0],
|
|
2840
|
+
[1, 0],
|
|
2841
|
+
[1, 0.3],
|
|
2842
|
+
[0.55, 1],
|
|
2843
|
+
[0, 1]
|
|
2844
|
+
]
|
|
2845
|
+
}),
|
|
2846
|
+
P("metal", -Math.min(hw * 0.33, 150), Math.min(hw * 0.33, 150), -hd, -hd + Math.min(D * 0.5, 250), 1790, 2250)
|
|
2847
|
+
];
|
|
2848
|
+
}
|
|
2849
|
+
},
|
|
2850
|
+
microwave: {
|
|
2851
|
+
names: ["microwave"],
|
|
2852
|
+
heightMm: 1200,
|
|
2853
|
+
materials: ["wood", "metal", "glass", "appliance", "screen"],
|
|
2854
|
+
gen(W, D) {
|
|
2855
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2856
|
+
const legs = [-hd + 20, hd - 44].flatMap(
|
|
2857
|
+
(z) => pair(P("metal", -hw + 20, -hw + 44, z, z + 24, 0, 880, { round: true }))
|
|
2858
|
+
);
|
|
2859
|
+
return [
|
|
2860
|
+
...legs,
|
|
2861
|
+
P("wood", -hw + 20, hw - 20, -hd + 20, hd - 20, 280, 300),
|
|
2862
|
+
P("wood", -hw, hw, -hd, hd, 880, 900, { radius: 6 }),
|
|
2863
|
+
P("appliance", -hw + 10, hw - 10, -hd + 20, hd - 20, 900, 1200, { radius: 8 }),
|
|
2864
|
+
P("appliance", -hw + 16, hw - 16, hd - 20, hd - 6, 912, 1188, { axis: "z", radius: 8 }),
|
|
2865
|
+
P("screen", -hw + W * 0.14, hw - W * 0.14, hd - 6, hd - 4, 960, 1120, { axis: "z", radius: 10 }),
|
|
2866
|
+
P("glass", -hw + W * 0.14 - 5, hw - W * 0.14 + 5, hd - 4, hd - 1, 955, 1125, { axis: "z", radius: 12 }),
|
|
2867
|
+
P("screen", -Math.min(W * 0.15, 70), Math.min(W * 0.15, 70), hd - 6, hd - 2, 1140, 1170, { radius: 3 }),
|
|
2868
|
+
bar(Math.min(W * 0.25, 120), hd - 6, hd, 934)
|
|
2869
|
+
];
|
|
2870
|
+
}
|
|
2871
|
+
},
|
|
2872
|
+
bar_counter: {
|
|
2873
|
+
names: ["bar_counter"],
|
|
2874
|
+
heightMm: 1050,
|
|
2875
|
+
materials: ["wood", "cushion", "stone", "metal", "rubber"],
|
|
2876
|
+
gen(W, D) {
|
|
2877
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2878
|
+
const zt = -hd + D * 0.62;
|
|
2879
|
+
const n = clamp(Math.round(W / D * 1.2), 1, 8);
|
|
2880
|
+
const r = Math.min(0.4 * W / n, 0.3 * D, 200);
|
|
2881
|
+
const stools = span(n, hw, 0).map(([a, b]) => (a + b) / 2);
|
|
2882
|
+
return [
|
|
2883
|
+
P("rubber", -hw + 40, hw - 40, -hd + 40, zt - 120, 0, 80),
|
|
2884
|
+
P("wood", -hw, hw, -hd, zt - 90, 80, 1020),
|
|
2885
|
+
P("stone", -hw, hw, -hd, zt, 1020, 1050, { radius: 8 }),
|
|
2886
|
+
P("metal", -hw + 40, hw - 40, zt - 70, zt - 40, 180, 210, { axis: "x", round: true }),
|
|
2887
|
+
...stools.flatMap((c) => [
|
|
2888
|
+
P("cushion", c - r, c + r, hd - 2 * r, hd, 720, 770, { round: true }),
|
|
2889
|
+
P("metal", c - 22, c + 22, hd - r - 22, hd - r + 22, 0, 720, { round: true }),
|
|
2890
|
+
...n <= 6 ? [P("metal", c - r * 0.75, c + r * 0.75, hd - r * 1.75, hd - r * 0.25, 0, 12, { round: true })] : []
|
|
2891
|
+
])
|
|
2892
|
+
];
|
|
2893
|
+
}
|
|
2894
|
+
},
|
|
2895
|
+
pantry: {
|
|
2896
|
+
names: ["pantry", "tall_cabinet", "larder"],
|
|
2897
|
+
heightMm: 2100,
|
|
2898
|
+
materials: ["metal", "paint"],
|
|
2899
|
+
gen(W, D) {
|
|
2900
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2901
|
+
const doors = span(clamp(Math.round(W / (D * 0.9)), 1, 4), hw - 2, 4);
|
|
2902
|
+
return [
|
|
2903
|
+
P("paint", -hw + 20, hw - 20, -hd, hd - 70, 0, 100),
|
|
2904
|
+
P("paint", -hw, hw, -hd, hd - 22, 100, 2100),
|
|
2905
|
+
...doors.map(([a, b]) => P("paint", a, b, hd - 22, hd - 6, 106, 2094, { radius: 3 })),
|
|
2906
|
+
...doors.map(([a, b]) => {
|
|
2907
|
+
const pw = Math.min((b - a) * 0.16, 90);
|
|
2908
|
+
const c = (a + b) / 2;
|
|
2909
|
+
return P("metal", c - pw, c + pw, hd - 6, hd, 1040, 1056, { axis: "x", round: true });
|
|
2910
|
+
})
|
|
2911
|
+
];
|
|
2912
|
+
}
|
|
2913
|
+
},
|
|
2914
|
+
towel_rail: {
|
|
2915
|
+
names: ["towel_rail", "towel_radiator"],
|
|
2916
|
+
heightMm: 1400,
|
|
2917
|
+
mountMm: 200,
|
|
2918
|
+
materials: ["linen", "metal"],
|
|
2919
|
+
gen(W, D) {
|
|
2920
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2921
|
+
const st = clamp(Math.min(D * 0.22, W * 0.08) * 0.6, 5, 25);
|
|
2922
|
+
const zc = -hd + D * 0.6;
|
|
2923
|
+
const rr = clamp(D * 0.09, 4, 14);
|
|
2924
|
+
const rungs = Array.from({ length: 10 }, (_, k) => 260 + k * 120);
|
|
2925
|
+
return [
|
|
2926
|
+
...pair(P("metal", -hw, -hw + 2 * st, zc - st, zc + st, 200, 1400, { round: true })),
|
|
2927
|
+
...rungs.map(
|
|
2928
|
+
(y) => P("metal", -hw + st, hw - st, zc - rr, zc + rr, y - rr, y + rr, { axis: "x", round: true })
|
|
2929
|
+
),
|
|
2930
|
+
...[300, 1300].flatMap(
|
|
2931
|
+
(y) => pair(P("metal", -hw + st - 6, -hw + st + 6, -hd, zc, y - 6, y + 6, { axis: "z", round: true }))
|
|
2932
|
+
),
|
|
2933
|
+
P("linen", -W * 0.2, W * 0.2, -hd + D * 0.2, hd, 560, 1140, { radius: 8 })
|
|
2934
|
+
];
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
};
|
|
2938
|
+
|
|
2939
|
+
// src/mesh/t0.ts
|
|
2940
|
+
var BATCHES = { ...T0_LIVING, ...T0_UTILITY, ...T0_OUTDOOR, ...T0_OFFICE };
|
|
2941
|
+
var batchTable = (pick) => Object.fromEntries(
|
|
2942
|
+
Object.entries(BATCHES).flatMap(([k, f]) => {
|
|
2943
|
+
const v = pick(f);
|
|
2944
|
+
return v === void 0 ? [] : [[k, v]];
|
|
2945
|
+
})
|
|
2946
|
+
);
|
|
2947
|
+
var T0_FAMILIES = {
|
|
2948
|
+
bed: ["bed", "double_bed"],
|
|
2949
|
+
sofa: ["sofa", "couch"],
|
|
2950
|
+
table: ["table", "dining_table"],
|
|
2951
|
+
rug: ["rug", "carpet"],
|
|
2952
|
+
wardrobe: ["wardrobe", "robe", "closet"],
|
|
2953
|
+
fridge: ["fridge", "refrigerator"],
|
|
2954
|
+
counter: ["counter", "worktop"],
|
|
2955
|
+
kitchen_sink: ["kitchen_sink", "sink"],
|
|
2956
|
+
stove: ["stove", "hob", "cooktop"],
|
|
2957
|
+
shower: ["shower"],
|
|
2958
|
+
wc: ["wc", "toilet"],
|
|
2959
|
+
basin: ["basin", "lavatory"],
|
|
2960
|
+
...batchTable((f) => f.names)
|
|
2961
|
+
};
|
|
2962
|
+
var FAMILY_OF = new Map(
|
|
2963
|
+
Object.entries(T0_FAMILIES).flatMap(([f, names]) => names.map((n) => [n, f]))
|
|
2964
|
+
);
|
|
2965
|
+
var assetFor = (category) => {
|
|
2966
|
+
const f = FAMILY_OF.get(category);
|
|
2967
|
+
return f ? `t0:${f}` : "greybox";
|
|
2968
|
+
};
|
|
2969
|
+
var T0_HEIGHT_MM = {
|
|
2970
|
+
bed: 1e3,
|
|
2971
|
+
sofa: 800,
|
|
2972
|
+
table: 750,
|
|
2973
|
+
rug: 12,
|
|
2974
|
+
wardrobe: 2100,
|
|
2975
|
+
fridge: 1800,
|
|
2976
|
+
counter: 900,
|
|
2977
|
+
kitchen_sink: 1160,
|
|
2978
|
+
stove: 910,
|
|
2979
|
+
shower: 2e3,
|
|
2980
|
+
wc: 800,
|
|
2981
|
+
basin: 990,
|
|
2982
|
+
...batchTable((f) => f.heightMm)
|
|
2983
|
+
};
|
|
2984
|
+
var T0_MOUNT_MM = batchTable((f) => f.mountMm);
|
|
2985
|
+
var T0_HUNG_FROM_TOP = new Set(Object.keys(batchTable((f) => f.hungFromTop)));
|
|
2986
|
+
var isHung = (family) => family in T0_MOUNT_MM || T0_HUNG_FROM_TOP.has(family);
|
|
2987
|
+
var T0_HANDED = new Set(Object.keys(batchTable((f) => f.handed)));
|
|
2988
|
+
function handedAt(family, W, D) {
|
|
2989
|
+
const h = BATCHES[family]?.handed;
|
|
2990
|
+
return h === true || typeof h === "function" && h(W, D);
|
|
2991
|
+
}
|
|
2992
|
+
var isHandedAsset = (asset) => asset.startsWith("t0:") && T0_HANDED.has(asset.slice(3));
|
|
2993
|
+
var T0_MATERIALS = {
|
|
2994
|
+
bed: ["wood", "linen", "wool"],
|
|
2995
|
+
sofa: ["wood_dark", "fabric", "cushion"],
|
|
2996
|
+
table: ["wood"],
|
|
2997
|
+
rug: ["fabric", "wool"],
|
|
2998
|
+
wardrobe: ["wood", "wood_dark", "metal"],
|
|
2999
|
+
fridge: ["metal", "appliance", "rubber"],
|
|
3000
|
+
counter: ["stone", "metal", "paint", "rubber"],
|
|
3001
|
+
kitchen_sink: ["stone", "metal", "paint", "rubber"],
|
|
3002
|
+
stove: ["stone", "metal", "appliance", "screen", "paint", "rubber"],
|
|
3003
|
+
shower: ["ceramic", "metal", "glass"],
|
|
3004
|
+
wc: ["ceramic", "metal", "water"],
|
|
3005
|
+
basin: ["wood", "ceramic", "metal"],
|
|
3006
|
+
...batchTable((f) => f.materials)
|
|
3007
|
+
};
|
|
3008
|
+
var GENERATORS = {
|
|
3009
|
+
bed(W, D) {
|
|
3010
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3011
|
+
const hb = clamp(D * 0.035, 30, 70);
|
|
3012
|
+
const head = -hd + hb;
|
|
3013
|
+
const rail = clamp(W * 0.02, 15, 35);
|
|
3014
|
+
const legH = 90;
|
|
3015
|
+
const deck = 300;
|
|
3016
|
+
const mTop = 500;
|
|
3017
|
+
const fold = head + (hd - head) * 0.3;
|
|
3018
|
+
const throwZ = hd - (hd - head) * 0.24;
|
|
3019
|
+
const n = W >= 1200 ? 2 : 1;
|
|
3020
|
+
const pd = clamp(D * 0.17, 120, 380);
|
|
3021
|
+
const leg = clamp(Math.min(W, D) * 0.035, 30, 55);
|
|
3022
|
+
const legs = [head, hd - leg].flatMap((z) => pair(P("wood", -hw, -hw + leg, z, z + leg, 0, legH)));
|
|
3023
|
+
return [
|
|
3024
|
+
P("wood", -hw, hw, -hd, head, 0, 1e3, { axis: "x", radius: hb * 0.45 }),
|
|
3025
|
+
...legs,
|
|
3026
|
+
P("wood", -hw, hw, head, hd, legH, deck, { radius: 12 }),
|
|
3027
|
+
P("linen", -hw + rail, hw - rail, head + 8, hd - rail, deck, mTop, { radius: 45 }),
|
|
3028
|
+
// The duvet, its turned-down sheet at the head and a wool throw across the foot.
|
|
3029
|
+
P("linen", -hw + 6, hw - 6, fold, hd - 6, deck + 70, mTop + 40, { axis: "x", radius: 45 }),
|
|
3030
|
+
P("linen", -hw + 8, hw - 8, fold - 40, fold + 150, mTop + 10, mTop + 62, { axis: "x", round: true }),
|
|
3031
|
+
P("wool", -hw + 2, hw - 2, throwZ, hd - 2, deck + 90, mTop + 52, { axis: "x", radius: 40 }),
|
|
3032
|
+
...span(n, hw - rail - 50, 70).map(
|
|
3033
|
+
([a, b]) => P("linen", a, b, head + 50, head + 50 + pd, mTop, mTop + 120, { axis: "x", radius: 55 })
|
|
3034
|
+
)
|
|
3035
|
+
];
|
|
3036
|
+
},
|
|
3037
|
+
// The plan symbol's arms (`drawSofa`): 8% of the width, held to [0.12, 0.22] of the depth.
|
|
3038
|
+
sofa: (W, D) => upholstered(W, D, Math.min(clamp(W * 0.08, D * 0.12, D * 0.22), W * 0.25)),
|
|
3039
|
+
table(W, D) {
|
|
3040
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3041
|
+
const s = Math.min(W, D);
|
|
3042
|
+
const leg = clamp(s * 0.045, 30, 55);
|
|
3043
|
+
const ins = clamp(s * 0.05, 20, 70);
|
|
3044
|
+
const under = 715;
|
|
3045
|
+
const legs = [-hd + ins, hd - ins - leg].flatMap(
|
|
3046
|
+
(z) => pair(P("wood", -hw + ins, -hw + ins + leg, z, z + leg, 0, under, { radius: leg * 0.3 }))
|
|
3047
|
+
);
|
|
3048
|
+
const a = ins + 8;
|
|
3049
|
+
const apron = hw - a - 20 >= 10 && hd - a - 20 >= 10 ? [
|
|
3050
|
+
P("wood", -hw + a, hw - a, -hd + a, hd - a, 640, under, {
|
|
3051
|
+
holes: [{ x0: -hw + a + 20, x1: hw - a - 20, z0: -hd + a + 20, z1: hd - a - 20 }]
|
|
3052
|
+
})
|
|
3053
|
+
] : [];
|
|
3054
|
+
return [P("wood", -hw, hw, -hd, hd, under, 750, { radius: clamp(s * 0.02, 4, 20) }), ...legs, ...apron];
|
|
3055
|
+
},
|
|
3056
|
+
rug(W, D) {
|
|
3057
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3058
|
+
const b = clamp(Math.min(W, D) * 0.04, 30, 110);
|
|
3059
|
+
if (hw - b < 10 || hd - b < 10) return [P("wool", -hw, hw, -hd, hd, 0, 10)];
|
|
3060
|
+
return [
|
|
3061
|
+
P("wool", -hw + 15, hw - 15, -hd + 15, hd - 15, 0, 10),
|
|
3062
|
+
P("fabric", -hw, hw, -hd, hd, 0, 12, {
|
|
3063
|
+
radius: 15,
|
|
3064
|
+
holes: [{ x0: -hw + b, x1: hw - b, z0: -hd + b, z1: hd - b }]
|
|
3065
|
+
})
|
|
3066
|
+
];
|
|
3067
|
+
},
|
|
3068
|
+
wardrobe(W, D) {
|
|
3069
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3070
|
+
const n = 2 * clamp(Math.round(W / 1e3), 1, MAX_DOORS / 2);
|
|
3071
|
+
const doors = span(n, hw - 8, 4);
|
|
3072
|
+
const fz = hd - 12;
|
|
3073
|
+
return [
|
|
3074
|
+
P("wood_dark", -hw + 20, hw - 20, -hd, hd - 60, 0, 80),
|
|
3075
|
+
P("wood", -hw, hw, -hd, hd - 30, 80, 2100),
|
|
3076
|
+
...doors.map(([a, b]) => P("wood", a, b, hd - 30, fz, 96, 2084)),
|
|
3077
|
+
...doors.map(([a, b], k) => {
|
|
3078
|
+
const x = k % 2 === 0 ? b - 40 : a + 22;
|
|
3079
|
+
return P("metal", x, x + 18, fz, hd, 900, 1340, { radius: 6 });
|
|
3080
|
+
})
|
|
3081
|
+
];
|
|
3082
|
+
},
|
|
3083
|
+
fridge(W, D) {
|
|
3084
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3085
|
+
const fz = hd - 16;
|
|
3086
|
+
const bar2 = Math.min(W * 0.32, 220);
|
|
3087
|
+
return [
|
|
3088
|
+
P("appliance", -hw, hw, -hd, hd - 40, 30, 1800, { radius: 10 }),
|
|
3089
|
+
P("appliance", -hw + 3, hw - 3, hd - 40, fz, 40, 700, { radius: 8 }),
|
|
3090
|
+
P("appliance", -hw + 3, hw - 3, hd - 40, fz, 712, 1790, { radius: 8 }),
|
|
3091
|
+
P("rubber", -hw + 20, hw - 20, -hd, hd - 60, 0, 30),
|
|
3092
|
+
P("metal", -bar2, bar2, fz, hd, 630, 656, { axis: "x", round: true }),
|
|
3093
|
+
P("metal", -bar2, bar2, fz, hd, 756, 782, { axis: "x", round: true })
|
|
3094
|
+
];
|
|
3095
|
+
},
|
|
3096
|
+
counter: (W, D) => cabinet(W, D),
|
|
3097
|
+
kitchen_sink(W, D) {
|
|
3098
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3099
|
+
const ix = hw - clamp(W * 0.15, 40, 120);
|
|
3100
|
+
const iz0 = -hd + clamp(D * 0.25, 60, 160);
|
|
3101
|
+
const iz1 = hd - clamp(D * 0.15, 60, 100);
|
|
3102
|
+
if (ix - 15 < 10 || iz1 - iz0 - 30 < 20 || ix + 10 >= hw || iz1 + 10 >= hd - 40 || iz0 - 10 <= -hd)
|
|
3103
|
+
return cabinet(W, D);
|
|
3104
|
+
const r = clamp(Math.min(ix, (iz1 - iz0) / 2) * 0.15, 5, 40);
|
|
3105
|
+
const hole = { x0: -ix, x1: ix, z0: iz0, z1: iz1, radius: r };
|
|
3106
|
+
const liner = { x0: -ix - 10, x1: ix + 10, z0: iz0 - 10, z1: iz1 + 10, radius: r + 10 };
|
|
3107
|
+
const lip = { x0: -ix + 15, x1: ix - 15, z0: iz0 + 15, z1: iz1 - 15, radius: Math.max(1, r - 15) };
|
|
3108
|
+
const parts = cabinet(W, D, { hole: [hole], carcassTop: 700 });
|
|
3109
|
+
const zc = (-hd + iz0) / 2;
|
|
3110
|
+
return [
|
|
3111
|
+
...parts,
|
|
3112
|
+
P("paint", -hw, hw, -hd, hd - 40, 700, 870, { holes: [liner] }),
|
|
3113
|
+
P("metal", liner.x0, liner.x1, liner.z0, liner.z1, 700, 896, { radius: liner.radius, holes: [lip] }),
|
|
3114
|
+
P("metal", lip.x0 - 5, lip.x1 + 5, lip.z0 - 5, lip.z1 + 5, 690, 715, { radius: lip.radius + 5 }),
|
|
3115
|
+
P("metal", -18, 18, zc - 18, zc + 18, 900, 1160, { round: true }),
|
|
3116
|
+
P("metal", -12, 12, zc, zc + Math.min(200, (iz1 - iz0) * 0.55), 1126, 1150, { axis: "z", round: true })
|
|
3117
|
+
];
|
|
3118
|
+
},
|
|
3119
|
+
stove(W, D) {
|
|
3120
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3121
|
+
const r = Math.min(W, D) * 0.11;
|
|
3122
|
+
const rings = [-1, 1].flatMap(
|
|
3123
|
+
(sx) => [-1, 1].map((sz) => {
|
|
3124
|
+
const [x, z] = [sx * W * 0.22, sz * D * 0.2];
|
|
3125
|
+
return P("metal", x - r, x + r, z - r, z + r, 906, 910, {
|
|
3126
|
+
round: true,
|
|
3127
|
+
holes: [{ x0: x - r * 0.62, x1: x + r * 0.62, z0: z - r * 0.62, z1: z + r * 0.62, round: true }]
|
|
3128
|
+
});
|
|
3129
|
+
})
|
|
3130
|
+
);
|
|
3131
|
+
const bar2 = Math.min(W * 0.32, 220);
|
|
3132
|
+
return [
|
|
3133
|
+
...cabinet(W, D, { fronts: false }),
|
|
3134
|
+
// The built-under oven: an appliance door (the core's `stove` is `appliance`, V-D2) with its
|
|
3135
|
+
// dark window.
|
|
3136
|
+
P("appliance", -hw + 30, hw - 30, hd - 40, hd - 22, 160, 760, { radius: 10 }),
|
|
3137
|
+
P("screen", -hw + W * 0.15, hw - W * 0.15, hd - 22, hd - 18, 300, 640, { axis: "z", radius: 10 }),
|
|
3138
|
+
P("metal", -bar2, bar2, hd - 22, hd - 4, 790, 808, { axis: "x", round: true }),
|
|
3139
|
+
P("screen", -hw + 30, hw - 30, -hd + 30, hd - 50, 900, 906, { radius: 12 }),
|
|
3140
|
+
...rings
|
|
3141
|
+
];
|
|
3142
|
+
},
|
|
3143
|
+
shower(W, D) {
|
|
3144
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3145
|
+
const rim = clamp(Math.min(W, D) * 0.06, 10, 50);
|
|
3146
|
+
const zh = -hd + 20;
|
|
3147
|
+
return [
|
|
3148
|
+
P("ceramic", -hw, hw, -hd, hd, 0, 30),
|
|
3149
|
+
// The tray's rim; a tray too small to leave a basin inside it is one solid slab.
|
|
3150
|
+
P(
|
|
3151
|
+
"ceramic",
|
|
3152
|
+
-hw,
|
|
3153
|
+
hw,
|
|
3154
|
+
-hd,
|
|
3155
|
+
hd,
|
|
3156
|
+
30,
|
|
3157
|
+
60,
|
|
3158
|
+
hw - rim >= 10 && hd - rim >= 10 ? { holes: [{ x0: -hw + rim, x1: hw - rim, z0: -hd + rim, z1: hd - rim }] } : {}
|
|
3159
|
+
),
|
|
3160
|
+
P("metal", -40, 40, -40, 40, 30, 34, { round: true }),
|
|
3161
|
+
P("glass", -hw + 10, hw - 10, hd - 10, hd, 60, 1980),
|
|
3162
|
+
P("metal", -hw, hw, hd - 20, hd, 1980, 2e3, { axis: "x", radius: 6 }),
|
|
3163
|
+
P("metal", -12, 12, zh, zh + 24, 900, 1960, { round: true }),
|
|
3164
|
+
P("metal", -100, 100, zh + 24, zh + 224, 1940, 1960, { round: true })
|
|
3165
|
+
];
|
|
3166
|
+
},
|
|
3167
|
+
wc(W, D) {
|
|
3168
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3169
|
+
const tank = clamp(D * 0.24, 100, 200);
|
|
3170
|
+
const zb = -hd + tank * 0.75;
|
|
3171
|
+
const hole = { x0: -hw * 0.62, x1: hw * 0.62, z0: zb + (hd - zb) * 0.14, z1: hd - (hd - zb) * 0.12, round: true };
|
|
3172
|
+
return [
|
|
3173
|
+
P("ceramic", -hw + 12, hw - 12, -hd, -hd + tank - 10, 380, 770, { radius: 25 }),
|
|
3174
|
+
P("ceramic", -hw, hw, -hd, -hd + tank, 770, 790, { radius: 25 }),
|
|
3175
|
+
P("metal", -22, 22, -hd + tank / 2 - 22, -hd + tank / 2 + 22, 790, 800, { round: true }),
|
|
3176
|
+
P("ceramic", -hw * 0.55, hw * 0.55, zb, hd - (hd - zb) * 0.25, 0, 300, { round: true }),
|
|
3177
|
+
P("ceramic", -hw, hw, zb, hd, 300, 385, { round: true, holes: [hole] }),
|
|
3178
|
+
P("ceramic", -hw, hw, zb, hd, 385, 405, { round: true, holes: [hole] }),
|
|
3179
|
+
P("water", hole.x0 - 8, hole.x1 + 8, hole.z0 - 8, hole.z1 + 8, 300, 335, { round: true })
|
|
3180
|
+
];
|
|
3181
|
+
},
|
|
3182
|
+
...batchTable((f) => f.gen),
|
|
3183
|
+
basin(W, D) {
|
|
3184
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3185
|
+
const z0 = -hd + D * 0.3;
|
|
3186
|
+
const r = clamp(Math.min(W, D) * 0.1, 10, 60);
|
|
3187
|
+
const hole = { x0: -hw * 0.62, x1: hw * 0.62, z0, z1: hd - D * 0.12, radius: r };
|
|
3188
|
+
const zc = (-hd + z0) / 2;
|
|
3189
|
+
return [
|
|
3190
|
+
P("wood", -hw + 15, hw - 15, -hd, hd - 25, 0, 780),
|
|
3191
|
+
...span(2, hw - 18, 4).map(([a, b]) => P("wood", a, b, hd - 25, hd - 8, 40, 760)),
|
|
3192
|
+
P("ceramic", -hw, hw, -hd, hd, 780, 840, { radius: clamp(Math.min(W, D) * 0.05, 5, 30), holes: [hole] }),
|
|
3193
|
+
P("ceramic", hole.x0 - 10, hole.x1 + 10, hole.z0 - 10, hole.z1 + 10, 740, 790, { radius: r + 10 }),
|
|
3194
|
+
P("metal", -16, 16, zc - 16, zc + 16, 840, 990, { round: true }),
|
|
3195
|
+
P("metal", -10, 10, zc, zc + Math.min(140, (hole.z1 - hole.z0) * 0.45), 964, 984, { axis: "z", round: true })
|
|
3196
|
+
];
|
|
3197
|
+
}
|
|
3198
|
+
};
|
|
3199
|
+
var C16 = [
|
|
3200
|
+
1,
|
|
3201
|
+
0.9238795325112867,
|
|
3202
|
+
Math.SQRT1_2,
|
|
3203
|
+
0.3826834323650898,
|
|
3204
|
+
0,
|
|
3205
|
+
-0.3826834323650898,
|
|
3206
|
+
-Math.SQRT1_2,
|
|
3207
|
+
-0.9238795325112867,
|
|
3208
|
+
-1,
|
|
3209
|
+
-0.9238795325112867,
|
|
3210
|
+
-Math.SQRT1_2,
|
|
3211
|
+
-0.3826834323650898,
|
|
3212
|
+
0,
|
|
3213
|
+
0.3826834323650898,
|
|
3214
|
+
Math.SQRT1_2,
|
|
3215
|
+
0.9238795325112867
|
|
3216
|
+
];
|
|
3217
|
+
var S16 = C16.map((_, k) => C16[(k + 12) % 16]);
|
|
3218
|
+
var um = (v) => (v < 0 ? -Math.round(-v * 1e3) : Math.round(v * 1e3)) || 0;
|
|
3219
|
+
function sectionRing(u0, u1, v0, v1, shape = {}) {
|
|
3220
|
+
if (!(u0 < u1 && v0 < v1)) return [];
|
|
3221
|
+
const [cu, cv, ru, rv] = [(u0 + u1) / 2, (v0 + v1) / 2, (u1 - u0) / 2, (v1 - v0) / 2];
|
|
3222
|
+
let pts;
|
|
3223
|
+
if (shape.profile) {
|
|
3224
|
+
if (shape.profile.some(([fu, fv]) => !(fu >= 0 && fu <= 1 && fv >= 0 && fv <= 1)))
|
|
3225
|
+
throw new RangeError("a T0 profile point lies outside [0, 1]\xB2");
|
|
3226
|
+
const at = (f, a, b, c) => f === 0 ? a : f === 1 ? b : c + (f - 0.5) * (b - a);
|
|
3227
|
+
pts = shape.profile.map(([fu, fv]) => [at(fu, u0, u1, cu), at(fv, v0, v1, cv)]);
|
|
3228
|
+
} else if (shape.round) {
|
|
3229
|
+
pts = C16.map((c, k) => [cu + ru * c, cv + rv * S16[k]]);
|
|
3230
|
+
} else if (shape.radius && shape.radius > 0) {
|
|
3231
|
+
const r = Math.max(0, Math.min(shape.radius, ru, rv));
|
|
3232
|
+
const centres = [
|
|
3233
|
+
[u1 - r, v1 - r],
|
|
3234
|
+
[u0 + r, v1 - r],
|
|
3235
|
+
[u0 + r, v0 + r],
|
|
3236
|
+
[u1 - r, v0 + r]
|
|
3237
|
+
];
|
|
3238
|
+
pts = centres.flatMap(
|
|
3239
|
+
([a, b], q) => [0, 1, 2, 3, 4].map((i) => {
|
|
3240
|
+
const k = (4 * q + i) % 16;
|
|
3241
|
+
return [a + r * C16[k], b + r * S16[k]];
|
|
3242
|
+
})
|
|
3243
|
+
);
|
|
3244
|
+
} else {
|
|
3245
|
+
pts = [
|
|
3246
|
+
[u0, v0],
|
|
3247
|
+
[u1, v0],
|
|
3248
|
+
[u1, v1],
|
|
3249
|
+
[u0, v1]
|
|
3250
|
+
];
|
|
3251
|
+
}
|
|
3252
|
+
const ring3 = [];
|
|
3253
|
+
for (const [u, v] of pts) {
|
|
3254
|
+
const p = [um(u), um(v)];
|
|
3255
|
+
const q = ring3[ring3.length - 1];
|
|
3256
|
+
if (!q || q[0] !== p[0] || q[1] !== p[1]) ring3.push(p);
|
|
3257
|
+
}
|
|
3258
|
+
while (ring3.length > 1 && ring3[0]?.[0] === ring3.at(-1)?.[0] && ring3[0]?.[1] === ring3.at(-1)?.[1]) ring3.pop();
|
|
3259
|
+
return ring3;
|
|
3260
|
+
}
|
|
3261
|
+
function partShell(p, dropped) {
|
|
3262
|
+
if (p.axis && p.holes?.length) throw new Error("a sideways T0 part takes no holes");
|
|
3263
|
+
if (!(um(p.x0) < um(p.x1) && um(p.y0) < um(p.y1) && um(p.z0) < um(p.z1))) return null;
|
|
3264
|
+
let s;
|
|
3265
|
+
if (!p.axis) {
|
|
3266
|
+
const outer = sectionRing(p.x0, p.x1, p.z0, p.z1, p);
|
|
3267
|
+
const holes = (p.holes ?? []).map((h) => sectionRing(h.x0, h.x1, h.z0, h.z1, h));
|
|
3268
|
+
const poly = { outer, ...holes.length ? { holes } : {} };
|
|
3269
|
+
s = prism(poly, um(p.y0), um(p.y1));
|
|
3270
|
+
if (s) {
|
|
3271
|
+
if (dropped) dropped.holes += degenerateHoles(poly);
|
|
3272
|
+
} else if (holes.length) {
|
|
3273
|
+
s = prism({ outer }, um(p.y0), um(p.y1));
|
|
3274
|
+
if (s && dropped) dropped.holes += holes.length;
|
|
3275
|
+
}
|
|
3276
|
+
} else {
|
|
3277
|
+
const x = p.axis === "x";
|
|
3278
|
+
const ring3 = x ? sectionRing(p.z0, p.z1, p.y0, p.y1, p) : sectionRing(p.x0, p.x1, p.y0, p.y1, p);
|
|
3279
|
+
const up = x ? prism({ outer: ring3 }, um(p.x0), um(p.x1)) : prism({ outer: ring3 }, um(p.z0), um(p.z1));
|
|
3280
|
+
if (up) {
|
|
3281
|
+
const positions = [];
|
|
3282
|
+
for (let i = 0; i < up.positions.length; i += 3) {
|
|
3283
|
+
const [u, h, v] = [up.positions[i], up.positions[i + 1], up.positions[i + 2]];
|
|
3284
|
+
if (x) positions.push(h, v, u);
|
|
3285
|
+
else positions.push(u, v, h);
|
|
3286
|
+
}
|
|
3287
|
+
const indices = [...up.indices];
|
|
3288
|
+
if (!x) {
|
|
3289
|
+
for (let t = 0; t < indices.length; t += 3) {
|
|
3290
|
+
const b = indices[t + 1];
|
|
3291
|
+
indices[t + 1] = indices[t + 2];
|
|
3292
|
+
indices[t + 2] = b;
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
s = { positions, indices };
|
|
3296
|
+
} else s = null;
|
|
3297
|
+
}
|
|
3298
|
+
if (s && p.mat && p.mat !== "body") s.slot = p.mat;
|
|
3299
|
+
return s;
|
|
3300
|
+
}
|
|
3301
|
+
var MIN_PART_MM = 1;
|
|
3302
|
+
function t0LocalParts(family, W, D) {
|
|
3303
|
+
const gen = GENERATORS[family];
|
|
3304
|
+
if (!gen) return null;
|
|
3305
|
+
const [hw, hd, H] = [W / 2, D / 2, T0_HEIGHT_MM[family] ?? 0];
|
|
3306
|
+
const mount = T0_MOUNT_MM[family];
|
|
3307
|
+
const out = [];
|
|
3308
|
+
for (const p of gen(W, D)) {
|
|
3309
|
+
const q = {
|
|
3310
|
+
...p,
|
|
3311
|
+
x0: Math.max(p.x0, -hw),
|
|
3312
|
+
x1: Math.min(p.x1, hw),
|
|
3313
|
+
z0: Math.max(p.z0, -hd),
|
|
3314
|
+
z1: Math.min(p.z1, hd),
|
|
3315
|
+
y0: Math.max(p.y0, mount ?? 0),
|
|
3316
|
+
y1: Math.min(p.y1, H)
|
|
3317
|
+
};
|
|
3318
|
+
if (q.x1 - q.x0 >= MIN_PART_MM && q.z1 - q.z0 >= MIN_PART_MM && q.y1 - q.y0 >= MIN_PART_MM) out.push(q);
|
|
3319
|
+
}
|
|
3320
|
+
const lowest = Math.min(...out.map((p) => p.y0));
|
|
3321
|
+
if (!isHung(family) && lowest > 0) {
|
|
3322
|
+
for (const p of out) if (p.y0 === lowest) p.y0 = 0;
|
|
3323
|
+
}
|
|
3324
|
+
return out;
|
|
3325
|
+
}
|
|
3326
|
+
var TURN_OVER = [0, 2, 1];
|
|
3327
|
+
function quarter(rotateDeg) {
|
|
3328
|
+
const r = (rotateDeg % 360 + 360) % 360;
|
|
3329
|
+
return r === 0 ? [1, 0] : r === 90 ? [0, 1] : r === 180 ? [-1, 0] : r === 270 ? [0, -1] : null;
|
|
3330
|
+
}
|
|
3331
|
+
function t0Shells(f, floor) {
|
|
3332
|
+
const family = f.asset.startsWith("t0:") ? f.asset.slice(3) : void 0;
|
|
3333
|
+
const cs = quarter(-f.yawDeg);
|
|
3334
|
+
const turned = cs !== null && cs[1] !== 0;
|
|
3335
|
+
const parts = family && cs ? t0LocalParts(family, (turned ? f.size.d : f.size.w) / 1e3, (turned ? f.size.w : f.size.d) / 1e3) : null;
|
|
3336
|
+
if (!parts || !cs) return null;
|
|
3337
|
+
const [c, s] = cs;
|
|
3338
|
+
const [cx, cy] = f.centre;
|
|
3339
|
+
const flip = f.mirror === true;
|
|
3340
|
+
const dropped = { holes: 0 };
|
|
3341
|
+
const shells = parts.map((p) => {
|
|
3342
|
+
const local = partShell(p, dropped);
|
|
3343
|
+
if (!local) return null;
|
|
3344
|
+
const positions = [];
|
|
3345
|
+
for (let i = 0; i < local.positions.length; i += 3) {
|
|
3346
|
+
const [x, y, z] = [
|
|
3347
|
+
flip ? -local.positions[i] || 0 : local.positions[i],
|
|
3348
|
+
local.positions[i + 1],
|
|
3349
|
+
local.positions[i + 2]
|
|
3350
|
+
];
|
|
3351
|
+
positions.push(cx + x * c - z * s, floor + y, cy + x * s + z * c);
|
|
3352
|
+
}
|
|
3353
|
+
const indices = flip ? local.indices.map((_, k, a) => a[k - k % 3 + TURN_OVER[k % 3]]) : local.indices;
|
|
3354
|
+
return { positions, indices, ...local.slot ? { slot: local.slot } : {} };
|
|
3355
|
+
});
|
|
3356
|
+
return { shells, holesDropped: dropped.holes };
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3359
|
+
// src/units.ts
|
|
3360
|
+
function um2(mm) {
|
|
3361
|
+
const v = mm * 1e3;
|
|
3362
|
+
const r = v < 0 ? -Math.round(-v) : Math.round(v);
|
|
3363
|
+
return r === 0 ? 0 : r;
|
|
3364
|
+
}
|
|
3365
|
+
function umPoint(p) {
|
|
3366
|
+
return [um2(p.x), um2(p.y)];
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
// src/walls/ownership.ts
|
|
3370
|
+
import * as core from "@chanmeng666/archlang";
|
|
3371
|
+
import { joinWallSet, loopsToPolygons } from "@chanmeng666/archlang";
|
|
3372
|
+
function signedArea(r) {
|
|
3373
|
+
let s = 0;
|
|
3374
|
+
for (let i = 0; i < r.length; i++) {
|
|
3375
|
+
const a = r[i];
|
|
3376
|
+
const b = r[(i + 1) % r.length];
|
|
3377
|
+
s += a.x * b.y - b.x * a.y;
|
|
3378
|
+
}
|
|
3379
|
+
return s / 2;
|
|
3380
|
+
}
|
|
3381
|
+
function inRing(p, r) {
|
|
3382
|
+
let c = false;
|
|
3383
|
+
for (let i = 0, j = r.length - 1; i < r.length; j = i++) {
|
|
3384
|
+
const a = r[i];
|
|
3385
|
+
const b = r[j];
|
|
3386
|
+
if (a.y > p.y !== b.y > p.y && p.x < (b.x - a.x) * (p.y - a.y) / (b.y - a.y) + a.x) c = !c;
|
|
3387
|
+
}
|
|
3388
|
+
return c;
|
|
3389
|
+
}
|
|
3390
|
+
function piecesOf(rings) {
|
|
3391
|
+
if (rings.length === 0) return [];
|
|
3392
|
+
const largest = rings.reduce((a, b) => Math.abs(signedArea(b)) > Math.abs(signedArea(a)) ? b : a);
|
|
3393
|
+
const outerSign = Math.sign(signedArea(largest));
|
|
3394
|
+
const outers = rings.filter((r) => Math.sign(signedArea(r)) === outerSign);
|
|
3395
|
+
const holes = rings.filter((r) => Math.sign(signedArea(r)) !== outerSign);
|
|
3396
|
+
return outers.map((outer) => ({ outer, holes: holes.filter((h) => inRing(h[0], outer)) }));
|
|
3397
|
+
}
|
|
3398
|
+
var pieceArea = (p) => Math.abs(signedArea(p.outer)) - p.holes.reduce((s, h) => s + Math.abs(signedArea(h)), 0);
|
|
3399
|
+
function wallOwnership(walls, tessellate = loopsToPolygons) {
|
|
3400
|
+
if (walls.length === 0) return { owned: [], fillArea: 0, cuts: [], outline: [] };
|
|
3401
|
+
const groups = [...new Set(walls.map((w) => core.hatchKey(core.hatchOf(w))))];
|
|
3402
|
+
const faces = walls.map((_, i) => String(i));
|
|
3403
|
+
const solid = walls.map((w) => ({ ...w, openings: [] }));
|
|
3404
|
+
const index = new Map(solid.map((w, i) => [w, i]));
|
|
3405
|
+
const joined = joinWallSet(solid, groups, { faceOf: (w) => String(index.get(w)), faces });
|
|
3406
|
+
const slotted = new Map(walls.map((w, i) => [w, i]));
|
|
3407
|
+
const withCuts = joinWallSet(walls, groups, { faceOf: (w) => String(slotted.get(w)), faces });
|
|
3408
|
+
const fillArea = (joined?.result.fills ?? []).reduce(
|
|
3409
|
+
(s, f) => s + tessellate(f.loops).reduce((t, r) => t + signedArea(r), 0),
|
|
3410
|
+
0
|
|
3411
|
+
);
|
|
3412
|
+
const byFace = (fills) => {
|
|
3413
|
+
const m = /* @__PURE__ */ new Map();
|
|
3414
|
+
for (const sf of fills) m.set(Number(sf.face), [...m.get(Number(sf.face)) ?? [], ...tessellate(sf.loops)]);
|
|
3415
|
+
return m;
|
|
3416
|
+
};
|
|
3417
|
+
const rings = byFace(joined?.result.split?.fills ?? []);
|
|
3418
|
+
const bodies = byFace(withCuts?.result.split?.fills ?? []);
|
|
3419
|
+
const owned = walls.map((wall2, i) => {
|
|
3420
|
+
const pieces = piecesOf(rings.get(i) ?? []);
|
|
3421
|
+
return {
|
|
3422
|
+
index: i,
|
|
3423
|
+
wall: wall2,
|
|
3424
|
+
pieces,
|
|
3425
|
+
body: piecesOf(bodies.get(i) ?? []),
|
|
3426
|
+
area: pieces.reduce((s, p) => s + pieceArea(p), 0)
|
|
3427
|
+
};
|
|
3428
|
+
});
|
|
3429
|
+
const outlineRings = tessellate(joined?.result.outline ?? []);
|
|
3430
|
+
const outline = piecesOf(outlineRings).map((p) => p.outer);
|
|
3431
|
+
return { owned, fillArea: Math.abs(fillArea), cuts: withCuts?.cuts ?? [], outline };
|
|
3432
|
+
}
|
|
3433
|
+
function segDist(p, a, b) {
|
|
3434
|
+
const dx = b.x - a.x;
|
|
3435
|
+
const dy = b.y - a.y;
|
|
3436
|
+
const len2 = dx * dx + dy * dy;
|
|
3437
|
+
const t = len2 === 0 ? 0 : Math.max(0, Math.min(1, ((p.x - a.x) * dx + (p.y - a.y) * dy) / len2));
|
|
3438
|
+
return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy));
|
|
3439
|
+
}
|
|
3440
|
+
var ringsOf = (p) => [p.outer, ...p.holes];
|
|
3441
|
+
var TOUCH_TOL_MM = 0.02;
|
|
3442
|
+
function piecesTouch(a, b, tol = TOUCH_TOL_MM) {
|
|
3443
|
+
const near = (p, rs) => rs.some((r) => r.some((q, i) => segDist(p, q, r[(i + 1) % r.length]) <= tol));
|
|
3444
|
+
return ringsOf(a).some((r) => r.some((p) => near(p, ringsOf(b)))) || ringsOf(b).some((r) => r.some((p) => near(p, ringsOf(a))));
|
|
3445
|
+
}
|
|
3446
|
+
var NOTCH_MIN_MM2 = 1;
|
|
3447
|
+
function mixedHeightJoints(own) {
|
|
3448
|
+
const out = [];
|
|
3449
|
+
const { owned } = own;
|
|
3450
|
+
const solo = /* @__PURE__ */ new Map();
|
|
3451
|
+
const soloArea = (w) => {
|
|
3452
|
+
const v = solo.get(w.index) ?? wallOwnership([w.wall]).owned[0]?.area ?? 0;
|
|
3453
|
+
solo.set(w.index, v);
|
|
3454
|
+
return v;
|
|
3455
|
+
};
|
|
3456
|
+
for (let i = 0; i < owned.length; i++) {
|
|
3457
|
+
for (let j = i + 1; j < owned.length; j++) {
|
|
3458
|
+
const a = owned[i];
|
|
3459
|
+
const b = owned[j];
|
|
3460
|
+
if (a.wall.height === b.wall.height) continue;
|
|
3461
|
+
if (!a.pieces.some((p) => b.pieces.some((q) => piecesTouch(p, q)))) continue;
|
|
3462
|
+
const [lower, taller] = a.wall.height < b.wall.height ? [a, b] : [b, a];
|
|
3463
|
+
const pair2 = wallOwnership(a.index < b.index ? [a.wall, b.wall] : [b.wall, a.wall]);
|
|
3464
|
+
const kept = pair2.owned.find((o) => o.wall === taller.wall)?.area ?? 0;
|
|
3465
|
+
const lost = soloArea(taller) - kept;
|
|
3466
|
+
if (!(lost > NOTCH_MIN_MM2)) continue;
|
|
3467
|
+
out.push({
|
|
3468
|
+
code: "W3D_MIXED_HEIGHT_JOINT",
|
|
3469
|
+
owner: { id: lower.wall.id, height: lower.wall.height },
|
|
3470
|
+
notched: { id: taller.wall.id, height: taller.wall.height },
|
|
3471
|
+
lostMm2: Math.round(lost),
|
|
3472
|
+
message: `Wall ${lower.wall.id} (${lower.wall.height} mm high) owns ${Math.round(lost)} mm\xB2 of the taller wall ${taller.wall.id}'s footprint (${taller.wall.height} mm), so the taller wall is notched where they meet.`
|
|
3473
|
+
});
|
|
3474
|
+
}
|
|
3475
|
+
}
|
|
3476
|
+
return out;
|
|
3477
|
+
}
|
|
3478
|
+
|
|
3479
|
+
// src/scene3d/overlap.ts
|
|
3480
|
+
import earcut2 from "earcut";
|
|
3481
|
+
var FLOOR_OVERLAP_MIN_UM2 = 1e8;
|
|
3482
|
+
var FLOOR_LIFT_UM = 500;
|
|
3483
|
+
function triangles(p) {
|
|
3484
|
+
const rings = [p.outer, ...p.holes ?? []];
|
|
3485
|
+
const flat = [];
|
|
3486
|
+
const holes = [];
|
|
3487
|
+
rings.forEach((r, i) => {
|
|
3488
|
+
if (i > 0) holes.push(flat.length / 2);
|
|
3489
|
+
for (const q of r) flat.push(q[0], q[1]);
|
|
3490
|
+
});
|
|
3491
|
+
const ix = earcut2(flat, holes, 2);
|
|
3492
|
+
const pt2 = (i) => [flat[2 * i], flat[2 * i + 1]];
|
|
3493
|
+
const out = [];
|
|
3494
|
+
for (let t = 0; t < ix.length; t += 3)
|
|
3495
|
+
out.push([pt2(ix[t]), pt2(ix[t + 1]), pt2(ix[t + 2])]);
|
|
3496
|
+
return out;
|
|
3497
|
+
}
|
|
3498
|
+
var cross = (o, a, b) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
|
|
3499
|
+
var areaOf = (r) => {
|
|
3500
|
+
let s = 0;
|
|
3501
|
+
for (let i = 0; i < r.length; i++) s += cross([0, 0], r[i], r[(i + 1) % r.length]);
|
|
3502
|
+
return Math.abs(s) / 2;
|
|
3503
|
+
};
|
|
3504
|
+
function triOverlap(a, b) {
|
|
3505
|
+
const clip = cross(b[0], b[1], b[2]) > 0 ? b : [b[0], b[2], b[1]];
|
|
3506
|
+
let poly = a.map((p) => [p[0], p[1]]);
|
|
3507
|
+
for (let k = 0; k < 3 && poly.length > 0; k++) {
|
|
3508
|
+
const e0 = clip[k];
|
|
3509
|
+
const e1 = clip[(k + 1) % 3];
|
|
3510
|
+
const input = poly;
|
|
3511
|
+
poly = [];
|
|
3512
|
+
for (let i = 0; i < input.length; i++) {
|
|
3513
|
+
const p = input[i];
|
|
3514
|
+
const q = input[(i + 1) % input.length];
|
|
3515
|
+
const sp = cross(e0, e1, p);
|
|
3516
|
+
const sq = cross(e0, e1, q);
|
|
3517
|
+
if (sp >= 0) poly.push(p);
|
|
3518
|
+
if (sp >= 0 !== sq >= 0) {
|
|
3519
|
+
const t = sp / (sp - sq);
|
|
3520
|
+
poly.push([
|
|
3521
|
+
p[0] + (q[0] - p[0]) * t,
|
|
3522
|
+
p[1] + (q[1] - p[1]) * t
|
|
3523
|
+
]);
|
|
3524
|
+
}
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
return poly.length >= 3 ? areaOf(poly) : 0;
|
|
3528
|
+
}
|
|
3529
|
+
var bboxOf = (ps) => [
|
|
3530
|
+
Math.min(...ps.map((p) => p[0])),
|
|
3531
|
+
Math.min(...ps.map((p) => p[1])),
|
|
3532
|
+
Math.max(...ps.map((p) => p[0])),
|
|
3533
|
+
Math.max(...ps.map((p) => p[1]))
|
|
3534
|
+
];
|
|
3535
|
+
var apart = (a, b) => a[2] <= b[0] || b[2] <= a[0] || a[3] <= b[1] || b[3] <= a[1];
|
|
3536
|
+
function overlapArea(p, q) {
|
|
3537
|
+
if (apart(bboxOf(p.outer), bboxOf(q.outer))) return 0;
|
|
3538
|
+
const tq = triangles(q).map((t) => [t, bboxOf(t)]);
|
|
3539
|
+
let s = 0;
|
|
3540
|
+
for (const t of triangles(p)) {
|
|
3541
|
+
const bt = bboxOf(t);
|
|
3542
|
+
for (const [u, bu] of tq) if (!apart(bt, bu)) s += triOverlap(t, u);
|
|
3543
|
+
}
|
|
3544
|
+
return s;
|
|
3545
|
+
}
|
|
3546
|
+
function floorOverlaps(floors) {
|
|
3547
|
+
const out = [];
|
|
3548
|
+
for (let j = 1; j < floors.length; j++) {
|
|
3549
|
+
for (let i = 0; i < j; i++) {
|
|
3550
|
+
const [a, b] = [floors[i], floors[j]];
|
|
3551
|
+
const area = overlapArea(a.polygon, b.polygon);
|
|
3552
|
+
if (!(area > FLOOR_OVERLAP_MIN_UM2)) continue;
|
|
3553
|
+
const mm2 = Math.round(area / 1e6);
|
|
3554
|
+
out.push({
|
|
3555
|
+
code: "W3D_FLOOR_OVERLAP",
|
|
3556
|
+
rooms: [a.id, b.id],
|
|
3557
|
+
areaMm2: mm2,
|
|
3558
|
+
message: `Rooms ${a.id} and ${b.id} overlap by ${mm2} mm\xB2; ${b.id}'s floor is lifted 0.5 mm above ${a.id}'s so the two never draw in the same plane.`
|
|
3559
|
+
});
|
|
3560
|
+
}
|
|
3561
|
+
}
|
|
3562
|
+
return out;
|
|
3563
|
+
}
|
|
3564
|
+
function floorLifts(floors, overlaps) {
|
|
3565
|
+
const steps = /* @__PURE__ */ new Map();
|
|
3566
|
+
for (const f of floors) {
|
|
3567
|
+
const below = overlaps.filter((o) => o.rooms[1] === f.id).map((o) => steps.get(o.rooms[0]) ?? 0);
|
|
3568
|
+
steps.set(f.id, below.length > 0 ? 1 + Math.max(...below) : 0);
|
|
3569
|
+
}
|
|
3570
|
+
return new Map([...steps].filter(([, s]) => s > 0).map(([id2, s]) => [id2, s * FLOOR_LIFT_UM]));
|
|
3571
|
+
}
|
|
3572
|
+
|
|
3573
|
+
// package.json
|
|
3574
|
+
var version = "0.2.0";
|
|
3575
|
+
|
|
3576
|
+
// src/scene3d/build.ts
|
|
3577
|
+
import {
|
|
3578
|
+
doorLeaves,
|
|
3579
|
+
doorSwing
|
|
3580
|
+
} from "@chanmeng666/archlang";
|
|
3581
|
+
|
|
3582
|
+
// src/curves.ts
|
|
3583
|
+
var DEFAULT_CURVE_TOL_MM = 2;
|
|
3584
|
+
var MIN_CHORDS = 4;
|
|
3585
|
+
var MAX_CHORDS = 720;
|
|
3586
|
+
function chordCount(r, sweep, tol) {
|
|
3587
|
+
const step = tol >= r ? Math.PI / 2 : 2 * Math.acos(1 - tol / r);
|
|
3588
|
+
return Math.min(MAX_CHORDS, Math.max(MIN_CHORDS, Math.ceil(Math.abs(sweep) / step)));
|
|
3589
|
+
}
|
|
3590
|
+
function arcPoints(arc, tol) {
|
|
3591
|
+
const n = chordCount(arc.r, arc.sweep, tol);
|
|
3592
|
+
const out = [arc.a];
|
|
3593
|
+
for (let i = 1; i < n; i++) {
|
|
3594
|
+
const t = arc.start + arc.sweep * i / n;
|
|
3595
|
+
out.push({ x: arc.center.x + arc.r * Math.cos(t), y: arc.center.y + arc.r * Math.sin(t) });
|
|
3596
|
+
}
|
|
3597
|
+
return out;
|
|
3598
|
+
}
|
|
3599
|
+
function tessellateLoops(loops, tol = DEFAULT_CURVE_TOL_MM) {
|
|
3600
|
+
return loops.map((loop) => loop.flatMap((e) => e.t === "line" ? [e.a] : arcPoints(e.arc, tol)));
|
|
3601
|
+
}
|
|
3602
|
+
function circleRing(c, r, tol = DEFAULT_CURVE_TOL_MM) {
|
|
3603
|
+
const n = chordCount(r, 2 * Math.PI, tol);
|
|
3604
|
+
return Array.from({ length: n }, (_, i) => {
|
|
3605
|
+
const t = 2 * Math.PI * i / n;
|
|
3606
|
+
return { x: c.x + r * Math.cos(t), y: c.y + r * Math.sin(t) };
|
|
3607
|
+
});
|
|
3608
|
+
}
|
|
3609
|
+
|
|
3610
|
+
// src/scene3d/build.ts
|
|
3611
|
+
var ARCHLANG_3D_VERSION = version;
|
|
3612
|
+
var ring = (r) => r.map(umPoint);
|
|
3613
|
+
var source = (e) => e.span ? { kind: e.kind, id: e.id, span: [e.span.start, e.span.end] } : { kind: e.kind, id: e.id };
|
|
3614
|
+
var rectRing = (at, size) => [
|
|
3615
|
+
{ x: at.x, y: at.y },
|
|
3616
|
+
{ x: at.x + size.w, y: at.y },
|
|
3617
|
+
{ x: at.x + size.w, y: at.y + size.h },
|
|
3618
|
+
{ x: at.x, y: at.y + size.h }
|
|
3619
|
+
];
|
|
3620
|
+
var polygon = (outer, holes = []) => holes.length > 0 ? { outer: ring(outer), holes: holes.map(ring) } : { outer: ring(outer) };
|
|
3621
|
+
var box = (e) => ({
|
|
3622
|
+
id: e.id,
|
|
3623
|
+
source: source(e),
|
|
3624
|
+
at: umPoint(e.at),
|
|
3625
|
+
size: { w: um2(e.size.w), h: um2(e.size.h) }
|
|
3626
|
+
});
|
|
3627
|
+
function floorOf(r, tol) {
|
|
3628
|
+
const outer = r.circle ? circleRing(r.circle.c, r.circle.r, tol) : r.poly ?? rectRing(r.at, r.size);
|
|
3629
|
+
return { id: r.id, source: source(r), polygon: polygon(outer), ...r.uses?.length ? { uses: [...r.uses] } : {} };
|
|
3630
|
+
}
|
|
3631
|
+
function furnitureOf(f, mirrored, ledger) {
|
|
3632
|
+
const rotate = f.rotate ?? 0;
|
|
3633
|
+
let asset = assetFor(f.category);
|
|
3634
|
+
const turned = Math.abs(rotate % 180) === 90;
|
|
3635
|
+
const [w, d] = turned ? [f.size.h, f.size.w] : [f.size.w, f.size.h];
|
|
3636
|
+
const handed = isHandedAsset(asset) && handedAt(asset.slice("t0:".length), w, d);
|
|
3637
|
+
if (handed && mirrored === null) {
|
|
3638
|
+
asset = "greybox";
|
|
3639
|
+
ledger.push({
|
|
3640
|
+
kind: "furniture",
|
|
3641
|
+
id: f.id,
|
|
3642
|
+
field: "asset",
|
|
3643
|
+
value: "greybox",
|
|
3644
|
+
provenance: "default",
|
|
3645
|
+
rule: "furniture-handed-mirror-unknown"
|
|
3646
|
+
});
|
|
3647
|
+
}
|
|
3648
|
+
return {
|
|
3649
|
+
id: f.id,
|
|
3650
|
+
source: source(f),
|
|
3651
|
+
category: f.category,
|
|
3652
|
+
...f.room ? { room: f.room } : {},
|
|
3653
|
+
centre: umPoint({ x: f.at.x + f.size.w / 2, y: f.at.y + f.size.h / 2 }),
|
|
3654
|
+
size: { w: um2(f.size.w), d: um2(f.size.h) },
|
|
3655
|
+
yawDeg: rotate === 0 ? 0 : -rotate,
|
|
3656
|
+
asset,
|
|
3657
|
+
...handed && mirrored?.has(f.id) ? { mirror: true } : {}
|
|
3658
|
+
};
|
|
3659
|
+
}
|
|
3660
|
+
function outdoorOf(o) {
|
|
3661
|
+
return {
|
|
3662
|
+
id: o.id,
|
|
3663
|
+
source: source(o),
|
|
3664
|
+
surface: o.surface,
|
|
3665
|
+
polygon: polygon(o.poly ?? rectRing(o.at, o.size)),
|
|
3666
|
+
...o.rail?.length ? { rail: [...o.rail] } : {}
|
|
3667
|
+
};
|
|
3668
|
+
}
|
|
3669
|
+
var fenceOf = (f) => ({
|
|
3670
|
+
id: f.id,
|
|
3671
|
+
source: source(f),
|
|
3672
|
+
style: f.style,
|
|
3673
|
+
points: f.points.map(umPoint),
|
|
3674
|
+
closed: f.closed
|
|
3675
|
+
});
|
|
3676
|
+
var stairOf = (s) => ({
|
|
3677
|
+
id: s.id,
|
|
3678
|
+
source: source(s),
|
|
3679
|
+
box: box(s),
|
|
3680
|
+
dir: s.dir,
|
|
3681
|
+
width: um2(s.width)
|
|
3682
|
+
});
|
|
3683
|
+
function wallsAndOpenings(ir, byId, tol) {
|
|
3684
|
+
const own = wallOwnership(ir.walls, (loops) => tessellateLoops(loops, tol));
|
|
3685
|
+
const cutsOf = /* @__PURE__ */ new Map();
|
|
3686
|
+
const openings = [];
|
|
3687
|
+
for (const cut of own.cuts) {
|
|
3688
|
+
const host = ir.walls[cut.wall];
|
|
3689
|
+
const op = cut.opening;
|
|
3690
|
+
const id2 = op.ownerId;
|
|
3691
|
+
if (!host || !id2) continue;
|
|
3692
|
+
const el = byId.get(id2);
|
|
3693
|
+
const kind = op.kind ?? (el?.kind === "door" || el?.kind === "window" || el?.kind === "opening" ? el.kind : "opening");
|
|
3694
|
+
const outer = tessellateLoops([cut.loop], tol)[0] ?? [];
|
|
3695
|
+
const sill = op.sill;
|
|
3696
|
+
const head = op.head ?? (el && "head" in el ? el.head : void 0);
|
|
3697
|
+
if (sill === void 0 || head === void 0) continue;
|
|
3698
|
+
const door = el?.kind === "door" ? el : void 0;
|
|
3699
|
+
const hosted = el;
|
|
3700
|
+
const jambs = jambsOf(op.at, op.width, hosted?.host ?? null);
|
|
3701
|
+
const leaves = door ? doorLeaves(door).map((l) => [umPoint(l.hinge), umPoint(l.farJamb), umPoint(l.leafEnd)]) : [];
|
|
3702
|
+
openings.push({
|
|
3703
|
+
id: id2,
|
|
3704
|
+
source: el ? source(el) : { kind, id: id2 },
|
|
3705
|
+
kind,
|
|
3706
|
+
...door?.doorKind ? { doorKind: door.doorKind } : door ? { doorKind: "hinged" } : {},
|
|
3707
|
+
host: host.id,
|
|
3708
|
+
cut: ring(outer),
|
|
3709
|
+
centre: umPoint(op.at),
|
|
3710
|
+
jambs,
|
|
3711
|
+
...leaves.length > 0 ? { leaves } : {},
|
|
3712
|
+
width: um2(op.width),
|
|
3713
|
+
sill: um2(sill),
|
|
3714
|
+
head: um2(head),
|
|
3715
|
+
...door ? { hinge: door.hinge, swing: door.swing } : {},
|
|
3716
|
+
...door?.slide ? { slide: door.slide } : {}
|
|
3717
|
+
});
|
|
3718
|
+
cutsOf.set(cut.wall, [...cutsOf.get(cut.wall) ?? [], id2]);
|
|
3719
|
+
}
|
|
3720
|
+
const walls = own.owned.map((o) => ({
|
|
3721
|
+
id: o.wall.id,
|
|
3722
|
+
source: source(o.wall),
|
|
3723
|
+
category: o.wall.category,
|
|
3724
|
+
material: o.wall.material,
|
|
3725
|
+
footprint: o.pieces.map((p) => polygon(p.outer, p.holes)),
|
|
3726
|
+
body: o.body.map((p) => polygon(p.outer, p.holes)),
|
|
3727
|
+
height: um2(o.wall.height),
|
|
3728
|
+
thickness: um2(o.wall.thickness),
|
|
3729
|
+
cuts: cutsOf.get(o.index) ?? []
|
|
3730
|
+
}));
|
|
3731
|
+
return { walls, openings, footprint: own.outline.map(ring) };
|
|
3732
|
+
}
|
|
3733
|
+
function demolishedOf(ir, standing, ledger, tol) {
|
|
3734
|
+
const gone = (ir.drawn?.walls ?? []).filter((w) => w.status === "demolish");
|
|
3735
|
+
if (gone.length === 0) return [];
|
|
3736
|
+
const own = wallOwnership([...ir.walls, ...gone], (loops) => tessellateLoops(loops, tol));
|
|
3737
|
+
return own.owned.slice(ir.walls.length).flatMap((o) => {
|
|
3738
|
+
const pieces = o.pieces.map((p) => polygon(p.outer, p.holes));
|
|
3739
|
+
if (pieces.length === 0) return [];
|
|
3740
|
+
const overlap = pieces.reduce(
|
|
3741
|
+
(s, p) => s + standing.reduce((t, w) => t + w.footprint.reduce((u, q) => u + overlapArea(p, q), 0), 0),
|
|
3742
|
+
0
|
|
3743
|
+
);
|
|
3744
|
+
if (overlap > FLOOR_OVERLAP_MIN_UM2) {
|
|
3745
|
+
ledger.push({
|
|
3746
|
+
kind: "wall",
|
|
3747
|
+
id: o.wall.id,
|
|
3748
|
+
field: "status",
|
|
3749
|
+
value: `ghost overlaps a thinner standing wall by ${Math.round(overlap / 1e6)} mm\xB2`,
|
|
3750
|
+
provenance: "default",
|
|
3751
|
+
rule: "wall-demolish-overlap"
|
|
3752
|
+
});
|
|
3753
|
+
}
|
|
3754
|
+
return [
|
|
3755
|
+
{
|
|
3756
|
+
id: o.wall.id,
|
|
3757
|
+
source: source(o.wall),
|
|
3758
|
+
category: o.wall.category,
|
|
3759
|
+
material: o.wall.material,
|
|
3760
|
+
footprint: pieces,
|
|
3761
|
+
body: pieces,
|
|
3762
|
+
height: um2(o.wall.height),
|
|
3763
|
+
thickness: um2(o.wall.thickness),
|
|
3764
|
+
cuts: []
|
|
3765
|
+
}
|
|
3766
|
+
];
|
|
3767
|
+
});
|
|
3768
|
+
}
|
|
3769
|
+
function jambsOf(at, width, host) {
|
|
3770
|
+
const s = host ? doorSwing({ at, width, hinge: "left", swing: "in", host }) : null;
|
|
3771
|
+
return s ? [umPoint(s.hinge), umPoint(s.farJamb)] : [umPoint(at), umPoint(at)];
|
|
3772
|
+
}
|
|
3773
|
+
function levelOf(s, ledger, tol, mirrored) {
|
|
3774
|
+
const { ir } = s;
|
|
3775
|
+
const els = ir.elements;
|
|
3776
|
+
const byId = new Map(els.map((e) => [e.id, e]));
|
|
3777
|
+
const of = (k) => els.filter((e) => e.kind === k);
|
|
3778
|
+
const { walls, openings, footprint } = wallsAndOpenings(ir, byId, tol);
|
|
3779
|
+
const demolished = demolishedOf(ir, walls, ledger, tol);
|
|
3780
|
+
for (const w of demolished) {
|
|
3781
|
+
ledger.push({
|
|
3782
|
+
kind: "wall",
|
|
3783
|
+
id: w.id,
|
|
3784
|
+
field: "status",
|
|
3785
|
+
value: "demolish",
|
|
3786
|
+
provenance: "authored",
|
|
3787
|
+
rule: "wall-demolish-ghost"
|
|
3788
|
+
});
|
|
3789
|
+
}
|
|
3790
|
+
const rooms = of("room").map((r) => floorOf(r, tol));
|
|
3791
|
+
const lifts = floorLifts(rooms, floorOverlaps(rooms));
|
|
3792
|
+
const floors = rooms.map((f) => {
|
|
3793
|
+
const lift = lifts.get(f.id);
|
|
3794
|
+
if (lift === void 0) return f;
|
|
3795
|
+
ledger.push({
|
|
3796
|
+
kind: "floor",
|
|
3797
|
+
id: f.id,
|
|
3798
|
+
field: "lift_mm",
|
|
3799
|
+
value: lift / 1e3,
|
|
3800
|
+
provenance: "derived",
|
|
3801
|
+
rule: "floor-overlap-lift"
|
|
3802
|
+
});
|
|
3803
|
+
return { ...f, lift };
|
|
3804
|
+
});
|
|
3805
|
+
const roofs = of("roof").map((r) => ({
|
|
3806
|
+
id: r.id,
|
|
3807
|
+
source: source(r),
|
|
3808
|
+
form: "flat",
|
|
3809
|
+
ring: ring(r.ring),
|
|
3810
|
+
provenance: "default"
|
|
3811
|
+
}));
|
|
3812
|
+
for (const r of roofs) {
|
|
3813
|
+
ledger.push({
|
|
3814
|
+
kind: "roof",
|
|
3815
|
+
id: r.id,
|
|
3816
|
+
field: "form",
|
|
3817
|
+
value: "flat",
|
|
3818
|
+
provenance: "default",
|
|
3819
|
+
rule: "roof-default-flat"
|
|
3820
|
+
});
|
|
3821
|
+
}
|
|
3822
|
+
for (const k of ["elevator", "escalator"]) {
|
|
3823
|
+
for (const e of of(k)) {
|
|
3824
|
+
ledger.push({
|
|
3825
|
+
kind: k,
|
|
3826
|
+
id: e.id,
|
|
3827
|
+
field: "geometry",
|
|
3828
|
+
value: "omitted",
|
|
3829
|
+
provenance: "default",
|
|
3830
|
+
rule: "v0-omits-vertical-transport"
|
|
3831
|
+
});
|
|
3832
|
+
}
|
|
3833
|
+
}
|
|
3834
|
+
return {
|
|
3835
|
+
level: s.level,
|
|
3836
|
+
...s.name ? { name: s.name } : {},
|
|
3837
|
+
elevation: um2(ir.elevation),
|
|
3838
|
+
storeyHeight: um2(ir.storeyHeight),
|
|
3839
|
+
footprint,
|
|
3840
|
+
floors,
|
|
3841
|
+
walls,
|
|
3842
|
+
...demolished.length > 0 ? { demolished } : {},
|
|
3843
|
+
openings,
|
|
3844
|
+
furniture: of("furniture").map((f) => furnitureOf(f, mirrored, ledger)),
|
|
3845
|
+
stairs: of("stair").map(stairOf),
|
|
3846
|
+
voids: of("void").map(box),
|
|
3847
|
+
columns: of("column").map(box),
|
|
3848
|
+
outdoor: of("outdoor").map(outdoorOf),
|
|
3849
|
+
fences: of("fence").map(fenceOf),
|
|
3850
|
+
roofs
|
|
3851
|
+
};
|
|
3852
|
+
}
|
|
3853
|
+
function buildScene3D(storeys, opts) {
|
|
3854
|
+
const first = storeys[0];
|
|
3855
|
+
if (!first) throw new Error("buildScene3D needs at least one storey");
|
|
3856
|
+
const tol = opts.curveTolMm ?? DEFAULT_CURVE_TOL_MM;
|
|
3857
|
+
const ledger = [
|
|
3858
|
+
{ kind: "door", field: "pose", value: "closed", provenance: "default", rule: "door-pose-closed" },
|
|
3859
|
+
{
|
|
3860
|
+
kind: "curve",
|
|
3861
|
+
field: "tolerance_mm",
|
|
3862
|
+
value: tol,
|
|
3863
|
+
provenance: opts.curveTolMm === void 0 ? "default" : "user-param",
|
|
3864
|
+
rule: "curve-tol"
|
|
3865
|
+
}
|
|
3866
|
+
];
|
|
3867
|
+
const levels = storeys.map((s, i) => levelOf(s, ledger, tol, opts.mirrored?.[i] ?? null));
|
|
3868
|
+
return {
|
|
3869
|
+
version: 0,
|
|
3870
|
+
kind: "scene3d",
|
|
3871
|
+
meta: {
|
|
3872
|
+
name: first.ir.name,
|
|
3873
|
+
units: "mm",
|
|
3874
|
+
tool: { archlang3d: ARCHLANG_3D_VERSION, archlang: opts.coreVersion },
|
|
3875
|
+
north: typeof first.ir.north === "object" ? first.ir.north.deg : first.ir.north,
|
|
3876
|
+
...first.ir.siteBoundary ? { siteBoundary: ring(first.ir.siteBoundary) } : {},
|
|
3877
|
+
params: { curveTolMm: tol },
|
|
3878
|
+
assumptions: ledger
|
|
3879
|
+
},
|
|
3880
|
+
levels
|
|
3881
|
+
};
|
|
3882
|
+
}
|
|
3883
|
+
|
|
3884
|
+
// src/scene3d/validate.ts
|
|
3885
|
+
var isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
3886
|
+
var fail = (out, path, message) => {
|
|
3887
|
+
out.push({ path, message });
|
|
3888
|
+
};
|
|
3889
|
+
var integer = (v, p, out) => {
|
|
3890
|
+
if (!Number.isInteger(v)) fail(out, p, "must be an integer (micrometres)");
|
|
3891
|
+
};
|
|
3892
|
+
var number = (v, p, out) => {
|
|
3893
|
+
if (typeof v !== "number" || !Number.isFinite(v)) fail(out, p, "must be a finite number");
|
|
3894
|
+
};
|
|
3895
|
+
var string = (v, p, out) => {
|
|
3896
|
+
if (typeof v !== "string") fail(out, p, "must be a string");
|
|
3897
|
+
};
|
|
3898
|
+
var id = (v, p, out) => {
|
|
3899
|
+
if (typeof v !== "string" || v.length === 0) fail(out, p, "must be a non-empty string");
|
|
3900
|
+
};
|
|
3901
|
+
var boolean = (v, p, out) => {
|
|
3902
|
+
if (typeof v !== "boolean") fail(out, p, "must be a boolean");
|
|
3903
|
+
};
|
|
3904
|
+
var any = () => {
|
|
3905
|
+
};
|
|
3906
|
+
var record = (v, p, out) => {
|
|
3907
|
+
if (!isObj(v)) fail(out, p, "must be an object");
|
|
3908
|
+
};
|
|
3909
|
+
var oneOf = (...values) => (v, p, out) => {
|
|
3910
|
+
if (!values.includes(v)) fail(out, p, `must be one of ${values.map((x) => JSON.stringify(x)).join(", ")}`);
|
|
3911
|
+
};
|
|
3912
|
+
var either = (...checks) => (v, p, out) => {
|
|
3913
|
+
const ok = checks.some((c) => {
|
|
3914
|
+
const tmp = [];
|
|
3915
|
+
c(v, p, tmp);
|
|
3916
|
+
return tmp.length === 0;
|
|
3917
|
+
});
|
|
3918
|
+
if (!ok) fail(out, p, "matches none of the allowed forms");
|
|
3919
|
+
};
|
|
3920
|
+
var array = (item, min = 0, max = Number.POSITIVE_INFINITY) => (v, p, out) => {
|
|
3921
|
+
if (!Array.isArray(v)) return fail(out, p, "must be an array");
|
|
3922
|
+
if (v.length < min) fail(out, p, `must have at least ${min} items`);
|
|
3923
|
+
if (v.length > max) fail(out, p, `must have at most ${max} items`);
|
|
3924
|
+
v.forEach((x, i) => {
|
|
3925
|
+
item(x, `${p}/${i}`, out);
|
|
3926
|
+
});
|
|
3927
|
+
};
|
|
3928
|
+
var object = (required, optional = {}) => (v, p, out) => {
|
|
3929
|
+
if (!isObj(v)) return fail(out, p, "must be an object");
|
|
3930
|
+
for (const [k, c] of Object.entries(required)) {
|
|
3931
|
+
if (!(k in v)) fail(out, `${p}/${k}`, "is required");
|
|
3932
|
+
else c(v[k], `${p}/${k}`, out);
|
|
3933
|
+
}
|
|
3934
|
+
for (const [k, c] of Object.entries(optional)) if (k in v) c(v[k], `${p}/${k}`, out);
|
|
3935
|
+
for (const k of Object.keys(v)) {
|
|
3936
|
+
if (!(k in required) && !(k in optional)) fail(out, `${p}/${k}`, "is not a Scene3D field");
|
|
3937
|
+
}
|
|
3938
|
+
};
|
|
3939
|
+
var pt = array(integer, 2, 2);
|
|
3940
|
+
var ring2 = array(pt, 3);
|
|
3941
|
+
var polygon2 = object({ outer: ring2 }, { holes: array(ring2) });
|
|
3942
|
+
var provenance = oneOf("authored", "derived", "default", "user-param");
|
|
3943
|
+
var source2 = object({ kind: string, id: string }, { span: array(integer, 2, 2) });
|
|
3944
|
+
var sized = (a, b) => object({ [a]: integer, [b]: integer });
|
|
3945
|
+
var box2 = object({ id, source: source2, at: pt, size: sized("w", "h") });
|
|
3946
|
+
var wall = object(
|
|
3947
|
+
{
|
|
3948
|
+
id,
|
|
3949
|
+
source: source2,
|
|
3950
|
+
footprint: array(polygon2),
|
|
3951
|
+
body: array(polygon2),
|
|
3952
|
+
height: integer,
|
|
3953
|
+
thickness: integer,
|
|
3954
|
+
cuts: array(string)
|
|
3955
|
+
},
|
|
3956
|
+
{ category: string, material: string }
|
|
3957
|
+
);
|
|
3958
|
+
var LEVEL_COLLECTIONS = {
|
|
3959
|
+
floors: array(object({ id, source: source2, polygon: polygon2 }, { uses: array(string), lift: integer })),
|
|
3960
|
+
walls: array(wall),
|
|
3961
|
+
openings: array(
|
|
3962
|
+
object(
|
|
3963
|
+
{
|
|
3964
|
+
id,
|
|
3965
|
+
source: source2,
|
|
3966
|
+
kind: oneOf("door", "window", "opening"),
|
|
3967
|
+
host: string,
|
|
3968
|
+
cut: ring2,
|
|
3969
|
+
centre: pt,
|
|
3970
|
+
jambs: array(pt, 2, 2),
|
|
3971
|
+
width: integer,
|
|
3972
|
+
sill: integer,
|
|
3973
|
+
head: integer
|
|
3974
|
+
},
|
|
3975
|
+
{
|
|
3976
|
+
doorKind: oneOf("hinged", "sliding", "barn", "bifold", "pocket", "garage", "double", "glazed_sliding"),
|
|
3977
|
+
leaves: array(array(pt, 2, 3)),
|
|
3978
|
+
hinge: oneOf("left", "right"),
|
|
3979
|
+
swing: oneOf("in", "out"),
|
|
3980
|
+
slide: oneOf("left", "right")
|
|
3981
|
+
}
|
|
3982
|
+
)
|
|
3983
|
+
),
|
|
3984
|
+
furniture: array(
|
|
3985
|
+
object(
|
|
3986
|
+
{ id, source: source2, category: string, centre: pt, size: sized("w", "d"), yawDeg: integer, asset: string },
|
|
3987
|
+
{ room: string, mirror: oneOf(true) }
|
|
3988
|
+
)
|
|
3989
|
+
),
|
|
3990
|
+
stairs: array(object({ id, source: source2, box: box2, dir: oneOf("up", "down"), width: integer })),
|
|
3991
|
+
voids: array(box2),
|
|
3992
|
+
columns: array(box2),
|
|
3993
|
+
outdoor: array(object({ id, source: source2, surface: string, polygon: polygon2 }, { rail: array(string) })),
|
|
3994
|
+
fences: array(object({ id, source: source2, style: string, points: array(pt, 2), closed: boolean })),
|
|
3995
|
+
roofs: array(object({ id, source: source2, form: oneOf("flat"), ring: ring2, provenance }))
|
|
3996
|
+
};
|
|
3997
|
+
var level = object(
|
|
3998
|
+
{ level: integer, elevation: integer, storeyHeight: integer, footprint: array(ring2), ...LEVEL_COLLECTIONS },
|
|
3999
|
+
{ name: string, demolished: array(wall) }
|
|
4000
|
+
);
|
|
4001
|
+
var scene = object({
|
|
4002
|
+
version: oneOf(0),
|
|
4003
|
+
kind: oneOf("scene3d"),
|
|
4004
|
+
meta: object(
|
|
4005
|
+
{
|
|
4006
|
+
name: string,
|
|
4007
|
+
units: oneOf("mm"),
|
|
4008
|
+
tool: object({ archlang3d: string, archlang: string }),
|
|
4009
|
+
assumptions: array(object({ kind: string, field: string, value: any, provenance, rule: string }, { id: string }))
|
|
4010
|
+
},
|
|
4011
|
+
{ north: either(oneOf("up", "down", "left", "right"), number), siteBoundary: ring2, params: record }
|
|
4012
|
+
),
|
|
4013
|
+
levels: array(level, 1)
|
|
4014
|
+
});
|
|
4015
|
+
function references(v, out) {
|
|
4016
|
+
const levels = Array.isArray(v.levels) ? v.levels : [];
|
|
4017
|
+
levels.forEach((lv, li) => {
|
|
4018
|
+
if (!isObj(lv)) return;
|
|
4019
|
+
const ids = (k) => (Array.isArray(lv[k]) ? lv[k] : []).map((e) => isObj(e) ? String(e.id) : "");
|
|
4020
|
+
for (const k of [...Object.keys(LEVEL_COLLECTIONS), "demolished"]) {
|
|
4021
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4022
|
+
ids(k).forEach((x, i) => {
|
|
4023
|
+
if (seen.has(x)) fail(out, `/levels/${li}/${k}/${i}/id`, `duplicates id "${x}" in ${k}`);
|
|
4024
|
+
seen.add(x);
|
|
4025
|
+
});
|
|
4026
|
+
}
|
|
4027
|
+
const walls = new Set(ids("walls"));
|
|
4028
|
+
for (const [i, x] of ids("demolished").entries()) {
|
|
4029
|
+
if (walls.has(x)) fail(out, `/levels/${li}/demolished/${i}/id`, `names a standing wall too ("${x}")`);
|
|
4030
|
+
}
|
|
4031
|
+
const openings = new Set(ids("openings"));
|
|
4032
|
+
(Array.isArray(lv.openings) ? lv.openings : []).forEach((o, i) => {
|
|
4033
|
+
if (isObj(o) && !walls.has(String(o.host))) {
|
|
4034
|
+
fail(out, `/levels/${li}/openings/${i}/host`, `names no wall of this level ("${String(o.host)}")`);
|
|
4035
|
+
}
|
|
4036
|
+
});
|
|
4037
|
+
(Array.isArray(lv.demolished) ? lv.demolished : []).forEach((w, i) => {
|
|
4038
|
+
if (isObj(w) && Array.isArray(w.cuts) && w.cuts.length > 0)
|
|
4039
|
+
fail(out, `/levels/${li}/demolished/${i}/cuts`, "a demolished wall hosts nothing");
|
|
4040
|
+
});
|
|
4041
|
+
(Array.isArray(lv.walls) ? lv.walls : []).forEach((w, i) => {
|
|
4042
|
+
if (!isObj(w) || !Array.isArray(w.cuts)) return;
|
|
4043
|
+
w.cuts.forEach((c, j) => {
|
|
4044
|
+
if (!openings.has(String(c)))
|
|
4045
|
+
fail(out, `/levels/${li}/walls/${i}/cuts/${j}`, `names no opening ("${String(c)}")`);
|
|
4046
|
+
});
|
|
4047
|
+
});
|
|
4048
|
+
});
|
|
4049
|
+
}
|
|
4050
|
+
function validateScene3D(v) {
|
|
4051
|
+
const out = [];
|
|
4052
|
+
scene(v, "", out);
|
|
4053
|
+
if (isObj(v)) references(v, out);
|
|
4054
|
+
return out;
|
|
4055
|
+
}
|
|
4056
|
+
|
|
4057
|
+
// src/replay/facts.ts
|
|
4058
|
+
import { describe, lint } from "@chanmeng666/archlang";
|
|
4059
|
+
var round2 = (x) => Math.round(x * 100) / 100;
|
|
4060
|
+
function replayFacts(source3, opts) {
|
|
4061
|
+
const view = opts.view ?? "all";
|
|
4062
|
+
const shown = view === "all" ? [...opts.storeys] : opts.storeys.slice(view - 1, view);
|
|
4063
|
+
if (shown.length === 0) return void 0;
|
|
4064
|
+
const d = describe(source3, opts.world ? { world: opts.world } : {});
|
|
4065
|
+
if (!d.ok) return void 0;
|
|
4066
|
+
const byLevel = d.levels ? d.levels.map((l) => [l.level, l.totals]) : shown.map((n) => [n, d.totals]);
|
|
4067
|
+
const pick = shown.map((n) => byLevel.find(([l]) => l === n)?.[1]);
|
|
4068
|
+
if (pick.some((t) => t === void 0)) return void 0;
|
|
4069
|
+
const totals = pick;
|
|
4070
|
+
const sum = (f) => totals.reduce((a, t) => a + f(t), 0);
|
|
4071
|
+
const nets = totals.map((t) => t.net_floor_area_m2);
|
|
4072
|
+
const warnings = lint(source3, opts.world ? { world: opts.world } : {}).filter(
|
|
4073
|
+
(x) => x.severity === "warning" && (x.level === void 0 || shown.includes(x.level))
|
|
4074
|
+
).length;
|
|
4075
|
+
return {
|
|
4076
|
+
...view === "all" && shown.length > 1 ? { storeys: shown.length } : {},
|
|
4077
|
+
rooms: sum((t) => t.rooms),
|
|
4078
|
+
doors: sum((t) => t.doors),
|
|
4079
|
+
windows: sum((t) => t.windows),
|
|
4080
|
+
areaCentre: round2(sum((t) => t.floor_area_m2)),
|
|
4081
|
+
...nets.every((n) => n !== void 0) ? { areaNet: round2(nets.reduce((a, n) => a + n, 0)) } : {},
|
|
4082
|
+
warnings
|
|
4083
|
+
};
|
|
4084
|
+
}
|
|
4085
|
+
|
|
4086
|
+
export {
|
|
4087
|
+
degenerateHoles,
|
|
4088
|
+
where,
|
|
4089
|
+
prism,
|
|
4090
|
+
rect,
|
|
4091
|
+
slab2d,
|
|
4092
|
+
clipToConvex,
|
|
4093
|
+
insideCut,
|
|
4094
|
+
cutSector,
|
|
4095
|
+
sectorBand,
|
|
4096
|
+
T0_FAMILIES,
|
|
4097
|
+
assetFor,
|
|
4098
|
+
T0_HEIGHT_MM,
|
|
4099
|
+
T0_MOUNT_MM,
|
|
4100
|
+
T0_HUNG_FROM_TOP,
|
|
4101
|
+
isHung,
|
|
4102
|
+
T0_HANDED,
|
|
4103
|
+
handedAt,
|
|
4104
|
+
isHandedAsset,
|
|
4105
|
+
T0_MATERIALS,
|
|
4106
|
+
sectionRing,
|
|
4107
|
+
partShell,
|
|
4108
|
+
t0LocalParts,
|
|
4109
|
+
t0Shells,
|
|
4110
|
+
um2 as um,
|
|
4111
|
+
umPoint,
|
|
4112
|
+
piecesOf,
|
|
4113
|
+
wallOwnership,
|
|
4114
|
+
piecesTouch,
|
|
4115
|
+
mixedHeightJoints,
|
|
4116
|
+
FLOOR_OVERLAP_MIN_UM2,
|
|
4117
|
+
FLOOR_LIFT_UM,
|
|
4118
|
+
overlapArea,
|
|
4119
|
+
floorOverlaps,
|
|
4120
|
+
floorLifts,
|
|
4121
|
+
ARCHLANG_3D_VERSION,
|
|
4122
|
+
buildScene3D,
|
|
4123
|
+
validateScene3D,
|
|
4124
|
+
replayFacts
|
|
4125
|
+
};
|