@kensnzk/koyu 0.16.0 → 0.18.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.
Files changed (254) hide show
  1. package/README.ja.md +12 -8
  2. package/README.md +13 -10
  3. package/dist/analysis/contracts.d.ts +217 -0
  4. package/dist/analysis/contracts.d.ts.map +1 -0
  5. package/dist/analysis/contracts.js +27 -0
  6. package/dist/analysis/contracts.js.map +1 -0
  7. package/dist/analysis/index.d.ts +5 -0
  8. package/dist/analysis/index.d.ts.map +1 -0
  9. package/dist/analysis/index.js +17 -0
  10. package/dist/analysis/index.js.map +1 -0
  11. package/dist/analysis/json.d.ts +21 -0
  12. package/dist/analysis/json.d.ts.map +1 -0
  13. package/dist/analysis/json.js +111 -0
  14. package/dist/analysis/json.js.map +1 -0
  15. package/dist/cli.js +106 -35
  16. package/dist/cli.js.map +1 -1
  17. package/dist/core/derive.d.ts +13 -8
  18. package/dist/core/derive.d.ts.map +1 -1
  19. package/dist/core/derive.js +19 -13
  20. package/dist/core/derive.js.map +1 -1
  21. package/dist/core/diagnose.d.ts +4 -3
  22. package/dist/core/diagnose.d.ts.map +1 -1
  23. package/dist/core/diagnose.js +46 -11
  24. package/dist/core/diagnose.js.map +1 -1
  25. package/dist/core/diff.d.ts +3 -2
  26. package/dist/core/diff.d.ts.map +1 -1
  27. package/dist/core/diff.js +8 -5
  28. package/dist/core/diff.js.map +1 -1
  29. package/dist/core/fabric.d.ts +1 -3
  30. package/dist/core/fabric.d.ts.map +1 -1
  31. package/dist/core/fabric.js +8 -8
  32. package/dist/core/fabric.js.map +1 -1
  33. package/dist/core/graph.d.ts +2 -2
  34. package/dist/core/graph.d.ts.map +1 -1
  35. package/dist/core/graph.js +12 -5
  36. package/dist/core/graph.js.map +1 -1
  37. package/dist/core/light.d.ts.map +1 -1
  38. package/dist/core/light.js +2 -2
  39. package/dist/core/light.js.map +1 -1
  40. package/dist/core/model.d.ts +59 -10
  41. package/dist/core/model.d.ts.map +1 -1
  42. package/dist/core/model.js +128 -26
  43. package/dist/core/model.js.map +1 -1
  44. package/dist/core/parse.d.ts.map +1 -1
  45. package/dist/core/parse.js +83 -82
  46. package/dist/core/parse.js.map +1 -1
  47. package/dist/core/poly.d.ts +0 -4
  48. package/dist/core/poly.d.ts.map +1 -1
  49. package/dist/core/poly.js +1 -5
  50. package/dist/core/poly.js.map +1 -1
  51. package/dist/core/site.d.ts +9 -0
  52. package/dist/core/site.d.ts.map +1 -1
  53. package/dist/core/site.js +8 -2
  54. package/dist/core/site.js.map +1 -1
  55. package/dist/core/tolerance.d.ts +1 -1
  56. package/dist/core/tolerance.js +2 -2
  57. package/dist/core/tolerance.js.map +1 -1
  58. package/dist/core/vertical.d.ts +9 -2
  59. package/dist/core/vertical.d.ts.map +1 -1
  60. package/dist/core/vertical.js +8 -1
  61. package/dist/core/vertical.js.map +1 -1
  62. package/dist/core/vocabulary.d.ts.map +1 -1
  63. package/dist/core/vocabulary.js +17 -5
  64. package/dist/core/vocabulary.js.map +1 -1
  65. package/dist/diagnostics.d.ts +2 -0
  66. package/dist/diagnostics.d.ts.map +1 -0
  67. package/dist/diagnostics.js +3 -0
  68. package/dist/diagnostics.js.map +1 -0
  69. package/dist/diff.d.ts +2 -0
  70. package/dist/diff.d.ts.map +1 -0
  71. package/dist/diff.js +3 -0
  72. package/dist/diff.js.map +1 -0
  73. package/dist/draw/index.js +1 -1
  74. package/dist/draw/index.js.map +1 -1
  75. package/dist/draw/plan.js +5 -5
  76. package/dist/draw/plan.js.map +1 -1
  77. package/dist/form.d.ts +5 -0
  78. package/dist/form.d.ts.map +1 -0
  79. package/dist/form.js +4 -0
  80. package/dist/form.js.map +1 -0
  81. package/dist/graph.d.ts +2 -0
  82. package/dist/graph.d.ts.map +1 -0
  83. package/dist/graph.js +3 -0
  84. package/dist/graph.js.map +1 -0
  85. package/dist/index.d.ts +2 -14
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +36 -45
  88. package/dist/index.js.map +1 -1
  89. package/dist/mcp.js +81 -30
  90. package/dist/mcp.js.map +1 -1
  91. package/dist/model.d.ts +3 -0
  92. package/dist/model.d.ts.map +1 -0
  93. package/dist/model.js +3 -0
  94. package/dist/model.js.map +1 -0
  95. package/dist/parse-file.d.ts.map +1 -1
  96. package/dist/parse-file.js +18 -3
  97. package/dist/parse-file.js.map +1 -1
  98. package/dist/validate/assessment.d.ts +8 -0
  99. package/dist/validate/assessment.d.ts.map +1 -0
  100. package/dist/validate/assessment.js +1738 -0
  101. package/dist/validate/assessment.js.map +1 -0
  102. package/dist/validate/builtin/access.d.ts +55 -0
  103. package/dist/validate/builtin/access.d.ts.map +1 -0
  104. package/dist/validate/builtin/access.js +494 -0
  105. package/dist/validate/builtin/access.js.map +1 -0
  106. package/dist/validate/builtin/daylight.d.ts +44 -0
  107. package/dist/validate/builtin/daylight.d.ts.map +1 -0
  108. package/dist/validate/builtin/daylight.js +233 -0
  109. package/dist/validate/builtin/daylight.js.map +1 -0
  110. package/dist/validate/builtin/door-column-collisions.d.ts +47 -0
  111. package/dist/validate/builtin/door-column-collisions.d.ts.map +1 -0
  112. package/dist/validate/builtin/door-column-collisions.js +189 -0
  113. package/dist/validate/builtin/door-column-collisions.js.map +1 -0
  114. package/dist/validate/builtin/envelope.d.ts +30 -0
  115. package/dist/validate/builtin/envelope.d.ts.map +1 -0
  116. package/dist/validate/builtin/envelope.js +169 -0
  117. package/dist/validate/builtin/envelope.js.map +1 -0
  118. package/dist/validate/builtin/freeze.d.ts +3 -0
  119. package/dist/validate/builtin/freeze.d.ts.map +1 -0
  120. package/dist/validate/builtin/freeze.js +21 -0
  121. package/dist/validate/builtin/freeze.js.map +1 -0
  122. package/dist/validate/builtin/index.d.ts +38 -0
  123. package/dist/validate/builtin/index.d.ts.map +1 -0
  124. package/dist/validate/builtin/index.js +106 -0
  125. package/dist/validate/builtin/index.js.map +1 -0
  126. package/dist/validate/builtin/site.d.ts +62 -0
  127. package/dist/validate/builtin/site.d.ts.map +1 -0
  128. package/dist/validate/builtin/site.js +333 -0
  129. package/dist/validate/builtin/site.js.map +1 -0
  130. package/dist/validate/builtin/vertical-runs.d.ts +53 -0
  131. package/dist/validate/builtin/vertical-runs.d.ts.map +1 -0
  132. package/dist/validate/builtin/vertical-runs.js +290 -0
  133. package/dist/validate/builtin/vertical-runs.js.map +1 -0
  134. package/dist/validate/contracts.d.ts +188 -0
  135. package/dist/validate/contracts.d.ts.map +1 -0
  136. package/dist/validate/contracts.js +28 -0
  137. package/dist/validate/contracts.js.map +1 -0
  138. package/dist/validate/index.d.ts +2 -59
  139. package/dist/validate/index.d.ts.map +1 -1
  140. package/dist/validate/index.js +22 -70
  141. package/dist/validate/index.js.map +1 -1
  142. package/dist/vocabulary.d.ts +2 -0
  143. package/dist/vocabulary.d.ts.map +1 -0
  144. package/dist/vocabulary.js +3 -0
  145. package/dist/vocabulary.js.map +1 -0
  146. package/editors/vscode/syntaxes/koyu.tmLanguage.json +2 -2
  147. package/examples/basement/main.muro +3 -3
  148. package/examples/complex/main.muro +1 -1
  149. package/examples/complex/podium.muro +1 -1
  150. package/examples/complex/site.muro +6 -6
  151. package/examples/house/L2.muro +1 -1
  152. package/examples/house/main.muro +1 -1
  153. package/examples/house/site.muro +4 -4
  154. package/examples/house.muro +6 -6
  155. package/examples/mansion.muro +2 -2
  156. package/examples/office.muro +3 -3
  157. package/examples/steps/04-exterior.muro +1 -1
  158. package/examples/steps/05-two-storeys.muro +1 -1
  159. package/examples/steps/06-finished.muro +2 -2
  160. package/examples/tower/L2.muro +1 -1
  161. package/examples/tower/main.muro +1 -1
  162. package/examples/tower/site.muro +4 -4
  163. package/examples/twin/main.muro +1 -1
  164. package/examples/twin/podium.muro +4 -4
  165. package/examples/twin/site.muro +8 -8
  166. package/examples/two-rooms.canonical.json +4 -4
  167. package/examples/two-rooms.muro +2 -2
  168. package/package.json +41 -9
  169. package/src/analysis/contracts.ts +234 -0
  170. package/src/analysis/index.ts +61 -0
  171. package/src/analysis/json.ts +117 -0
  172. package/src/cli.ts +116 -36
  173. package/src/core/derive.ts +32 -15
  174. package/src/core/diagnose.ts +63 -16
  175. package/src/core/diff.ts +10 -6
  176. package/src/core/fabric.ts +18 -9
  177. package/src/core/graph.ts +19 -5
  178. package/src/core/light.ts +2 -2
  179. package/src/core/model.ts +141 -31
  180. package/src/core/parse.ts +100 -85
  181. package/src/core/poly.ts +1 -8
  182. package/src/core/site.ts +19 -2
  183. package/src/core/tolerance.ts +2 -2
  184. package/src/core/vertical.ts +10 -3
  185. package/src/core/vocabulary.ts +18 -5
  186. package/src/diagnostics.ts +8 -0
  187. package/src/diff.ts +14 -0
  188. package/src/draw/index.ts +1 -1
  189. package/src/draw/plan.ts +5 -5
  190. package/src/form.ts +37 -0
  191. package/src/graph.ts +12 -0
  192. package/src/index.ts +40 -175
  193. package/src/mcp.ts +85 -35
  194. package/src/model.ts +43 -0
  195. package/src/parse-file.ts +17 -3
  196. package/src/validate/assessment.ts +1934 -0
  197. package/src/validate/builtin/access.ts +642 -0
  198. package/src/validate/builtin/daylight.ts +321 -0
  199. package/src/validate/builtin/door-column-collisions.ts +266 -0
  200. package/src/validate/builtin/envelope.ts +227 -0
  201. package/src/validate/builtin/freeze.ts +19 -0
  202. package/src/validate/builtin/index.ts +156 -0
  203. package/src/validate/builtin/site.ts +445 -0
  204. package/src/validate/builtin/vertical-runs.ts +390 -0
  205. package/src/validate/contracts.ts +240 -0
  206. package/src/validate/index.ts +45 -99
  207. package/src/vocabulary.ts +9 -0
  208. package/dist/validate/access.d.ts +0 -6
  209. package/dist/validate/access.d.ts.map +0 -1
  210. package/dist/validate/access.js +0 -238
  211. package/dist/validate/access.js.map +0 -1
  212. package/dist/validate/envelope.d.ts +0 -4
  213. package/dist/validate/envelope.d.ts.map +0 -1
  214. package/dist/validate/envelope.js +0 -55
  215. package/dist/validate/envelope.js.map +0 -1
  216. package/dist/validate/light.d.ts +0 -6
  217. package/dist/validate/light.d.ts.map +0 -1
  218. package/dist/validate/light.js +0 -28
  219. package/dist/validate/light.js.map +0 -1
  220. package/dist/validate/runs.d.ts +0 -16
  221. package/dist/validate/runs.d.ts.map +0 -1
  222. package/dist/validate/runs.js +0 -60
  223. package/dist/validate/runs.js.map +0 -1
  224. package/dist/validate/site.d.ts +0 -6
  225. package/dist/validate/site.d.ts.map +0 -1
  226. package/dist/validate/site.js +0 -63
  227. package/dist/validate/site.js.map +0 -1
  228. package/spec/README.md +0 -28
  229. package/spec/canonical-json.md +0 -98
  230. package/spec/composition.md +0 -121
  231. package/spec/derivation.md +0 -393
  232. package/spec/en/README.md +0 -30
  233. package/spec/en/canonical-json.md +0 -101
  234. package/spec/en/composition.md +0 -121
  235. package/spec/en/derivation.md +0 -393
  236. package/spec/en/language.md +0 -164
  237. package/spec/en/notation-v0.md +0 -145
  238. package/spec/en/scope.md +0 -229
  239. package/spec/en/semantics.md +0 -132
  240. package/spec/en/tools.md +0 -108
  241. package/spec/en/validation.md +0 -79
  242. package/spec/en/vocabulary.md +0 -103
  243. package/spec/language.md +0 -163
  244. package/spec/notation-v0.md +0 -184
  245. package/spec/scope.md +0 -229
  246. package/spec/semantics.md +0 -130
  247. package/spec/tools.md +0 -106
  248. package/spec/validation.md +0 -79
  249. package/spec/vocabulary.md +0 -114
  250. package/src/validate/access.ts +0 -279
  251. package/src/validate/envelope.ts +0 -59
  252. package/src/validate/light.ts +0 -43
  253. package/src/validate/runs.ts +0 -87
  254. package/src/validate/site.ts +0 -84
@@ -1,121 +0,0 @@
1
- **English** · [日本語](../composition.md)
2
-
3
- # The rules of composition
4
-
5
- koyu v0.16.0 / muro 1.0. The grammar is in [language.md](language.md) §8; the normative scope is in [scope.md](scope.md).
6
-
7
- **Composition exists for time and for division of labour, not for size.** Writing in parts, writing an exception as a difference, laying as-built over the plan — these are what composition is for. Files are not split because a building is large.
8
-
9
- Following USD, six rules are laid down. **Composition is usable only when all six hold.** The consequence of any one being absent is that the same input yields a different result, and that is not an original.
10
-
11
- ---
12
-
13
- ## Rule 1 — Layers carry a declared order of strength
14
-
15
- **The order of the `import` lines is the declaration of strength.** The list flattened depth-first is the layer order, and **later layers are stronger**. The entry is index 0 and the weakest. A layer imported twice keeps its first position (it is composed only once).
16
-
17
- ```muro-part
18
- koyu 1.0
19
- grid X 0 6400 12800
20
- level L1 0 h:3600 slab:600
21
- import ./plan.muro # layer 1
22
- import ./as-built.muro # layer 2 — this one is stronger
23
- ```
24
-
25
- **Strength is not scan order.** A line in the entry that sits after the `import` lines is still at index 0. Deciding by scan order would mean that moving an `import` line up or down changes the result.
26
-
27
- ```sh
28
- koyu layers <entry.muro> # prints the layers in strength order
29
- ```
30
-
31
- ## Rule 2 — For a single value, the strongest layer's opinion wins
32
-
33
- Thickness, specification, use, storey height — every override is explained by one rule.
34
-
35
- ```muro-part
36
- over /L5/A/ldk h:2600 spec:改修後
37
- over /L5/A/hall /L5/corridor t:200 type:open
38
- over level L3 h:2600
39
- over asset SD1 w:900
40
- ```
41
-
42
- `over` takes a space, a zone, a boundary, a level, or an asset. The kind of target follows from how it is written — one path is a space (a zone if no space has it), two paths a boundary, and `level` or `asset` followed by a name the corresponding element.
43
-
44
- **It is an error for one layer to hold two opinions about the same attribute.** Which one wins would be undetermined, and that is the direct consequence of leaving no implicit resolution.
45
-
46
- ## Rule 3 — Sets compose through declared edits
47
-
48
- **No implicit merge.** Everything about which several layers may hold an opinion at the same place — openings, segs, areas, columns — belongs to this rule.
49
-
50
- ```muro-part
51
- over /L5/A/hall /L5/corridor
52
- - door D2 # remove
53
- = door D1 w:1000 # replace (only the attributes written)
54
- + window w:600 h:1200 at:0.9 name:W1 # add
55
- drop /L5/A/store # a space (its relations go with it)
56
- drop /L5/a /L5/b # a boundary
57
- drop column C1 # a column declaration
58
- ```
59
-
60
- **Identity is "the containing object plus a name unique within it"** ([scope.md §5](scope.md#5-identity)). An element without `name:` cannot be the target of an edit — there is no word with which to point at it. An element added with `+` requires `name:`, and a duplicate within the same container is an error.
61
-
62
- **Rule 3 makes ordinary what used to be treated as special.** Anything about which several layers may hold an opinion is resolved by a declared edit rather than an implicit winner. **What is special is the kind of value, not the rule.** No dedicated syntax is created.
63
-
64
- ## Rule 4 — Definition and override are distinguished
65
-
66
- | | Statement | When the target exists | When it does not |
67
- |---|---|---|---|
68
- | **Definition** | `space` `boundary` `zone` `asset` `level` `polygon` | **error** (duplicate) | defines it |
69
- | **Override** | `over` | overrides it | **error** |
70
-
71
- They are different statements, and which is which follows from how they are written. Adding an opinion to something that does not exist is usually a misspelling, or a mistaken idea of the layer order.
72
-
73
- ## Rule 5 — The same input always yields the same result
74
-
75
- The input includes **the declaration of the layers and their order**. The same entry always yields the same list of layers, and the same list of layers always yields the same model.
76
-
77
- **No trace of an override remains in the machine format.** A model brought to `h:2400` by `over` and a model written with `h:2400` from the start yield the same canonical JSON. What the canonical form answers is "is this the same building", not "how was it written".
78
-
79
- ## Rule 6 — Provenance can be followed
80
-
81
- The layer that gave the final value can be named.
82
-
83
- ```sh
84
- koyu layers <entry.muro> --attrs
85
- ```
86
-
87
- ```text
88
- Layers (weakest first — later layers are stronger):
89
- 0 main.muro
90
- 1 plan.muro
91
- 2 as-built.muro
92
-
93
- Attribute provenance:
94
- boundary:/L1/a|/L1/b:t ← 2 as-built.muro
95
- space:/L1/a:h ← 2 as-built.muro
96
- space:/L1/a:spec ← 2 as-built.muro
97
- ```
98
-
99
- Through the API it is `model.attrSrc` (keys are `<kind>:<subject>:<attribute>`, values are indices into `model.layers`).
100
-
101
- ---
102
-
103
- ## Collisions and errors
104
-
105
- A state in which the resolution of the composition is undetermined **stops before the model is assembled** (a syntax or composition error, i.e. `SourceError`; it appears as SYN01 under `check --json`). It sits at the same layer as a JSON parser rejecting broken JSON, and is not something reported afterwards as a diagnostic.
106
-
107
- | State | Treatment |
108
- |---|---|
109
- | Duplicate space path, zone path, asset name, or site shape | error (with both origins) |
110
- | Re-declaring `grid` / `name` / `koyu` | error (even with the same value) |
111
- | `over` with no target / `drop` with no target | error |
112
- | One layer holding two opinions about the same attribute | error |
113
- | A set edit with no name, an ambiguous name, or a duplicate name | error |
114
- | Importing the same file twice, or a cycle | idempotent (composed once) |
115
-
116
- ## What is not composed
117
-
118
- - **Variants (USD's variant)** — alternatives are not carried. Branching belongs to git
119
- - **Nested asset references** — an asset does not reference an asset
120
- - **Per-layer namespace prefixes** — the path hierarchy is already a namespace
121
- - **Partial loading of a layer** — a layer is composed whole
@@ -1,393 +0,0 @@
1
- **English** · [日本語](../derivation.md)
2
-
3
- # Derivation — from what is written to a single shape
4
-
5
- koyu v0.16.0 / muro 1.0. **This document is the norm for what shape comes out of a written composition.**
6
-
7
- The source holds no geometry ([policy.md](../../docs/policy.md) §2). Plans, areas and circulation are not written; they are derived. If the rules of derivation differ from consumer to consumer, the same source yields different buildings — **and then it is not a source** ([scope.md](scope.md) §6). So the rules live here, and the implementation follows as a reference implementation.
8
-
9
- The reference implementation is `derive(model): Form` ([tools.md](tools.md)). `Form` **carries no appearance at all** — no colours, no typefaces, no line weights, no annotation strings, no symbols, no scale, no page margins. It returns coordinates, thicknesses, z ranges, orientations, and the identity of what each shape belongs to. `src/draw/` and ugatsu only draw that `Form`; what may legitimately differ is the **appearance**, never the shape.
10
-
11
- The norm for scope is [scope.md](scope.md), semantics is [semantics.md](semantics.md), and the ranges of attribute values are in [vocabulary.md](vocabulary.md).
12
-
13
- ---
14
-
15
- ## 0. Four promises
16
-
17
- **1. The form is a function of the canonical form.**
18
-
19
- ```
20
- toCanonical(a) === toCanonical(b) ⟹ derive(a) ≡ derive(b)
21
- ```
22
-
23
- The canonical form is the definition of "what counts as the same building" ([canonical-json.md](canonical-json.md)). Therefore **whatever the canonical form discards must not move the form** — not the written order of a line's endpoints, not the declaration order of boundaries, not the order of lines in the file. This restates the promise of uniqueness in §6 in a shape a machine can hold ([scope.md](scope.md) §6).
24
-
25
- Two rules follow from this promise. **A drawn line has no direction** (§1.5). **Recutting happens in canonical boundary order** (§1.1).
26
-
27
- **2. There is one entrance to the shape.** The shape of a space is its `pieces` (the derived convex parts), never its `rects` (the written allotment). The allotment is the spelling of cells, not a shape. Areas, shared edges, outlines, coverage, where columns land, projections — every derivation that reads shape goes through that one entrance.
28
-
29
- **3. No default is invented.** If a value that is needed is not written, no default is quietly supplied: **the element is not made**. Sufficiency (SUF01-04) puts "it cannot be made" into words. The derivation defaults listed in §5 are the exception — those are rules the specification sets, not inventions.
30
-
31
- **4. Convex parts run counter-clockwise.** Every outline `Form` returns is counter-clockwise (its signed area is positive), and reading the orientation of an edge (N/E/S/W) assumes that winding.
32
-
33
- ---
34
-
35
- ## 1. Regions — the shape of a space
36
-
37
- ### 1.1 From allotment to convex parts
38
-
39
- A region is written as a union of rectangles. Derivation first maps each rectangle to four counter-clockwise vertices `[(x1,y1),(x2,y1),(x2,y2),(x1,y2)]`, and then, if a boundary carries a **drawn line** (`line`), cuts it again by that half-plane.
40
-
41
- ```
42
- pieces = rects # no line: a copy of the allotment
43
- pieces = outside(window) + halfplane(inside) # a line: recut only inside the window
44
- ```
45
-
46
- The recut happens **exactly once**, at the exit of `parse`, in **canonical boundary order**. It is not idempotent — a region shrunk by an earlier line shrinks the window of a later one.
47
-
48
- **That order is not declaration order.** The canonical JSON discards the declaration order of boundaries ([canonical-json.md](canonical-json.md)), so cutting in declaration order would produce different areas from the same canonical form, against promise 1 of §0. The ordering rule is the one `toCanonical` uses — lexicographic by `between`, and serialization order within one `between`. Inserting a boundary through composition does not move it.
49
-
50
- ### 1.2 The window a line reaches
51
-
52
- A line is not an infinite line. **Along the line it cuts a limited interval; across the line it cuts a range that includes the other side.** That asymmetry is the crux — treated as an infinite line it drags in a distant wing and a room disappears; treated as the bounding box of the segment it degenerates on an axis-parallel line and cuts nothing.
53
-
54
- A line counts as **vertical** when `|Δy| >= |Δx|` (exactly 45 degrees, and a degenerate point, count as vertical). For a vertical line the axis "along" is y and the axis "across" is x; for a horizontal line it is the other way round.
55
-
56
- | Case | Along | Across |
57
- |---|---|---|
58
- | Re-dividing two spaces (both hold a region) | the **intersection** of the two bounding boxes | the **union** of the two bounding boxes |
59
- | Cutting the envelope (one side holds no region) | **the interval of the segment itself** | the **whole** bounding box of the side that holds a region |
60
-
61
- Unless both sides of the window exceed the tolerance (`EPS` in §6) it has no substance, and the line cuts nothing (LIN01).
62
-
63
- ### 1.3 Which side is kept
64
-
65
- Which side of the line is kept is decided by **measuring, whole, the convex parts the window touches**. Touching is judged by overlap of bounding boxes. Each part is halved by the line; the total area on the left is compared with the total on the right, and if the difference is under the tolerance (`AREA_EPS` in §6) there is "no bias".
66
-
67
- **Only what is inside the window is cut; what decides is the whole of each part.** Measure every convex part and a wing the line never reaches dominates the sign and the room disappears; measure only inside the window and a corner-to-corner line looks like a bisection.
68
-
69
- - **Cutting the envelope**: the bias of the side that holds a region is the side kept. No bias means no cut (LIN01)
70
- - **Two spaces**: take the bias on both sides; if exactly one is zero, give it the opposite of the other. Both zero, or the same side, means no cut (LIN01)
71
-
72
- **Which space is written first does not affect the side kept.** `boundary /L1/room /out` and `boundary /out /L1/room` are two spellings of the same relation, and the side kept is decided by **the side that holds a region, itself**. The `a`/`b` orientation means something only to `edge` and `swing` — the two notions that need "seen from which side".
73
-
74
- ### 1.4 The re-division itself
75
-
76
- The parts are split into inside and outside of the window, and **the allotments inside the window are merged and then re-divided to the two sides of the line**. So re-dividing two spaces conserves total area (the triangle one loses, the other gains). Cutting the envelope only shrinks the side that holds a region; the other side gains nothing.
77
-
78
- If a half-plane cut leaves fewer than three vertices, or an area at or below the tolerance, that part never existed. Without that threshold a hair-thin sliver survives at the end of a clipped corner, gets read as an edge, and grows a ghost wall.
79
-
80
- ### 1.5 The direction of a line
81
-
82
- **A line segment has no direction.** A line joining the same two points is the same line whichever end it is written from. Before recutting, derivation orders each line's endpoints by **resolved coordinate, ascending in x then y** — the same rule the canonical JSON applies to the pair. The spelling (the grid references) moves with them, so a diagnostic quotes exactly what was written, only in the other order.
83
-
84
- **This canonical start is the origin of `at:` for openings carried on the line** (§3.2). Without the ordering, a door lands somewhere else while the canonical JSON stays byte-identical — against promise 1 of §0.
85
-
86
- ---
87
-
88
- ## 2. Boundaries — where walls are
89
-
90
- ### 2.1 The orientation of an edge
91
-
92
- Walk the counter-clockwise vertices of a convex part and read only the axis-parallel edges. An edge running +x is the **S** face, −x is **N**, +y is **E** and −y is **W**. So N=+Y, S=−Y, E=+X, W=−X. A diagonal edge has no orientation.
93
-
94
- Two edges "face each other" when their orientations are opposite (N↔S / E↔W) and the difference of their fixed coordinates is at or under the tolerance.
95
-
96
- ### 2.2 Deriving the segments
97
-
98
- The segments of a boundary are decided in this order. **The order carries meaning.**
99
-
100
- 1. If either end space does not exist, there is no segment
101
- 2. If `kind` is `stair` / `shaft` / `void` there is no segment (a vertical boundary holds no wall)
102
- 3. **If a line is drawn, that is the realisation of the boundary** (§2.4). Neither collinear merging nor the `edge:` filter applies
103
- 4. If both sides hold a region, the **shared edge**. Different levels means no segment (no wall stands between levels)
104
- 5. If only one side holds a region, the **outline**. The others are "the regions of every space on the same level except these two"
105
- 6. If neither holds a region, there is no segment
106
-
107
- The results of 4 and 5 are collinear-merged (§2.3), and finally filtered by `edge:` if present, read as "the edge seen from the a side".
108
-
109
- **Shared edge** — take the axis-parallel edges of every convex part of A and of B that face each other and share an interval. An overlap at or under the tolerance is not a shared edge (touching at a point is not touching). The segment runs in ascending coordinate order and carries the orientation seen from `a`.
110
-
111
- **Outline** — from each edge of each convex part, subtract the intervals covered by facing edges. **The other convex parts of the same space count as others too**, so writing an L as two rectangles grows no wall along the internal seam. The order in which others are subtracted does not affect the result.
112
-
113
- ### 2.3 Collinear merging
114
-
115
- Segments lying on the same line are merged into one. The grouping key is (orientation, fixed coordinate, the edge seen from a), and **the fixed coordinate must match exactly**. Within a group, sort by ascending coordinate; extend across a gap at or under the tolerance, and cut where it exceeds it.
116
-
117
- Back-to-back edges (an N edge and an S edge on the same line) differ in orientation and are not merged.
118
-
119
- ### 2.4 The interval a drawn line realises
120
-
121
- **One drawn line is shared by several boundaries.** The wall of a through passage has as many boundaries as there are units fronting it. If every boundary realised the full length of the line, the plan would carry the same wall several times over.
122
-
123
- Cut the line at the edges of the convex parts of both spaces, take two points offset from the midpoint of each interval along the normal by the probe distance (`PROBE` in §6), and keep only the intervals where the left and the right are exactly a and b. Against a side that holds no region, the side that does holds one flank and that is enough. The test is symmetric in a and b.
124
-
125
- The output segment keeps **the canonical order of the endpoints** (§1.5 — ascending in resolved coordinate) and carries no orientation seen from `a`. So writing `edge:` on a boundary that carries a `line` has no effect.
126
-
127
- ---
128
-
129
- ## 3. Substance — walls, openings, columns, surfaces
130
-
131
- ### 3.1 Wall thickness and z range
132
-
133
- A boundary stands on the level of "a if a holds a region, otherwise b". The foot of the wall is the FL of that level.
134
-
135
- | | Thickness | Top |
136
- |---|---|---|
137
- | Wall (`kind:wall`) | `t:` if written, otherwise the default (§5) | FL + storey height |
138
- | Non-enclosing boundary (`air:1`) | `t:` if written, capped at the maximum | FL + the boundary's `h:`, or the default |
139
-
140
- **Storey height** is "the difference to the level above, or — with no level above — the greatest ceiling height on that level plus the roof slab thickness". Aligning to the apex of the roof when nothing is above is required because `slabs()` hangs the roof by the same formula; without that, the wall pierces the roof or a gap opens under it. If no ceiling height is determined, the storey height is not either, and **neither walls nor columns stand on that level** (SUF01 already says so as an error).
141
-
142
- Thickness is split evenly to both sides of the centreline. The same holds for a diagonal segment: a quadrilateral offset ±t/2 along the unit normal.
143
-
144
- ### 3.2 Where a band (an opening, a seg) sits
145
-
146
- An opening and a `seg` are both "an interval along a boundary segment", and both are placed by the same rule. **The order carries meaning.**
147
-
148
- 1. Take the segments of the boundary (`edge:` is already applied). If the band carries `edge:` too, narrow further
149
- 2. No segment at all means it cannot be placed (OPN04 / SEG04)
150
- 3. Two or more segments means an edge must be chosen (OPN05 / SEG05)
151
- 4. A band wider than the segment cannot be placed (OPN06 / SEG06). Equal fits
152
- 5. With a **grid reference** (`at:X2+450`), it cannot sit on a diagonal segment (OPN07 / SEG07), a horizontal segment takes an X line and a vertical one takes a Y line (OPN07 / SEG07), and running off the end cannot be placed (OPN08 / SEG08)
153
- 6. With a **ratio** (`at:0.2`, default 0.5), the centre is **clamped** into the range where it fits (no diagnostic is raised)
154
-
155
- The centre is taken as a parameter from the start of the segment to its end — one formula, axis-parallel or diagonal. **So if the direction of the segment changes, the same `at:` points somewhere else.** Segments — derived ones and those of drawn lines alike — **always run in ascending coordinate order** (§1.5), so neither the order a and b were written nor the order the line's endpoints were written has any effect.
156
-
157
- ### 3.3 The z range of an opening, and the wall being split
158
-
159
- **The head of an opening aligns to the lintel height.** A door rises from the floor to the lintel height; any other opening hangs down from the lintel height by its own height. The height is the opening's `h:`, or the default in §5.
160
-
161
- ```
162
- door : z0 = FL ; z1 = FL + (h ?? OPENING_HEAD)
163
- opening: z0 = FL + OPENING_HEAD - (h ?? OPENING_H) ; z1 = FL + OPENING_HEAD
164
- ```
165
-
166
- The sill (`sill`) is in the **carry tier**, so core never reads it ([scope.md](scope.md) §7). The sill height falls out of aligning the head.
167
-
168
- A wall appears as **a list of intervals split by its openings**. The openings sitting on a segment are ordered by distance from its start; between openings a full-height interval remains, and at an opening a spandrel below (floor to the underside) and a head panel above (the top of the opening to the top of the wall). Intervals whose length or height is at or under the tolerance are not made.
169
-
170
- **With that rule, "painting the black band of the wall over in the paper colour so it looks like a hole" does not exist.** In plan and in solid alike, a wall is a list of intervals with the holes already in it.
171
-
172
- ### 3.4 Which way a door opens, and its arc
173
-
174
- Which space it opens into is `swing:a/b`, or, unwritten, "a if a holds a region, otherwise b". The direction is decided by the component pointing at the centre of the bounding box of the convex part of **the derived shape** of that space nearest the opening (the shape, not the allotment — in a space cut by a drawn line, the centre of the nearest allotment can fall on the far side of the line).
175
-
176
- The hinge is: on a horizontal segment, the east end with `hinge:E` and otherwise the west end; on a vertical segment, the north end with `hinge:N` and otherwise the south end. **On a diagonal segment the hinge is fixed at the start end** — the N/E/S/W of `hinge` are the words of the axes and do not apply to a diagonal.
177
-
178
- The arc is a quarter circle centred on the hinge with a radius equal to the opening width, running from the tip of the leaf (the hinge offset by the width towards the opening side) to the far jamb (the hinge offset by the width along the segment). The sweep is decided by the sign of the cross product of those two points about the hinge.
179
-
180
- An opening with `style:sliding` / `style:auto` has no arc — it is drawn back past the hinge side.
181
-
182
- ### 3.5 Columns
183
-
184
- The position of a column is written nowhere. **It appears where a grid intersection meets a floor.**
185
-
186
- The floors it may stand on are the spaces "on that level, neither exterior nor void, holding a region, and **not a semi-outdoor space that carries only sky**" ([ADR-0030](../../docs/decisions/0030-columns-hold-something.md)). If the declaration names grid lines, only those are considered; otherwise all of them. The scan runs X on the outside and Y on the inside. If the intersection falls inside any convex part of a floor (a point on an edge counts as inside), a column stands there.
187
-
188
- No two columns stand on the same intersection — **the declaration written first wins** ([ADR-0029](../../docs/decisions/0029-order-as-meaning.md)). The z range of a column is the FL of that level to FL + storey height (§3.1).
189
-
190
- ### 3.6 Surfaces (floors, ceilings, roofs)
191
-
192
- The scan runs levels in ascending z, spaces within a level in declaration order, and within a space floor → ceiling → roof. Every outline is a derived convex part.
193
-
194
- | Surface | Condition | z range |
195
- |---|---|---|
196
- | **Floor** | neither void nor exterior, and the level carries `slab` | FL − slab … FL |
197
- | **Ceiling** | not `ceiling:0`, and not void / exterior / semi-outdoor / vertical circulation, and the ceiling height is determined | FL + h − ceiling thickness … FL + h |
198
- | **Roof** | neither exterior nor semi-outdoor. **Only where no space sits above** | apex − thickness … apex |
199
-
200
- **The absence of a floor is not the absence of a roof** — a void gets a roof too. Conversely **a void and a semi-outdoor space both count as cover**. Cover is taken from **every level above**, not only the one directly above, and is subtracted as the derived shape.
201
-
202
- The apex and the thickness of the roof switch on whether a level sits above.
203
-
204
- ```
205
- upper level : top = upper.z ; t = upper.slab ?? ROOF_T
206
- no upper level : top = FL + h + ROOF_T ; t = ROOF_T
207
- ```
208
-
209
- With a level above, **the ceiling height is not read**. So a roof is generated even where no ceiling height is determined. With no level above and no ceiling height either, the shape goes thin — but SUF01 already blocks that state as an error.
210
-
211
- A tile left over with an area at or under the tolerance is not made into a roof.
212
-
213
- ---
214
-
215
- ## 4. Vertical circulation
216
-
217
- Neither the number of steps, nor the going, nor the slope is written. **All of it is derived from the region, the storey height, and the declared direction of ascent.**
218
-
219
- ### 4.1 Local coordinates, and every condition under which no shape is generated
220
-
221
- The local coordinates of a run are t (from 0 in the direction of travel) and s (from the **left of the direction of travel**). `turn:` is L only when `L` is written; unwritten and invalid values are both R.
222
-
223
- Any one of the following means **no shape at all is generated** — check puts it into words as RUN01-05 / SUF04.
224
-
225
- Zero declarations or two or more / the region is not a single rectangle / the level cannot be determined / a value other than N/E/S/W on anything but a lift / a value other than 1 on a lift / `form:` other than straight or return / `form:return` on anything but a stair or a ramp / no level above (except a lift) / the entry landing consumes the whole length / no flight length is left in a turn.
226
-
227
- **A lift has a shape even with no level above** — the car closes on its own level.
228
-
229
- ### 4.2 Entry landing and step division
230
-
231
- A run does not start at the edge of the region. An **entry landing** remains at the near end, and that is where the door opens. A straight stair keeps one at the far end too.
232
-
233
- ```
234
- usable = length - entry # form:return
235
- usable = length - entry * 2 # form:straight
236
- risers = max(2, ceil(rise / (riser ?? DEFAULT_RISER_MAX)))
237
- riser = rise / risers
238
- tread = usable / max(1, risers - 1)
239
- ```
240
-
241
- ### 4.3 Turning back
242
-
243
- The width is halved and an intermediate landing is placed at the far end. With `turn:R` the first flight is on the left of the direction of travel; with `turn:L`, on the right. The two flights occupy the same interval of t and differ only in s.
244
-
245
- The steps divide at `k = min(risers−1, max(1, round(risers÷2)))`, and the landing sits at FL + k×riser. **Since round rounds a half up, an odd number of steps gives the lower flight one more.** The second flight is reversed as geometry too: the low-t side is the high one. A ramp turning back puts its landing at exactly half the rise.
246
-
247
- **The depth of the intermediate landing falls out as the remainder.** Flight length, going and landing are bound by one equation, and at most two of them can be written. What a designer wants to hold is the comfort of the going, so by default the remainder goes to the landing ([ADR-0021](../../docs/decisions/0021-vertical-circulation.md)). Write `landing:` and the going becomes the remainder instead. Derived or written, a value below the minimum depth is raised to the minimum depth.
248
-
249
- ### 4.4 Units in parallel (escalators)
250
-
251
- The nominal width of one unit is `lane:`, or the default. The number of units is `floor(width ÷ nominal)` with a minimum of one; one unit is the smaller of the nominal and width÷units, and the remainder is split evenly at both ends. **Consecutive units run in alternating directions** — next to one going up is one coming down. `lane:` has no effect on a stair, a ramp or a lift (the count is always one).
252
-
253
- ### 4.5 Aggregates
254
-
255
- The total horizontal length of the flights counts **only the first unit** (both flights of a turn are counted). The going is represented by **the tightest flight** and the slope by **the steepest**. That asymmetry is what validation (RUN06/RUN07) rests on.
256
-
257
- ### 4.6 Solids
258
-
259
- | Part | Shape |
260
- |---|---|
261
- | Landing | a slab. Its top is the landing height, its thickness the slab thickness |
262
- | Stair flight | for k risers there are **k−1 treads** (the top step is carried by the floor above). The top of step i is the bottom + i×riser, and its depth is the riser plus the tread thickness |
263
- | Ramp, escalator | one inclined slab. **The incline is decided by the z values** — never by the direction of travel |
264
- | Escalator balustrade | two per unit. Inclined thin slabs raised above the tread surface |
265
- | Lift car | a box inset from all four sides. **A fixed height independent of the storey height**, rising from the FL of that level |
266
-
267
- ### 4.7 In plan — the cut
268
-
269
- A plan is "a section cut at that level". The height of the cut plane is a **height above FL**, and it is an **input** to `derive`, not part of what is derived (the default is in §5).
270
-
271
- For an **ascending run**, each part's visible interval is decided by comparing its z range with the cut plane. At or above the part's top it is wholly visible; at or below its bottom it is wholly hidden; crossing it, it is cut where it crosses. The test is purely geometric and never uses the number of the part — parallel units are cut at the same height, and only written this way does the second unit get a window at all.
272
-
273
- A **descending run** appears in what the twin ascending run **left behind**. To be a twin, the four coordinates of the rectangle must agree within tolerance and the direction, the form, the device and the number of parts must all agree. Matching by position alone produces a mirror image. With no twin, the descending run is wholly visible.
274
-
275
- Nosings are laid out from the part's t0 at the pitch of the going, and any falling outside the visible interval are dropped. The step marks of an escalator are laid out from **the start of the visible interval** at a fixed pitch.
276
-
277
- An arrow is drawn per unit on an escalator, and on a stair or a ramp on the departing flight (the ascending face) / the arriving flight (the descending face). Its direction follows only the direction of travel, so **an escalator points the same way on both faces while a stair and a ramp reverse on the descending face** (the machine is fixed; the person turns with the face). Too short a visible interval draws no arrow.
278
-
279
- The break is **one segment crossing the full width of the run** at the position where it crosses the cut plane. The two parallel oblique lines of drawing convention are appearance, and the drawing side draws them.
280
-
281
- ---
282
-
283
- ## 5. The constants of derivation
284
-
285
- **These are not ledger defaults.** [vocabulary.md](vocabulary.md) settles what may be written; this settles what is derived when nothing is written. A written value always wins.
286
-
287
- <!-- derivation-constants -->
288
-
289
- | Constant | Value | Unit | What it settles |
290
- |---|---|---|---|
291
- | `WALL_T` | 100 | mm | the default wall thickness (`t:` overrides). Split evenly to both sides of the centreline |
292
- | `RAIL_T` | 60 | mm | the default thickness of a non-enclosing boundary (`air:1`) (`t:` overrides) |
293
- | `RAIL_T_MAX` | 80 | mm | the cap on the thickness of a non-enclosing boundary. Whatever `t:` says stops here |
294
- | `RAIL_H` | 1100 | mm | the default top height of a non-enclosing boundary (the boundary's `h:` overrides) |
295
- | `OPENING_HEAD` | 2000 | mm | the lintel height. A door rises to it; anything else hangs down from it |
296
- | `OPENING_H` | 1200 | mm | the default height of an opening other than a door (the opening's `h:` overrides) |
297
- | `CEILING_T` | 30 | mm | the face thickness of a ceiling surface |
298
- | `ROOF_T` | 200 | mm | the default roof slab thickness, and how far above the ceiling height it sits on the top level |
299
- | `CUT_HEIGHT` | 1200 | mm | the height of the plan cut above FL (the default input to `derive`) |
300
- | `DEFAULT_RISER_MAX` | 180 | mm | the maximum riser (`riser:` overrides). It settles the number of steps |
301
- | `TREAD_TARGET` | 300 | mm | the target going used when a turn's landing is derived as the remainder (`tread:` overrides) |
302
- | `LANDING_MIN` | 1100 | mm | the minimum depth of an intermediate landing. A written `landing:` is raised to it too |
303
- | `ENTRY_LANDING` | 1100 | mm | the default depth of the entry landing (`entry:` overrides) |
304
- | `LANE_ESCALATOR` | 1200 | mm | the default nominal width of one escalator unit (`lane:` overrides). It settles the count |
305
- | `TREAD_SOLID` | 200 | mm | the face thickness of a tread (in solid) |
306
- | `SLAB_T` | 200 | mm | the thickness of a landing slab, and of the inclined slab of a ramp or an escalator |
307
- | `STEP_MARK` | 400 | mm | the pitch of the escalator step marks in plan |
308
-
309
- A lift car is inset by `min(300, side÷6)` on all four sides and stands from FL+60 to FL+2400. An escalator balustrade is `min(140, unit width÷8)` wide and 100 thick, raised 900mm above the tread surface.
310
-
311
- ---
312
-
313
- ## 6. Tolerances
314
-
315
- **No question may have two tolerances.** Coordinates are integers in mm, so the tolerance on length sits at half of that step.
316
-
317
- <!-- tolerances -->
318
-
319
- | Tolerance | Value | Unit | What it tolerates |
320
- |---|---|---|---|
321
- | `EPS` | 0.5 | mm | axis-parallel edges, facing edges, matching intervals, the gap in collinear merging, overrun on a grid reference, overlapping openings |
322
- | `AREA_EPS` | 1 | mm² | whether a cut remnant vanishes; whether a left–right area difference is "no bias"; whether a roof tile survives |
323
- | `PROBE` | 5 | mm | the distance probed either side of a drawn line. **It is the lower bound of the resolution of shape** |
324
- | `SPAN_EPS` | 1 | mm | comparing a part's z with the cut plane, the minimum length of a visible interval, matching twin frames, the minimum length of an envelope gap, the minimum length of a wall interval |
325
- | `CROSS_EPS` | 1e-6 | — | the sign (a cross product — twice an area) when clipping by a half-plane |
326
- | `PARALLEL_EPS` | 1e-9 | — | parallelism between an infinite line and a segment, and the range of the segment parameter |
327
- | `POINT_EPS` | 1 | mm | the width within which a point counts as lying on an edge of a polygon (on the boundary counts as inside). Column placement uses it too |
328
-
329
- ---
330
-
331
- ## 7. Where shape ends and appearance begins
332
-
333
- This is what `Form` holds.
334
-
335
- **Coordinates** (the convex parts of a region, boundary segments, opening centres, column sections, tread rectangles) · **thicknesses** (walls, rails, surfaces) · **z ranges** (walls, openings, columns, surfaces, solids) · **orientations** (edge orientation, the direction of ascent, the hinge and the swing side of a door, whether an arrow ascends) · **the identity of the subject** (whose space, whose boundary, whose opening this shape is) · **the classification in plan** (cut section / what shows below the cut / what is projected from above the cut / the arc of a movement / where a symbol is anchored).
336
-
337
- This is what `Form` does not hold.
338
-
339
- **Colours, typefaces, type sizes, line weights, line styles (dash patterns), the words of an annotation** (neither `UP` nor `12 steps, riser 175 / going 300`) **· drawing symbols** (the diagonals of a void, the two oblique lines of a break, the circle of a grid mark, the head of an arrow, the diagonals of a lift) · **scale, page margin and viewBox** · **drawing order, stacking and shading** · the judgement of **what to draw and what to leave out**.
340
-
341
- **"The same composition yielding several shapes" is a defect.** What may legitimately differ is the appearance, never the shape ([scope.md](scope.md) §6).
342
-
343
- ### 7.1 The constructors of substance
344
-
345
- What `Form` holds is centrelines, thicknesses and z. **The rule that raises substance out of those is part of the derivation too, and there must be exactly one implementation of it.** If each consumer rewrites it, the parts are shared but the rule of assembly is not, and the room for one `Form` to yield different shapes opens again.
346
-
347
- | Constructor | What it raises |
348
- |---|---|
349
- | `thicken(x1, y1, x2, y2, t)` | A centreline into a thickened quadrilateral (§3.1). The same single expression serves diagonal segments |
350
- | `bandLine(seg, cx, cy, w)` | The interval a band (an opening, a `seg`) occupies on a segment (§3.2) |
351
- | `band(seg, cx, cy, w, t)` | That interval into a thickened quadrilateral — `bandLine` put through `thicken` |
352
- | `columnRect(c)` | The section of a column (§3.5) |
353
- | `runPrism(s)` | A vertical-circulation solid into a prism (a base outline plus a top and bottom z per vertex). The four corners of an inclined slab follow the rule in §4.6 |
354
-
355
- **The vertices of the quadrilateral run start+n → end+n → end−n → start−n**, so joining the midpoints of the opposing edges returns the centreline. A plan entity carries **both the footprint (the quadrilateral) and the centreline** of an interval — whether to draw it as something with thickness or as a single line (a rail or a fence that does not enclose) is a judgement of appearance, so a consumer never has to reconstruct the centreline from the footprint.
356
-
357
- ---
358
-
359
- ## 8. A plan is not a pure section
360
-
361
- Cutting a solid does not by itself make a plan. None of the following comes out, however exactly you cut.
362
-
363
- - **The arc of a door** — the sign of a movement; there is no matter there
364
- - **The projection of a void above** — something above the cut plane, dropped onto the plan of the storey below
365
- - **The break** — the position of the very fact of having been cut
366
- - **The descending run** — what shows below the cut plane
367
-
368
- So `Form` holds the plan as **a set of classified 2D entities**. Each carries (geometry, classification, the identity of its subject), and the classification splits into `cut` (a cut section) / `below` (what shows below the cut) / `above` (what is projected from above the cut) / `swing` (the arc of a movement) / `anchor` (where a symbol is placed).
369
-
370
- Tell a consumer to "cut it out of the solid" and each of them invents those four. The projection of a void above is exactly how it fell: the bundled examples carry eleven, and not one of them came out in the viewer's plan.
371
-
372
- What is dropped as the projection of a void above is **the derived shape**. Drop the allotment and a void cut by a drawn line comes out in the shape it had before it was cut.
373
-
374
- ---
375
-
376
- ## 9. The implementation, and what checks it
377
-
378
- The reference implementation is `derive(model, {cut?})`, returning a `Form` (the table of the public face in [tools.md](tools.md)). The ledger of constants is `DERIVATION_CONSTANTS` and the ledger of tolerances is `TOLERANCES`, and **the tables in §5 and §6 are copies of them** — `test/derive.test.ts` binds the tables to the implementation.
379
-
380
- **Promise 1 of §0 (the form is a function of the canonical form) is bound by machine** (`test/uniqueness.test.ts`). Each case first asserts the canonical forms are equal **as its premise** and only then asserts the forms agree, so a broken premise fails with "this pair proves nothing". There is a case for the written order of a line's endpoints, for the declaration order of boundaries, and for the `a`/`b` orientation.
381
-
382
- **The order in which `Form` lists boundaries is the canonical order** (the same rule as §1.1). Indices such as `FormSeg.boundary` point into that ordering, so a consumer must not index `model.boundaries[i]` (declaration order) against it. The function that yields the ordering, `canonicalBoundaryOrder(model)`, is part of the public face ([tools.md](tools.md)).
383
-
384
- That `Form` carries no appearance is bound by machine too: the `Form` of every bundled example is turned into JSON and checked for the absence of any colour spelling, any Japanese, and any `UP`/`DN`.
385
-
386
- `src/draw/` (`svgPlan` / `svgAxo`) only draws the `Form`, and **is not frozen** ([scope.md](scope.md) §8). The contents of the SVG may change at any time. What may not change is the `Form`.
387
-
388
- **That it only draws is bound by machine too** (`test/draw.test.ts`).
389
-
390
- - The imports of `src/draw/` are actually read, and none of the **parts that build a form** (`segmentsFor`, `placeOpening`, `placeBand`, `slabs`, `runSolids`, `verticalRuns`, `runDrawsForLevel`, `columnsFor`, `regionOf`, `heff`, `levelsSorted` and the rest) may appear
391
- - None of the constants of §5 may be spelled inside `src/draw/`
392
- - Every black band on the plan is a cut interval of the `Form` itself — the similarity that maps the world onto the paper is solved from the bounding boxes, and the two sets of quadrilaterals are matched
393
- - An interval that carries a footprint always carries its centreline too, and that centreline is the axis of the footprint (§7.1)