@kensnzk/koyu 0.25.0 → 0.26.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.md +5 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/diagnose.d.ts +1 -0
- package/dist/core/diagnose.d.ts.map +1 -1
- package/dist/core/diagnose.js +40 -4
- package/dist/core/diagnose.js.map +1 -1
- package/dist/core/graph.d.ts +7 -1
- package/dist/core/graph.d.ts.map +1 -1
- package/dist/core/graph.js +125 -13
- package/dist/core/graph.js.map +1 -1
- package/dist/core/model.d.ts +16 -1
- package/dist/core/model.d.ts.map +1 -1
- package/dist/core/model.js +20 -1
- package/dist/core/model.js.map +1 -1
- package/dist/draw/marks.d.ts +3 -1
- package/dist/draw/marks.d.ts.map +1 -1
- package/dist/draw/marks.js +4 -1
- package/dist/draw/marks.js.map +1 -1
- package/dist/draw/plan.d.ts.map +1 -1
- package/dist/draw/plan.js +5 -3
- package/dist/draw/plan.js.map +1 -1
- package/dist/draw/sheet.d.ts +15 -0
- package/dist/draw/sheet.d.ts.map +1 -1
- package/dist/draw/sheet.js +15 -0
- package/dist/draw/sheet.js.map +1 -1
- package/dist/model.d.ts +1 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +1 -1
- package/dist/model.js.map +1 -1
- package/dist/validate/builtin/index.d.ts +8 -3
- package/dist/validate/builtin/index.d.ts.map +1 -1
- package/dist/validate/builtin/index.js +8 -7
- package/dist/validate/builtin/index.js.map +1 -1
- package/examples/basement/main.muro +1 -1
- package/examples/complex/main.muro +1 -1
- package/examples/house/main.muro +1 -1
- package/examples/house.muro +1 -1
- package/examples/mansion.muro +1 -1
- package/examples/office.muro +1 -1
- package/examples/steps/06-finished.muro +1 -1
- package/examples/tower/main.muro +1 -1
- package/examples/twin/main.muro +1 -1
- package/examples/two-rooms.canonical.json +1 -1
- package/examples/two-rooms.muro +1 -1
- package/package.json +4 -3
- package/src/cli.ts +1 -1
- package/src/core/diagnose.ts +43 -3
- package/src/core/graph.ts +147 -11
- package/src/core/model.ts +21 -1
- package/src/draw/marks.ts +7 -2
- package/src/draw/plan.ts +5 -3
- package/src/draw/sheet.ts +15 -0
- package/src/model.ts +1 -0
- package/src/validate/builtin/index.ts +8 -7
- package/dist/validate/builtin/envelope.d.ts +0 -30
- package/dist/validate/builtin/envelope.d.ts.map +0 -1
- package/dist/validate/builtin/envelope.js +0 -169
- package/dist/validate/builtin/envelope.js.map +0 -1
- package/src/validate/builtin/envelope.ts +0 -227
package/src/core/diagnose.ts
CHANGED
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
// severity はコードの不変属性 — 重さを変えたくなったら新コードを切る。
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
|
+
envelopeGaps,
|
|
12
13
|
placeBand,
|
|
13
14
|
placeOpening,
|
|
14
15
|
planOverlap,
|
|
16
|
+
segmentLength,
|
|
15
17
|
segmentsFor,
|
|
16
18
|
spacesOverlap,
|
|
17
19
|
} from "./graph.js";
|
|
@@ -25,7 +27,8 @@ import { heff, isSemiOutdoor, levelsSorted, SUPPORTED_LANGUAGE_VERSIONS, type At
|
|
|
25
27
|
srcRef,
|
|
26
28
|
polygonSelfIntersection,
|
|
27
29
|
isOutside,
|
|
28
|
-
isVoid
|
|
30
|
+
isVoid,
|
|
31
|
+
EXTERIOR
|
|
29
32
|
} from "./model.js";
|
|
30
33
|
import { ASSET_ELEM, attrSpec, isNamespaced } from "./vocabulary.js";
|
|
31
34
|
import { runDecls, runIssues } from "./vertical.js";
|
|
@@ -67,6 +70,7 @@ export const DIAGNOSTIC_CODES = {
|
|
|
67
70
|
BND04: "error", // 接していない空間の境界
|
|
68
71
|
BND05: "warning", // 同一空間対でedge限定の有無が混在
|
|
69
72
|
BND06: "warning", // 境界線分がゼロ
|
|
73
|
+
BND08: "warning", // 屋外に面する外周に境界が書かれていない — 既定の外壁を導いた (ADR-0065)
|
|
70
74
|
LVL01: "error", // レベルzの重複
|
|
71
75
|
GEO01: "error", // 自らの領域 (合併の矩形) 同士の重なり
|
|
72
76
|
GEO02: "error", // 同一レベルの空間同士の重なり
|
|
@@ -312,6 +316,7 @@ export function checkDiagnostics(model: Model): Diagnostic[] {
|
|
|
312
316
|
checkLanguageVersion(ctx);
|
|
313
317
|
checkUids(ctx);
|
|
314
318
|
checkBoundaryValidity(ctx);
|
|
319
|
+
checkEnvelope(ctx);
|
|
315
320
|
checkAreas(ctx);
|
|
316
321
|
checkZones(ctx);
|
|
317
322
|
checkHeights(ctx);
|
|
@@ -337,11 +342,44 @@ function voidCoverage(s: Space, partners: Space[]): number {
|
|
|
337
342
|
return area > 0 ? inter / area : 0;
|
|
338
343
|
}
|
|
339
344
|
|
|
345
|
+
/**
|
|
346
|
+
* 屋外に面していながら境界が書かれていない外周 — BND08 (ADR-0065)。
|
|
347
|
+
*
|
|
348
|
+
* **これは穴の報告ではない。**1.4 からその面は壁であり、`deriveExteriorBoundaries` が既に
|
|
349
|
+
* 一枚導いている。言っているのは「どの外部に面しているかを書いていない」ことのほうで、
|
|
350
|
+
* 道路側か隣地側か庭かは書かれなければ誰にも分からない情報だからである (ADR-0014 決定2b が
|
|
351
|
+
* 守ろうとし、ADR-0025 が失われる様を数えたもの)。
|
|
352
|
+
*
|
|
353
|
+
* **母集団は空間の宣言であり、順は宣言順である。**一つの空間につき一件で、区間ごとには言わない —
|
|
354
|
+
* 直すのは一本の `boundary` 行であって、面の数だけ行を書くわけではない。
|
|
355
|
+
*/
|
|
356
|
+
function checkEnvelope(ctx: Ctx): void {
|
|
357
|
+
const { model, emit } = ctx;
|
|
358
|
+
for (const b of model.boundaries) {
|
|
359
|
+
if (!b.derived || b.b !== EXTERIOR) continue;
|
|
360
|
+
const s = model.spaces.get(b.a);
|
|
361
|
+
if (!s) continue;
|
|
362
|
+
const runs = envelopeGaps(model, s);
|
|
363
|
+
if (runs.length === 0) continue;
|
|
364
|
+
const total = runs.reduce((sum, r) => sum + segmentLength(r), 0);
|
|
365
|
+
const faces = runs
|
|
366
|
+
.map((r) => `${r.edgeOfA ?? (r.horizontal ? "N/S" : "E/W")} ${Math.round(segmentLength(r))}mm`)
|
|
367
|
+
.join(" / ");
|
|
368
|
+
emit(
|
|
369
|
+
"BND08",
|
|
370
|
+
`A default wall was derived where ${s.path} faces the outside: ${faces} (${Math.round(total)}mm over ${runs.length} run${runs.length === 1 ? "" : "s"}) — write a boundary to say which outside it faces`,
|
|
371
|
+
{ line: s.line, file: s.file, path: [s.path] },
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
340
376
|
/** 境界の参照先 — REF01 / BND01 */
|
|
341
377
|
function checkBoundaryRefs(ctx: Ctx): void {
|
|
342
378
|
const { model, emit, loc, withRect, levels, levelIndex } = ctx;
|
|
343
|
-
//
|
|
379
|
+
// 境界の参照先。**母集団は書かれた宣言である** — 導出された境界は誰も書いていないので
|
|
380
|
+
// 参照の誤りを問えない。外部との既定境界 (ADR-0065) の相手は空間ですらない
|
|
344
381
|
for (const b of model.boundaries) {
|
|
382
|
+
if (b.derived) continue;
|
|
345
383
|
for (const p of [b.a, b.b]) {
|
|
346
384
|
if (!model.spaces.has(p)) {
|
|
347
385
|
emit("REF01", `References an undefined space: ${p}`, { line: b.line, file: b.file, path: [b.a, b.b] });
|
|
@@ -610,7 +648,9 @@ function checkLanguageVersion(ctx: Ctx): void {
|
|
|
610
648
|
// 既定境界 (ADR-0014) が導出されるファイルは、0.1の意味 (境界なし+警告) と食い違う — エラーで二択を示す
|
|
611
649
|
if (model.version === "0.1") {
|
|
612
650
|
for (const b of model.boundaries) {
|
|
613
|
-
|
|
651
|
+
// 外部との既定境界は 1.4 の話であり、0.1 → 0.2 の二択ではない (ADR-0065)。
|
|
652
|
+
// 版に関わらず導出され、書き忘れは BND08 が言う
|
|
653
|
+
if (b.derived && b.b !== EXTERIOR) {
|
|
614
654
|
emit(
|
|
615
655
|
"VER01",
|
|
616
656
|
`A koyu 0.1 file has a touching pair with no declared boundary: ${b.a} | ${b.b} — in 0.2 a default wall is derived and the meaning changes. Declare the boundary, or raise the version to koyu 0.2`,
|
package/src/core/graph.ts
CHANGED
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
canonicalBoundaryOrder,
|
|
9
9
|
canonicalizeDrawn,
|
|
10
10
|
compareCanonical,
|
|
11
|
+
EXTERIOR,
|
|
12
|
+
isOutside,
|
|
11
13
|
rectToPoly,
|
|
12
14
|
srcRef,
|
|
13
15
|
} from "./model.js";
|
|
@@ -191,6 +193,76 @@ export function deriveDefaultBoundaries(model: Model): void {
|
|
|
191
193
|
declared.add(key);
|
|
192
194
|
}
|
|
193
195
|
}
|
|
196
|
+
deriveExteriorBoundaries(model);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The spaces whose free perimeter becomes a wall.
|
|
201
|
+
*
|
|
202
|
+
* **Not every space is enclosed, and the excluded ones are excluded because being open is what
|
|
203
|
+
* they are** — an `outside:1` space is the outside, a semi-outdoor space (ADR-0007) is one whose
|
|
204
|
+
* openness was declared with `open` or `air:1`, and the tiles under a `site:1` zone are paving.
|
|
205
|
+
* Putting a wall around any of those would be inventing a building nobody wrote.
|
|
206
|
+
*
|
|
207
|
+
* A void is *not* excluded. A void has a region and sits on a level, and where one reaches the
|
|
208
|
+
* edge of the building the outer wall passes it exactly as it passes a room.
|
|
209
|
+
*
|
|
210
|
+
* **`isSemiOutdoor` cannot see a derived wall, so this cannot chase its own tail.** It reads
|
|
211
|
+
* only `open` and `air:1` boundaries, and every boundary derived here is a plain `wall` — so
|
|
212
|
+
* running the derivation can never change which spaces are in this population, which is what
|
|
213
|
+
* makes `deriveDefaultBoundaries` idempotent.
|
|
214
|
+
*/
|
|
215
|
+
function facesTheOutside(s: Space, siteZones: readonly string[], index: GapIndex): boolean {
|
|
216
|
+
if (s.rects.length === 0 || s.level === undefined) return false;
|
|
217
|
+
if (isOutside(s) || index.semiOutdoor.has(s.path)) return false;
|
|
218
|
+
return !siteZones.some((prefix) => s.path.startsWith(prefix));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* 外部との既定境界の導出 (ADR-0065) — 「屋外に面していれば、宣言しない限り壁」。
|
|
223
|
+
*
|
|
224
|
+
* ADR-0014 は接する空間の組に既定の壁を導いたが、領域を持たない相手 (外部) との組は除いた。
|
|
225
|
+
* 名指し (道路側か隣地側か庭か) が情報だからである。代償は ADR-0025 が数えた通りで、
|
|
226
|
+
* **外部への境界の書き忘れは黙って壁の不在になる** — 416空間の建物で34箇所、目で見つけたのは2箇所。
|
|
227
|
+
*
|
|
228
|
+
* 名指しは旧規則で得られていたわけではない。要求されていただけで、忘れたときに手に入るのは
|
|
229
|
+
* 名前ではなく穴だった。**既定を壁にしても名指しは失われない** — 宣言はそのまま勝つ。
|
|
230
|
+
* 失われるのは穴のほうである。書き忘れは BND08 が言葉にする。
|
|
231
|
+
*
|
|
232
|
+
* 抑制は**組ではなく区間で効く。**外部は組ではない — 「他の何にも面していない残り」だからで、
|
|
233
|
+
* 抑制すべき相手が居ない。`envelopeGaps` が宣言された境界の実現する区間を引いた残りが、
|
|
234
|
+
* そのまま導出される壁になる。だから `boundary /L1/a /road edge:S` と書いた空間の
|
|
235
|
+
* 北・東・西にも壁が立つ (1.3 までは何も立たなかった)。
|
|
236
|
+
*/
|
|
237
|
+
function deriveExteriorBoundaries(model: Model): void {
|
|
238
|
+
const siteZones = [...model.zones.values()]
|
|
239
|
+
.filter((z) => z.attrs["site"] === 1)
|
|
240
|
+
.map((z) => `${z.path}/`);
|
|
241
|
+
// 冪等 — 二度目の呼び出しで同じ壁を重ねない。`envelopeGaps` は導出された境界を数えないので、
|
|
242
|
+
// これが無いと一度導いた壁の区間がまた「面していない残り」として返ってくる
|
|
243
|
+
const already = new Set(
|
|
244
|
+
model.boundaries.filter((b) => b.b === EXTERIOR).map((b) => b.a),
|
|
245
|
+
);
|
|
246
|
+
const index = indexFor(model);
|
|
247
|
+
// **宣言順で走る。**導出された境界は正準JSONに出ないので書かれた向きを持たず、
|
|
248
|
+
// 並べ直しは `canonicalBoundaryOrder` が受け持つ (ADR-0041)
|
|
249
|
+
for (const s of model.spaces.values()) {
|
|
250
|
+
if (already.has(s.path)) continue;
|
|
251
|
+
if (!facesTheOutside(s, siteZones, index)) continue;
|
|
252
|
+
if (gapsOf(model, s, index).length === 0) continue;
|
|
253
|
+
model.boundaries.push({
|
|
254
|
+
// a は領域を持つ側である。`edgeOfA` は室から見た面になり、`edge:` を書いた宣言と
|
|
255
|
+
// 同じ向きで読める
|
|
256
|
+
a: s.path,
|
|
257
|
+
b: EXTERIOR,
|
|
258
|
+
kind: "wall",
|
|
259
|
+
derived: true,
|
|
260
|
+
attrs: {},
|
|
261
|
+
openings: [],
|
|
262
|
+
segs: [],
|
|
263
|
+
line: 0,
|
|
264
|
+
});
|
|
265
|
+
}
|
|
194
266
|
}
|
|
195
267
|
|
|
196
268
|
/**
|
|
@@ -305,6 +377,10 @@ export function drawnCut(
|
|
|
305
377
|
/** 境界の壁芯線分を導く。壁の位置は空間の割付から生成される — 壁を置く操作は存在しない */
|
|
306
378
|
export function segmentsFor(model: Model, b: Boundary): Segment[] {
|
|
307
379
|
const sa = model.spaces.get(b.a);
|
|
380
|
+
// 外部との既定境界 (ADR-0065)。相手は空間ではないので `model.spaces` を引いても居ない。
|
|
381
|
+
// **実現するのは「他の何にも面していない残り」そのもの** — 宣言された境界が覆う区間は
|
|
382
|
+
// その宣言のものであり、ここには残らない。だから抑制は組ではなく区間で効く
|
|
383
|
+
if (b.b === EXTERIOR) return sa ? envelopeGaps(model, sa) : [];
|
|
308
384
|
const sb = model.spaces.get(b.b);
|
|
309
385
|
if (!sa || !sb) return [];
|
|
310
386
|
|
|
@@ -351,17 +427,68 @@ export function segmentsFor(model: Model, b: Boundary): Segment[] {
|
|
|
351
427
|
* 外部への境界の書き忘れは黙って壁の不在になる。これを言葉にするための導出。
|
|
352
428
|
*/
|
|
353
429
|
export function envelopeGaps(model: Model, s: Space): Segment[] {
|
|
430
|
+
return gapsOf(model, s, indexFor(model));
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* The lookups `gapsOf` and the exterior derivation would otherwise rebuild per space.
|
|
435
|
+
*
|
|
436
|
+
* **Asking about one space is cheap; asking about all of them was not.** Both a walk of
|
|
437
|
+
* `model.spaces` and a walk of `model.boundaries` sat inside a loop over every space, and on a
|
|
438
|
+
* 1,808-space building that took composition from 165ms to 745ms — nearly all of it spent
|
|
439
|
+
* establishing that there was nothing to derive.
|
|
440
|
+
*/
|
|
441
|
+
interface GapIndex {
|
|
442
|
+
/** the pieces of every space of a level, by level */
|
|
443
|
+
readonly byLevel: Map<string, Array<{ space: Space; pieces: Pt[][] }>>;
|
|
444
|
+
/** the written, horizontal boundaries that name a space, by path */
|
|
445
|
+
readonly byPath: Map<string, Boundary[]>;
|
|
446
|
+
/** the paths derived as semi-outdoor (ADR-0007) — an `open` or `air:1` boundary to the outside */
|
|
447
|
+
readonly semiOutdoor: ReadonlySet<string>;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function indexFor(model: Model): GapIndex {
|
|
451
|
+
const byLevel = new Map<string, Array<{ space: Space; pieces: Pt[][] }>>();
|
|
452
|
+
for (const o of model.spaces.values()) {
|
|
453
|
+
if (o.level === undefined) continue;
|
|
454
|
+
const row = byLevel.get(o.level) ?? [];
|
|
455
|
+
row.push({ space: o, pieces: piecesOf(o) });
|
|
456
|
+
byLevel.set(o.level, row);
|
|
457
|
+
}
|
|
458
|
+
const byPath = new Map<string, Boundary[]>();
|
|
459
|
+
const semiOutdoor = new Set<string>();
|
|
460
|
+
for (const b of model.boundaries) {
|
|
461
|
+
if (!b.derived && b.kind !== "stair" && b.kind !== "shaft" && b.kind !== "void") {
|
|
462
|
+
for (const path of b.a === b.b ? [b.a] : [b.a, b.b]) {
|
|
463
|
+
const row = byPath.get(path) ?? [];
|
|
464
|
+
row.push(b);
|
|
465
|
+
byPath.set(path, row);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
// the same predicate as `isSemiOutdoor`, read once over the boundaries instead of once
|
|
469
|
+
// over the boundaries per space
|
|
470
|
+
if (b.kind !== "open" && !b.air) continue;
|
|
471
|
+
for (const [self, other] of [[b.a, b.b], [b.b, b.a]] as const) {
|
|
472
|
+
const mine = model.spaces.get(self);
|
|
473
|
+
const theirs = model.spaces.get(other);
|
|
474
|
+
if (mine && mine.rects.length > 0 && theirs && isOutside(theirs)) semiOutdoor.add(self);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
return { byLevel, byPath, semiOutdoor };
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function gapsOf(model: Model, s: Space, index: GapIndex): Segment[] {
|
|
354
481
|
if (s.rects.length === 0 || !s.level) return [];
|
|
355
482
|
const others: Pt[][] = [];
|
|
356
|
-
for (const o of
|
|
357
|
-
if (o === s
|
|
358
|
-
others.push(...
|
|
483
|
+
for (const o of index.byLevel.get(s.level) ?? []) {
|
|
484
|
+
if (o.space === s) continue;
|
|
485
|
+
others.push(...o.pieces);
|
|
359
486
|
}
|
|
360
487
|
let gaps = pieceOutline(piecesOf(s), others);
|
|
361
|
-
// 宣言された境界 (外部・斜めを含む)
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
488
|
+
// 宣言された境界 (外部・斜めを含む) が覆う区間を引く。
|
|
489
|
+
// **導出された境界は引かない。**外部との既定境界はこの関数の答えそのものなので、数えれば
|
|
490
|
+
// 自分を呼び戻す。接する空間同士の既定壁は共有辺であり、上の `others` が既に引いている
|
|
491
|
+
for (const b of index.byPath.get(s.path) ?? []) {
|
|
365
492
|
for (const seg of segmentsFor(model, b)) {
|
|
366
493
|
gaps = gaps.flatMap((g) => subtractOverlap(g, seg));
|
|
367
494
|
}
|
|
@@ -673,7 +800,13 @@ export function doorsBetween(model: Model, from: string, to: string): Route | un
|
|
|
673
800
|
}
|
|
674
801
|
|
|
675
802
|
export interface NeighborInfo {
|
|
676
|
-
|
|
803
|
+
/** 相手の綴り。空間ならその path、外部との既定境界なら [[EXTERIOR]] */
|
|
804
|
+
path: string;
|
|
805
|
+
/**
|
|
806
|
+
* 相手の空間。**外部との既定境界 (ADR-0065) では無い** — 外部は空間ではないからである。
|
|
807
|
+
* `path` は必ずあり、`space` は名指された相手が居るときだけある
|
|
808
|
+
*/
|
|
809
|
+
space?: Space;
|
|
677
810
|
boundary: Boundary;
|
|
678
811
|
passable: boolean;
|
|
679
812
|
doors: number;
|
|
@@ -683,11 +816,14 @@ export function neighbors(model: Model, path: string): NeighborInfo[] {
|
|
|
683
816
|
const out: NeighborInfo[] = [];
|
|
684
817
|
for (const b of model.boundaries) {
|
|
685
818
|
const other = b.a === path ? b.b : b.b === path ? b.a : undefined;
|
|
686
|
-
if (
|
|
819
|
+
if (other === undefined) continue;
|
|
687
820
|
const s = model.spaces.get(other);
|
|
688
|
-
|
|
821
|
+
// 外部との既定境界は関係として本物である — 隠すと、壁のある面を「何とも接していない」と
|
|
822
|
+
// 答えることになる。相手が空間として居ないだけで、辺は在る
|
|
823
|
+
if (!s && other !== EXTERIOR) continue;
|
|
689
824
|
out.push({
|
|
690
|
-
|
|
825
|
+
path: other,
|
|
826
|
+
...(s ? { space: s } : {}),
|
|
691
827
|
boundary: b,
|
|
692
828
|
passable: passable(b),
|
|
693
829
|
doors: b.openings.filter((o) => o.kind === "door").length,
|
package/src/core/model.ts
CHANGED
|
@@ -47,6 +47,10 @@ export const MURO_SUPPORT: readonly { muro: string; since: string; until: string
|
|
|
47
47
|
// space, so tenancy, fire compartment and department all competed for it. VER07 stops it here;
|
|
48
48
|
// the ledger row stays so that every version up to 1.2 goes on reading it (ADR-0061).
|
|
49
49
|
{ muro: "1.3", since: "0.21.0", until: null },
|
|
50
|
+
// 1.4 inverts the exterior default. Up to 1.3 a face looking at nothing got no wall unless a
|
|
51
|
+
// boundary to a region-less space was written, so a forgotten line was a silent hole; from 1.4
|
|
52
|
+
// that face is a wall, and what is declared is which outside it looks at (ADR-0065).
|
|
53
|
+
{ muro: "1.4", since: "0.26.0", until: null },
|
|
50
54
|
];
|
|
51
55
|
|
|
52
56
|
/** The word a version line is written with from 1.2 on. */
|
|
@@ -73,7 +77,7 @@ export const LAST_KOYU_SPELLED_VERSION = "1.1";
|
|
|
73
77
|
* `since` column is written in this vocabulary, and every surface that answers "which muro
|
|
74
78
|
* does this build speak" needs both halves at once.
|
|
75
79
|
*/
|
|
76
|
-
export const KOYU_VERSION = "0.
|
|
80
|
+
export const KOYU_VERSION = "0.26.0";
|
|
77
81
|
|
|
78
82
|
/**
|
|
79
83
|
* Whether `a` names a later language version than `b`.
|
|
@@ -791,6 +795,22 @@ export function columnsFor(model: Model, level: string): Column[] {
|
|
|
791
795
|
return out;
|
|
792
796
|
}
|
|
793
797
|
|
|
798
|
+
/**
|
|
799
|
+
* The counterpart of a derived exterior wall — the outside a face looks at when nothing was
|
|
800
|
+
* written about it.
|
|
801
|
+
*
|
|
802
|
+
* **It is deliberately not a member of `model.spaces`.** Every space path begins with `/`
|
|
803
|
+
* (`parseSpace` refuses one that does not), so this spelling can never collide with a space
|
|
804
|
+
* anyone wrote; and a materialised exterior would leak into the canonical form, the area
|
|
805
|
+
* tallies, the drawings and every listing that walks `model.spaces`, each of which would then
|
|
806
|
+
* need an exclusion nobody can be trusted to remember.
|
|
807
|
+
*
|
|
808
|
+
* An `outside:1` space is not replaced by it. Declaring one **names** a part of the outside —
|
|
809
|
+
* the road, the neighbour, the garden — and a boundary to it wins over the default wherever it
|
|
810
|
+
* reaches. This constant is what stands where no name was given.
|
|
811
|
+
*/
|
|
812
|
+
export const EXTERIOR = "outside";
|
|
813
|
+
|
|
794
814
|
/**
|
|
795
815
|
* 建物の外部か。**空間の型ではなく `outside:1` の宣言で決まる。**
|
|
796
816
|
*
|
package/src/draw/marks.ts
CHANGED
|
@@ -29,8 +29,10 @@ import type { RunDevice, Seg2 } from "../core/vertical.js";
|
|
|
29
29
|
export type MarkRole =
|
|
30
30
|
/** a space's face, cut by the plane */
|
|
31
31
|
| "space"
|
|
32
|
-
/** the same, where the space is
|
|
32
|
+
/** the same, where the space is semi-outdoor — roofed, not enclosed */
|
|
33
33
|
| "space-semi-outdoor"
|
|
34
|
+
/** the same, where the space is declared `outside:1` — ground, not floor */
|
|
35
|
+
| "space-outdoor"
|
|
34
36
|
/** a void's face — no floor, so no room */
|
|
35
37
|
| "space-void"
|
|
36
38
|
/** the void's two bounding-box diagonals (a drafting convention, not a shape of the building) */
|
|
@@ -182,7 +184,10 @@ export function planMarks(form: Form, level: string, opts?: MarkOptions): Mark[]
|
|
|
182
184
|
continue;
|
|
183
185
|
}
|
|
184
186
|
marks.push({
|
|
185
|
-
|
|
187
|
+
// **Outside is asked first.** A space declared `outside:1` that also carries an `open` or
|
|
188
|
+
// `air:1` boundary to another outside space derives as semi-outdoor too, and of the two
|
|
189
|
+
// facts the declared one is the one that decides what the space is
|
|
190
|
+
role: s?.outside ? "space-outdoor" : s?.semiOutdoor ? "space-semi-outdoor" : "space",
|
|
186
191
|
of: "space",
|
|
187
192
|
ref: e.ref,
|
|
188
193
|
class: "cut",
|
package/src/draw/plan.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { derive } from "../core/derive.js";
|
|
|
13
13
|
import { displayName, polyBounds, type Model, type Pt } from "../core/model.js";
|
|
14
14
|
import { slopeText } from "../core/vertical.js";
|
|
15
15
|
import { planMarks, type Mark } from "./marks.js";
|
|
16
|
-
import { esc, Extent, FAINT, GRID, INK, openSheet, PAPER, ROOM } from "./sheet.js";
|
|
16
|
+
import { esc, Extent, FAINT, GRID, INK, openSheet, OUTDOOR, PAPER, ROOM, SEMI_OUTDOOR } from "./sheet.js";
|
|
17
17
|
import { writtenOf } from "./written.js";
|
|
18
18
|
|
|
19
19
|
export interface PlanOptions {
|
|
@@ -77,11 +77,12 @@ export function svgPlan(model: Model, opts: PlanOptions = {}): string {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// 空間の面 — 切断面が気積を切った姿。同色・輪郭なしなのでL字も切られた形も一体に見える。
|
|
80
|
-
//
|
|
80
|
+
// **暖色が屋内、寒色が屋外**である。宣言された屋外 (outside:1)・半屋外・屋内の三段で、
|
|
81
|
+
// 前庭と玄関ホールが同じ一枚のクリームに見えていた状態を分ける
|
|
81
82
|
for (const s of rooms) {
|
|
82
83
|
const isVoid = s.void;
|
|
83
84
|
for (const poly of s.outline) {
|
|
84
|
-
parts.push(fill(poly, isVoid ? PAPER : s.semiOutdoor ?
|
|
85
|
+
parts.push(fill(poly, isVoid ? PAPER : s.outside ? OUTDOOR : s.semiOutdoor ? SEMI_OUTDOOR : ROOM));
|
|
85
86
|
if (isVoid) {
|
|
86
87
|
// 吹抜け: 破線の対角線 (作図慣習)
|
|
87
88
|
const r = polyBounds(poly);
|
|
@@ -140,6 +141,7 @@ export function svgPlan(model: Model, opts: PlanOptions = {}): string {
|
|
|
140
141
|
// 分節には Form しか持たない座と向きが要るため。上部吹抜けは空間ラベルより後ろに置く
|
|
141
142
|
case "space":
|
|
142
143
|
case "space-semi-outdoor":
|
|
144
|
+
case "space-outdoor":
|
|
143
145
|
case "space-void":
|
|
144
146
|
case "void-hatch":
|
|
145
147
|
case "void-above":
|
package/src/draw/sheet.ts
CHANGED
|
@@ -21,6 +21,21 @@ export const INK = "#1f1f1f";
|
|
|
21
21
|
export const PAPER = "#faf8f4";
|
|
22
22
|
/** The air of a room, cut open. */
|
|
23
23
|
export const ROOM = "#f1ebdd";
|
|
24
|
+
/**
|
|
25
|
+
* A space that is roofed but not enclosed — a balcony, a piloti, an external walkway.
|
|
26
|
+
*
|
|
27
|
+
* **Warm is inside and cool is outside**, and this is the step between them: paler than a room,
|
|
28
|
+
* because there is less of a room here, and already tinted away from the warm of one.
|
|
29
|
+
*/
|
|
30
|
+
export const SEMI_OUTDOOR = "#eef1e9";
|
|
31
|
+
/**
|
|
32
|
+
* A space declared `outside:1` that has a region — a courtyard, a plaza, the paving of a site.
|
|
33
|
+
*
|
|
34
|
+
* It used to be painted as a room, which said the opposite of what it is: on a large plan the
|
|
35
|
+
* forecourt and the entrance hall were one continuous field of the same cream. Cool and a shade
|
|
36
|
+
* deeper reads as ground rather than floor without naming a material.
|
|
37
|
+
*/
|
|
38
|
+
export const OUTDOOR = "#dfe6da";
|
|
24
39
|
/** Given lines — the grid, and the level datums that are the grid of a section. */
|
|
25
40
|
export const GRID = "#b5aa94";
|
|
26
41
|
/** A line that is present but not the subject. */
|
package/src/model.ts
CHANGED
|
@@ -42,7 +42,6 @@ import {
|
|
|
42
42
|
DOOR_COLUMN_COLLISIONS_ANALYSIS,
|
|
43
43
|
DOOR_COLUMN_COLLISIONS_ANALYSIS_ID,
|
|
44
44
|
} from "./door-column-collisions.js";
|
|
45
|
-
import { ENVELOPE_ANALYSIS, ENVELOPE_ANALYSIS_ID, ENVELOPE_GAP_RULE } from "./envelope.js";
|
|
46
45
|
import {
|
|
47
46
|
SITE_ANALYSIS,
|
|
48
47
|
SITE_ANALYSIS_ID,
|
|
@@ -62,7 +61,6 @@ import {
|
|
|
62
61
|
export * from "./access.js";
|
|
63
62
|
export * from "./daylight.js";
|
|
64
63
|
export * from "./door-column-collisions.js";
|
|
65
|
-
export * from "./envelope.js";
|
|
66
64
|
export * from "./site.js";
|
|
67
65
|
export * from "./vertical-runs.js";
|
|
68
66
|
|
|
@@ -77,14 +75,13 @@ export const SCHEMATIC_PROFILE_ID: ProfileRef = freezeBuiltin({
|
|
|
77
75
|
});
|
|
78
76
|
|
|
79
77
|
/**
|
|
80
|
-
* The
|
|
78
|
+
* The five analyses, in the order they are declared in the catalog.
|
|
81
79
|
*
|
|
82
80
|
* Each computes facts once and says nothing about pass or fail — no rule identity, no level,
|
|
83
81
|
* no compliance summary. CLI, MCP and eval read these rather than recomputing a ratio,
|
|
84
82
|
* an area tolerance, a frontage, a route or a slope of their own.
|
|
85
83
|
*/
|
|
86
84
|
export const SCHEMATIC_ANALYSES: readonly AnalysisDefinition<JsonValue>[] = freezeBuiltin([
|
|
87
|
-
ENVELOPE_ANALYSIS,
|
|
88
85
|
DAYLIGHT_ANALYSIS,
|
|
89
86
|
VERTICAL_RUNS_ANALYSIS,
|
|
90
87
|
ACCESS_ANALYSIS,
|
|
@@ -93,7 +90,6 @@ export const SCHEMATIC_ANALYSES: readonly AnalysisDefinition<JsonValue>[] = free
|
|
|
93
90
|
] as unknown as AnalysisDefinition<JsonValue>[]);
|
|
94
91
|
|
|
95
92
|
export const SCHEMATIC_ANALYSIS_IDS: readonly AnalysisRef[] = freezeBuiltin([
|
|
96
|
-
ENVELOPE_ANALYSIS_ID,
|
|
97
93
|
DAYLIGHT_ANALYSIS_ID,
|
|
98
94
|
VERTICAL_RUNS_ANALYSIS_ID,
|
|
99
95
|
ACCESS_ANALYSIS_ID,
|
|
@@ -102,14 +98,19 @@ export const SCHEMATIC_ANALYSIS_IDS: readonly AnalysisRef[] = freezeBuiltin([
|
|
|
102
98
|
] as unknown as AnalysisRef[]);
|
|
103
99
|
|
|
104
100
|
/**
|
|
105
|
-
* The
|
|
101
|
+
* The fifteen rules, in the order of the legacy ledger.
|
|
106
102
|
*
|
|
107
103
|
* The one place the order is not a copy is the old `run.slope`, which splits in place into the
|
|
108
104
|
* ramp rule and then the escalator rule: a declared limit and a customary band have different
|
|
109
105
|
* grounds and have to be revisable one without the other.
|
|
106
|
+
*
|
|
107
|
+
* `koyu.schematic.envelope.gap` used to open the list and is gone. It said "this perimeter faces
|
|
108
|
+
* nothing" — a state muro 1.4 cannot reach, because an unfaced perimeter is a wall (ADR-0065).
|
|
109
|
+
* What is left of the question is that nobody said *which* outside the face looks at, and that is
|
|
110
|
+
* a fact about a missing declaration rather than a judgement about a building, so it belongs to
|
|
111
|
+
* `check` and is [[BND08]].
|
|
110
112
|
*/
|
|
111
113
|
export const SCHEMATIC_RULES: readonly Rule[] = freezeBuiltin([
|
|
112
|
-
ENVELOPE_GAP_RULE,
|
|
113
114
|
DAYLIGHT_RATIO_RULE,
|
|
114
115
|
DAYLIGHT_UNKNOWN_RULE,
|
|
115
116
|
STAIR_PROPORTION_RULE,
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { AnalysisDefinition, AnalysisRef } from "../../analysis/contracts.js";
|
|
2
|
-
import type { Rule } from "../contracts.js";
|
|
3
|
-
export type EnvelopeRunFact = {
|
|
4
|
-
readonly edge: string;
|
|
5
|
-
readonly lengthMm: number;
|
|
6
|
-
readonly segment: {
|
|
7
|
-
readonly x1: number;
|
|
8
|
-
readonly y1: number;
|
|
9
|
-
readonly x2: number;
|
|
10
|
-
readonly y2: number;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export type EnvelopeSpaceFact = {
|
|
14
|
-
readonly ref: string;
|
|
15
|
-
readonly levelRef: string;
|
|
16
|
-
readonly uncoveredLengthMm: number;
|
|
17
|
-
readonly runs: readonly EnvelopeRunFact[];
|
|
18
|
-
};
|
|
19
|
-
export type EnvelopeAnalysisValue = {
|
|
20
|
-
readonly startedLevels: readonly string[];
|
|
21
|
-
readonly spaces: readonly EnvelopeSpaceFact[];
|
|
22
|
-
};
|
|
23
|
-
export declare const ENVELOPE_ANALYSIS_ID: AnalysisRef<EnvelopeAnalysisValue>;
|
|
24
|
-
export declare const ENVELOPE_GAP_RULE_ID: {
|
|
25
|
-
readonly id: "koyu.schematic.envelope.gap";
|
|
26
|
-
readonly revision: "1";
|
|
27
|
-
};
|
|
28
|
-
export declare const ENVELOPE_ANALYSIS: AnalysisDefinition<EnvelopeAnalysisValue>;
|
|
29
|
-
export declare const ENVELOPE_GAP_RULE: Rule;
|
|
30
|
-
//# sourceMappingURL=envelope.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../../src/validate/builtin/envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAElB,WAAW,EAIZ,MAAM,6BAA6B,CAAC;AASrC,OAAO,KAAK,EAAE,IAAI,EAA+B,MAAM,iBAAiB,CAAC;AAGzE,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;KACrB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,eAAe,EAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC/C,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,qBAAqB,CAGlE,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;CAGtB,CAAC;AAIZ,eAAO,MAAM,iBAAiB,EAAE,kBAAkB,CAAC,qBAAqB,CAoCtE,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,IAoC9B,CAAC"}
|