@kensnzk/koyu 0.23.0 → 0.24.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/dist/core/bodies.d.ts +26 -0
- package/dist/core/bodies.d.ts.map +1 -0
- package/dist/core/bodies.js +67 -0
- package/dist/core/bodies.js.map +1 -0
- package/dist/core/model.d.ts +1 -1
- package/dist/core/model.js +1 -1
- package/dist/core/section.d.ts +1 -1
- package/dist/core/section.d.ts.map +1 -1
- package/dist/core/section.js +16 -58
- package/dist/core/section.js.map +1 -1
- package/dist/draw/index.d.ts +3 -0
- package/dist/draw/index.d.ts.map +1 -1
- package/dist/draw/index.js +3 -0
- package/dist/draw/index.js.map +1 -1
- package/dist/draw/marks.d.ts +126 -0
- package/dist/draw/marks.d.ts.map +1 -0
- package/dist/draw/marks.js +227 -0
- package/dist/draw/marks.js.map +1 -0
- package/dist/draw/plan.d.ts.map +1 -1
- package/dist/draw/plan.js +102 -117
- package/dist/draw/plan.js.map +1 -1
- package/dist/draw/scene.d.ts +133 -0
- package/dist/draw/scene.d.ts.map +1 -0
- package/dist/draw/scene.js +251 -0
- package/dist/draw/scene.js.map +1 -0
- package/dist/draw/written.d.ts +27 -0
- package/dist/draw/written.d.ts.map +1 -0
- package/dist/draw/written.js +50 -0
- package/dist/draw/written.js.map +1 -0
- package/package.json +2 -2
- package/src/core/bodies.ts +90 -0
- package/src/core/model.ts +1 -1
- package/src/core/section.ts +20 -69
- package/src/draw/index.ts +23 -0
- package/src/draw/marks.ts +315 -0
- package/src/draw/plan.ts +97 -108
- package/src/draw/scene.ts +389 -0
- package/src/draw/written.ts +64 -0
package/src/core/section.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// koyu — the section and the elevation (ADR-0064)
|
|
2
2
|
//
|
|
3
|
-
// **This reads a `Form` and nothing else.** Every body it cuts was
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
3
|
+
// **This reads a `Form` and nothing else.** Every body it cuts was raised by `derive` and
|
|
4
|
+
// enumerated by `formBodies` (bodies.ts). It composes no matter; it re-frames what came out of the
|
|
5
|
+
// one entry point to shape, which is what `planOf` does for a horizontal plane and this does for a
|
|
6
|
+
// vertical one.
|
|
7
7
|
//
|
|
8
8
|
// **Why it is here and not in `src/draw/`.** Everything a section needs is public on `Form`, so a
|
|
9
9
|
// renderer could compute one without tripping a single import gate. What forbids it is not a test
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
// with its windows, the stair beyond the cut — and none of that falls out of cutting. Nor does the
|
|
18
18
|
// decision to throw the near half away, which is a choice of viewpoint and has to be an input.
|
|
19
19
|
|
|
20
|
-
import {
|
|
20
|
+
import { formBodies, type FormBody } from "./bodies.js";
|
|
21
|
+
import type { Form } from "./derive.js";
|
|
21
22
|
import type { Edge, Pt } from "./model.js";
|
|
22
23
|
import { crossing, hull, signedArea } from "./poly.js";
|
|
23
24
|
import { EPS } from "./tolerance.js";
|
|
@@ -80,16 +81,6 @@ export interface FormSection {
|
|
|
80
81
|
entities: SectionEntity[];
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
/** A body of the `Form`, in the one shape every body reduces to. */
|
|
84
|
-
interface Body {
|
|
85
|
-
of: SectionSubject;
|
|
86
|
-
ref: string;
|
|
87
|
-
kind?: string;
|
|
88
|
-
poly: Pt[];
|
|
89
|
-
bottom: number[];
|
|
90
|
-
top: number[];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
84
|
/** The direction of view as a unit vector in plan. */
|
|
94
85
|
function look(edge: Edge): Pt {
|
|
95
86
|
return edge === "N"
|
|
@@ -133,59 +124,19 @@ function rightOf(d: Pt): Pt {
|
|
|
133
124
|
return { x: d.y, y: -d.x };
|
|
134
125
|
}
|
|
135
126
|
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
// Spaces come first because space is the primary element. A space is a void: the plane opens it,
|
|
146
|
-
// but from outside you see the matter that bounds it, never the void itself — so a space that
|
|
147
|
-
// stands wholly beyond the plane is dropped rather than painted (see `entitiesOf`).
|
|
148
|
-
for (const s of form.spaces) {
|
|
149
|
-
if (s.z0 === undefined || s.z1 === undefined) continue; // no ceiling height, no volume (SUF01)
|
|
150
|
-
// **Outside and semi-outdoor spaces have no volume to cut.** A storey's ceiling height reaches
|
|
151
|
-
// them, so they carry a z range, but no ceiling is derived over them (fabric.ts excludes both)
|
|
152
|
-
// and there is nothing above them to bound the air. Cutting one paints a garden as a room.
|
|
153
|
-
if (s.outside || s.semiOutdoor) continue;
|
|
154
|
-
for (const piece of s.outline) {
|
|
155
|
-
out.push({ of: "space", ref: s.path, ...(s.type ? { kind: s.type } : {}), ...flat(piece, s.z0, s.z1) });
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
for (const b of form.boundaries) {
|
|
159
|
-
if (!b.material) continue; // type:open — a relation with no matter to cut
|
|
160
|
-
for (const p of b.material.panels) {
|
|
161
|
-
out.push({ of: "boundary", ref: b.ref, kind: b.kind, ...flat(p.footprint, p.z0, p.z1) });
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
for (const o of form.openings) {
|
|
165
|
-
out.push({
|
|
166
|
-
of: "opening",
|
|
167
|
-
ref: o.ref,
|
|
168
|
-
kind: o.kind,
|
|
169
|
-
...flat(band(o.segment, o.cx, o.cy, o.w, o.t), o.z0, o.z1),
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
for (const c of form.columns) {
|
|
173
|
-
out.push({ of: "column", ref: c.ref, ...flat(columnRect(c), c.z0, c.z1) });
|
|
174
|
-
}
|
|
175
|
-
for (const sl of form.slabs) {
|
|
176
|
-
out.push({ of: "slab", ref: sl.space, kind: sl.kind, ...flat(sl.outline, sl.z0, sl.z1) });
|
|
177
|
-
}
|
|
178
|
-
for (const run of form.runs) {
|
|
179
|
-
for (const s of run.solids) {
|
|
180
|
-
const pr = runPrism(s);
|
|
181
|
-
out.push({ of: "run", ref: run.path, kind: run.device, poly: pr.poly, bottom: pr.bottom, top: pr.top });
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return out;
|
|
127
|
+
/**
|
|
128
|
+
* The bodies a vertical plane may cut. **Outside and semi-outdoor spaces are dropped.** A storey's
|
|
129
|
+
* ceiling height reaches them, so they carry a z range, but no ceiling is derived over them
|
|
130
|
+
* (fabric.ts excludes both) and there is nothing above them to bound the air. Cutting one paints a
|
|
131
|
+
* garden as a room. A 3D scene keeps them, which is why the enumeration itself does not judge.
|
|
132
|
+
*/
|
|
133
|
+
function cuttableBodies(form: Form): FormBody[] {
|
|
134
|
+
const airless = new Set(form.spaces.filter((s) => s.outside || s.semiOutdoor).map((s) => s.path));
|
|
135
|
+
return formBodies(form).filter((b) => !(b.of === "space" && airless.has(b.ref)));
|
|
185
136
|
}
|
|
186
137
|
|
|
187
138
|
/** The polygon a body leaves on the plane, or `undefined` where the plane only grazes a corner. */
|
|
188
|
-
function cutOf(body:
|
|
139
|
+
function cutOf(body: FormBody, axis: SectionAxis, at: number, u: (p: Pt) => number): SectionPt[] | undefined {
|
|
189
140
|
const met = crossing(body.poly, axis, at);
|
|
190
141
|
if (!met) return undefined;
|
|
191
142
|
const n = body.poly.length;
|
|
@@ -217,7 +168,7 @@ function cutOf(body: Body, axis: SectionAxis, at: number, u: (p: Pt) => number):
|
|
|
217
168
|
* fitted to it. Where the top and bottom do not vary (everything but a ramp or an escalator) that
|
|
218
169
|
* hull is a rectangle, and it is taken directly.
|
|
219
170
|
*/
|
|
220
|
-
function shadowOf(body:
|
|
171
|
+
function shadowOf(body: FormBody, u: (p: Pt) => number): SectionPt[] | undefined {
|
|
221
172
|
let uLo = Infinity;
|
|
222
173
|
let uHi = -Infinity;
|
|
223
174
|
let zLo = Infinity;
|
|
@@ -251,7 +202,7 @@ function shadowOf(body: Body, u: (p: Pt) => number): SectionPt[] | undefined {
|
|
|
251
202
|
return ring.length >= 3 ? ring.map((p) => ({ u: p.x, z: p.y })) : undefined;
|
|
252
203
|
}
|
|
253
204
|
|
|
254
|
-
function entitiesOf(bodies:
|
|
205
|
+
function entitiesOf(bodies: FormBody[], spec: SectionSpec): SectionEntity[] {
|
|
255
206
|
const d = look(spec.look);
|
|
256
207
|
const r = rightOf(d);
|
|
257
208
|
const u = (p: Pt): number => p.x * r.x + p.y * r.y;
|
|
@@ -319,7 +270,7 @@ export function sectionForm(form: Form, spec: SectionSpec): FormSection {
|
|
|
319
270
|
at: spec.at,
|
|
320
271
|
...(spec.atRef !== undefined ? { atRef: spec.atRef } : {}),
|
|
321
272
|
look: spec.look,
|
|
322
|
-
entities: entitiesOf(
|
|
273
|
+
entities: entitiesOf(cuttableBodies(form), spec),
|
|
323
274
|
};
|
|
324
275
|
}
|
|
325
276
|
|
|
@@ -337,7 +288,7 @@ export function elevationForm(form: Form, face: Edge): FormSection {
|
|
|
337
288
|
const from: Edge = face === "N" ? "S" : face === "S" ? "N" : face === "E" ? "W" : "E";
|
|
338
289
|
const axis = axisOf(from);
|
|
339
290
|
const d = look(from);
|
|
340
|
-
const bodies =
|
|
291
|
+
const bodies = cuttableBodies(form);
|
|
341
292
|
// The near extreme along the line of sight: looking towards the larger coordinate puts the plane
|
|
342
293
|
// at the smallest, and looking towards the smaller puts it at the largest.
|
|
343
294
|
const towardsLarger = (axis === "X" ? d.x : d.y) > 0;
|
package/src/draw/index.ts
CHANGED
|
@@ -8,5 +8,28 @@
|
|
|
8
8
|
// **凍る面と凍らない面を、import 一行で見分けられるようにするため**である。
|
|
9
9
|
|
|
10
10
|
export { svgPlan, type PlanOptions } from "./plan.js";
|
|
11
|
+
export {
|
|
12
|
+
planMarks,
|
|
13
|
+
SLIDE_POCKET,
|
|
14
|
+
type Mark,
|
|
15
|
+
type MarkArc,
|
|
16
|
+
type MarkNote,
|
|
17
|
+
type MarkOptions,
|
|
18
|
+
type MarkRole,
|
|
19
|
+
type MarkSubject,
|
|
20
|
+
} from "./marks.js";
|
|
11
21
|
export { svgAxo, type AxoOptions } from "./axo.js";
|
|
22
|
+
export {
|
|
23
|
+
sceneOf,
|
|
24
|
+
type Scene,
|
|
25
|
+
type SceneFacts,
|
|
26
|
+
type SceneLevel,
|
|
27
|
+
type SceneLine,
|
|
28
|
+
type SceneMark,
|
|
29
|
+
type SceneNode,
|
|
30
|
+
type ScenePrism,
|
|
31
|
+
type SceneRole,
|
|
32
|
+
type SceneSubject,
|
|
33
|
+
} from "./scene.js";
|
|
12
34
|
export { svgSection, svgElevation, type SectionOptions, type ElevationOptions } from "./section.js";
|
|
35
|
+
export { writtenOf, type Written } from "./written.js";
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
// koyu — the marks of a plan (`@kensnzk/koyu/draw`)
|
|
2
|
+
//
|
|
3
|
+
// **This copies `Form`'s 2D entities into marks. Not one rule of geometry lives here.** Wall
|
|
4
|
+
// thickness, the intervals an opening splits a wall into, a door swing's centre and radius and
|
|
5
|
+
// sweep, where a run is cut, the projection of the void above — all of it is already in the `Form`
|
|
6
|
+
// that `derive(model)` returns (ADR-0040). What is decided here is *which* of those entities
|
|
7
|
+
// becomes a mark and what the mark stands for.
|
|
8
|
+
//
|
|
9
|
+
// **A plan is not a pure section.** Door swings, the projection of the void above, break lines and
|
|
10
|
+
// the descending run do not fall out of cutting a solid, however exactly it is cut. So `Form` hands
|
|
11
|
+
// the plan over as entities carrying a class (cut / below / above / swing / anchor), and this page
|
|
12
|
+
// reads that class rather than re-deciding it.
|
|
13
|
+
//
|
|
14
|
+
// **No words and no style.** `Form` carries no colour, no line type and no annotation wording
|
|
15
|
+
// (docs/reference/scope.md), and neither does a mark. "UP", "DN", 「上部吹抜け」 and 「12段
|
|
16
|
+
// 蹴上180/踏面240」 are the consumer's — three consumers spell three different sets of them today,
|
|
17
|
+
// and a mark that carried one would make koyu's language mix everyone's. A mark carries the seat
|
|
18
|
+
// (`at`) and the unrounded facts (`note`); the words are put on at the far end.
|
|
19
|
+
import { band, type Form, type FormOpening, type PlanClass, type PlanEntity } from "../core/derive.js";
|
|
20
|
+
import { polyBounds, type Pt } from "../core/model.js";
|
|
21
|
+
import type { RunDevice, Seg2 } from "../core/vertical.js";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A mark's role. The consumer decides stroke weight, colour, dash and every word from it.
|
|
25
|
+
*
|
|
26
|
+
* **Closed, and meant to be.** A consumer that spells `Record<MarkRole, …>` stops compiling when
|
|
27
|
+
* koyu adds one, which is the point — the alternative is a mark that silently never appears.
|
|
28
|
+
*/
|
|
29
|
+
export type MarkRole =
|
|
30
|
+
/** a space's face, cut by the plane */
|
|
31
|
+
| "space"
|
|
32
|
+
/** the same, where the space is declared semi-outdoor */
|
|
33
|
+
| "space-semi-outdoor"
|
|
34
|
+
/** a void's face — no floor, so no room */
|
|
35
|
+
| "space-void"
|
|
36
|
+
/** the void's two bounding-box diagonals (a drafting convention, not a shape of the building) */
|
|
37
|
+
| "void-hatch"
|
|
38
|
+
/** the body of a wall interval the plane cut */
|
|
39
|
+
| "wall"
|
|
40
|
+
/** the centreline of something that does not enclose (`air:1`) */
|
|
41
|
+
| "rail"
|
|
42
|
+
/** a relation with no matter (`type:open`) — a centreline and nothing else */
|
|
43
|
+
| "open"
|
|
44
|
+
/** the band of a segment that does not count */
|
|
45
|
+
| "seg"
|
|
46
|
+
/** a non-door opening's centreline */
|
|
47
|
+
| "window"
|
|
48
|
+
/** hinge to leaf tip */
|
|
49
|
+
| "door-leaf"
|
|
50
|
+
/** the swing trace */
|
|
51
|
+
| "door-arc"
|
|
52
|
+
/** a sliding door's pocket panel */
|
|
53
|
+
| "slide-panel"
|
|
54
|
+
/** its setback line */
|
|
55
|
+
| "slide-tail"
|
|
56
|
+
| "column"
|
|
57
|
+
| "run-outline"
|
|
58
|
+
| "run-tread"
|
|
59
|
+
/** where the plane crosses the run — one line; making two of it is the consumer's convention */
|
|
60
|
+
| "run-break"
|
|
61
|
+
| "run-arrow"
|
|
62
|
+
/** a seat only. The note has no geometry, and no words either */
|
|
63
|
+
| "run-note"
|
|
64
|
+
/** the projection of an upper void onto the plan below */
|
|
65
|
+
| "void-above";
|
|
66
|
+
|
|
67
|
+
/** Pinned to `Form` by construction, so it cannot drift from what `derive` produced. */
|
|
68
|
+
export type MarkArc = NonNullable<PlanEntity["arc"]>;
|
|
69
|
+
|
|
70
|
+
/** What a mark stands for. `PlanSubject` plus the two Form arrays that make marks without entities. */
|
|
71
|
+
export type MarkSubject = "space" | "boundary" | "opening" | "column" | "run" | "seg";
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The facts an annotation is worded from. **No wording, no units, no rounding** — a ramp at
|
|
75
|
+
* `slope = 1/12.5` is "1/13" to one consumer and "1/12.5" to another, and that disagreement
|
|
76
|
+
* belongs to them, not here.
|
|
77
|
+
*/
|
|
78
|
+
export type MarkNote =
|
|
79
|
+
/** direction of travel at an arrow's tail */
|
|
80
|
+
| { of: "direction"; up: boolean }
|
|
81
|
+
/** a stair's proportions, exactly as `FormRun` carries them */
|
|
82
|
+
| { of: "stair"; risers: number; riser: number; tread: number; going: number; rise: number }
|
|
83
|
+
/** a ramp, escalator or lift. `slope` is rise over run; "1/N" is a spelling, not a number */
|
|
84
|
+
| { of: "incline"; device: RunDevice; lanes: number; slope: number; rise: number };
|
|
85
|
+
|
|
86
|
+
export interface Mark {
|
|
87
|
+
role: MarkRole;
|
|
88
|
+
of: MarkSubject;
|
|
89
|
+
/** the subject's identity: a space's or run's `path`, otherwise the Form `ref` */
|
|
90
|
+
ref: string;
|
|
91
|
+
/**
|
|
92
|
+
* The classification `Form` gave the subject, carried through unchanged. Marks with no backing
|
|
93
|
+
* entity (`seg`, `void-hatch`, the two sliding marks) carry `"cut"` — they show at the cut.
|
|
94
|
+
*/
|
|
95
|
+
class: PlanClass;
|
|
96
|
+
polygon?: Pt[];
|
|
97
|
+
lines?: Seg2[];
|
|
98
|
+
arc?: MarkArc;
|
|
99
|
+
/** where a symbol or annotation is seated. A point, never a string */
|
|
100
|
+
at?: Pt;
|
|
101
|
+
note?: MarkNote;
|
|
102
|
+
/**
|
|
103
|
+
* Place in the canonical order — the only route back to what was written. `boundary` indexes
|
|
104
|
+
* `canonicalBoundaryOrder(model)`, **never `model.boundaries`** (ADR-0041): declaration order is
|
|
105
|
+
* information the canonical form discards, so indexing by it reads a different boundary's `spec`
|
|
106
|
+
* and nothing throws. Never parse `ref` for this.
|
|
107
|
+
*/
|
|
108
|
+
written?: { boundary: number; index?: number };
|
|
109
|
+
/** the two spaces a boundary-derived mark relates */
|
|
110
|
+
pair?: { a: string; b: string };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Setback of a sliding door's pocket panel from the wall face, mm.
|
|
115
|
+
*
|
|
116
|
+
* **A drafting convention, not a derivation default.** It is not in the ledger of derivation
|
|
117
|
+
* constants because no shape of the building depends on it; all three implementations spell 110.
|
|
118
|
+
*/
|
|
119
|
+
export const SLIDE_POCKET = 110;
|
|
120
|
+
|
|
121
|
+
export interface MarkOptions {
|
|
122
|
+
/** override `SLIDE_POCKET` */
|
|
123
|
+
slidePocket?: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const unit = (from: Pt, to: Pt, len: number): Pt => ({
|
|
127
|
+
x: (to.x - from.x) / (len || 1),
|
|
128
|
+
y: (to.y - from.y) / (len || 1),
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
/** A sliding or automatic door: no swing trace — a panel set back on the hinge side, and its tail. */
|
|
132
|
+
function slideMarks(o: FormOpening, pocket: number, base: Omit<Mark, "role" | "lines">): Mark[] {
|
|
133
|
+
const sw = o.swing;
|
|
134
|
+
if (!sw) return [];
|
|
135
|
+
const { hinge } = sw;
|
|
136
|
+
const u = unit(hinge, sw.leaf, o.w); // towards the side it opens onto
|
|
137
|
+
const a = unit(hinge, sw.jamb, o.w); // along the segment
|
|
138
|
+
const s1 = { x: hinge.x - a.x * o.w + u.x * pocket, y: hinge.y - a.y * o.w + u.y * pocket };
|
|
139
|
+
const s2 = { x: hinge.x + u.x * pocket, y: hinge.y + u.y * pocket };
|
|
140
|
+
return [
|
|
141
|
+
{ ...base, role: "slide-panel", lines: [{ x1: s1.x, y1: s1.y, x2: s2.x, y2: s2.y }] },
|
|
142
|
+
{ ...base, role: "slide-tail", lines: [{ x1: s2.x, y1: s2.y, x2: hinge.x, y2: hinge.y }] },
|
|
143
|
+
];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The marks drawn on one level's plan, from `Form`.
|
|
148
|
+
*
|
|
149
|
+
* **The model is not read.** Grid lines, `area` frames, space names, the north arrow and the sheet
|
|
150
|
+
* title are written givens, and the consumer draws them separately from what it wrote. Returns an
|
|
151
|
+
* empty list where the level has no plan.
|
|
152
|
+
*/
|
|
153
|
+
export function planMarks(form: Form, level: string, opts?: MarkOptions): Mark[] {
|
|
154
|
+
const plan = form.plans.find((p) => p.level === level);
|
|
155
|
+
if (!plan) return [];
|
|
156
|
+
const pocket = opts?.slidePocket ?? SLIDE_POCKET;
|
|
157
|
+
const marks: Mark[] = [];
|
|
158
|
+
const S = new Map(form.spaces.map((s) => [s.path, s]));
|
|
159
|
+
const B = new Map(form.boundaries.map((b) => [b.ref, b]));
|
|
160
|
+
const O = new Map(form.openings.map((o) => [o.ref, o]));
|
|
161
|
+
const R = new Map(form.runs.map((r) => [r.path, r]));
|
|
162
|
+
|
|
163
|
+
// ---- spaces ----
|
|
164
|
+
for (const e of plan.entities) {
|
|
165
|
+
if (e.of !== "space" || e.class !== "cut" || !e.polygon) continue;
|
|
166
|
+
const s = S.get(e.ref);
|
|
167
|
+
// A void is a **declaration** (`void:1`), not a word in the type vocabulary (ADR-0051), and
|
|
168
|
+
// `Form` carries that fact through as `FormSpace.void`.
|
|
169
|
+
if (s?.void) {
|
|
170
|
+
const r = polyBounds(e.polygon);
|
|
171
|
+
marks.push({ role: "space-void", of: "space", ref: e.ref, class: "cut", polygon: e.polygon });
|
|
172
|
+
marks.push({
|
|
173
|
+
role: "void-hatch",
|
|
174
|
+
of: "space",
|
|
175
|
+
ref: e.ref,
|
|
176
|
+
class: "cut",
|
|
177
|
+
lines: [
|
|
178
|
+
{ x1: r.x1, y1: r.y1, x2: r.x2, y2: r.y2 },
|
|
179
|
+
{ x1: r.x1, y1: r.y2, x2: r.x2, y2: r.y1 },
|
|
180
|
+
],
|
|
181
|
+
});
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
marks.push({
|
|
185
|
+
role: s?.semiOutdoor ? "space-semi-outdoor" : "space",
|
|
186
|
+
of: "space",
|
|
187
|
+
ref: e.ref,
|
|
188
|
+
class: "cut",
|
|
189
|
+
polygon: e.polygon,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// ---- boundaries ----
|
|
194
|
+
// **What says a boundary has matter is the presence of `polygon`, not a lookup on the boundary.**
|
|
195
|
+
// Read `lines` first and every wall falls into the `open` branch — the whole drawing turns to
|
|
196
|
+
// dashes with not one black band in it. That regression is real; it has happened.
|
|
197
|
+
//
|
|
198
|
+
// The order matters as much. Asking "is this class dropped?" before "is this a rail?" draws no
|
|
199
|
+
// handrail at all: a rail stands 1100 high and the plane cuts at 1200, so every rail interval is
|
|
200
|
+
// classified `below` and a class-first branch discards the lot in silence.
|
|
201
|
+
for (const e of plan.entities) {
|
|
202
|
+
if (e.of !== "boundary") continue;
|
|
203
|
+
const b = B.get(e.ref);
|
|
204
|
+
const base = {
|
|
205
|
+
of: "boundary" as const,
|
|
206
|
+
ref: e.ref,
|
|
207
|
+
...(b ? { written: { boundary: b.boundary }, pair: { a: b.a, b: b.b } } : {}),
|
|
208
|
+
};
|
|
209
|
+
if (!e.polygon) {
|
|
210
|
+
if (e.lines) marks.push({ ...base, role: "open", class: e.class, lines: e.lines });
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
if (b?.air) {
|
|
214
|
+
// Something that does not enclose is drawn as its axis, not as a body — that the space is
|
|
215
|
+
// not shut is readable from the drawing. `Form` carries the axis, so it is never recovered
|
|
216
|
+
// from the footprint.
|
|
217
|
+
if (e.class !== "above" && e.lines) marks.push({ ...base, role: "rail", class: e.class, lines: e.lines });
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (e.class === "cut") marks.push({ ...base, role: "wall", class: "cut", polygon: e.polygon });
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// ---- segments that do not count — no area, no graph, but a derived position ----
|
|
224
|
+
for (const g of form.segs) {
|
|
225
|
+
if (g.level !== level) continue;
|
|
226
|
+
marks.push({
|
|
227
|
+
role: "seg",
|
|
228
|
+
of: "seg",
|
|
229
|
+
ref: g.ref,
|
|
230
|
+
class: "cut",
|
|
231
|
+
polygon: band(g.segment, g.cx, g.cy, g.w, g.t),
|
|
232
|
+
written: { boundary: g.boundary, index: g.index },
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// ---- openings ----
|
|
237
|
+
for (const e of plan.entities) {
|
|
238
|
+
if (e.of !== "opening") continue;
|
|
239
|
+
const o = O.get(e.ref);
|
|
240
|
+
if (!o) continue;
|
|
241
|
+
const base = {
|
|
242
|
+
of: "opening" as const,
|
|
243
|
+
ref: e.ref,
|
|
244
|
+
written: { boundary: o.boundary, index: o.index },
|
|
245
|
+
pair: { a: o.a, b: o.b },
|
|
246
|
+
};
|
|
247
|
+
if (e.class === "swing") {
|
|
248
|
+
if (o.sliding) {
|
|
249
|
+
marks.push(...slideMarks(o, pocket, { ...base, class: "swing" }));
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
if (e.lines) marks.push({ ...base, role: "door-leaf", class: "swing", lines: e.lines });
|
|
253
|
+
if (e.arc) marks.push({ ...base, role: "door-arc", class: "swing", arc: e.arc });
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
// No class filter, so a clerestory above the cut arrives as a `window` too. `Mark.class` puts
|
|
257
|
+
// that fact in the consumer's hand instead of hiding it.
|
|
258
|
+
if (o.kind !== "door" && e.lines) marks.push({ ...base, role: "window", class: e.class, lines: e.lines });
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// ---- columns (written nowhere — they appear where grid lines meet a floor) ----
|
|
262
|
+
for (const e of plan.entities) {
|
|
263
|
+
if (e.of === "column" && e.polygon) {
|
|
264
|
+
marks.push({ role: "column", of: "column", ref: e.ref, class: e.class, polygon: e.polygon });
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// ---- vertical circulation — the ascending run is cut, and beyond it the descending run shows ----
|
|
269
|
+
for (const e of plan.entities) {
|
|
270
|
+
if (e.of !== "run") continue;
|
|
271
|
+
const base = { of: "run" as const, ref: e.ref };
|
|
272
|
+
if (e.role === "outline" && e.lines) marks.push({ ...base, role: "run-outline", class: e.class, lines: e.lines });
|
|
273
|
+
else if (e.role === "tread" && e.lines) marks.push({ ...base, role: "run-tread", class: e.class, lines: e.lines });
|
|
274
|
+
else if (e.role === "break" && e.lines) marks.push({ ...base, role: "run-break", class: "cut", lines: e.lines });
|
|
275
|
+
else if (e.role === "arrow" && e.lines) {
|
|
276
|
+
marks.push({
|
|
277
|
+
...base,
|
|
278
|
+
role: "run-arrow",
|
|
279
|
+
class: e.class,
|
|
280
|
+
lines: e.lines,
|
|
281
|
+
...(e.anchor ? { at: { x: e.anchor.x, y: e.anchor.y } } : {}),
|
|
282
|
+
note: { of: "direction", up: e.anchor?.up === true },
|
|
283
|
+
});
|
|
284
|
+
} else if (e.class === "anchor" && e.anchor) {
|
|
285
|
+
const r = R.get(e.ref);
|
|
286
|
+
if (!r) continue;
|
|
287
|
+
marks.push({
|
|
288
|
+
...base,
|
|
289
|
+
role: "run-note",
|
|
290
|
+
class: "anchor",
|
|
291
|
+
at: { x: e.anchor.x, y: e.anchor.y },
|
|
292
|
+
note:
|
|
293
|
+
r.device === "stair"
|
|
294
|
+
? { of: "stair", risers: r.risers, riser: r.riser, tread: r.tread, going: r.going, rise: r.rise }
|
|
295
|
+
: { of: "incline", device: r.device, lanes: r.lanes, slope: r.slope, rise: r.rise },
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// ---- the void above, dropped onto the plan below ----
|
|
301
|
+
for (const e of plan.entities) {
|
|
302
|
+
if (e.class !== "above" || e.of !== "space" || !e.polygon) continue;
|
|
303
|
+
const r = polyBounds(e.polygon);
|
|
304
|
+
marks.push({
|
|
305
|
+
role: "void-above",
|
|
306
|
+
of: "space",
|
|
307
|
+
ref: e.ref,
|
|
308
|
+
class: "above",
|
|
309
|
+
polygon: e.polygon,
|
|
310
|
+
at: { x: (r.x1 + r.x2) / 2, y: (r.y1 + r.y2) / 2 },
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return marks;
|
|
315
|
+
}
|