@kensnzk/koyu 0.5.0 → 0.13.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/README.ja.md +43 -11
- package/README.md +51 -11
- package/dist/axo.d.ts +16 -0
- package/dist/axo.d.ts.map +1 -0
- package/dist/axo.js +211 -0
- package/dist/axo.js.map +1 -0
- package/dist/check.d.ts +109 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +957 -0
- package/dist/check.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +410 -0
- package/dist/cli.js.map +1 -0
- package/dist/diff.d.ts +105 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +583 -0
- package/dist/diff.js.map +1 -0
- package/dist/fabric.d.ts +28 -0
- package/dist/fabric.d.ts.map +1 -0
- package/dist/fabric.js +105 -0
- package/dist/fabric.js.map +1 -0
- package/dist/graph.d.ts +118 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +627 -0
- package/dist/graph.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/light.d.ts +15 -0
- package/dist/light.d.ts.map +1 -0
- package/dist/light.js +53 -0
- package/dist/light.js.map +1 -0
- package/dist/mcp.d.ts +3 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +361 -0
- package/dist/mcp.js.map +1 -0
- package/dist/model.d.ts +379 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +464 -0
- package/dist/model.js.map +1 -0
- package/dist/parse-file.d.ts +9 -0
- package/dist/parse-file.d.ts.map +1 -0
- package/dist/parse-file.js +22 -0
- package/dist/parse-file.js.map +1 -0
- package/dist/parse.d.ts +16 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +1040 -0
- package/dist/parse.js.map +1 -0
- package/dist/plan.d.ts +10 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +354 -0
- package/dist/plan.js.map +1 -0
- package/dist/poly.d.ts +78 -0
- package/dist/poly.d.ts.map +1 -0
- package/dist/poly.js +277 -0
- package/dist/poly.js.map +1 -0
- package/dist/site.d.ts +24 -0
- package/dist/site.d.ts.map +1 -0
- package/dist/site.js +54 -0
- package/dist/site.js.map +1 -0
- package/dist/vertical.d.ts +176 -0
- package/dist/vertical.d.ts.map +1 -0
- package/dist/vertical.js +669 -0
- package/dist/vertical.js.map +1 -0
- package/examples/basement/main.muro +84 -0
- package/examples/comparison/README.md +64 -1
- package/examples/comparison/gen-ifc4.ts +1 -1
- package/examples/comparison/gen-ifcx.ts +2 -2
- package/examples/comparison/two-rooms.ifcx +1 -1
- package/examples/complex/L1.muro +132 -0
- package/examples/complex/assets.muro +17 -0
- package/examples/complex/basement.muro +40 -0
- package/examples/complex/core.muro +40 -0
- package/examples/complex/hotel.muro +117 -0
- package/examples/complex/main.muro +67 -0
- package/examples/complex/office.muro +41 -0
- package/examples/complex/plant.muro +34 -0
- package/examples/complex/podium.muro +140 -0
- package/examples/complex/site.muro +18 -0
- package/examples/house/L1.muro +16 -0
- package/examples/house/L2.muro +19 -0
- package/examples/house/assets.muro +9 -0
- package/examples/house/main.muro +27 -0
- package/examples/house/site.muro +31 -0
- package/examples/house.muro +3 -3
- package/examples/mansion.muro +18 -13
- package/examples/office.muro +1 -1
- package/examples/steps/01-one-room.muro +4 -0
- package/examples/steps/02-two-rooms.muro +5 -0
- package/examples/steps/03-door.muro +9 -0
- package/examples/steps/04-exterior.muro +15 -0
- package/examples/steps/05-two-storeys.muro +27 -0
- package/examples/steps/06-finished.muro +30 -0
- package/examples/steps/README.md +25 -0
- package/examples/tower/L1.muro +80 -0
- package/examples/tower/L11.muro +49 -0
- package/examples/tower/L2.muro +71 -0
- package/examples/tower/L3.muro +31 -0
- package/examples/tower/assets.muro +14 -0
- package/examples/tower/main.muro +37 -0
- package/examples/tower/site-geometry.muro +7 -0
- package/examples/tower/site.muro +33 -0
- package/examples/tower/typical.muro +131 -0
- package/examples/two-rooms.canonical.json +30 -3
- package/examples/two-rooms.muro +11 -7
- package/package.json +29 -2
- package/src/axo.ts +258 -0
- package/src/check.ts +948 -122
- package/src/cli.ts +175 -12
- package/src/diff.ts +676 -0
- package/src/fabric.ts +123 -0
- package/src/graph.ts +451 -61
- package/src/index.ts +38 -2
- package/src/light.ts +4 -7
- package/src/mcp.ts +397 -0
- package/src/model.ts +462 -67
- package/src/parse-file.ts +28 -0
- package/src/parse.ts +682 -45
- package/src/plan.ts +152 -14
- package/src/poly.ts +295 -0
- package/src/site.ts +19 -11
- package/src/vertical.ts +884 -0
- package/.github/workflows/ci.yml +0 -16
- package/.zenodo.json +0 -20
- package/CITATION.cff +0 -26
- package/docs/decisions/0001-notation-v0.md +0 -29
- package/docs/decisions/0002-height-and-offsets.md +0 -27
- package/docs/decisions/0003-uncounted-divisions.md +0 -36
- package/docs/decisions/0004-typical-floors.md +0 -21
- package/docs/decisions/0005-zones-and-unions.md +0 -23
- package/docs/decisions/0006-voids-and-light.md +0 -31
- package/docs/decisions/0007-semi-outdoor-air.md +0 -27
- package/docs/decisions/0008-vocabulary-and-level-attr.md +0 -23
- package/docs/decisions/0009-site-and-exterior.md +0 -29
- package/docs/ifc-coverage.md +0 -82
- package/docs/ifcx-notes.md +0 -25
- package/docs/img/house-L1.svg +0 -80
- package/docs/img/house-L2.svg +0 -53
- package/docs/img/mansion-L1.svg +0 -113
- package/docs/img/mansion-L10.svg +0 -111
- package/docs/img/mansion-L5.svg +0 -160
- package/docs/img/office-L1.svg +0 -116
- package/docs/img/office-L2.svg +0 -109
- package/docs/img/two-rooms.svg +0 -39
- package/docs/log/2026-07-22.md +0 -13
- package/docs/log/2026-07-23.md +0 -51
- package/docs/roadmap.md +0 -55
- package/docs/writing-architecture.md +0 -119
- package/spec/notation-v0.md +0 -164
- package/spec/vocabulary.md +0 -62
- package/test/core.test.ts +0 -171
- package/test/design2.test.ts +0 -97
- package/test/house.test.ts +0 -74
- package/test/mansion.test.ts +0 -99
- package/test/office.test.ts +0 -71
- package/test/uncounted.test.ts +0 -120
- package/test/vertical.test.ts +0 -75
- package/tsconfig.json +0 -13
package/src/plan.ts
CHANGED
|
@@ -5,17 +5,26 @@
|
|
|
5
5
|
import { placeBand, placeOpening, segmentsFor, type Segment } from "./graph.js";
|
|
6
6
|
import {
|
|
7
7
|
areaM2,
|
|
8
|
+
columnsFor,
|
|
8
9
|
displayName,
|
|
10
|
+
regionOf,
|
|
9
11
|
isSemiOutdoor,
|
|
12
|
+
polygonAreaM2,
|
|
13
|
+
polyBounds,
|
|
14
|
+
rectToPoly,
|
|
10
15
|
type Boundary,
|
|
11
16
|
type Model,
|
|
12
17
|
type Opening,
|
|
18
|
+
type Pt,
|
|
13
19
|
} from "./model.js";
|
|
20
|
+
import { runDrawsForLevel, CUT_HEIGHT } from "./vertical.js";
|
|
14
21
|
|
|
15
22
|
export interface PlanOptions {
|
|
16
23
|
level?: string;
|
|
17
24
|
/** px per mm */
|
|
18
25
|
scale?: number;
|
|
26
|
+
/** 切断面の高さ mm (FLから) — 縦動線がどこで切れるかを決める */
|
|
27
|
+
cut?: number;
|
|
19
28
|
}
|
|
20
29
|
|
|
21
30
|
const WALL_DEFAULT_T = 100;
|
|
@@ -34,11 +43,19 @@ export function svgPlan(model: Model, opts: PlanOptions = {}): string {
|
|
|
34
43
|
);
|
|
35
44
|
if (rooms.length === 0) throw new Error(`レベル ${level} に領域を持つ空間がありません`);
|
|
36
45
|
|
|
46
|
+
// 敷地形状 (ADR-0011) は最下階の平面 (配置図兼用) に敷地境界線として描く
|
|
47
|
+
const lowest = Object.values(model.levels).sort((a, b) => a.z - b.z)[0]?.name;
|
|
48
|
+
const sitePolys = level === lowest ? [...model.polygons.values()] : [];
|
|
49
|
+
|
|
37
50
|
const allRects = rooms.flatMap((s) => s.rects);
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
const polyPts = [
|
|
52
|
+
...sitePolys.flatMap((p) => p.points),
|
|
53
|
+
...rooms.flatMap((s) => s.pieces.flat()),
|
|
54
|
+
];
|
|
55
|
+
const minX = Math.min(...allRects.map((r) => r.x1), ...polyPts.map((p) => p.x));
|
|
56
|
+
const maxX = Math.max(...allRects.map((r) => r.x2), ...polyPts.map((p) => p.x));
|
|
57
|
+
const minY = Math.min(...allRects.map((r) => r.y1), ...polyPts.map((p) => p.y));
|
|
58
|
+
const maxY = Math.max(...allRects.map((r) => r.y2), ...polyPts.map((p) => p.y));
|
|
42
59
|
|
|
43
60
|
const M = 84; // 余白 px (通り芯記号ぶん)
|
|
44
61
|
const W = (maxX - minX) * scale + M * 2;
|
|
@@ -52,17 +69,29 @@ export function svgPlan(model: Model, opts: PlanOptions = {}): string {
|
|
|
52
69
|
);
|
|
53
70
|
parts.push(`<rect width="${W}" height="${H}" fill="${PAPER}"/>`);
|
|
54
71
|
|
|
55
|
-
//
|
|
72
|
+
// 敷地境界線 (一点二点鎖線 — 作図慣習)。形は生成しない: 書かれた所与の形をそのまま引く
|
|
73
|
+
for (const poly of sitePolys) {
|
|
74
|
+
const d = poly.points.map((pt, i) => `${i === 0 ? "M" : "L"} ${sx(pt.x)} ${sy(pt.y)}`).join(" ");
|
|
75
|
+
parts.push(
|
|
76
|
+
`<path d="${d} Z" fill="none" stroke="#8a8171" stroke-width="1.1" stroke-dasharray="14 3 2.5 3 2.5 3"/>`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 空間の面 — 導出された凸片 (ADR-0022)。描かれた線で切られていれば斜めの面になる。
|
|
81
|
+
// 同色・輪郭なしなのでL字も切られた形も一体に見える。
|
|
56
82
|
// 半屋外 (外部にopen/railで接する空間) は淡く塗り分け、屋外であることが図から読めるように
|
|
83
|
+
const path2d = (poly: Pt[]): string =>
|
|
84
|
+
poly.map((p, i) => `${i === 0 ? "M" : "L"} ${sx(p.x)} ${sy(p.y)}`).join(" ") + " Z";
|
|
57
85
|
for (const s of rooms) {
|
|
58
86
|
const isVoid = s.type === "void";
|
|
59
87
|
const semi = isSemiOutdoor(model, s);
|
|
60
|
-
for (const
|
|
88
|
+
for (const poly of regionOf(s)) {
|
|
61
89
|
parts.push(
|
|
62
|
-
`<
|
|
90
|
+
`<path d="${path2d(poly)}" fill="${isVoid ? PAPER : semi ? "#f8f5ec" : ROOM}"/>`,
|
|
63
91
|
);
|
|
64
92
|
if (isVoid) {
|
|
65
93
|
// 吹抜け: 破線の対角線 (作図慣習)
|
|
94
|
+
const r = polyBounds(poly);
|
|
66
95
|
parts.push(
|
|
67
96
|
`<line x1="${sx(r.x1)}" y1="${sy(r.y1)}" x2="${sx(r.x2)}" y2="${sy(r.y2)}" stroke="#b3ab9c" stroke-width="0.8" stroke-dasharray="6 4"/>`,
|
|
68
97
|
`<line x1="${sx(r.x1)}" y1="${sy(r.y2)}" x2="${sx(r.x2)}" y2="${sy(r.y1)}" stroke="#b3ab9c" stroke-width="0.8" stroke-dasharray="6 4"/>`,
|
|
@@ -190,11 +219,57 @@ export function svgPlan(model: Model, opts: PlanOptions = {}): string {
|
|
|
190
219
|
}
|
|
191
220
|
}
|
|
192
221
|
|
|
193
|
-
//
|
|
222
|
+
// 柱 (ADR-0023) — 位置はどこにも書かれていない。通り芯の交点と床の交わりから現れる
|
|
223
|
+
for (const c of columnsFor(model, level)) {
|
|
224
|
+
parts.push(
|
|
225
|
+
`<rect x="${sx(c.x - c.w / 2)}" y="${sy(c.y + c.d / 2)}" width="${c.w * scale}" height="${c.d * scale}" fill="${INK}"/>`,
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// 縦動線 (ADR-0021) — そのレベルで切った姿。上る走りは切断線で切れ、
|
|
230
|
+
// その先には下りる走り (下階の走りを上から見たもの) が現れる。
|
|
231
|
+
// 階段が階ごとに違う顔をするのは、平面図が「切った断面」だという事実そのものである
|
|
232
|
+
for (const d of runDrawsForLevel(model, level, opts.cut ?? CUT_HEIGHT)) {
|
|
233
|
+
for (const g of d.outline) {
|
|
234
|
+
parts.push(
|
|
235
|
+
`<line x1="${sx(g.x1)}" y1="${sy(g.y1)}" x2="${sx(g.x2)}" y2="${sy(g.y2)}" stroke="${INK}" stroke-width="1.1"/>`,
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
for (const g of d.treads) {
|
|
239
|
+
parts.push(
|
|
240
|
+
`<line x1="${sx(g.x1)}" y1="${sy(g.y1)}" x2="${sx(g.x2)}" y2="${sy(g.y2)}" stroke="${INK}" stroke-width="0.7"/>`,
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
for (const g of d.breaks) {
|
|
244
|
+
parts.push(
|
|
245
|
+
`<line x1="${sx(g.x1)}" y1="${sy(g.y1)}" x2="${sx(g.x2)}" y2="${sy(g.y2)}" stroke="${INK}" stroke-width="1.4"/>`,
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
for (const a of d.arrows) {
|
|
249
|
+
const dx = a.x2 - a.x1;
|
|
250
|
+
const dy = a.y2 - a.y1;
|
|
251
|
+
const len = Math.hypot(dx, dy) || 1;
|
|
252
|
+
const hx = (dx / len) * 420;
|
|
253
|
+
const hy = (dy / len) * 420;
|
|
254
|
+
const px = (-dy / len) * 200;
|
|
255
|
+
const py = (dx / len) * 200;
|
|
256
|
+
parts.push(
|
|
257
|
+
`<line x1="${sx(a.x1)}" y1="${sy(a.y1)}" x2="${sx(a.x2)}" y2="${sy(a.y2)}" stroke="${INK}" stroke-width="1"/>`,
|
|
258
|
+
`<path d="M ${sx(a.x2)} ${sy(a.y2)} L ${sx(a.x2 - hx + px)} ${sy(a.y2 - hy + py)} L ${sx(a.x2 - hx - px)} ${sy(a.y2 - hy - py)} Z" fill="${INK}"/>`,
|
|
259
|
+
`<text x="${sx(a.x1) + 4}" y="${sy(a.y1) + 4}" font-size="9" fill="${INK}">${a.label}</text>`,
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
for (const n of d.notes) {
|
|
263
|
+
parts.push(
|
|
264
|
+
`<text x="${sx(n.x)}" y="${sy(n.y) + 42}" text-anchor="middle" font-size="8" fill="#8a8171">${esc(n.text)}</text>`,
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// 空間ラベル (最大の凸片の中心に置く)
|
|
194
270
|
for (const s of rooms) {
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
)[0]!;
|
|
271
|
+
const poly = [...regionOf(s)].sort((a, b) => polygonAreaM2(b) - polygonAreaM2(a))[0]!;
|
|
272
|
+
const r = polyBounds(poly);
|
|
198
273
|
const cx = sx((r.x1 + r.x2) / 2);
|
|
199
274
|
const cy = sy((r.y1 + r.y2) / 2);
|
|
200
275
|
const sub =
|
|
@@ -220,9 +295,11 @@ export function svgPlan(model: Model, opts: PlanOptions = {}): string {
|
|
|
220
295
|
const lower = za < zb ? sa : sb;
|
|
221
296
|
const upper = za < zb ? sb : sa;
|
|
222
297
|
if (lower.level !== level) continue;
|
|
223
|
-
|
|
298
|
+
// 上階の**導出された形**を落とす — 割付で描くと、切られた吹抜けが切られる前の姿で出る
|
|
299
|
+
for (const poly of regionOf(upper)) {
|
|
300
|
+
const r = polyBounds(poly);
|
|
224
301
|
parts.push(
|
|
225
|
-
`<
|
|
302
|
+
`<path d="${path2d(poly)}" fill="none" stroke="#b3ab9c" stroke-width="0.8" stroke-dasharray="6 4"/>`,
|
|
226
303
|
`<text x="${sx((r.x1 + r.x2) / 2)}" y="${sy((r.y1 + r.y2) / 2) + 40}" text-anchor="middle" font-size="9" fill="#b3ab9c">上部吹抜け</text>`,
|
|
227
304
|
);
|
|
228
305
|
}
|
|
@@ -246,6 +323,22 @@ function wallRect(
|
|
|
246
323
|
sx: (x: number) => number,
|
|
247
324
|
sy: (y: number) => number,
|
|
248
325
|
): string {
|
|
326
|
+
if (seg.diagonal) {
|
|
327
|
+
// 斜めの壁 (描かれた線 — ADR-0022): 芯線に対して法線方向へ t/2 ずつ振り分けた四辺形
|
|
328
|
+
const dx = seg.x2 - seg.x1;
|
|
329
|
+
const dy = seg.y2 - seg.y1;
|
|
330
|
+
const len = Math.hypot(dx, dy) || 1;
|
|
331
|
+
const nx = (-dy / len) * (t / 2);
|
|
332
|
+
const ny = (dx / len) * (t / 2);
|
|
333
|
+
const q: Array<[number, number]> = [
|
|
334
|
+
[seg.x1 + nx, seg.y1 + ny],
|
|
335
|
+
[seg.x2 + nx, seg.y2 + ny],
|
|
336
|
+
[seg.x2 - nx, seg.y2 - ny],
|
|
337
|
+
[seg.x1 - nx, seg.y1 - ny],
|
|
338
|
+
];
|
|
339
|
+
const d = q.map(([x, y], i) => `${i === 0 ? "M" : "L"} ${sx(x)} ${sy(y)}`).join(" ");
|
|
340
|
+
return `<path d="${d} Z" fill="${INK}"/>`;
|
|
341
|
+
}
|
|
249
342
|
if (seg.horizontal) {
|
|
250
343
|
const x = sx(seg.x1);
|
|
251
344
|
const y = sy(seg.y1 + t / 2);
|
|
@@ -267,6 +360,23 @@ function bandRect(
|
|
|
267
360
|
sy: (y: number) => number,
|
|
268
361
|
fill: string,
|
|
269
362
|
): string {
|
|
363
|
+
if (seg.diagonal) {
|
|
364
|
+
const dx = seg.x2 - seg.x1;
|
|
365
|
+
const dy = seg.y2 - seg.y1;
|
|
366
|
+
const len = Math.hypot(dx, dy) || 1;
|
|
367
|
+
const ux = (dx / len) * (w / 2);
|
|
368
|
+
const uy = (dy / len) * (w / 2);
|
|
369
|
+
const nx = (-dy / len) * (t / 2);
|
|
370
|
+
const ny = (dx / len) * (t / 2);
|
|
371
|
+
const q: Array<[number, number]> = [
|
|
372
|
+
[cx - ux + nx, cy - uy + ny],
|
|
373
|
+
[cx + ux + nx, cy + uy + ny],
|
|
374
|
+
[cx + ux - nx, cy + uy - ny],
|
|
375
|
+
[cx - ux - nx, cy - uy - ny],
|
|
376
|
+
];
|
|
377
|
+
const d = q.map(([x, y], i) => `${i === 0 ? "M" : "L"} ${sx(x)} ${sy(y)}`).join(" ");
|
|
378
|
+
return `<path d="${d} Z" fill="${fill}"/>`;
|
|
379
|
+
}
|
|
270
380
|
if (seg.horizontal) {
|
|
271
381
|
return `<rect x="${sx(cx - w / 2)}" y="${sy(cy + t / 2)}" width="${w * scale}" height="${t * scale}" fill="${fill}"/>`;
|
|
272
382
|
}
|
|
@@ -302,7 +412,19 @@ function doorSwing(
|
|
|
302
412
|
let hinge: { x: number; y: number };
|
|
303
413
|
let along: { x: number; y: number };
|
|
304
414
|
let inward: { x: number; y: number };
|
|
305
|
-
if (seg.
|
|
415
|
+
if (seg.diagonal) {
|
|
416
|
+
// 斜めの線分では吊元は始端側に固定し (hingeのN/E/S/Wは軸の言葉なので使えない)、
|
|
417
|
+
// 開く側は法線のうち開く空間の重心へ向く方をとる
|
|
418
|
+
const dx = seg.x2 - seg.x1;
|
|
419
|
+
const dy = seg.y2 - seg.y1;
|
|
420
|
+
const len = Math.hypot(dx, dy) || 1;
|
|
421
|
+
along = { x: dx / len, y: dy / len };
|
|
422
|
+
const n = { x: -along.y, y: along.x };
|
|
423
|
+
const toC = { x: c.x - cx, y: c.y - cy };
|
|
424
|
+
const sign = n.x * toC.x + n.y * toC.y >= 0 ? 1 : -1;
|
|
425
|
+
inward = { x: n.x * sign, y: n.y * sign };
|
|
426
|
+
hinge = { x: cx - along.x * (o.w / 2), y: cy - along.y * (o.w / 2) };
|
|
427
|
+
} else if (seg.horizontal) {
|
|
306
428
|
const fromEast = o.hinge === "E";
|
|
307
429
|
hinge = { x: fromEast ? cx + o.w / 2 : cx - o.w / 2, y: cy };
|
|
308
430
|
along = { x: fromEast ? -1 : 1, y: 0 };
|
|
@@ -313,6 +435,22 @@ function doorSwing(
|
|
|
313
435
|
along = { x: 0, y: fromNorth ? -1 : 1 };
|
|
314
436
|
inward = { x: c.x > cx ? 1 : -1, y: 0 };
|
|
315
437
|
}
|
|
438
|
+
// 引き戸・自動ドア (style:sliding / style:auto — アセット語彙): 開き軌跡ではなく
|
|
439
|
+
// 吊元側の控え (戸袋側) にパネルを描く
|
|
440
|
+
const style = o.attrs["style"];
|
|
441
|
+
if (style === "sliding" || style === "auto") {
|
|
442
|
+
const off = 110; // 壁面からの控え mm
|
|
443
|
+
const s1 = {
|
|
444
|
+
x: hinge.x - along.x * o.w + inward.x * off,
|
|
445
|
+
y: hinge.y - along.y * o.w + inward.y * off,
|
|
446
|
+
};
|
|
447
|
+
const s2 = { x: hinge.x + inward.x * off, y: hinge.y + inward.y * off };
|
|
448
|
+
return (
|
|
449
|
+
`<line x1="${sx(s1.x)}" y1="${sy(s1.y)}" x2="${sx(s2.x)}" y2="${sy(s2.y)}" stroke="${INK}" stroke-width="2"/>` +
|
|
450
|
+
`<line x1="${sx(s2.x)}" y1="${sy(s2.y)}" x2="${sx(hinge.x)}" y2="${sy(hinge.y)}" stroke="${INK}" stroke-width="0.7"/>`
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
|
|
316
454
|
const leafEnd = { x: hinge.x + inward.x * o.w, y: hinge.y + inward.y * o.w };
|
|
317
455
|
const gapEnd = { x: hinge.x + along.x * o.w, y: hinge.y + along.y * o.w };
|
|
318
456
|
|
package/src/poly.ts
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
// koyu — 凸片の幾何 (ADR-0027)
|
|
2
|
+
//
|
|
3
|
+
// 空間の形は**凸片の集合** (`Pt[][]`) である (ADR-0022)。矩形はその入口の綴りにすぎない。
|
|
4
|
+
// この層が存在しなかったあいだ、面積・被覆・切り分けの計算が model / graph / fabric /
|
|
5
|
+
// check / axo に散り、シューレース公式が三通り、矩形で切る処理が三通りあった。そして
|
|
6
|
+
// **「判定に使う集合」と「操作する集合」がずれる**という一つの誤りが、七箇所で別々に
|
|
7
|
+
// 現れた — 離れた翼が隅切りの向きを裏返して室が消え、上階を切ると下階の屋根が消え、
|
|
8
|
+
// 軸平行の線が「何も切っていない」と誤報された。どれも check が緑のまま起きた。
|
|
9
|
+
//
|
|
10
|
+
// ここに集めるのは、その規律である。**窓 (window) を渡さない操作を作らない** —
|
|
11
|
+
// どの範囲で測り、どの範囲を切るのかを、呼び手が必ず一緒に言う。
|
|
12
|
+
|
|
13
|
+
import type { Pt, Rect } from "./model.js";
|
|
14
|
+
|
|
15
|
+
/** 幾何の許容 mm。座標はmmの整数が基本なので、これより細かい差は同一とみなす */
|
|
16
|
+
export const EPS = 0.5;
|
|
17
|
+
/** 面積の退化の閾値 mm² — 1mm×1mm 未満の片は捨てる */
|
|
18
|
+
const AREA_EPS = 1;
|
|
19
|
+
|
|
20
|
+
// ---- 基本 ----
|
|
21
|
+
|
|
22
|
+
/** 符号つき面積 mm² (反時計回りが正)。**シューレースはここにしか無い** */
|
|
23
|
+
export function signedArea(poly: Pt[]): number {
|
|
24
|
+
let s = 0;
|
|
25
|
+
for (let i = 0; i < poly.length; i++) {
|
|
26
|
+
const a = poly[i]!;
|
|
27
|
+
const b = poly[(i + 1) % poly.length]!;
|
|
28
|
+
s += a.x * b.y - b.x * a.y;
|
|
29
|
+
}
|
|
30
|
+
return s / 2;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** 面積 mm² */
|
|
34
|
+
export const area = (poly: Pt[]): number => Math.abs(signedArea(poly));
|
|
35
|
+
|
|
36
|
+
/** 凸片の集合の面積 mm² (片同士は重ならない前提 — check の GEO01/GEO02 が保証する) */
|
|
37
|
+
export const areaOf = (pieces: Pt[][]): number => pieces.reduce((a, p) => a + area(p), 0);
|
|
38
|
+
|
|
39
|
+
export function rectToPoly(r: Rect): Pt[] {
|
|
40
|
+
return [
|
|
41
|
+
{ x: r.x1, y: r.y1 },
|
|
42
|
+
{ x: r.x2, y: r.y1 },
|
|
43
|
+
{ x: r.x2, y: r.y2 },
|
|
44
|
+
{ x: r.x1, y: r.y2 },
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function bounds(poly: Pt[]): Rect {
|
|
49
|
+
return {
|
|
50
|
+
x1: Math.min(...poly.map((p) => p.x)),
|
|
51
|
+
x2: Math.max(...poly.map((p) => p.x)),
|
|
52
|
+
y1: Math.min(...poly.map((p) => p.y)),
|
|
53
|
+
y2: Math.max(...poly.map((p) => p.y)),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** 凸片の集合の外接矩形 (空なら undefined) */
|
|
58
|
+
export function boundsOf(pieces: Pt[][]): Rect | undefined {
|
|
59
|
+
const all = pieces.flat();
|
|
60
|
+
return all.length ? bounds(all) : undefined;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ---- 切る ----
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 凸多角形を半平面で切る (Sutherland–Hodgman)。
|
|
67
|
+
* 半平面は有向線分 a→b の左側 (外積>0)。**面積が退化した結果は空として返す** —
|
|
68
|
+
* 以前は 1e-9 m² を閾値にしていたので mm² では 1e-3 mm² となり、
|
|
69
|
+
* 実質どんな破片も生き残っていた。
|
|
70
|
+
*/
|
|
71
|
+
export function clipHalf(poly: Pt[], a: Pt, b: Pt, keepLeft: boolean): Pt[] {
|
|
72
|
+
const side = (p: Pt): number => {
|
|
73
|
+
const v = (b.x - a.x) * (p.y - a.y) - (b.y - a.y) * (p.x - a.x);
|
|
74
|
+
return keepLeft ? v : -v;
|
|
75
|
+
};
|
|
76
|
+
const out: Pt[] = [];
|
|
77
|
+
for (let i = 0; i < poly.length; i++) {
|
|
78
|
+
const p = poly[i]!;
|
|
79
|
+
const q = poly[(i + 1) % poly.length]!;
|
|
80
|
+
const sp = side(p);
|
|
81
|
+
const sq = side(q);
|
|
82
|
+
if (sp >= -1e-6) out.push(p);
|
|
83
|
+
if ((sp > 1e-6 && sq < -1e-6) || (sp < -1e-6 && sq > 1e-6)) {
|
|
84
|
+
const t = sp / (sp - sq);
|
|
85
|
+
out.push({ x: p.x + t * (q.x - p.x), y: p.y + t * (q.y - p.y) });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return out.length >= 3 && area(out) > AREA_EPS ? out : [];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** 軸平行の窓の内と外へ割る (どちらも凸片のまま) */
|
|
92
|
+
export function splitByRect(pieces: Pt[][], w: Rect): { inside: Pt[][]; outside: Pt[][] } {
|
|
93
|
+
const edges: Array<[Pt, Pt]> = [
|
|
94
|
+
[{ x: w.x1, y: w.y1 }, { x: w.x2, y: w.y1 }],
|
|
95
|
+
[{ x: w.x2, y: w.y1 }, { x: w.x2, y: w.y2 }],
|
|
96
|
+
[{ x: w.x2, y: w.y2 }, { x: w.x1, y: w.y2 }],
|
|
97
|
+
[{ x: w.x1, y: w.y2 }, { x: w.x1, y: w.y1 }],
|
|
98
|
+
];
|
|
99
|
+
const outside: Pt[][] = [];
|
|
100
|
+
let inside = pieces;
|
|
101
|
+
for (const [u, v] of edges) {
|
|
102
|
+
const next: Pt[][] = [];
|
|
103
|
+
for (const p of inside) {
|
|
104
|
+
const keep = clipHalf(p, u, v, true);
|
|
105
|
+
const drop = clipHalf(p, u, v, false);
|
|
106
|
+
if (keep.length) next.push(keep);
|
|
107
|
+
if (drop.length) outside.push(drop);
|
|
108
|
+
}
|
|
109
|
+
inside = next;
|
|
110
|
+
}
|
|
111
|
+
return { inside, outside };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** 軸平行の窓の内側だけ */
|
|
115
|
+
export const clipToRect = (poly: Pt[], w: Rect): Pt[] => splitByRect([poly], w).inside[0] ?? [];
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 凸片から凸片群を引く (差集合)。結果も凸片の集合。
|
|
119
|
+
*
|
|
120
|
+
* 一つの凸な引き手について、その各辺の外側を残す — 凸な穴の補集合は、辺ごとの
|
|
121
|
+
* 半平面の和で正確に覆える。引き手が複数なら順に適用する。
|
|
122
|
+
* **これが軸平行の矩形しか引けなかったせいで、斜めに切られた上階の下に屋根が
|
|
123
|
+
* 架からなかった** (ADR-0024 が謳った部分被覆が、斜めでは効いていなかった)。
|
|
124
|
+
*/
|
|
125
|
+
export function subtract(piece: Pt[], covers: Pt[][]): Pt[][] {
|
|
126
|
+
let rest: Pt[][] = [piece];
|
|
127
|
+
for (const c of covers) {
|
|
128
|
+
if (c.length < 3) continue;
|
|
129
|
+
const ccw = signedArea(c) > 0 ? c : [...c].reverse();
|
|
130
|
+
const next: Pt[][] = [];
|
|
131
|
+
for (const r of rest) {
|
|
132
|
+
// r ∩ c が空なら丸ごと残す (辺ごとに削ると重複が出るため先に見る)
|
|
133
|
+
let inter: Pt[] = r;
|
|
134
|
+
for (let i = 0; i < ccw.length && inter.length; i++) {
|
|
135
|
+
inter = clipHalf(inter, ccw[i]!, ccw[(i + 1) % ccw.length]!, true);
|
|
136
|
+
}
|
|
137
|
+
if (inter.length === 0) {
|
|
138
|
+
next.push(r);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
// 各辺の外側を順に取り、取った分は以降の候補から外す (重なりなく分割される)
|
|
142
|
+
let remain = r;
|
|
143
|
+
for (let i = 0; i < ccw.length && remain.length; i++) {
|
|
144
|
+
const u = ccw[i]!;
|
|
145
|
+
const v = ccw[(i + 1) % ccw.length]!;
|
|
146
|
+
const out = clipHalf(remain, u, v, false);
|
|
147
|
+
if (out.length) next.push(out);
|
|
148
|
+
remain = clipHalf(remain, u, v, true);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
rest = next;
|
|
152
|
+
}
|
|
153
|
+
return rest;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* 凸片の集合の**合併**面積 mm² (重なりを二重に数えない)。
|
|
158
|
+
* 建築面積 (水平投影) のように、階をまたぐ床を重ねて数える場面のための計算。
|
|
159
|
+
* 積んだものから順に引きながら足す — 座標圧縮と違い、斜めの片にも厳密である。
|
|
160
|
+
*/
|
|
161
|
+
export function unionArea(pieces: Pt[][]): number {
|
|
162
|
+
const acc: Pt[][] = [];
|
|
163
|
+
let total = 0;
|
|
164
|
+
for (const p of pieces) {
|
|
165
|
+
if (p.length < 3) continue;
|
|
166
|
+
total += areaOf(subtract(p, acc));
|
|
167
|
+
acc.push(p);
|
|
168
|
+
}
|
|
169
|
+
return total;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** 凸片の集合から凸片群を引く */
|
|
173
|
+
export const subtractAll = (pieces: Pt[][], covers: Pt[][]): Pt[][] =>
|
|
174
|
+
pieces.flatMap((p) => subtract(p, covers));
|
|
175
|
+
|
|
176
|
+
// ---- 窓 (どの範囲で測り、どの範囲を切るか) ----
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* 描かれた線の及ぶ窓 (ADR-0022)。
|
|
180
|
+
*
|
|
181
|
+
* **線に沿っては線自身の区間、線を横切っては相手を含む範囲。**
|
|
182
|
+
* この非対称が要である — 無限直線として扱うと離れた翼を巻き込み、
|
|
183
|
+
* 線分の外接矩形として扱うと軸平行の線で退化して何も切れない。
|
|
184
|
+
* どちらの誤りも実際に起きた (室が消える / LIN03 が誤報する)。
|
|
185
|
+
*
|
|
186
|
+
* `across` に相手の範囲を渡すと二空間の分け直しの窓 (沿っては積・横切っては和) になり、
|
|
187
|
+
* 省くと外皮を切る窓 (沿っては線の区間・横切っては自分の全体) になる。
|
|
188
|
+
*/
|
|
189
|
+
export function lineWindow(a: Pt, b: Pt, self: Rect, across?: Rect): Rect {
|
|
190
|
+
const vertical = Math.abs(b.y - a.y) >= Math.abs(b.x - a.x);
|
|
191
|
+
const lo = { x: Math.min(a.x, b.x), y: Math.min(a.y, b.y) };
|
|
192
|
+
const hi = { x: Math.max(a.x, b.x), y: Math.max(a.y, b.y) };
|
|
193
|
+
const span = (s: number, t: number, o1?: number, o2?: number): [number, number] =>
|
|
194
|
+
o1 === undefined || o2 === undefined
|
|
195
|
+
? [Math.min(s, t), Math.max(s, t)]
|
|
196
|
+
: [Math.min(s, o1), Math.max(t, o2)];
|
|
197
|
+
if (vertical) {
|
|
198
|
+
// 沿う = y、横切る = x
|
|
199
|
+
const [y1, y2] = across
|
|
200
|
+
? [Math.max(self.y1, across.y1), Math.min(self.y2, across.y2)]
|
|
201
|
+
: [lo.y, hi.y];
|
|
202
|
+
const [x1, x2] = span(self.x1, self.x2, across?.x1, across?.x2);
|
|
203
|
+
return { x1, x2, y1, y2 };
|
|
204
|
+
}
|
|
205
|
+
const [x1, x2] = across
|
|
206
|
+
? [Math.max(self.x1, across.x1), Math.min(self.x2, across.x2)]
|
|
207
|
+
: [lo.x, hi.x];
|
|
208
|
+
const [y1, y2] = span(self.y1, self.y2, across?.y1, across?.y2);
|
|
209
|
+
return { x1, x2, y1, y2 };
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** 窓が実体を持つか */
|
|
213
|
+
export const validWindow = (w: Rect): boolean => w.x2 - w.x1 > EPS && w.y2 - w.y1 > EPS;
|
|
214
|
+
|
|
215
|
+
/** 窓に触れる凸片だけを選ぶ。線が届かない翼を判定から外すための門 */
|
|
216
|
+
export function touching(pieces: Pt[][], w: Rect): Pt[][] {
|
|
217
|
+
return pieces.filter((p) => {
|
|
218
|
+
const r = bounds(p);
|
|
219
|
+
return r.x2 > w.x1 - EPS && r.x1 < w.x2 + EPS && r.y2 > w.y1 - EPS && r.y1 < w.y2 + EPS;
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* 線が触れる凸片が、線のどちら側に偏っているか (正=左 / 負=右 / 0=偏りなし)。
|
|
225
|
+
*
|
|
226
|
+
* **母集団は「線が触れる凸片」であり、それを丸ごと測る。**二つの誤りの間を通る:
|
|
227
|
+
* 全ての凸片を測ると、線が届かない離れた翼が符号を支配して室が消える。
|
|
228
|
+
* 窓の中だけを測ると、窓の外にある同じ片の大部分という判断材料を捨てて、
|
|
229
|
+
* 隅から隅への線が「二等分」に見えてしまう。切るのは窓の中だけ、決めるのは片の全体。
|
|
230
|
+
*/
|
|
231
|
+
export function sideOfTouching(pieces: Pt[][], w: Rect, a: Pt, b: Pt): number {
|
|
232
|
+
let left = 0;
|
|
233
|
+
let right = 0;
|
|
234
|
+
for (const p of touching(pieces, w)) {
|
|
235
|
+
left += area(clipHalf(p, a, b, true));
|
|
236
|
+
right += area(clipHalf(p, a, b, false));
|
|
237
|
+
}
|
|
238
|
+
const d = left - right;
|
|
239
|
+
return Math.abs(d) < AREA_EPS ? 0 : d > 0 ? 1 : -1;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** 窓の中で線が実際に切っているか (両側に面積が残るか) */
|
|
243
|
+
export function cutsInWindow(pieces: Pt[][], w: Rect, a: Pt, b: Pt): boolean {
|
|
244
|
+
for (const p of splitByRect(touching(pieces, w), w).inside) {
|
|
245
|
+
if (clipHalf(p, a, b, true).length > 0 && clipHalf(p, a, b, false).length > 0) return true;
|
|
246
|
+
}
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// ---- 包含 ----
|
|
251
|
+
|
|
252
|
+
/** 点が多角形の辺の上にあるか */
|
|
253
|
+
export function onEdge(p: Pt, poly: Pt[], eps = 1): boolean {
|
|
254
|
+
for (let i = 0; i < poly.length; i++) {
|
|
255
|
+
const a = poly[i]!;
|
|
256
|
+
const b = poly[(i + 1) % poly.length]!;
|
|
257
|
+
const dx = b.x - a.x;
|
|
258
|
+
const dy = b.y - a.y;
|
|
259
|
+
const len2 = dx * dx + dy * dy;
|
|
260
|
+
const t = len2 === 0 ? 0 : Math.max(0, Math.min(1, ((p.x - a.x) * dx + (p.y - a.y) * dy) / len2));
|
|
261
|
+
const qx = a.x + t * dx;
|
|
262
|
+
const qy = a.y + t * dy;
|
|
263
|
+
if ((p.x - qx) ** 2 + (p.y - qy) ** 2 <= eps * eps) return true;
|
|
264
|
+
}
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** 点が多角形の内側にあるか (境界上は内側扱い) */
|
|
269
|
+
export function pointIn(p: Pt, poly: Pt[], eps = 1): boolean {
|
|
270
|
+
if (onEdge(p, poly, eps)) return true;
|
|
271
|
+
let inside = false;
|
|
272
|
+
for (let i = 0, j = poly.length - 1; i < poly.length; j = i++) {
|
|
273
|
+
const a = poly[i]!;
|
|
274
|
+
const b = poly[j]!;
|
|
275
|
+
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) {
|
|
276
|
+
inside = !inside;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return inside;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** 二つの凸片の集合が平面上で重なるか */
|
|
283
|
+
export function overlaps(A: Pt[][], B: Pt[][]): boolean {
|
|
284
|
+
for (const a of A) {
|
|
285
|
+
for (const b of B) {
|
|
286
|
+
let inter: Pt[] = a;
|
|
287
|
+
const ccw = signedArea(b) > 0 ? b : [...b].reverse();
|
|
288
|
+
for (let i = 0; i < ccw.length && inter.length; i++) {
|
|
289
|
+
inter = clipHalf(inter, ccw[i]!, ccw[(i + 1) % ccw.length]!, true);
|
|
290
|
+
}
|
|
291
|
+
if (inter.length > 0) return true;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return false;
|
|
295
|
+
}
|
package/src/site.ts
CHANGED
|
@@ -3,12 +3,17 @@
|
|
|
3
3
|
// 敷地 = site:1 属性を持つゾーン。地上の外部空間 (庭・アプローチ) はL1上の実在の空間として
|
|
4
4
|
// 建物の周りをタイルし、道路・隣地は /out を割った複数のexterior空間 (道路は road:幅員)。
|
|
5
5
|
|
|
6
|
+
import { unionArea } from "./poly.js";
|
|
6
7
|
import { segmentLength, segmentsFor } from "./graph.js";
|
|
7
8
|
import {
|
|
8
9
|
areaM2,
|
|
10
|
+
isIndoor,
|
|
9
11
|
isSemiOutdoor,
|
|
12
|
+
polygonAreaM2,
|
|
13
|
+
regionOf,
|
|
10
14
|
unionAreaM2,
|
|
11
15
|
type Model,
|
|
16
|
+
type SitePolygon,
|
|
12
17
|
type Space,
|
|
13
18
|
type Zone,
|
|
14
19
|
} from "./model.js";
|
|
@@ -23,9 +28,11 @@ export interface RoadFrontage {
|
|
|
23
28
|
|
|
24
29
|
export interface SiteReport {
|
|
25
30
|
siteZone?: Zone;
|
|
31
|
+
/** 敷地形状 (polygon宣言 — ADR-0011)。あるとき導出面積はこの多角形から出る */
|
|
32
|
+
polygon?: SitePolygon;
|
|
26
33
|
/** 宣言された敷地面積 m² (zoneのarea:属性 — 測量値) */
|
|
27
34
|
declaredArea?: number;
|
|
28
|
-
/** 導出された敷地面積 m² (
|
|
35
|
+
/** 導出された敷地面積 m² (敷地形状があれば多角形、なければ敷地内空間+建物水平投影の合併) */
|
|
29
36
|
derivedArea: number;
|
|
30
37
|
/** 建築面積 m² (屋内空間の水平投影の合併 — 庇・バルコニーの算入は粗い) */
|
|
31
38
|
footprint: number;
|
|
@@ -39,20 +46,20 @@ export function siteReport(model: Model): SiteReport {
|
|
|
39
46
|
const declared = siteZone?.attrs["area"];
|
|
40
47
|
|
|
41
48
|
const spaces = [...model.spaces.values()];
|
|
42
|
-
const indoor = spaces.filter(
|
|
43
|
-
(s) =>
|
|
44
|
-
s.rects.length > 0 && s.level && s.type !== "void" && s.type !== "exterior" &&
|
|
45
|
-
!isSemiOutdoor(model, s),
|
|
46
|
-
);
|
|
49
|
+
const indoor = spaces.filter((s) => s.level && isIndoor(model, s));
|
|
47
50
|
const siteChildren = siteZone
|
|
48
51
|
? spaces.filter((s) => s.path.startsWith(siteZone.path + "/") && s.rects.length > 0)
|
|
49
52
|
: [];
|
|
50
53
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const polygon = siteZone ? model.polygons.get(siteZone.path) : undefined;
|
|
55
|
+
const derivedArea = polygon
|
|
56
|
+
? Math.round(polygonAreaM2(polygon.points) * 100) / 100
|
|
57
|
+
: unionAreaM2([
|
|
58
|
+
...siteChildren.flatMap((s) => s.rects),
|
|
59
|
+
...indoor.flatMap((s) => s.rects),
|
|
60
|
+
]);
|
|
61
|
+
// 建築面積も導出された形から。割付から数えると、隅切りで落とした分まで数えてしまう
|
|
62
|
+
const footprint = Math.round((unionArea(indoor.flatMap((s) => regionOf(s))) / 1e6) * 100) / 100;
|
|
56
63
|
const totalFloor =
|
|
57
64
|
Math.round(indoor.reduce((sum, s) => sum + (areaM2(s) ?? 0), 0) * 100) / 100;
|
|
58
65
|
|
|
@@ -73,6 +80,7 @@ export function siteReport(model: Model): SiteReport {
|
|
|
73
80
|
|
|
74
81
|
return {
|
|
75
82
|
...(siteZone ? { siteZone } : {}),
|
|
83
|
+
...(polygon ? { polygon } : {}),
|
|
76
84
|
...(typeof declared === "number" ? { declaredArea: declared } : {}),
|
|
77
85
|
derivedArea,
|
|
78
86
|
footprint,
|