@chanmeng666/archlang-3d 0.7.0 → 0.8.1
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 +91 -0
- package/README.md +4 -4
- package/dist/browser.d.ts +3 -5
- package/dist/browser.js +87 -472
- package/dist/{camera-CGIIudHj.d.ts → camera-BAsRq_eC.d.ts} +1 -1
- package/dist/{chunk-GXWLZ2KC.js → chunk-33J3YGNF.js} +392 -29
- package/dist/{chunk-QN4LQTVG.js → chunk-CYSES7C3.js} +128 -44
- package/dist/chunk-JQTG6BDR.js +1127 -0
- package/dist/{chunk-TI4RYEOL.js → chunk-LNIVDMPG.js} +75 -5
- package/dist/{chunk-FHBR2U5Z.js → chunk-VMVKI2WQ.js} +65 -3
- package/dist/{chunk-FVD3DZU2.js → chunk-WOEJKIXN.js} +15 -6
- package/dist/cli.js +12 -6
- package/dist/{facts-3wb9egIT.d.ts → facts-CsO0xtFw.d.ts} +1 -1
- package/dist/index.d.ts +104 -35
- package/dist/index.js +19 -5
- package/dist/node.d.ts +23 -7
- package/dist/node.js +4 -4
- package/dist/{strip-Sdsm54Qw.d.ts → payload-DwiB2P7x.d.ts} +232 -12
- package/dist/replay.d.ts +1 -115
- package/dist/scene3d.schema.json +12 -0
- package/dist/viewer.iife.js +180 -180
- package/package.json +3 -3
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
C16,
|
|
3
|
+
S16
|
|
4
|
+
} from "./chunk-LNIVDMPG.js";
|
|
5
|
+
|
|
1
6
|
// src/mesh/extrude.ts
|
|
2
7
|
import earcut from "earcut";
|
|
3
8
|
var area2 = (r) => {
|
|
@@ -1158,8 +1163,93 @@ var T0_LIVING = {
|
|
|
1158
1163
|
P("cushion", -rx * 0.42, rx * 0.42, zs - D * 0.15, zs + D * 0.15, 372, 410, { round: true })
|
|
1159
1164
|
];
|
|
1160
1165
|
}
|
|
1166
|
+
},
|
|
1167
|
+
// ── the new-families batch (product-roadmap RM8.9) ──
|
|
1168
|
+
display_cabinet: {
|
|
1169
|
+
names: ["display_cabinet", "vitrine", "curio_cabinet"],
|
|
1170
|
+
heightMm: 1900,
|
|
1171
|
+
materials: ["wood", "metal", "glass"],
|
|
1172
|
+
gen(W, D) {
|
|
1173
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1174
|
+
const side = W * 0.04;
|
|
1175
|
+
const k = Math.min(W * 0.01, 8);
|
|
1176
|
+
return [
|
|
1177
|
+
P("wood", -hw + W * 0.02, hw - W * 0.02, -hd, hd - D * 0.04, 0, 80),
|
|
1178
|
+
P("wood", -hw, hw, -hd, hd, 80, 120),
|
|
1179
|
+
P("wood", -hw, hw, -hd, -hd + D * 0.06, 120, 1860),
|
|
1180
|
+
...pair(P("wood", -hw, -hw + side, -hd, hd, 120, 1860)),
|
|
1181
|
+
P("wood", -hw, hw, -hd, hd, 1860, 1900),
|
|
1182
|
+
...[700, 1250].map((y) => P("glass", -hw + side, hw - side, -hd + D * 0.06, hd - D * 0.06, y, y + 10)),
|
|
1183
|
+
...span(2, hw - side, 4).map(([a, b]) => P("glass", a, b, hd - D * 0.05, hd - D * 0.02, 130, 1850)),
|
|
1184
|
+
...pair(P("metal", -W * 0.04 - k, -W * 0.04 + k, hd - D * 0.02, hd, 900, 1100))
|
|
1185
|
+
];
|
|
1186
|
+
}
|
|
1187
|
+
},
|
|
1188
|
+
folding_screen: {
|
|
1189
|
+
names: ["folding_screen", "room_divider", "privacy_screen"],
|
|
1190
|
+
heightMm: 1700,
|
|
1191
|
+
materials: ["wood", "fabric"],
|
|
1192
|
+
gen(W, D) {
|
|
1193
|
+
const n = 2 * clamp(Math.round(W / (2.2 * D)), 1, 4);
|
|
1194
|
+
return span(n, W / 2, 0).flatMap(([a, b], k) => {
|
|
1195
|
+
const zig = k % 2 === 0 ? SCREEN_PANEL : SCREEN_PANEL_BACK;
|
|
1196
|
+
const at = (mat, y0, y1) => P(mat, a, b, -D / 2, D / 2, y0, y1, { profile: zig });
|
|
1197
|
+
return [at("wood", 0, 120), at("fabric", 120, 1600), at("wood", 1600, 1700)];
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
},
|
|
1201
|
+
daybed: {
|
|
1202
|
+
names: ["daybed", "day_bed"],
|
|
1203
|
+
heightMm: 750,
|
|
1204
|
+
materials: ["wood_dark", "fabric", "cushion"],
|
|
1205
|
+
gen(W, D) {
|
|
1206
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
1207
|
+
const s = Math.min(W, D);
|
|
1208
|
+
const back = D * 0.2;
|
|
1209
|
+
const arm = Math.min(W * 0.07, D * 0.2);
|
|
1210
|
+
const [c, leg] = [s * 0.04, s * 0.05];
|
|
1211
|
+
const g = s * 0.02;
|
|
1212
|
+
return [
|
|
1213
|
+
...[-hd + c, hd - c - leg].flatMap((z) => pair(P("wood_dark", -hw + c, -hw + c + leg, z, z + leg, 0, 100))),
|
|
1214
|
+
P("fabric", -hw, hw, -hd, hd, 100, 400, { radius: s * 0.03 }),
|
|
1215
|
+
P("fabric", -hw, hw, -hd, -hd + back, 400, 750, { axis: "x", radius: Math.min(back * 0.4, 60) }),
|
|
1216
|
+
...pair(P("fabric", -hw, -hw + arm, -hd, hd, 400, 650, { axis: "z", radius: Math.min(arm * 0.4, 60) })),
|
|
1217
|
+
P("cushion", -hw + arm + g, hw - arm - g, -hd + back + g, hd - g, 400, 520, { radius: s * 0.04 })
|
|
1218
|
+
];
|
|
1219
|
+
}
|
|
1220
|
+
},
|
|
1221
|
+
wall_art: {
|
|
1222
|
+
names: ["wall_art", "artwork", "painting", "picture"],
|
|
1223
|
+
heightMm: 1900,
|
|
1224
|
+
hungFromTop: true,
|
|
1225
|
+
materials: ["wood", "paint"],
|
|
1226
|
+
gen(W, D) {
|
|
1227
|
+
const [hw, hd, H] = [W / 2, D / 2, 1900];
|
|
1228
|
+
const ph = clamp(W * 0.75, 300, 1e3);
|
|
1229
|
+
const fw = Math.min(W * 0.06, ph * 0.08);
|
|
1230
|
+
const zf = hd - D * 0.4;
|
|
1231
|
+
return [
|
|
1232
|
+
P("wood", -hw, hw, -hd, zf, H - ph, H),
|
|
1233
|
+
P("paint", -hw + fw, hw - fw, zf, hd - D * 0.1, H - ph + fw, H - fw),
|
|
1234
|
+
P("wood", -hw, hw, zf, hd, H - fw, H),
|
|
1235
|
+
P("wood", -hw, hw, zf, hd, H - ph, H - ph + fw),
|
|
1236
|
+
...pair(P("wood", -hw, -hw + fw, zf, hd, H - ph + fw, H - fw))
|
|
1237
|
+
];
|
|
1238
|
+
}
|
|
1161
1239
|
}
|
|
1162
1240
|
};
|
|
1241
|
+
var SCREEN_PANEL = [
|
|
1242
|
+
[0, 0],
|
|
1243
|
+
[1, 55 / 64],
|
|
1244
|
+
[1, 1],
|
|
1245
|
+
[0, 9 / 64]
|
|
1246
|
+
];
|
|
1247
|
+
var SCREEN_PANEL_BACK = [
|
|
1248
|
+
[1, 9 / 64],
|
|
1249
|
+
[0, 1],
|
|
1250
|
+
[0, 55 / 64],
|
|
1251
|
+
[1, 0]
|
|
1252
|
+
];
|
|
1163
1253
|
|
|
1164
1254
|
// src/mesh/t0-office.ts
|
|
1165
1255
|
var SHELL = [
|
|
@@ -2489,8 +2579,155 @@ var T0_OUTDOOR = {
|
|
|
2489
2579
|
...seedlings
|
|
2490
2580
|
];
|
|
2491
2581
|
}
|
|
2582
|
+
},
|
|
2583
|
+
// ── the new-families batch (product-roadmap RM8.9) ──
|
|
2584
|
+
pool: {
|
|
2585
|
+
names: ["pool", "swimming_pool", "plunge_pool"],
|
|
2586
|
+
heightMm: 50,
|
|
2587
|
+
materials: ["stone", "water"],
|
|
2588
|
+
// The ground is the viewer's, drawn at floor level, so a pool dug below it would be hidden: the
|
|
2589
|
+
// water is a slab at grade inside the coping, never excavated (visual-language.md § 4.1).
|
|
2590
|
+
defaults: [{ field: "water_mm", value: 20, rule: "pool-water-at-grade" }],
|
|
2591
|
+
gen(W, D) {
|
|
2592
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2593
|
+
const s = Math.min(W, D);
|
|
2594
|
+
const e = s * 0.08;
|
|
2595
|
+
const r = s * 0.03;
|
|
2596
|
+
const d = Math.min(10, e / 2);
|
|
2597
|
+
return [
|
|
2598
|
+
P("stone", -hw, hw, -hd, hd, 0, 50, {
|
|
2599
|
+
radius: s * 0.06,
|
|
2600
|
+
holes: [{ x0: -hw + e, x1: hw - e, z0: -hd + e, z1: hd - e, radius: r }]
|
|
2601
|
+
}),
|
|
2602
|
+
P("water", -hw + e - d, hw - e + d, -hd + e - d, hd - e + d, 0, 20, { radius: r + d })
|
|
2603
|
+
];
|
|
2604
|
+
}
|
|
2605
|
+
},
|
|
2606
|
+
garden_gate: {
|
|
2607
|
+
names: ["garden_gate", "yard_gate"],
|
|
2608
|
+
heightMm: 1200,
|
|
2609
|
+
materials: ["wood", "stone"],
|
|
2610
|
+
gen(W, D) {
|
|
2611
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2612
|
+
const t = Math.min(D * 0.12, W * 0.04);
|
|
2613
|
+
return [
|
|
2614
|
+
P("stone", -hw, hw, -hd, hd, 0, 10),
|
|
2615
|
+
...pair(P("wood", -hw, -hw + t, -hd, -hd + t, 0, 1200)),
|
|
2616
|
+
...span(2, hw - t, Math.min(W * 0.01, 10)).map(
|
|
2617
|
+
([a, b]) => P("wood", a, b, -hd + t * 0.2, -hd + t * 0.8, 60, 1100)
|
|
2618
|
+
)
|
|
2619
|
+
];
|
|
2620
|
+
}
|
|
2621
|
+
},
|
|
2622
|
+
gazebo: {
|
|
2623
|
+
names: ["gazebo", "pavilion", "garden_pavilion"],
|
|
2624
|
+
heightMm: 3e3,
|
|
2625
|
+
materials: ["wood", "wood_dark"],
|
|
2626
|
+
gen(W, D) {
|
|
2627
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2628
|
+
const s = Math.min(W, D);
|
|
2629
|
+
const [px, pz, h] = [hw - s * 0.14, hd - s * 0.14, s * 0.025];
|
|
2630
|
+
return [
|
|
2631
|
+
P("wood", -hw + s * 0.1, hw - s * 0.1, -hd + s * 0.1, hd - s * 0.1, 0, 150, { radius: s * 0.02 }),
|
|
2632
|
+
...[-pz, pz].flatMap((z) => pair(P("wood", -px - h, -px + h, z - h, z + h, 150, 2400))),
|
|
2633
|
+
P("wood", -hw, hw, -hd, hd, 2400, 2460),
|
|
2634
|
+
P("wood_dark", -hw, hw, -hd, hd, 2460, 3e3, { loft: GAZEBO_ROOF })
|
|
2635
|
+
];
|
|
2636
|
+
}
|
|
2637
|
+
},
|
|
2638
|
+
greenhouse: {
|
|
2639
|
+
names: ["greenhouse", "glasshouse"],
|
|
2640
|
+
heightMm: 2400,
|
|
2641
|
+
materials: ["metal", "glass"],
|
|
2642
|
+
gen(W, D) {
|
|
2643
|
+
const fr = longFrame(W, D);
|
|
2644
|
+
const { L, S, part, ends, sides } = fr;
|
|
2645
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2646
|
+
const f = Math.min(L, S) * 0.04;
|
|
2647
|
+
const bays = clamp(Math.round(L / (S * 0.45)), 2, 8);
|
|
2648
|
+
const mw = Math.min(f / 2, 15);
|
|
2649
|
+
const mullions = Array.from({ length: bays - 1 }, (_, i) => L * (2 * (i + 1) - bays) / (2 * bays));
|
|
2650
|
+
return [
|
|
2651
|
+
P("glass", -hw + f, hw - f, -hd + f, hd - f, 0, 1800),
|
|
2652
|
+
...ends(part("metal", -L / 2, -L / 2 + f, -S / 2, -S / 2 + f, 0, 1800)).flatMap(sides),
|
|
2653
|
+
...mullions.flatMap((a) => sides(part("metal", a - mw, a + mw, -S / 2, -S / 2 + f, 0, 1800))),
|
|
2654
|
+
P("metal", -hw, hw, -hd, hd, 1800, 1840),
|
|
2655
|
+
part("glass", -L / 2, L / 2, -S / 2, S / 2, 1840, 2400, { profile: GABLE }, "along"),
|
|
2656
|
+
part("metal", -L / 2, L / 2, -Math.min(S * 0.01, 15), Math.min(S * 0.01, 15), 2380, 2400)
|
|
2657
|
+
];
|
|
2658
|
+
}
|
|
2659
|
+
},
|
|
2660
|
+
climber: {
|
|
2661
|
+
names: ["climber", "climbing_plant"],
|
|
2662
|
+
heightMm: 2400,
|
|
2663
|
+
materials: ["wood", "foliage"],
|
|
2664
|
+
gen(W, D) {
|
|
2665
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
2666
|
+
const rail = D * 0.14;
|
|
2667
|
+
return [
|
|
2668
|
+
...pair(P("wood", -hw, -hw + Math.min(W * 0.03, 40), -hd, -hd + rail, 0, 2400)),
|
|
2669
|
+
...[600, 1300, 2e3].map((y) => P("wood", -hw, hw, -hd, -hd + rail * 0.5, y, y + 30)),
|
|
2670
|
+
P("foliage", -hw, hw, -hd + rail * 0.5, hd, 150, 2350, { radius: Math.min(D * 0.4, 200) })
|
|
2671
|
+
];
|
|
2672
|
+
}
|
|
2673
|
+
},
|
|
2674
|
+
bamboo: {
|
|
2675
|
+
names: ["bamboo"],
|
|
2676
|
+
heightMm: 4e3,
|
|
2677
|
+
materials: ["wood", "foliage"],
|
|
2678
|
+
gen(W, D) {
|
|
2679
|
+
const fr = longFrame(W, D);
|
|
2680
|
+
const { L, S, part, sides } = fr;
|
|
2681
|
+
const n = clamp(Math.round(L / (S * 0.35)), 1, 10);
|
|
2682
|
+
const rho = Math.min(S * 0.08, L / n * 0.3);
|
|
2683
|
+
const culms = Array.from({ length: n }, (_, i) => L * (2 * i + 1 - n) / (2 * n)).flatMap(
|
|
2684
|
+
(a) => sides(part("wood", a - rho, a + rho, S * 0.18 - rho, S * 0.18 + rho, 0, 3400, { round: true }))
|
|
2685
|
+
);
|
|
2686
|
+
return [...culms, P("foliage", -W / 2, W / 2, -D / 2, D / 2, 1600, 4e3, { round: true, loft: BAMBOO_CROWN })];
|
|
2687
|
+
}
|
|
2688
|
+
},
|
|
2689
|
+
potted_tree: {
|
|
2690
|
+
names: ["potted_tree", "indoor_tree"],
|
|
2691
|
+
heightMm: 2e3,
|
|
2692
|
+
materials: ["ceramic", "foliage", "bark"],
|
|
2693
|
+
gen(W, D) {
|
|
2694
|
+
const [rx, rz] = [W / 2, D / 2];
|
|
2695
|
+
const rt = clamp(Math.min(W, D) * 0.03, 10, 50);
|
|
2696
|
+
return [
|
|
2697
|
+
P("ceramic", -rx * 0.3, rx * 0.3, -rz * 0.3, rz * 0.3, 0, 440, { round: true }),
|
|
2698
|
+
P("ceramic", -rx * 0.33, rx * 0.33, -rz * 0.33, rz * 0.33, 420, 470, { round: true }),
|
|
2699
|
+
P("bark", -rt, rt, -rt, rt, 440, 1300, { round: true }),
|
|
2700
|
+
...dome("foliage", 0, 0, rx, rz, 1e3, 2e3, CROWN)
|
|
2701
|
+
];
|
|
2702
|
+
}
|
|
2703
|
+
},
|
|
2704
|
+
stepping_stones: {
|
|
2705
|
+
names: ["stepping_stones"],
|
|
2706
|
+
heightMm: 30,
|
|
2707
|
+
materials: ["stone"],
|
|
2708
|
+
gen(W, D) {
|
|
2709
|
+
const { L, S, part } = longFrame(W, D);
|
|
2710
|
+
const n = clamp(Math.round(L / (1.2 * S)), 2, 24);
|
|
2711
|
+
return span(n, L / 2, L / n * 0.25).map(
|
|
2712
|
+
([a0, a1]) => part("stone", a0, a1, -S / 2, S / 2, 0, 30, { radius: Math.min(a1 - a0, S) * 0.35 })
|
|
2713
|
+
);
|
|
2714
|
+
}
|
|
2492
2715
|
}
|
|
2493
2716
|
};
|
|
2717
|
+
var GAZEBO_ROOF = [
|
|
2718
|
+
[0.08, 1],
|
|
2719
|
+
[1, 0.04]
|
|
2720
|
+
];
|
|
2721
|
+
var GABLE = [
|
|
2722
|
+
[0, 0],
|
|
2723
|
+
[1, 0],
|
|
2724
|
+
[0.5, 1]
|
|
2725
|
+
];
|
|
2726
|
+
var BAMBOO_CROWN = [
|
|
2727
|
+
[0.3, 1],
|
|
2728
|
+
[0.8, 0.8],
|
|
2729
|
+
[1, 0.4]
|
|
2730
|
+
];
|
|
2494
2731
|
var DIR16 = [
|
|
2495
2732
|
[1, 0],
|
|
2496
2733
|
[0.9238795325112867, 0.3826834323650898],
|
|
@@ -2927,6 +3164,69 @@ var T0_UTILITY = {
|
|
|
2927
3164
|
P("linen", -W * 0.2, W * 0.2, -hd + D * 0.2, hd, 560, 1140, { radius: 8 })
|
|
2928
3165
|
];
|
|
2929
3166
|
}
|
|
3167
|
+
},
|
|
3168
|
+
// ── the new-families batch (product-roadmap RM8.9) ──
|
|
3169
|
+
wall_ac: {
|
|
3170
|
+
names: ["wall_ac", "split_ac", "air_conditioner", "ac_indoor"],
|
|
3171
|
+
heightMm: 2400,
|
|
3172
|
+
mountMm: 2100,
|
|
3173
|
+
materials: ["appliance"],
|
|
3174
|
+
gen(W, D) {
|
|
3175
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3176
|
+
return [
|
|
3177
|
+
P("appliance", -hw, hw, -hd, hd - D * 0.1, 2130, 2400, { axis: "x", radius: Math.min(D * 0.3, 60) }),
|
|
3178
|
+
P("appliance", -hw + W * 0.04, hw - W * 0.04, hd - D * 0.12, hd, 2100, 2160, {
|
|
3179
|
+
axis: "x",
|
|
3180
|
+
radius: Math.min(D * 0.05, 20)
|
|
3181
|
+
})
|
|
3182
|
+
];
|
|
3183
|
+
}
|
|
3184
|
+
},
|
|
3185
|
+
condenser: {
|
|
3186
|
+
names: ["condenser", "ac_outdoor", "outdoor_unit", "heat_pump"],
|
|
3187
|
+
heightMm: 700,
|
|
3188
|
+
materials: ["metal", "appliance"],
|
|
3189
|
+
gen(W, D) {
|
|
3190
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3191
|
+
const rf = Math.min(W * 0.4, D * 0.38);
|
|
3192
|
+
const zc = -hd + D * 0.56;
|
|
3193
|
+
return [
|
|
3194
|
+
...pair(P("metal", -hw + W * 0.08, -hw + W * 0.2, -hd + D * 0.1, hd - D * 0.1, 0, 40)),
|
|
3195
|
+
P("appliance", -hw, hw, -hd + D * 0.04, hd, 40, 690, { radius: Math.min(W, D) * 0.04 }),
|
|
3196
|
+
P("metal", -hw + W * 0.03, hw - W * 0.03, -hd, -hd + D * 0.06, 60, 660),
|
|
3197
|
+
P("metal", -rf, rf, zc - rf, zc + rf, 690, 700, { round: true })
|
|
3198
|
+
];
|
|
3199
|
+
}
|
|
3200
|
+
},
|
|
3201
|
+
chest_freezer: {
|
|
3202
|
+
names: ["chest_freezer"],
|
|
3203
|
+
heightMm: 850,
|
|
3204
|
+
materials: ["metal", "appliance"],
|
|
3205
|
+
gen(W, D) {
|
|
3206
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3207
|
+
const s = Math.min(W, D);
|
|
3208
|
+
const hc = Math.min(W * 0.16, s * 0.3);
|
|
3209
|
+
return [
|
|
3210
|
+
P("appliance", -hw + W * 0.02, hw - W * 0.02, -hd + D * 0.02, hd - D * 0.05, 0, 60),
|
|
3211
|
+
P("appliance", -hw, hw, -hd, hd - D * 0.03, 60, 800, { radius: s * 0.04 }),
|
|
3212
|
+
P("appliance", -hw, hw, -hd, hd - D * 0.01, 800, 850, { radius: s * 0.05 }),
|
|
3213
|
+
P("metal", -hc, hc, hd - D * 0.03, hd, 760, 795, { axis: "x", round: true })
|
|
3214
|
+
];
|
|
3215
|
+
}
|
|
3216
|
+
},
|
|
3217
|
+
wine_fridge: {
|
|
3218
|
+
names: ["wine_fridge", "wine_cooler"],
|
|
3219
|
+
heightMm: 850,
|
|
3220
|
+
materials: ["metal", "glass", "appliance"],
|
|
3221
|
+
gen(W, D) {
|
|
3222
|
+
const [hw, hd] = [W / 2, D / 2];
|
|
3223
|
+
return [
|
|
3224
|
+
P("appliance", -hw + W * 0.02, hw - W * 0.02, -hd, hd - D * 0.06, 0, 80),
|
|
3225
|
+
P("appliance", -hw, hw, -hd, hd - D * 0.04, 80, 850, { radius: 4 }),
|
|
3226
|
+
P("glass", -hw + W * 0.04, hw - W * 0.04, hd - D * 0.04, hd - D * 0.015, 100, 830, { axis: "z", radius: 6 }),
|
|
3227
|
+
P("metal", -W * 0.3, W * 0.3, hd - D * 0.015, hd, 770, 800, { axis: "x", round: true })
|
|
3228
|
+
];
|
|
3229
|
+
}
|
|
2930
3230
|
}
|
|
2931
3231
|
};
|
|
2932
3232
|
|
|
@@ -2977,6 +3277,7 @@ var T0_HEIGHT_MM = {
|
|
|
2977
3277
|
};
|
|
2978
3278
|
var T0_MOUNT_MM = batchTable((f) => f.mountMm);
|
|
2979
3279
|
var T0_HUNG_FROM_TOP = new Set(Object.keys(batchTable((f) => f.hungFromTop)));
|
|
3280
|
+
var T0_DEFAULTS = batchTable((f) => f.defaults);
|
|
2980
3281
|
var isHung = (family) => family in T0_MOUNT_MM || T0_HUNG_FROM_TOP.has(family);
|
|
2981
3282
|
var T0_HANDED = new Set(Object.keys(batchTable((f) => f.handed)));
|
|
2982
3283
|
function handedAt(family, W, D) {
|
|
@@ -3190,25 +3491,6 @@ var GENERATORS = {
|
|
|
3190
3491
|
];
|
|
3191
3492
|
}
|
|
3192
3493
|
};
|
|
3193
|
-
var C16 = [
|
|
3194
|
-
1,
|
|
3195
|
-
0.9238795325112867,
|
|
3196
|
-
Math.SQRT1_2,
|
|
3197
|
-
0.3826834323650898,
|
|
3198
|
-
0,
|
|
3199
|
-
-0.3826834323650898,
|
|
3200
|
-
-Math.SQRT1_2,
|
|
3201
|
-
-0.9238795325112867,
|
|
3202
|
-
-1,
|
|
3203
|
-
-0.9238795325112867,
|
|
3204
|
-
-Math.SQRT1_2,
|
|
3205
|
-
-0.3826834323650898,
|
|
3206
|
-
0,
|
|
3207
|
-
0.3826834323650898,
|
|
3208
|
-
Math.SQRT1_2,
|
|
3209
|
-
0.9238795325112867
|
|
3210
|
-
];
|
|
3211
|
-
var S16 = C16.map((_, k) => C16[(k + 12) % 16]);
|
|
3212
3494
|
var um = (v) => (v < 0 ? -Math.round(-v * 1e3) : Math.round(v * 1e3)) || 0;
|
|
3213
3495
|
function sectionRing(u0, u1, v0, v1, shape = {}) {
|
|
3214
3496
|
if (!(u0 < u1 && v0 < v1)) return [];
|
|
@@ -3623,7 +3905,7 @@ function floorLifts(floors, overlaps) {
|
|
|
3623
3905
|
}
|
|
3624
3906
|
|
|
3625
3907
|
// package.json
|
|
3626
|
-
var version = "0.
|
|
3908
|
+
var version = "0.8.1";
|
|
3627
3909
|
|
|
3628
3910
|
// src/scene3d/build.ts
|
|
3629
3911
|
import * as core2 from "@chanmeng666/archlang";
|
|
@@ -3680,7 +3962,14 @@ var box = (e) => ({
|
|
|
3680
3962
|
});
|
|
3681
3963
|
function floorOf(r, tol) {
|
|
3682
3964
|
const outer = r.circle ? circleRing(r.circle.c, r.circle.r, tol) : r.poly ?? rectRing(r.at, r.size);
|
|
3683
|
-
return {
|
|
3965
|
+
return {
|
|
3966
|
+
id: r.id,
|
|
3967
|
+
source: source(r),
|
|
3968
|
+
polygon: polygon(outer),
|
|
3969
|
+
...r.uses?.length ? { uses: [...r.uses] } : {},
|
|
3970
|
+
// The author's `floor` word (card RM8.7): a public, non-underscore field of `RRoom` (ADR 0031).
|
|
3971
|
+
...r.floor !== void 0 ? { pattern: r.floor } : {}
|
|
3972
|
+
};
|
|
3684
3973
|
}
|
|
3685
3974
|
function furnitureOf(f, mirrored, ledger) {
|
|
3686
3975
|
const rotate = f.rotate ?? 0;
|
|
@@ -3728,7 +4017,7 @@ var fenceOf = (f) => ({
|
|
|
3728
4017
|
closed: f.closed
|
|
3729
4018
|
});
|
|
3730
4019
|
var OPPOSITE = { top: "bottom", bottom: "top", left: "right", right: "left" };
|
|
3731
|
-
function stairPieces(s) {
|
|
4020
|
+
function stairPieces(s, ledger) {
|
|
3732
4021
|
const treadCount3 = core2.treadCount;
|
|
3733
4022
|
if (typeof treadCount3 !== "function") return void 0;
|
|
3734
4023
|
const flight = (at, size, tail2) => ({
|
|
@@ -3738,22 +4027,95 @@ function stairPieces(s) {
|
|
|
3738
4027
|
treads: treadCount3(tail2 === "top" || tail2 === "bottom" ? size.h : size.w)
|
|
3739
4028
|
});
|
|
3740
4029
|
if (s.flights && s.landings) {
|
|
4030
|
+
const flights = s.flights;
|
|
3741
4031
|
return {
|
|
3742
|
-
flights:
|
|
3743
|
-
landings: s.landings.map((l) =>
|
|
4032
|
+
flights: flights.map((f) => flight(f.at, f.size, f.tail)),
|
|
4033
|
+
landings: s.landings.map((l, i) => {
|
|
4034
|
+
const winders = winderRings(s.id, i, l, flights[i], flights[i + 1], ledger);
|
|
4035
|
+
return { at: umPoint(l.at), size: { w: um2(l.size.w), h: um2(l.size.h) }, ...winders ? { winders } : {} };
|
|
4036
|
+
})
|
|
3744
4037
|
};
|
|
3745
4038
|
}
|
|
3746
4039
|
const tail = entryEdges(s)[0];
|
|
3747
4040
|
return tail ? { flights: [flight(s.at, s.size, tail)], landings: [] } : void 0;
|
|
3748
4041
|
}
|
|
3749
|
-
var stairOf = (s) => ({
|
|
4042
|
+
var stairOf = (s, ledger) => ({
|
|
3750
4043
|
id: s.id,
|
|
3751
4044
|
source: source(s),
|
|
3752
4045
|
box: box(s),
|
|
3753
4046
|
dir: s.dir,
|
|
3754
4047
|
width: um2(s.width),
|
|
3755
|
-
...stairPieces(s)
|
|
4048
|
+
...stairPieces(s, ledger)
|
|
3756
4049
|
});
|
|
4050
|
+
var rectOf = (p) => ({
|
|
4051
|
+
x: p.at.x,
|
|
4052
|
+
y: p.at.y,
|
|
4053
|
+
w: p.size.w,
|
|
4054
|
+
h: p.size.h
|
|
4055
|
+
});
|
|
4056
|
+
function winderRings(id2, i, l, before, after, ledger) {
|
|
4057
|
+
if (l.winders === void 0) return void 0;
|
|
4058
|
+
const lines = core2.winderTreads;
|
|
4059
|
+
const rings = typeof lines === "function" && before && after ? treadRings(l, before, lines(l, rectOf(before), rectOf(after))) : void 0;
|
|
4060
|
+
if (!rings)
|
|
4061
|
+
ledger.push({
|
|
4062
|
+
kind: "stair",
|
|
4063
|
+
id: id2,
|
|
4064
|
+
field: `winders(landing ${i + 1})`,
|
|
4065
|
+
value: "level",
|
|
4066
|
+
provenance: "default",
|
|
4067
|
+
rule: "stair-winders-not-read"
|
|
4068
|
+
});
|
|
4069
|
+
return rings;
|
|
4070
|
+
}
|
|
4071
|
+
var NEAR_MM = 1e-6;
|
|
4072
|
+
function treadRings(l, before, lines) {
|
|
4073
|
+
const n = l.winders;
|
|
4074
|
+
if (n === void 0) return void 0;
|
|
4075
|
+
const near = (a, b) => Math.abs(a - b) <= NEAR_MM;
|
|
4076
|
+
const [x0, y0] = [l.at.x, l.at.y];
|
|
4077
|
+
const [x1, y1] = [x0 + l.size.w, y0 + l.size.h];
|
|
4078
|
+
const inside = (p) => p.x >= x0 - NEAR_MM && p.x <= x1 + NEAR_MM && p.y >= y0 - NEAR_MM && p.y <= y1 + NEAR_MM;
|
|
4079
|
+
const [bx0, by0, bx1, by1] = [before.at.x, before.at.y, before.at.x + before.size.w, before.at.y + before.size.h];
|
|
4080
|
+
const against = (ax, ay, bx, by) => ay === by ? (near(by0, ay) || near(by1, ay)) && bx0 < Math.max(ax, bx) - NEAR_MM && bx1 > Math.min(ax, bx) + NEAR_MM : (near(bx0, ax) || near(bx1, ax)) && by0 < Math.max(ay, by) - NEAR_MM && by1 > Math.min(ay, by) + NEAR_MM;
|
|
4081
|
+
const fans = [
|
|
4082
|
+
[x0, y0],
|
|
4083
|
+
[x1, y0],
|
|
4084
|
+
[x1, y1],
|
|
4085
|
+
[x0, y1]
|
|
4086
|
+
].flatMap(([cx, cy]) => {
|
|
4087
|
+
const [ox2, oy2] = [near(cx, x0) ? x1 : x0, near(cy, y0) ? y1 : y0];
|
|
4088
|
+
const alongX2 = against(cx, cy, ox2, cy);
|
|
4089
|
+
if (!alongX2 && !against(cx, cy, cx, oy2)) return [];
|
|
4090
|
+
const ends2 = lines.flatMap(([a, b]) => {
|
|
4091
|
+
for (const [p, q] of [
|
|
4092
|
+
[a, b],
|
|
4093
|
+
[b, a]
|
|
4094
|
+
])
|
|
4095
|
+
if (near(p.x, cx) && near(p.y, cy) && inside(q) && (near(q.x, ox2) || near(q.y, oy2))) return [q];
|
|
4096
|
+
return [];
|
|
4097
|
+
});
|
|
4098
|
+
return ends2.length === n - 1 ? [{ c: { x: cx, y: cy }, ox: ox2, oy: oy2, alongX: alongX2, ends: ends2 }] : [];
|
|
4099
|
+
});
|
|
4100
|
+
const fan = fans[0];
|
|
4101
|
+
if (fans.length !== 1 || !fan) return void 0;
|
|
4102
|
+
const { c, ox, oy, alongX } = fan;
|
|
4103
|
+
const entry = alongX ? { x: ox, y: c.y } : { x: c.x, y: oy };
|
|
4104
|
+
const exit = alongX ? { x: c.x, y: oy } : { x: ox, y: c.y };
|
|
4105
|
+
const [ux, uy] = [entry.x - c.x, entry.y - c.y];
|
|
4106
|
+
const angle = (p) => {
|
|
4107
|
+
const [vx, vy] = [p.x - c.x, p.y - c.y];
|
|
4108
|
+
return Math.atan2(Math.abs(ux * vy - uy * vx), ux * vx + uy * vy);
|
|
4109
|
+
};
|
|
4110
|
+
const ends = [entry, ...[...fan.ends].sort((a, b) => angle(a) - angle(b)), exit];
|
|
4111
|
+
const onX = (p) => near(p.x, ox);
|
|
4112
|
+
const onY = (p) => near(p.y, oy);
|
|
4113
|
+
return Array.from({ length: n }, (_, k) => {
|
|
4114
|
+
const [a, b] = [ends[k], ends[k + 1]];
|
|
4115
|
+
const far = !(onX(a) && onX(b)) && !(onY(a) && onY(b));
|
|
4116
|
+
return [c, a, ...far ? [{ x: ox, y: oy }] : [], b].map(umPoint);
|
|
4117
|
+
});
|
|
4118
|
+
}
|
|
3757
4119
|
function wallsAndOpenings(ir, byId, tol) {
|
|
3758
4120
|
const own = wallOwnership(ir.walls, (loops) => tessellateLoops(loops, tol));
|
|
3759
4121
|
const cutsOf = /* @__PURE__ */ new Map();
|
|
@@ -3916,7 +4278,7 @@ function levelOf(s, ledger, tol, mirrored) {
|
|
|
3916
4278
|
...demolished.length > 0 ? { demolished } : {},
|
|
3917
4279
|
openings,
|
|
3918
4280
|
furniture: of("furniture").map((f) => furnitureOf(f, mirrored, ledger)),
|
|
3919
|
-
stairs: of("stair").map(stairOf),
|
|
4281
|
+
stairs: of("stair").map((st) => stairOf(st, ledger)),
|
|
3920
4282
|
// A core `void … polygon` (an L) carries the rectangles its hole is made of (`parts`): each is
|
|
3921
4283
|
// one box, ids `<id>#<k>` (unique per collection), `source` still naming the void.
|
|
3922
4284
|
voids: of("void").flatMap(
|
|
@@ -4037,7 +4399,7 @@ var wall = object(
|
|
|
4037
4399
|
{ category: string, material: string }
|
|
4038
4400
|
);
|
|
4039
4401
|
var LEVEL_COLLECTIONS = {
|
|
4040
|
-
floors: array(object({ id, source: source2, polygon: polygon2 }, { uses: array(string), lift: integer })),
|
|
4402
|
+
floors: array(object({ id, source: source2, polygon: polygon2 }, { uses: array(string), pattern: string, lift: integer })),
|
|
4041
4403
|
walls: array(wall),
|
|
4042
4404
|
openings: array(
|
|
4043
4405
|
object(
|
|
@@ -4081,7 +4443,7 @@ var LEVEL_COLLECTIONS = {
|
|
|
4081
4443
|
}),
|
|
4082
4444
|
1
|
|
4083
4445
|
),
|
|
4084
|
-
landings: array(object({ at: pt, size: sized("w", "h") }))
|
|
4446
|
+
landings: array(object({ at: pt, size: sized("w", "h") }, { winders: array(ring2, 2) }))
|
|
4085
4447
|
}
|
|
4086
4448
|
)
|
|
4087
4449
|
),
|
|
@@ -4195,6 +4557,7 @@ export {
|
|
|
4195
4557
|
T0_HEIGHT_MM,
|
|
4196
4558
|
T0_MOUNT_MM,
|
|
4197
4559
|
T0_HUNG_FROM_TOP,
|
|
4560
|
+
T0_DEFAULTS,
|
|
4198
4561
|
isHung,
|
|
4199
4562
|
T0_HANDED,
|
|
4200
4563
|
handedAt,
|