@mark1russell7/room-view 0.3.0 → 0.3.2
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 +28 -0
- package/build/{check-DI_B57qy.js → check-lFfxIUS3.js} +3 -29
- package/build/check-lFfxIUS3.js.map +1 -0
- package/build/index.d.ts +4 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +5 -3
- package/build/index.js.map +1 -1
- package/build/{layers-CYZwt1bH.d.ts → layers-BiiyFJwZ.d.ts} +3 -2
- package/build/layers-BiiyFJwZ.d.ts.map +1 -0
- package/build/{layers-CDNFVXds.js → layers-DmTro5Ny.js} +5 -29
- package/build/layers-DmTro5Ny.js.map +1 -0
- package/build/{level-BERjgyrT.js → level-CvbiwvhH.js} +4 -3
- package/build/{level-BERjgyrT.js.map → level-CvbiwvhH.js.map} +1 -1
- package/build/{level-m-mJ_3Ok.d.ts → level-DmEftWYn.d.ts} +3 -3
- package/build/{level-m-mJ_3Ok.d.ts.map → level-DmEftWYn.d.ts.map} +1 -1
- package/build/marks.d.ts +2 -2
- package/build/marks.js +1 -1
- package/build/plan-import.d.ts +329 -0
- package/build/plan-import.d.ts.map +1 -0
- package/build/plan-import.js +864 -0
- package/build/plan-import.js.map +1 -0
- package/build/room-BQua5eSs.d.ts +124 -0
- package/build/room-BQua5eSs.d.ts.map +1 -0
- package/build/room-CiVZ_07s.js +29 -0
- package/build/room-CiVZ_07s.js.map +1 -0
- package/build/sample.d.ts +2 -2
- package/build/schema.d.ts +3 -3
- package/build/schema.js +4 -3
- package/build/schema.js.map +1 -1
- package/build/{solids-OiTlb_Pm.d.ts → solids-CdJf0U39.d.ts} +3 -123
- package/build/solids-CdJf0U39.d.ts.map +1 -0
- package/build/three.d.ts +2 -1
- package/build/three.d.ts.map +1 -1
- package/build/three.js +2 -1
- package/build/three.js.map +1 -1
- package/build/units-BZmvVyu4.js +30 -0
- package/build/units-BZmvVyu4.js.map +1 -0
- package/package.json +7 -1
- package/build/check-DI_B57qy.js.map +0 -1
- package/build/layers-CDNFVXds.js.map +0 -1
- package/build/layers-CYZwt1bH.d.ts.map +0 -1
- package/build/solids-OiTlb_Pm.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -368,6 +368,33 @@ viewer?.showMarks((mark) => mark.kind === "outlet");
|
|
|
368
368
|
|
|
369
369
|
The option `cut` gives a floor plan: the plan keeps only the solids that start below the height of the cut. Thus a door becomes a gap in its wall. Use the plan for a drawing in SVG, or for a browser with no WebGL 2.
|
|
370
370
|
|
|
371
|
+
## A floor plan from a drawing
|
|
372
|
+
|
|
373
|
+
The entry `@mark1russell7/room-view/import` reads the vector paths of a floor plan drawing, for example the lines of a page of a PDF file. It gives a room record with the walls, the openings and one floor for each room.
|
|
374
|
+
|
|
375
|
+
```ts
|
|
376
|
+
import { importPlan, readLegend, type Sheet } from "@mark1russell7/room-view/import";
|
|
377
|
+
|
|
378
|
+
// The lines, the fills and the texts of one page, in points. The scale 1/8 inch to the foot gives 9 points for each foot.
|
|
379
|
+
const sheet: Sheet = { width, height, scale: 9, unit: "ft", lines, fills, texts };
|
|
380
|
+
const result = importPlan(sheet, { legend: readLegend(sheet) });
|
|
381
|
+
console.log(result.rooms.length, result.gate.within);
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
The import has five steps:
|
|
385
|
+
|
|
386
|
+
1. `readPens` finds the wall pens. A wall pen has long lines, and each line has a parallel partner at the distance of a wall thickness.
|
|
387
|
+
2. `findBridges` closes each gap between two wall ends. The bridge of a gap is an opening of the room record.
|
|
388
|
+
3. The walls, the door swings and the bridges go on a grid. Each free region inside the building is a room.
|
|
389
|
+
4. Each room gets the fill color under most of its cells. `readLegend` gives the name of each color.
|
|
390
|
+
5. The area gate compares the area of each fill of the legend with the rooms in it.
|
|
391
|
+
|
|
392
|
+
- A free region with a small area is a speck. A thin free region is the space inside a wall. They are not rooms.
|
|
393
|
+
- The sheet has the y axis down. The plan of the result has the y axis up.
|
|
394
|
+
- Each option has a default in feet. The import changes the default to the unit of the sheet.
|
|
395
|
+
- An opening is a `door` when a door swing is near it. Each other opening is a `gap`.
|
|
396
|
+
- The import does not read the windows or the heights. The room record has the default heights.
|
|
397
|
+
|
|
371
398
|
## The entries
|
|
372
399
|
|
|
373
400
|
| Entry | What it has |
|
|
@@ -376,6 +403,7 @@ The option `cut` gives a floor plan: the plan keeps only the solids that start b
|
|
|
376
403
|
| `@mark1russell7/room-view/schema` | `readRecord`, the schemas of the records and of an anchor in `zod/mini`, and `READ_CONTEXT`: the read of a JSON record. |
|
|
377
404
|
| `@mark1russell7/room-view/sample` | `SAMPLE_ROOM`, `SAMPLE_SCENE`, `SAMPLE_SURVEY` and `SAMPLE_LEVEL`: a room with a rack and an apartment of four rooms, for demos and tests. |
|
|
378
405
|
| `@mark1russell7/room-view/marks` | `layerMarks` and the type `AddOnMarks`: the marks of the layers of a scene, as plain data for a viewer. |
|
|
406
|
+
| `@mark1russell7/room-view/import` | `importPlan`, `readLegend`, `readPens`, `wallPairs` and `findBridges`: a room record from the vector paths of a floor plan drawing. |
|
|
379
407
|
| `@mark1russell7/room-view/three` | `createRoomViewer`, the themes and `solidGeometry`: the viewer in a page. It needs the package `three`. |
|
|
380
408
|
|
|
381
409
|
The schemas examine the form of a record: the fields and their types. The checks examine its meaning. Use the two for a record from a file:
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as metersPer, r as lengthsInRange, t as LARGEST_LENGTH } from "./units-BZmvVyu4.js";
|
|
2
2
|
import { boundsOf3, box3Corners, box3Volume, clipRing, composeTransforms3, convexOverlap, length3, pointInRing, regionArea, rotationAbout, transformPoint3 } from "@mark1russell7/layout-contract";
|
|
3
|
-
// src/units.ts
|
|
4
|
-
/** These are the units of length that a room record can use. */
|
|
5
|
-
const LENGTH_UNITS = [
|
|
6
|
-
"m",
|
|
7
|
-
"cm",
|
|
8
|
-
"mm",
|
|
9
|
-
"ft",
|
|
10
|
-
"in"
|
|
11
|
-
];
|
|
12
|
-
/** This function gives the length of one unit in meters. The factor comes from `@mark1russell7/quantity`. */
|
|
13
|
-
function metersPer(unit) {
|
|
14
|
-
return valueIn(quantity(1, unit), "m");
|
|
15
|
-
}
|
|
16
|
-
/** This function gives the length of one unit in a different unit. For example, one foot is 12 inches. */
|
|
17
|
-
function unitsPer(unit, other) {
|
|
18
|
-
return valueIn(quantity(1, unit), other);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* The largest length in meters that the model can use: 1 000 km. A larger number in a room record is a mistake.
|
|
22
|
-
* With this limit, each calculation of the model gives a finite number.
|
|
23
|
-
*/
|
|
24
|
-
const LARGEST_LENGTH = 1e6;
|
|
25
|
-
/** This function tells if the model can use each value as a length. Such a value is a finite number of meters, with a size of `LARGEST_LENGTH` or less. */
|
|
26
|
-
function lengthsInRange(...meters) {
|
|
27
|
-
return meters.every((value) => Math.abs(value) <= LARGEST_LENGTH);
|
|
28
|
-
}
|
|
29
3
|
// src/frames.ts
|
|
30
4
|
/** This function gives the frame of one wall. `scale` is the length of the unit of the room in meters. */
|
|
31
5
|
function frameOf(room, wall, scale) {
|
|
@@ -938,6 +912,6 @@ function checkAnchor(anchor, space, name = "The anchor") {
|
|
|
938
912
|
message: `${name} is not ${word} a floor of the room.`
|
|
939
913
|
}];
|
|
940
914
|
}
|
|
941
|
-
export {
|
|
915
|
+
export { wallFootprints as C, wallTransform as D, wallPoint as E, MITER_LIMIT as S, wallHasOutline as T, roomSolids as _, checkAnchor as a, solidVolume as b, parseRecordName as c, FLOOR_DEPTH as d, GLASS_THICKNESS as f, objectTransforms as g, boundsOfSolids as h, RECORD_KINDS as i, recordName as l, TO_Y_UP as m, FINDING_CODES as n, checkRoom as o, SOLID_KINDS as p, FINDING_LEVELS as r, checkScene as s, ANCHOR_CODES as t, solidRecord as u, sceneSolids as v, wallFrames as w, JOIN_TOLERANCE as x, solidCorners as y };
|
|
942
916
|
|
|
943
|
-
//# sourceMappingURL=check-
|
|
917
|
+
//# sourceMappingURL=check-lFfxIUS3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-lFfxIUS3.js","names":[],"sources":["../src/frames.ts","../src/joins.ts","../src/solids.ts","../src/check.ts"],"sourcesContent":["import { rotationAbout, type Point, type Transform3 } from \"@mark1russell7/layout-contract\";\nimport type { Room, Wall } from \"./room.ts\";\nimport { lengthsInRange, metersPer } from \"./units.ts\";\n\n/**\n * The frame of a wall, in meters. A point of the wall has a distance along the line and a distance across it.\n * The distance across is positive to the left, for a person who looks from the start to the end.\n */\nexport interface WallFrame {\n /** The `id` of the wall. */\n readonly id: string;\n readonly start: Point;\n readonly end: Point;\n /** The unit vector from the start to the end. A wall with the length 0, or with a length that is not finite, has the vector (1, 0). */\n readonly along: Point;\n /** The unit vector to the left of `along`. */\n readonly left: Point;\n readonly length: number;\n readonly thickness: number;\n readonly height: number;\n /** The distance across of the left face. It is 0 or more. */\n readonly leftOffset: number;\n /** The distance across of the right face. It is 0 or less. */\n readonly rightOffset: number;\n}\n\n/** This function gives the frame of one wall. `scale` is the length of the unit of the room in meters. */\nfunction frameOf(room: Room, wall: Wall, scale: number): WallFrame {\n const start = { x: wall.from[0] * scale, y: wall.from[1] * scale };\n const end = { x: wall.to[0] * scale, y: wall.to[1] * scale };\n const length = Math.hypot(end.x - start.x, end.y - start.y);\n const along = length > 0 && Number.isFinite(length) ? { x: (end.x - start.x) / length, y: (end.y - start.y) / length } : { x: 1, y: 0 };\n const thickness = (wall.thickness ?? room.wallThickness) * scale;\n const side = wall.side ?? \"center\";\n const leftOffset = side === \"left\" ? thickness : side === \"right\" ? 0 : thickness / 2;\n return {\n id: wall.id,\n start,\n end,\n along,\n left: { x: 0 - along.y, y: along.x },\n length,\n thickness,\n height: (wall.height ?? room.height) * scale,\n leftOffset,\n rightOffset: leftOffset - thickness,\n };\n}\n\n/** This function gives the frame of each wall of a room, in the sequence of the walls. */\nexport function wallFrames(room: Room): readonly WallFrame[] {\n const scale = metersPer(room.unit);\n return room.walls.map((wall) => frameOf(room, wall, scale));\n}\n\n/**\n * This function tells if a wall has an outline in the plan. Its ends and its thickness must be lengths in the range of the model,\n * and its length and its thickness must be above 0. Only such a wall makes a corner, and the model makes only such a wall.\n */\nexport function wallHasOutline(frame: WallFrame): boolean {\n return lengthsInRange(frame.start.x, frame.start.y, frame.end.x, frame.end.y, frame.thickness) && frame.length > 0 && frame.thickness > 0;\n}\n\n/** This function gives the point of the plan at a distance along a wall and a distance across it, in meters. */\nexport function wallPoint(frame: WallFrame, along: number, across: number): Point {\n return {\n x: frame.start.x + frame.along.x * along + frame.left.x * across,\n y: frame.start.y + frame.along.y * along + frame.left.y * across,\n };\n}\n\n/**\n * This function gives the transform from the frame of a wall to the room.\n * In the frame of a wall, x is the distance along the wall and y is the distance across it. The height above the floor is z.\n */\nexport function wallTransform(frame: WallFrame): Transform3 {\n return {\n position: { x: frame.start.x, y: frame.start.y, z: 0 },\n rotation: rotationAbout({ x: 0, y: 0, z: 1 }, Math.atan2(frame.along.y, frame.along.x)),\n };\n}\n","import { clipRing, type Point, type Ring } from \"@mark1russell7/layout-contract\";\nimport { wallHasOutline, wallPoint, type WallFrame } from \"./frames.ts\";\n\n/** The outline of one wall in the plan, after its corners with the other walls. */\nexport interface WallFootprint {\n /** The `id` of the wall. */\n readonly wall: string;\n /** The outline in meters, counter-clockwise and convex. It is empty for a wall with no outline (`wallHasOutline`) and for a wall that its corners remove. */\n readonly ring: Ring;\n /**\n * The part of the wall that has its full thickness: two distances along the wall, in meters.\n * An opening must be in this part. A wall with no such part has the two distances 0.\n */\n readonly clear: readonly [number, number];\n}\n\n/** The options of the corners of the walls. */\nexport interface JoinOptions {\n /** Two ends of walls at this distance or less make one corner. The unit is the meter, and the default is 1e-6. A value that is not finite gives the default. */\n readonly tolerance?: number | undefined;\n /**\n * The limit of a sharp corner. The faces of two walls meet at a point. When that point is farther from the corner\n * than this number of thicknesses, the two walls get square ends. The default is 4. A value that is not finite gives the default.\n */\n readonly miterLimit?: number | undefined;\n}\n\n/** The default distance in meters at which two ends of walls make one corner. */\nexport const JOIN_TOLERANCE = 1e-6;\n\n/** The default limit of a sharp corner, in thicknesses. */\nexport const MITER_LIMIT = 4;\n\n/** Two unit vectors with a cross product below this value are parallel. */\nconst PARALLEL = 1e-9;\n\n/** A corner of an outline with a turn of this value or less is flat, so the outline does not need it. */\nconst FLAT = 1e-12;\n\n/** Two points at this distance or less are one point. A point at this distance or less from a face of a wall is on the face. */\nconst SAME = 1e-9;\n\n/**\n * One end of a wall, as a person at the end sees it who looks along the wall.\n * `high` and `low` are the distances of the two faces along `normal`, the unit vector to the left of `out`.\n */\ninterface End {\n readonly point: Point;\n readonly out: Point;\n readonly normal: Point;\n readonly high: number;\n readonly low: number;\n readonly thickness: number;\n /** The points of the two faces at this end. The corners of the walls replace the square points. */\n highPoint: Point;\n lowPoint: Point;\n /** This value tells if the end makes a corner with a different end. */\n joined: boolean;\n}\n\n/** This function gives an option, or its default when the option has no value or a value that is not finite. */\nfunction finiteOr(value: number | undefined, fallback: number): number {\n return value !== undefined && Number.isFinite(value) ? value : fallback;\n}\n\n/** This function gives the point at a distance across from the point of an end. */\nfunction across(end: End, distance: number): Point {\n return { x: end.point.x + end.normal.x * distance, y: end.point.y + end.normal.y * distance };\n}\n\n/** This function makes the two ends of a wall, with square points. */\nfunction endsOf(frame: WallFrame): readonly [End, End] {\n const back = { x: 0 - frame.along.x, y: 0 - frame.along.y };\n const right = { x: 0 - frame.left.x, y: 0 - frame.left.y };\n const make = (point: Point, out: Point, normal: Point, high: number, low: number): End => {\n const end: End = { point, out, normal, high, low, thickness: frame.thickness, highPoint: point, lowPoint: point, joined: false };\n end.highPoint = across(end, high);\n end.lowPoint = across(end, low);\n return end;\n };\n return [\n make(frame.start, frame.along, frame.left, frame.leftOffset, frame.rightOffset),\n make(frame.end, back, right, 0 - frame.rightOffset, 0 - frame.leftOffset),\n ];\n}\n\n/** This function gives the point where two lines meet, or `undefined` for parallel lines. Each line has a point and a unit direction. */\nfunction meet(p: Point, d: Point, q: Point, e: Point): Point | undefined {\n const cross = d.x * e.y - d.y * e.x;\n if (Math.abs(cross) < PARALLEL) return undefined;\n const t = ((q.x - p.x) * e.y - (q.y - p.y) * e.x) / cross;\n return { x: p.x + d.x * t, y: p.y + d.y * t };\n}\n\n/**\n * This function makes the corner of the ends at one point. The ends are in sequence counter-clockwise.\n * The left face of each end meets the right face of the next end.\n */\nfunction joinEnds(ends: readonly End[], miterLimit: number): void {\n if (ends.length < 2) return;\n for (let i = 0; i < ends.length; i++) {\n const end = ends[i]!;\n const next = ends[(i + 1) % ends.length]!;\n end.joined = true;\n const corner = meet(across(end, end.high), end.out, across(next, next.low), next.out);\n if (corner === undefined) continue;\n const reach = Math.hypot(corner.x - end.point.x, corner.y - end.point.y);\n if (reach > miterLimit * Math.max(end.thickness, next.thickness)) continue;\n end.highPoint = corner;\n next.lowPoint = corner;\n }\n}\n\n/** This function gives the part of a ring to the left of the line from `p` to `q`. Two points at one position give the full ring. */\nfunction leftOf(ring: Ring, p: Point, q: Point): Ring {\n const length = Math.hypot(q.x - p.x, q.y - p.y);\n if (length <= SAME) return ring;\n const dx = (q.x - p.x) / length;\n const dy = (q.y - p.y) / length;\n return clipRing(ring, dy, 0 - dx, dy * p.x - dx * p.y);\n}\n\n/**\n * This function cuts the outline of a wall at one end. An end with no corner gets a square cut.\n * An end with a corner keeps the part between the two lines from the point of the corner to the points of the two faces.\n */\nfunction cut(ring: Ring, end: End): Ring {\n if (!end.joined) return leftOf(ring, end.highPoint, end.lowPoint);\n return leftOf(leftOf(ring, end.highPoint, end.point), end.point, end.lowPoint);\n}\n\n/** This function removes each corner of a convex outline that is flat or that is a copy of the corner before it. Fewer than 3 corners give an empty outline. */\nfunction withoutFlat(points: Ring): Ring {\n const ring = [...points];\n let changed = true;\n while (changed && ring.length >= 3) {\n changed = false;\n for (let i = 0; i < ring.length && ring.length >= 3; i++) {\n const [ax, ay] = ring[(i + ring.length - 1) % ring.length]!;\n const [bx, by] = ring[i]!;\n const [cx, cy] = ring[(i + 1) % ring.length]!;\n if ((bx - ax) * (cy - by) - (by - ay) * (cx - bx) > FLAT) continue;\n ring.splice(i, 1);\n changed = true;\n i--;\n }\n }\n return ring.length >= 3 ? ring : [];\n}\n\n/** This function gives the range of the distances along a wall of the corners of an outline that are on one face. */\nfunction faceRange(frame: WallFrame, ring: Ring, offset: number): readonly [number, number] {\n let from = Infinity;\n let to = -Infinity;\n for (const [x, y] of ring) {\n const dx = x - frame.start.x;\n const dy = y - frame.start.y;\n if (Math.abs(dx * frame.left.x + dy * frame.left.y - offset) > SAME) continue;\n const along = dx * frame.along.x + dy * frame.along.y;\n from = Math.min(from, along);\n to = Math.max(to, along);\n }\n return [from, to];\n}\n\n/**\n * This function gives the outline of each wall in the plan, in the sequence of the frames.\n *\n * Two or more ends of walls at one point make a corner. At a corner, the faces of the walls that are adjacent meet at a point.\n * Each wall ends at the lines from the corner to those points. Thus two walls make a miter, and the walls of a corner do not overlap.\n * An end with no other end at its point is square. An end on the face of a different wall is also square: the two walls touch.\n * A wall with no outline (`wallHasOutline`) gets an empty outline, and it makes no corner.\n */\nexport function wallFootprints(frames: readonly WallFrame[], options: JoinOptions = {}): readonly WallFootprint[] {\n const tolerance = finiteOr(options.tolerance, JOIN_TOLERANCE);\n const miterLimit = Math.max(finiteOr(options.miterLimit, MITER_LIMIT), 0);\n const pairs = frames.map((frame) => (wallHasOutline(frame) ? endsOf(frame) : undefined));\n const corners: End[][] = [];\n for (const pair of pairs) {\n for (const end of pair ?? []) {\n const corner = corners.find((ends) => Math.hypot(ends[0]!.point.x - end.point.x, ends[0]!.point.y - end.point.y) <= tolerance);\n if (corner === undefined) corners.push([end]);\n else corner.push(end);\n }\n }\n for (const ends of corners) {\n ends.sort((a, b) => Math.atan2(a.out.y, a.out.x) - Math.atan2(b.out.y, b.out.x));\n joinEnds(ends, miterLimit);\n }\n const thickest = frames.reduce((most, frame, index) => (pairs[index] === undefined ? most : Math.max(most, frame.thickness)), 0);\n const reach = (miterLimit + 1) * thickest;\n return frames.map((frame, index): WallFootprint => {\n const pair = pairs[index];\n if (pair === undefined) return { wall: frame.id, ring: [], clear: [0, 0] };\n const strip = [\n wallPoint(frame, 0 - reach, frame.rightOffset),\n wallPoint(frame, frame.length + reach, frame.rightOffset),\n wallPoint(frame, frame.length + reach, frame.leftOffset),\n wallPoint(frame, 0 - reach, frame.leftOffset),\n ].map((point) => [point.x, point.y] as const);\n const ring = withoutFlat(cut(cut(strip, pair[0]), pair[1]));\n // A very large limit of a sharp corner can make numbers that are not finite. Such an outline is no outline.\n if (!ring.every(([x, y]) => Number.isFinite(x) && Number.isFinite(y))) return { wall: frame.id, ring: [], clear: [0, 0] };\n const leftFace = faceRange(frame, ring, frame.leftOffset);\n const rightFace = faceRange(frame, ring, frame.rightOffset);\n const from = Math.max(leftFace[0], rightFace[0]);\n const to = Math.min(leftFace[1], rightFace[1]);\n return { wall: frame.id, ring, clear: from < to ? [from, to] : [0, 0] };\n });\n}\n","import {\n boundsOf3,\n box3Corners,\n box3Volume,\n clipRing,\n composeTransforms3,\n regionArea,\n rotationAbout,\n transformPoint3,\n type Box3,\n type Point3,\n type Ring,\n type Transform3,\n} from \"@mark1russell7/layout-contract\";\nimport { wallFrames, wallHasOutline, wallTransform, type WallFrame } from \"./frames.ts\";\nimport { wallFootprints, type JoinOptions, type WallFootprint } from \"./joins.ts\";\nimport type { OpeningKind, PlacedObject, Room, Scene } from \"./room.ts\";\nimport { LARGEST_LENGTH, lengthsInRange, metersPer } from \"./units.ts\";\n\n/** These are the kinds of a solid. */\nexport const SOLID_KINDS: readonly [\"floor\", \"wall\", \"glass\", \"object\"] = [\"floor\", \"wall\", \"glass\", \"object\"];\n\n/** A kind of solid. */\nexport type SolidKind = (typeof SOLID_KINDS)[number];\n\n/** A prism: an outline in the plan, from the height `z` up by `d`. The unit is the meter. */\nexport interface Prism {\n readonly kind: \"prism\";\n readonly ring: Ring;\n readonly z: number;\n readonly d: number;\n}\n\n/** A placed box: a box in its own frame, and the transform from that frame to the room. The unit is the meter. */\nexport interface PlacedBox {\n readonly kind: \"box\";\n readonly box: Box3;\n readonly transform: Transform3;\n}\n\n/** The shape of a solid. */\nexport type SolidShape = Prism | PlacedBox;\n\n/**\n * A solid: one part of the 3D model of a room. The x and y axes are the axes of the plan, and the z axis points up.\n * The floor is at the height 0, and each length is in meters. Each number of a solid is finite, and its volume is above 0.\n */\nexport interface Solid {\n /** The name of the solid. Each solid of a model has a different name. */\n readonly id: string;\n readonly kind: SolidKind;\n /** The `id` of the record that the solid comes from: a wall, a floor, an opening or a placed object. */\n readonly source: string;\n readonly shape: SolidShape;\n}\n\n/** The options of the model of a room. */\nexport interface SolidOptions {\n /** The depth of the floor below the height 0, in meters. The walls go down by the same depth. The default is 0.1. A value that is not finite gives the default. */\n readonly floorDepth?: number | undefined;\n /** The options of the corners of the walls. */\n readonly joins?: JoinOptions | undefined;\n}\n\n/** The default depth of the floor, in meters. */\nexport const FLOOR_DEPTH = 0.1;\n\n/** The thickness of the glass of a window, in meters. */\nexport const GLASS_THICKNESS = 0.02;\n\n/**\n * The transform from the room, where the z axis points up, to a space where the y axis points up.\n * The glTF format and three.js have the y axis up. The x axis stays, and the y axis of the plan becomes the negative z axis.\n */\nexport const TO_Y_UP: Transform3 = { position: { x: 0, y: 0, z: 0 }, rotation: { x: -Math.SQRT1_2, y: 0, z: 0, w: Math.SQRT1_2 } };\n\n/** A length in meters at this value or less is empty: the model does not make a part of this size. */\nconst EMPTY = 1e-9;\n\n/** An area in square meters at this value or less is empty. */\nconst EMPTY_AREA = 1e-12;\n\n/** This function gives an outline, or an empty ring when the outline has no area or a number that is not finite. */\nfunction solidRing(ring: Ring): Ring {\n if (ring.length < 3 || !ring.every(([x, y]) => Number.isFinite(x) && Number.isFinite(y))) return [];\n return regionArea({ kind: \"polygon\", points: ring }) > EMPTY_AREA ? ring : [];\n}\n\n/** This function tells if the model makes a wall. Such a wall has an outline in the plan, and its height is above 0 and in the range of the model. */\nfunction isMade(frame: WallFrame): boolean {\n return wallHasOutline(frame) && frame.height > 0 && lengthsInRange(frame.height);\n}\n\n/** An opening of a wall, in meters, in the frame of the wall. */\ninterface Hole {\n readonly id: string;\n readonly kind: OpeningKind;\n readonly from: number;\n readonly to: number;\n readonly sill: number;\n readonly top: number;\n}\n\n/**\n * This function gives the openings of one wall that the model can make, in sequence along the wall.\n * It skips an opening with no size and an opening out of the straight part of the wall. It also skips an opening that overlaps the opening before it.\n */\nfunction holesOf(room: Room, frame: WallFrame, footprint: WallFootprint, scale: number): readonly Hole[] {\n const [clearFrom, clearTo] = footprint.clear;\n const holes = (room.openings ?? [])\n .filter((opening) => opening.wall === frame.id)\n .map((opening): Hole => {\n const sill = (opening.sill ?? 0) * scale;\n return {\n id: opening.id,\n kind: opening.kind,\n from: opening.offset * scale,\n to: (opening.offset + opening.width) * scale,\n sill,\n top: Math.min(sill + opening.height * scale, frame.height),\n };\n })\n .filter((hole) => hole.to - hole.from > EMPTY && hole.sill >= 0 && hole.top - hole.sill > EMPTY && hole.from >= clearFrom - EMPTY && hole.to <= clearTo + EMPTY)\n .sort((a, b) => a.from - b.from);\n const kept: Hole[] = [];\n let cursor = -Infinity;\n for (const hole of holes) {\n if (hole.from < cursor - EMPTY) continue;\n kept.push(hole);\n cursor = hole.to;\n }\n return kept;\n}\n\n/** This function removes each corner of a ring that is at the position of the corner before it. */\nfunction withoutRepeats(ring: Ring): Ring {\n return ring.filter(([x, y], index) => {\n const [px, py] = ring[(index + ring.length - 1) % ring.length]!;\n return ring.length === 1 || Math.hypot(x - px, y - py) > EMPTY;\n });\n}\n\n/** This function gives the part of the outline of a wall between two distances along the wall. An empty part gives an empty ring. */\nfunction slice(frame: WallFrame, ring: Ring, from: number, to: number): Ring {\n const base = frame.start.x * frame.along.x + frame.start.y * frame.along.y;\n let part = ring;\n if (Number.isFinite(from)) part = clipRing(part, 0 - frame.along.x, 0 - frame.along.y, 0 - (base + from));\n if (Number.isFinite(to)) part = clipRing(part, frame.along.x, frame.along.y, base + to);\n return solidRing(withoutRepeats(part));\n}\n\n/** This function gives the solids of one wall: the parts between, below and above its openings, and the glass of each window. */\nfunction wallSolids(room: Room, frame: WallFrame, footprint: WallFootprint, scale: number, depth: number): readonly Solid[] {\n if (footprint.ring.length < 3 || !isMade(frame)) return [];\n const walls: Solid[] = [];\n const glass: Solid[] = [];\n const add = (ring: Ring, z: number, top: number): void => {\n if (ring.length < 3 || top - z <= EMPTY) return;\n walls.push({ id: `wall:${frame.id}:${String(walls.length)}`, kind: \"wall\", source: frame.id, shape: { kind: \"prism\", ring, z, d: top - z } });\n };\n let cursor = -Infinity;\n for (const hole of holesOf(room, frame, footprint, scale)) {\n add(slice(frame, footprint.ring, cursor, hole.from), 0 - depth, frame.height);\n const part = slice(frame, footprint.ring, hole.from, hole.to);\n add(part, 0 - depth, hole.sill);\n add(part, hole.top, frame.height);\n cursor = hole.to;\n if (hole.kind !== \"window\") continue;\n glass.push({\n id: `glass:${hole.id}`,\n kind: \"glass\",\n source: hole.id,\n shape: {\n kind: \"box\",\n box: {\n x: hole.from,\n y: (frame.leftOffset + frame.rightOffset - GLASS_THICKNESS) / 2,\n z: hole.sill,\n w: hole.to - hole.from,\n h: GLASS_THICKNESS,\n d: hole.top - hole.sill,\n },\n transform: wallTransform(frame),\n },\n });\n }\n add(slice(frame, footprint.ring, cursor, Infinity), 0 - depth, frame.height);\n return [...walls, ...glass];\n}\n\n/**\n * This function gives the 3D model of a room as a list of solids.\n * The solids are the floors, the walls with their openings and the glass of the windows. The marks of the layers show the records of the add-ons.\n *\n * The function does not stop for a record with a fault. It skips each part that it cannot make.\n * One example is a wall with no length. A second example is an opening on a wall that the room does not have.\n * A third example is a part with a number that is not finite or not in the range of the model (`LARGEST_LENGTH`). `checkRoom` tells each fault.\n */\nexport function roomSolids(room: Room, options: SolidOptions = {}): readonly Solid[] {\n const scale = metersPer(room.unit);\n const given = options.floorDepth ?? FLOOR_DEPTH;\n const depth = Number.isFinite(given) ? Math.min(Math.max(given, 0), LARGEST_LENGTH) : FLOOR_DEPTH;\n const frames = wallFrames(room);\n const footprints = wallFootprints(frames, options.joins);\n const solids: Solid[] = [];\n for (const floor of room.floors ?? []) {\n const ring = solidRing(floor.ring.map(([x, y]) => [x * scale, y * scale] as const));\n if (ring.length < 3 || depth <= EMPTY || !ring.every(([x, y]) => lengthsInRange(x, y))) continue;\n solids.push({ id: `floor:${floor.id}`, kind: \"floor\", source: floor.id, shape: { kind: \"prism\", ring, z: 0 - depth, d: depth } });\n }\n frames.forEach((frame, index) => {\n solids.push(...wallSolids(room, frame, footprints[index]!, scale, depth));\n });\n return solids;\n}\n\n/**\n * This function gives the transform of each placed object of a scene, from the frame of the object to the room, in meters.\n * The origin of the frame of an object is the center of its bottom. An object with a parent gets the transform of the parent first.\n * An object has no transform when a parent is not in the scene, or when its parents make a loop.\n * An object also has no transform when one value of its place is not finite or not in the range of the model.\n */\nexport function objectTransforms(scene: Scene): ReadonlyMap<string, Transform3> {\n const scale = metersPer(scene.room.unit);\n const objects = new Map((scene.objects ?? []).map((object) => [object.id, object] as const));\n const done = new Map<string, Transform3>();\n const open = new Set<string>();\n const resolve = (object: PlacedObject): Transform3 | undefined => {\n const known = done.get(object.id);\n if (known !== undefined) return known;\n if (open.has(object.id)) return undefined;\n const turn = object.turn ?? 0;\n const position = { x: object.at[0] * scale, y: object.at[1] * scale, z: (object.lift ?? 0) * scale };\n if (!Number.isFinite(turn) || !lengthsInRange(position.x, position.y, position.z)) return undefined;\n // The remainder is exact. Thus a very large turn does not make an angle that is not finite.\n const local: Transform3 = { position, rotation: rotationAbout({ x: 0, y: 0, z: 1 }, ((turn % 360) * Math.PI) / 180) };\n let world: Transform3 | undefined = local;\n if (object.parent !== undefined) {\n open.add(object.id);\n const parent = objects.get(object.parent);\n const outer = parent === undefined ? undefined : resolve(parent);\n world = outer === undefined ? undefined : composeTransforms3(outer, local);\n open.delete(object.id);\n }\n if (world !== undefined) done.set(object.id, world);\n return world;\n };\n for (const object of scene.objects ?? []) resolve(object);\n return done;\n}\n\n/**\n * This function gives the 3D model of a scene: the solids of its room, then one box for each placed object.\n * It skips an object that has no transform, no size, or a size that is not in the range of the model. `checkScene` tells each fault.\n */\nexport function sceneSolids(scene: Scene, options: SolidOptions = {}): readonly Solid[] {\n const scale = metersPer(scene.room.unit);\n const transforms = objectTransforms(scene);\n const solids: Solid[] = [...roomSolids(scene.room, options)];\n for (const object of scene.objects ?? []) {\n const transform = transforms.get(object.id);\n const w = object.size[0] * scale;\n const h = object.size[1] * scale;\n const d = object.size[2] * scale;\n if (transform === undefined || ![w, h, d].every((size) => size > EMPTY && size <= LARGEST_LENGTH)) continue;\n solids.push({\n id: `object:${object.id}`,\n kind: \"object\",\n source: object.id,\n shape: { kind: \"box\", box: { x: 0 - w / 2, y: 0 - h / 2, z: 0, w, h, d }, transform },\n });\n }\n return solids;\n}\n\n/** This function gives the corners of a solid in the room. A box has 8, and a prism has 2 for each corner of its outline. */\nexport function solidCorners(solid: Solid): readonly Point3[] {\n const shape = solid.shape;\n if (shape.kind === \"box\") return box3Corners(shape.box).map((corner) => transformPoint3(shape.transform, corner));\n return shape.ring.flatMap(([x, y]) => [\n { x, y, z: shape.z },\n { x, y, z: shape.z + shape.d },\n ]);\n}\n\n/** This function gives the smallest box along the axes that holds each solid, or `undefined` for no solids. */\nexport function boundsOfSolids(solids: readonly Solid[]): Box3 | undefined {\n return boundsOf3(solids.flatMap((solid) => solidCorners(solid)));\n}\n\n/** This function gives the volume of a solid in cubic meters. */\nexport function solidVolume(solid: Solid): number {\n const shape = solid.shape;\n return shape.kind === \"box\" ? box3Volume(shape.box) : regionArea({ kind: \"polygon\", points: shape.ring }) * shape.d;\n}\n","import { convexOverlap, length3, pointInRing, regionArea, transformPoint3, type Ring, type Transform3 } from \"@mark1russell7/layout-contract\";\nimport type { Anchor, SceneSpace } from \"./anchors.ts\";\nimport { wallFrames, wallHasOutline } from \"./frames.ts\";\nimport { wallFootprints, type JoinOptions } from \"./joins.ts\";\nimport type { PlacedObject, Room, Scene } from \"./room.ts\";\nimport { objectTransforms, type SolidKind } from \"./solids.ts\";\nimport { LARGEST_LENGTH, lengthsInRange, metersPer } from \"./units.ts\";\n\n/** These are the levels of a finding. An error is a fault that the model cannot show. A warning is a fault that the model can show. */\nexport const FINDING_LEVELS: readonly [\"error\", \"warning\"] = [\"error\", \"warning\"];\n\n/** A level of a finding. */\nexport type FindingLevel = (typeof FINDING_LEVELS)[number];\n\n/** These are the kinds of the records that a finding can name. */\nexport const RECORD_KINDS: readonly [\"room\", \"wall\", \"opening\", \"floor\", \"object\"] = [\"room\", \"wall\", \"opening\", \"floor\", \"object\"];\n\n/** A kind of record. */\nexport type RecordKind = (typeof RECORD_KINDS)[number];\n\n/**\n * This function gives the name of a record: its kind, a colon and its `id`, for example `object:desk`.\n * The kind of a record of a layer is the name of the layer, for example `electrical/1`. A finding, a mark and the selection use this name.\n */\nexport function recordName(kind: string, id: string): string {\n return `${kind}:${id}`;\n}\n\n/**\n * This function gives the name of the record of a solid, as `recordName` gives it. `source` is the field `source` of the solid.\n * The glass of a window is a solid of its opening, so its name has the kind `opening`.\n */\nexport function solidRecord(kind: SolidKind, source: string): string {\n return recordName(kind === \"glass\" ? \"opening\" : kind, source);\n}\n\n/** This function gives the kind and the `id` of a record name, or `undefined` for a text with no kind. A kind has no colon, so the first colon ends it. */\nexport function parseRecordName(name: string): { readonly kind: string; readonly id: string } | undefined {\n const colon = name.indexOf(\":\");\n return colon < 1 ? undefined : { kind: name.slice(0, colon), id: name.slice(colon + 1) };\n}\n\n/** These are the codes of the findings. */\nexport const FINDING_CODES: readonly [\n \"number-not-finite\",\n \"number-too-large\",\n \"id-duplicate\",\n \"size-not-positive\",\n \"wall-length\",\n \"wall-short\",\n \"wall-overlap\",\n \"opening-wall\",\n \"opening-range\",\n \"opening-height\",\n \"opening-overlap\",\n \"floor-ring\",\n \"object-parent\",\n \"object-cycle\",\n \"object-outside\",\n \"object-overlap\",\n \"object-in-wall\",\n] = [\n \"number-not-finite\",\n \"number-too-large\",\n \"id-duplicate\",\n \"size-not-positive\",\n \"wall-length\",\n \"wall-short\",\n \"wall-overlap\",\n \"opening-wall\",\n \"opening-range\",\n \"opening-height\",\n \"opening-overlap\",\n \"floor-ring\",\n \"object-parent\",\n \"object-cycle\",\n \"object-outside\",\n \"object-overlap\",\n \"object-in-wall\",\n];\n\n/** A code of a finding. */\nexport type FindingCode = (typeof FINDING_CODES)[number];\n\n/** A finding: one fault of a room record or a scene record. */\nexport interface Finding {\n readonly level: FindingLevel;\n readonly code: FindingCode;\n /** The kind of the record with the fault. */\n readonly record: RecordKind;\n /** The `id` of the record with the fault. For the room record, it is empty. */\n readonly at: string;\n /** The fault in plain words, with the values. */\n readonly message: string;\n /**\n * The `id` of the second record of the fault. It is the other opening or the other object of an overlap.\n * It is also the wall that an object overlaps, or the parent that an object names. A fault of one record has none.\n */\n readonly other?: string | undefined;\n}\n\n/** The options of the checks. Give the options that the model gets. */\nexport interface CheckOptions {\n /** The options of the corners of the walls. */\n readonly joins?: JoinOptions | undefined;\n}\n\n/** A length in meters at this value or less is 0 for the checks: a size must be above it. */\nconst SMALL = 1e-6;\n\n/** This function gives a number with 3 decimals at most. */\nfunction show(value: number): string {\n return String(Math.round(value * 1000) / 1000);\n}\n\n/** This function tells if a value is a number that is not finite, or if it holds such a number. */\nfunction holdsBadNumber(value: unknown): boolean {\n if (typeof value === \"number\") return !Number.isFinite(value);\n if (Array.isArray(value)) return value.some((item) => holdsBadNumber(item));\n if (typeof value === \"object\" && value !== null) return Object.values(value).some((item) => holdsBadNumber(item));\n return false;\n}\n\n/** This function tells if a value is a finite number with a size above a limit, or if it holds such a number. */\nfunction holdsLargeNumber(value: unknown, limit: number): boolean {\n if (typeof value === \"number\") return Number.isFinite(value) && Math.abs(value) > limit;\n if (Array.isArray(value)) return value.some((item) => holdsLargeNumber(item, limit));\n if (typeof value === \"object\" && value !== null) return Object.values(value).some((item) => holdsLargeNumber(item, limit));\n return false;\n}\n\n/** This function gives each value that a list has two or more times. */\nfunction repeated(ids: readonly string[]): readonly string[] {\n const seen = new Set<string>();\n const twice = new Set<string>();\n for (const id of ids) {\n if (seen.has(id)) twice.add(id);\n seen.add(id);\n }\n return [...twice];\n}\n\n/**\n * This function gives each fault of a room record. A room with no finding of the level `error` gives a full model.\n *\n * The function examines the meaning of the record: for example, an opening must be in its wall. The schema examines the form of the record.\n */\nexport function checkRoom(room: Room, options: CheckOptions = {}): readonly Finding[] {\n const findings: Finding[] = [];\n const error = (code: FindingCode, record: RecordKind, at: string, message: string, other?: string): void => {\n findings.push({ level: \"error\", code, record, at, message, ...(other === undefined ? {} : { other }) });\n };\n const warning = (code: FindingCode, record: RecordKind, at: string, message: string, other?: string): void => {\n findings.push({ level: \"warning\", code, record, at, message, ...(other === undefined ? {} : { other }) });\n };\n const scale = metersPer(room.unit);\n /** The largest length of the model, in the unit of the room. */\n const largest = LARGEST_LENGTH / scale;\n /** This function tells if a size of the record is 0 for the checks. */\n const none = (size: number): boolean => !(size * scale > SMALL);\n const openings = room.openings ?? [];\n const floors = room.floors ?? [];\n\n if (holdsBadNumber([room.height, room.wallThickness])) error(\"number-not-finite\", \"room\", \"\", \"The height or the wall thickness of the room is not a finite number.\");\n if (holdsLargeNumber([room.height, room.wallThickness], largest)) error(\"number-too-large\", \"room\", \"\", `The height or the wall thickness of the room is above 1 000 km, the largest length of the model.`);\n const lists: readonly (readonly [RecordKind, readonly { readonly id: string }[]])[] = [\n [\"wall\", room.walls],\n [\"opening\", openings],\n [\"floor\", floors],\n ];\n for (const [record, list] of lists) {\n for (const item of list) {\n if (holdsBadNumber(item)) error(\"number-not-finite\", record, item.id, `A number of the ${record} \"${item.id}\" is not finite.`);\n if (holdsLargeNumber(item, largest)) error(\"number-too-large\", record, item.id, `A length of the ${record} \"${item.id}\" is above 1 000 km, the largest length of the model.`);\n }\n for (const id of repeated(list.map((item) => item.id))) error(\"id-duplicate\", record, id, `Two or more records of the kind ${record} have the id \"${id}\".`);\n }\n\n if (none(room.height)) error(\"size-not-positive\", \"room\", \"\", `The height of the room is ${show(room.height)}. It must be above 0.`);\n if (none(room.wallThickness)) error(\"size-not-positive\", \"room\", \"\", `The wall thickness of the room is ${show(room.wallThickness)}. It must be above 0.`);\n\n const frames = wallFrames(room);\n const footprints = wallFootprints(frames, options.joins);\n frames.forEach((frame, index) => {\n const wall = room.walls[index]!;\n if (wall.thickness !== undefined && none(wall.thickness)) error(\"size-not-positive\", \"wall\", wall.id, `The thickness of the wall \"${wall.id}\" is ${show(wall.thickness)}. It must be above 0.`);\n if (wall.height !== undefined && none(wall.height)) error(\"size-not-positive\", \"wall\", wall.id, `The height of the wall \"${wall.id}\" is ${show(wall.height)}. It must be above 0.`);\n const [clearFrom, clearTo] = footprints[index]!.clear;\n if (!(frame.length > SMALL)) error(\"wall-length\", \"wall\", wall.id, `The wall \"${wall.id}\" has the length 0: its two ends are one point.`);\n else if (wallHasOutline(frame) && !(clearTo - clearFrom > SMALL)) warning(\"wall-short\", \"wall\", wall.id, `The wall \"${wall.id}\" is too short for the corners at its ends: no part of it has its full thickness.`);\n });\n for (let i = 0; i < footprints.length; i++) {\n for (let j = i + 1; j < footprints.length; j++) {\n const a = footprints[i]!;\n const b = footprints[j]!;\n if (a.ring.length < 3 || b.ring.length < 3 || !(convexOverlap(a.ring, b.ring) > SMALL)) continue;\n warning(\"wall-overlap\", \"wall\", a.wall, `The walls \"${a.wall}\" and \"${b.wall}\" overlap. Walls connect only at their ends: divide a wall at the point where a different wall crosses it.`);\n }\n }\n\n const frameOf = new Map(frames.map((frame, index) => [frame.id, { frame, footprint: footprints[index]! }] as const));\n const holes = new Map<string, { id: string; from: number; to: number; sill: number; top: number }[]>();\n for (const opening of openings) {\n const found = frameOf.get(opening.wall);\n if (found === undefined) {\n error(\"opening-wall\", \"opening\", opening.id, `The opening \"${opening.id}\" is on the wall \"${opening.wall}\", which the room does not have.`);\n continue;\n }\n if (none(opening.width)) error(\"size-not-positive\", \"opening\", opening.id, `The width of the opening \"${opening.id}\" is ${show(opening.width)}. It must be above 0.`);\n if (none(opening.height)) error(\"size-not-positive\", \"opening\", opening.id, `The height of the opening \"${opening.id}\" is ${show(opening.height)}. It must be above 0.`);\n if (none(opening.width) || none(opening.height)) continue;\n const from = opening.offset * scale;\n const to = (opening.offset + opening.width) * scale;\n const sill = (opening.sill ?? 0) * scale;\n const top = sill + opening.height * scale;\n const [clearFrom, clearTo] = found.footprint.clear;\n if (from < clearFrom - SMALL || to > clearTo + SMALL) {\n error(\n \"opening-range\",\n \"opening\",\n opening.id,\n `The opening \"${opening.id}\" is from ${show(opening.offset)} to ${show(opening.offset + opening.width)} along the wall \"${opening.wall}\". The straight part of that wall is from ${show(clearFrom / scale)} to ${show(clearTo / scale)}.`,\n );\n }\n if (sill < 0 || top > found.frame.height + SMALL) {\n error(\n \"opening-height\",\n \"opening\",\n opening.id,\n `The opening \"${opening.id}\" is from the height ${show(sill / scale)} to ${show(top / scale)}. The wall \"${opening.wall}\" is from 0 to ${show(found.frame.height / scale)}.`,\n );\n }\n const list = holes.get(opening.wall) ?? [];\n list.push({ id: opening.id, from, to, sill, top });\n holes.set(opening.wall, list);\n }\n for (const [wall, list] of holes) {\n list.sort((a, b) => a.from - b.from);\n for (let i = 1; i < list.length; i++) {\n const before = list[i - 1]!;\n const hole = list[i]!;\n if (hole.from < before.to - SMALL) error(\"opening-overlap\", \"opening\", hole.id, `The openings \"${before.id}\" and \"${hole.id}\" of the wall \"${wall}\" overlap.`, before.id);\n }\n }\n\n for (const floor of floors) {\n if (floor.ring.length < 3 || !(regionArea({ kind: \"polygon\", points: floor.ring }) * scale * scale > SMALL * SMALL)) {\n error(\"floor-ring\", \"floor\", floor.id, `The floor \"${floor.id}\" has no area. Its ring must have 3 or more corners that are not on one line.`);\n }\n }\n return findings;\n}\n\n/** The outline in the plan and the range of heights of a placed object, in meters. */\ninterface Extent {\n readonly object: PlacedObject;\n readonly ring: Ring;\n readonly z: number;\n readonly top: number;\n}\n\n/** This function gives the extent of a placed object from its transform. The turn of each object is about the vertical axis, so the outline is a rectangle. */\nfunction extentOf(object: PlacedObject, transform: Transform3, scale: number): Extent {\n const w = (object.size[0] * scale) / 2;\n const h = (object.size[1] * scale) / 2;\n const corners: readonly (readonly [number, number])[] = [\n [0 - w, 0 - h],\n [w, 0 - h],\n [w, h],\n [0 - w, h],\n ];\n const ring = corners.map(([x, y]) => {\n const point = transformPoint3(transform, { x, y, z: 0 });\n return [point.x, point.y] as const;\n });\n return { object, ring, z: transform.position.z, top: transform.position.z + object.size[2] * scale };\n}\n\n/**\n * This function gives each fault of a scene record: the faults of its room, then the faults of its placed objects.\n * `checkLayers` examines the layers of the scene.\n * A scene with no finding of the level `error` gives a full model.\n */\nexport function checkScene(scene: Scene, options: CheckOptions = {}): readonly Finding[] {\n const findings: Finding[] = [...checkRoom(scene.room, options)];\n const error = (code: FindingCode, record: RecordKind, at: string, message: string, other?: string): void => {\n findings.push({ level: \"error\", code, record, at, message, ...(other === undefined ? {} : { other }) });\n };\n const warning = (code: FindingCode, record: RecordKind, at: string, message: string, other?: string): void => {\n findings.push({ level: \"warning\", code, record, at, message, ...(other === undefined ? {} : { other }) });\n };\n const room = scene.room;\n const scale = metersPer(room.unit);\n const objects = scene.objects ?? [];\n const byId = new Map(objects.map((object) => [object.id, object] as const));\n /** This function tells if each size of an object is above 0 for the checks. */\n const hasSize = (object: PlacedObject): boolean => object.size.every((size) => size * scale > SMALL);\n\n for (const id of repeated(objects.map((object) => object.id))) error(\"id-duplicate\", \"object\", id, `Two or more records of the kind object have the id \"${id}\".`);\n\n /** The objects that hold an object, from its parent up. A loop of parents gives `undefined`. */\n const holders = (object: PlacedObject): ReadonlySet<string> | undefined => {\n const seen = new Set<string>([object.id]);\n const above = new Set<string>();\n let parent = object.parent === undefined ? undefined : byId.get(object.parent);\n while (parent !== undefined) {\n if (seen.has(parent.id)) return undefined;\n seen.add(parent.id);\n above.add(parent.id);\n parent = parent.parent === undefined ? undefined : byId.get(parent.parent);\n }\n return above;\n };\n\n for (const object of objects) {\n if (holdsBadNumber(object)) error(\"number-not-finite\", \"object\", object.id, `A number of the object \"${object.id}\" is not finite.`);\n // The turn of an object is an angle, so it has no such limit.\n if (holdsLargeNumber([object.size, object.at, object.lift], LARGEST_LENGTH / scale)) error(\"number-too-large\", \"object\", object.id, `A length of the object \"${object.id}\" is above 1 000 km, the largest length of the model.`);\n if (!hasSize(object)) error(\"size-not-positive\", \"object\", object.id, `The size of the object \"${object.id}\" is ${object.size.map(show).join(\" by \")}. Each number must be above 0.`);\n if (object.parent !== undefined && !byId.has(object.parent)) error(\"object-parent\", \"object\", object.id, `The object \"${object.id}\" is on the object \"${object.parent}\", which the scene does not have.`, object.parent);\n else if (holders(object) === undefined) error(\"object-cycle\", \"object\", object.id, `The parents of the object \"${object.id}\" make a loop.`);\n }\n\n const transforms = objectTransforms(scene);\n const extents: Extent[] = [];\n for (const object of objects) {\n const transform = transforms.get(object.id);\n if (transform !== undefined && hasSize(object)) extents.push(extentOf(object, transform, scale));\n }\n\n const floors = (room.floors ?? []).filter((floor) => floor.ring.length >= 3).map((floor) => floor.ring.map(([x, y]) => [x * scale, y * scale] as const));\n const frames = wallFrames(room);\n const footprints = wallFootprints(frames, options.joins);\n for (const extent of extents) {\n const { object } = extent;\n const transform = transforms.get(object.id)!;\n if (object.parent === undefined && floors.length > 0 && !floors.some((ring) => pointInRing(transform.position.x, transform.position.y, ring))) {\n warning(\"object-outside\", \"object\", object.id, `The center of the object \"${object.id}\" is not on a floor of the room.`);\n }\n footprints.forEach((footprint, index) => {\n if (footprint.ring.length < 3 || !(extent.z < frames[index]!.height - SMALL) || !(convexOverlap(footprint.ring, extent.ring) > SMALL)) return;\n warning(\"object-in-wall\", \"object\", object.id, `The object \"${object.id}\" overlaps the wall \"${footprint.wall}\".`, footprint.wall);\n });\n }\n for (let i = 0; i < extents.length; i++) {\n for (let j = i + 1; j < extents.length; j++) {\n const a = extents[i]!;\n const b = extents[j]!;\n if (holders(a.object)?.has(b.object.id) === true || holders(b.object)?.has(a.object.id) === true) continue;\n if (!(Math.min(a.top, b.top) - Math.max(a.z, b.z) > SMALL) || !(convexOverlap(a.ring, b.ring) > SMALL)) continue;\n warning(\"object-overlap\", \"object\", a.object.id, `The objects \"${a.object.id}\" and \"${b.object.id}\" overlap.`, b.object.id);\n }\n }\n\n return findings;\n}\n\n/** These are the codes of the faults of an anchor. */\nexport const ANCHOR_CODES: readonly [\n \"anchor-not-finite\",\n \"anchor-wall\",\n \"anchor-object\",\n \"anchor-floor\",\n \"anchor-range\",\n \"anchor-direction\",\n \"anchor-in-opening\",\n \"anchor-outside\",\n] = [\"anchor-not-finite\", \"anchor-wall\", \"anchor-object\", \"anchor-floor\", \"anchor-range\", \"anchor-direction\", \"anchor-in-opening\", \"anchor-outside\"];\n\n/** A code of a fault of an anchor. */\nexport type AnchorCode = (typeof ANCHOR_CODES)[number];\n\n/** A fault of an anchor. `checkLayers` gives it the layer and the key of the anchor. */\nexport interface AnchorFault {\n readonly level: FindingLevel;\n readonly code: AnchorCode;\n /** The fault in plain words, with the values. */\n readonly message: string;\n /** The `id` of the second record of the fault: the opening that the anchor is in. A different fault has none. */\n readonly other?: string | undefined;\n}\n\n/**\n * This function gives the faults of an anchor in the space of a scene. `name` starts each message.\n * An error tells that the anchor has no position. A warning tells a fault that the model can show.\n */\nexport function checkAnchor(anchor: Anchor, space: SceneSpace, name: string = \"The anchor\"): readonly AnchorFault[] {\n const error = (code: AnchorCode, message: string): readonly AnchorFault[] => [{ level: \"error\", code, message: `${name} ${message}` }];\n const { scene, scale } = space;\n if (holdsBadNumber(anchor)) return error(\"anchor-not-finite\", \"has a number that is not finite.\");\n if (anchor.on === \"wall\") {\n const wall = space.wall(anchor.wall);\n if (wall === undefined) return error(\"anchor-wall\", `is on the wall \"${anchor.wall}\", which the room does not have.`);\n const along = anchor.offset * scale;\n const height = anchor.height * scale;\n if (!(along >= 0 && along <= wall.length + SMALL && height >= 0 && height <= wall.height + SMALL)) {\n return error(\n \"anchor-range\",\n `is at ${show(anchor.offset)} along the wall \"${anchor.wall}\" and at the height ${show(anchor.height)}. The wall has the length ${show(wall.length / scale)} and the height ${show(wall.height / scale)}.`,\n );\n }\n const hole = (scene.room.openings ?? []).find((opening) => {\n const sill = (opening.sill ?? 0) * scale;\n return opening.wall === anchor.wall && along > opening.offset * scale && along < (opening.offset + opening.width) * scale && height > sill && height < sill + opening.height * scale;\n });\n return hole === undefined ? [] : [{ level: \"warning\", code: \"anchor-in-opening\", message: `${name} is in the opening \"${hole.id}\" of the wall \"${anchor.wall}\".`, other: hole.id }];\n }\n if (anchor.on === \"object\") {\n const object = space.object(anchor.object);\n if (object === undefined) return error(\"anchor-object\", `is on the object \"${anchor.object}\", which the scene does not have.`);\n // An object with no place has a fault of its own, which `checkScene` tells. Here, the anchor tells that it has no position.\n if (space.transform(anchor.object) === undefined) return error(\"anchor-object\", `is on the object \"${anchor.object}\", which has no place in the room.`);\n const small = SMALL / scale;\n if (anchor.at !== undefined) {\n const [x, y, z] = anchor.at;\n const [width, depth, height] = object.size;\n if (!(Math.abs(x) <= width / 2 + small && Math.abs(y) <= depth / 2 + small && z >= -small && z <= height + small)) {\n return error(\"anchor-range\", `is at (${anchor.at.map(show).join(\", \")}) in the frame of the object \"${anchor.object}\". The object has the size ${object.size.map(show).join(\" by \")}.`);\n }\n }\n if (anchor.out !== undefined) {\n const [x, y, z] = anchor.out;\n if (!(length3({ x, y, z }) > 0)) return error(\"anchor-direction\", \"has a direction with the length 0. A direction must have a length above 0.\");\n }\n return [];\n }\n const [x, y] = anchor.at;\n if (!lengthsInRange(x * scale, y * scale)) return error(\"anchor-range\", \"is at a point above 1 000 km, the largest length of the model.\");\n const word = anchor.on === \"floor\" ? \"on\" : \"above\";\n const floors = scene.room.floors ?? [];\n if (anchor.floor !== undefined) {\n const floor = floors.find((item) => item.id === anchor.floor);\n if (floor === undefined) return error(\"anchor-floor\", `is ${word} the floor \"${anchor.floor}\", which the room does not have.`);\n return pointInRing(x, y, floor.ring) ? [] : [{ level: \"warning\", code: \"anchor-outside\", message: `${name} is not ${word} the floor \"${anchor.floor}\".` }];\n }\n if (floors.length === 0 || floors.some((floor) => pointInRing(x, y, floor.ring))) return [];\n return [{ level: \"warning\", code: \"anchor-outside\", message: `${name} is not ${word} a floor of the room.` }];\n}\n"],"mappings":";;;;AA2BA,SAAS,QAAQ,MAAY,MAAY,OAA0B;CACjE,MAAM,QAAQ;EAAE,GAAG,KAAK,KAAK,KAAK;EAAO,GAAG,KAAK,KAAK,KAAK;CAAM;CACjE,MAAM,MAAM;EAAE,GAAG,KAAK,GAAG,KAAK;EAAO,GAAG,KAAK,GAAG,KAAK;CAAM;CAC3D,MAAM,SAAS,KAAK,MAAM,IAAI,IAAI,MAAM,GAAG,IAAI,IAAI,MAAM,CAAC;CAC1D,MAAM,QAAQ,SAAS,KAAK,OAAO,SAAS,MAAM,IAAI;EAAE,IAAI,IAAI,IAAI,MAAM,KAAK;EAAQ,IAAI,IAAI,IAAI,MAAM,KAAK;CAAO,IAAI;EAAE,GAAG;EAAG,GAAG;CAAE;CACtI,MAAM,aAAa,KAAK,aAAa,KAAK,iBAAiB;CAC3D,MAAM,OAAO,KAAK,QAAQ;CAC1B,MAAM,aAAa,SAAS,SAAS,YAAY,SAAS,UAAU,IAAI,YAAY;CACpF,OAAO;EACL,IAAI,KAAK;EACT;EACA;EACA;EACA,MAAM;GAAE,GAAG,IAAI,MAAM;GAAG,GAAG,MAAM;EAAE;EACnC;EACA;EACA,SAAS,KAAK,UAAU,KAAK,UAAU;EACvC;EACA,aAAa,aAAa;CAC5B;AACF;;AAGA,SAAgB,WAAW,MAAkC;CAC3D,MAAM,QAAQ,UAAU,KAAK,IAAI;CACjC,OAAO,KAAK,MAAM,KAAK,SAAS,QAAQ,MAAM,MAAM,KAAK,CAAC;AAC5D;;;;;AAMA,SAAgB,eAAe,OAA2B;CACxD,OAAO,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M,KAAK,cAAc,OAAO,MAAM,iCAAiC;EAC7H,OAAO,YAAY,GAAG,GAAG,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC;GAAE,OAAO;GAAW,MAAM;GAAkB,SAAS,GAAG,KAAK,UAAU,KAAK,cAAc,OAAO,MAAM;EAAI,CAAC;CAC3J;CACA,IAAI,OAAO,WAAW,KAAK,OAAO,MAAM,UAAU,YAAY,GAAG,GAAG,MAAM,IAAI,CAAC,GAAG,OAAO,CAAC;CAC1F,OAAO,CAAC;EAAE,OAAO;EAAW,MAAM;EAAkB,SAAS,GAAG,KAAK,UAAU,KAAK;CAAuB,CAAC;AAC9G"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { A as
|
|
1
|
+
import { S as unitsPer, _ as LARGEST_LENGTH, a as PlacedObject, b as lengthsInRange, c as Room, d as WALL_FACES, f as WALL_SIDES, g as isLayerName, h as WallSide, i as OpeningKind, l as SCENE_SCHEMA, m as WallFace, n as OPENING_KINDS, o as PlanPoint, p as Wall, r as Opening, s as ROOM_SCHEMA, t as Floor, u as Scene, v as LENGTH_UNITS, x as metersPer, y as LengthUnit } from "./room-BQua5eSs.js";
|
|
2
|
+
import { C as wallFrames, E as wallTransform, S as WallFrame, T as wallPoint, _ as JOIN_TOLERANCE, a as SOLID_KINDS, b as WallFootprint, c as SolidOptions, d as boundsOfSolids, f as objectTransforms, g as solidVolume, h as solidCorners, i as Prism, l as SolidShape, m as sceneSolids, n as GLASS_THICKNESS, o as Solid, p as roomSolids, r as PlacedBox, s as SolidKind, t as FLOOR_DEPTH, u as TO_Y_UP, v as JoinOptions, w as wallHasOutline, x as wallFootprints, y as MITER_LIMIT } from "./solids-CdJf0U39.js";
|
|
3
|
+
import { A as checkRoom, B as FloorAnchor, C as FINDING_LEVELS, D as RECORD_KINDS, E as FindingLevel, F as ANCHOR_SURFACES, G as sceneSpace, H as SceneSpace, I as Anchor, L as AnchorFrame, M as parseRecordName, N as recordName, O as RecordKind, P as solidRecord, R as AnchorSurface, S as FINDING_CODES, T as FindingCode, U as WallAnchor, V as ObjectAnchor, W as scaleAnchor, _ as roomName, a as FileKind, b as AnchorFault, c as LayerParse, d as RoomLayers, f as checkLayers, g as readLayer, h as moveLayers, i as FILE_KINDS, j as checkScene, k as checkAnchor, l as LayerPart, m as layerPart, n as AddOnFault, o as LAYER_CODES, p as joinLayers, r as AddOnV1, s as LayerFinding, t as AddOn, u as LayersMove, v as ANCHOR_CODES, w as Finding, x as CheckOptions, y as AnchorCode, z as CeilingAnchor } from "./layers-BiiyFJwZ.js";
|
|
4
|
+
import { A as SurveySide, C as SurveyCheck, D as SurveyObject, E as SurveyFrame, F as surveyAnchor, M as convertSurvey, N as expandSurvey, O as SurveyOptions, P as resultScene, S as Survey, T as SurveyClosure, _ as expandLevel, a as ConnectionFault, b as SURVEY_FLOOR, c as Level, d as LevelOptions, f as LevelResult, g as RoomPlace, h as ROOM_PLACES, i as ConnectionEnd, j as SurveyTurn, k as SurveyResult, l as LevelConnection, m as LevelRoomResult, n as CONNECTION_TURN_LIMIT, o as ConnectionUse, p as LevelRoom, r as CONNECTION_USES, s as LEVEL_SCHEMA, t as CONNECTION_FAULTS, u as LevelConnectionResult, v as CLOSURE_LIMIT, w as SurveyCheckResult, x as SURVEY_SCHEMA, y as SQUARE_TURNS } from "./level-DmEftWYn.js";
|
|
4
5
|
import { Ring } from "@mark1russell7/layout-contract";
|
|
5
6
|
/** The outline of one solid in the plan of a room: the solid as a camera above the room sees it. */
|
|
6
7
|
export interface PlanShape {
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/plan.ts","../src/form.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/plan.ts","../src/form.ts"],"mappings":";;;;;;iBAKiB;;WAEN;WACA,MAAM;;WAEN;;WA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1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
1
|
+
import { a as unitsPer, i as metersPer, n as LENGTH_UNITS, r as lengthsInRange, t as LARGEST_LENGTH } from "./units-BZmvVyu4.js";
|
|
2
|
+
import { a as WALL_SIDES, i as WALL_FACES, n as ROOM_SCHEMA, o as isLayerName, r as SCENE_SCHEMA, t as OPENING_KINDS } from "./room-CiVZ_07s.js";
|
|
3
|
+
import { C as wallFootprints, D as wallTransform, E as wallPoint, S as MITER_LIMIT, T as wallHasOutline, _ as roomSolids, a as checkAnchor, b as solidVolume, c as parseRecordName, d as FLOOR_DEPTH, f as GLASS_THICKNESS, g as objectTransforms, h as boundsOfSolids, i as RECORD_KINDS, l as recordName, m as TO_Y_UP, n as FINDING_CODES, o as checkRoom, p as SOLID_KINDS, r as FINDING_LEVELS, s as checkScene, t as ANCHOR_CODES, u as solidRecord, v as sceneSolids, w as wallFrames, x as JOIN_TOLERANCE, y as solidCorners } from "./check-lFfxIUS3.js";
|
|
4
|
+
import { a as layerPart, c as roomName, d as scaleAnchor, f as sceneSpace, i as joinLayers, n as LAYER_CODES, o as moveLayers, r as checkLayers, s as readLayer, t as FILE_KINDS, u as ANCHOR_SURFACES } from "./layers-DmTro5Ny.js";
|
|
5
|
+
import { a as ROOM_PLACES, c as SQUARE_TURNS, d as convertSurvey, f as expandSurvey, i as LEVEL_SCHEMA, l as SURVEY_FLOOR, m as surveyAnchor, n as CONNECTION_TURN_LIMIT, o as expandLevel, p as resultScene, r as CONNECTION_USES, s as CLOSURE_LIMIT, t as CONNECTION_FAULTS, u as SURVEY_SCHEMA } from "./level-CvbiwvhH.js";
|
|
4
6
|
import { transformPoint3 } from "@mark1russell7/layout-contract";
|
|
5
7
|
// src/plan.ts
|
|
6
8
|
/**
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/plan.ts","../src/form.ts"],"sourcesContent":["import { transformPoint3, type Ring } from \"@mark1russell7/layout-contract\";\nimport type { Scene } from \"./room.ts\";\nimport { sceneSolids, type Solid, type SolidKind, type SolidOptions } from \"./solids.ts\";\n\n/** The outline of one solid in the plan of a room: the solid as a camera above the room sees it. */\nexport interface PlanShape {\n /** The `id` of the solid. */\n readonly solid: string;\n readonly kind: SolidKind;\n /** The `id` of the record that the solid comes from. */\n readonly source: string;\n /** The outline in the plan, in meters. */\n readonly ring: Ring;\n /** The height of the bottom of the solid above the floor, in meters. */\n readonly bottom: number;\n /** The height of the top of the solid above the floor, in meters. */\n readonly top: number;\n}\n\n/**\n * This function gives the outline of a solid in the plan.\n * Each box of a model stands on its bottom face, so the outline of a box is that face.\n */\nexport function planShape(solid: Solid): PlanShape {\n const { id, kind, source, shape } = solid;\n if (shape.kind === \"prism\") return { solid: id, kind, source, ring: shape.ring, bottom: shape.z, top: shape.z + shape.d };\n const { box, transform } = shape;\n const face = [\n { x: box.x, y: box.y, z: box.z },\n { x: box.x + box.w, y: box.y, z: box.z },\n { x: box.x + box.w, y: box.y + box.h, z: box.z },\n { x: box.x, y: box.y + box.h, z: box.z },\n ].map((corner) => transformPoint3(transform, corner));\n const bottom = face[0]!.z;\n const top = transformPoint3(transform, { x: box.x, y: box.y, z: box.z + box.d }).z;\n return { solid: id, kind, source, ring: face.map((corner) => [corner.x, corner.y] as const), bottom: Math.min(bottom, top), top: Math.max(bottom, top) };\n}\n\n/** The options of a plan. */\nexport interface PlanOptions extends SolidOptions {\n /**\n * The height of the cut of the plan above the floor, in meters. The plan has only the solids with a bottom below the cut.\n * Thus a cut below the top of a door shows the door as a gap in its wall. Without a cut, the plan has each solid.\n */\n readonly cut?: number | undefined;\n}\n\n/**\n * This function gives the plan of a scene: the outline of each solid of its model.\n * The sequence goes from the solid with the lowest top to the solid with the highest top.\n * Thus a drawing in this sequence shows the room as a camera above it sees the room.\n */\nexport function planShapes(scene: Scene, options: PlanOptions = {}): readonly PlanShape[] {\n const cut = options.cut ?? Infinity;\n return sceneSolids(scene, options)\n .map((solid) => planShape(solid))\n .filter((shape) => shape.bottom < cut)\n .map((shape, index) => ({ shape, index }))\n .sort((a, b) => a.shape.top - b.shape.top || a.index - b.index)\n .map(({ shape }) => shape);\n}\n","import type { Anchor, AnchorSurface } from \"./anchors.ts\";\nimport { isLayerName } from \"./room.ts\";\n\n// The form of a layer: the collections of its records and the fields of each record, as data.\n// A page makes the inputs of an add-on from this data, so the page has no code of a topic.\n// The functions of this file give a layer from the records of a form, and the records of a form from a layer.\n// A record of a layer has this shape: its `id`, its `anchor` when it has a place, and one value for each field.\n\n/** These are the systems of units of a person. A usual value has one number for each system. */\nexport const FORM_SYSTEMS: readonly [\"metric\", \"imperial\"] = [\"metric\", \"imperial\"];\n\n/** A system of units of a person. */\nexport type FormSystem = (typeof FORM_SYSTEMS)[number];\n\n/** The usual value of a number for each system of units. A page shows it in a field that has no value. */\nexport type FormUsual = Readonly<Record<FormSystem, number>>;\n\n/** These are the kinds of a field of a record. */\nexport const FORM_FIELD_KINDS: readonly [\"text\", \"number\", \"record\", \"object\"] = [\"text\", \"number\", \"record\", \"object\"];\n\n/** The kind of a field of a record. */\nexport type FormFieldKind = (typeof FORM_FIELD_KINDS)[number];\n\n/** The parts that each field of a record has. */\nexport interface FormFieldPart {\n /** The name of the field in a record of the layer, for example `breaker`. */\n readonly name: string;\n /** The name of the field in a page, for example `Breaker`. */\n readonly label: string;\n /** This value is true when a record needs a value of the field. A record with no value of it is not in the layer. */\n readonly needed?: boolean | undefined;\n}\n\n/** A field with a text, for example the name of a circuit. */\nexport interface FormTextField extends FormFieldPart {\n readonly kind: \"text\";\n}\n\n/** A field with a number in a fixed unit, for example the rating of a breaker in amperes. */\nexport interface FormNumberField extends FormFieldPart {\n readonly kind: \"number\";\n /** The text of the unit in a page, for example `A`. */\n readonly unit?: string | undefined;\n /** The value of a record that has no value of the field. */\n readonly usual?: FormUsual | undefined;\n /** A valid value is above this number. */\n readonly above?: number | undefined;\n /** A valid value is this number or more. */\n readonly least?: number | undefined;\n /** The sentence of a page for a value that is not valid. It tells the person the value to type. */\n readonly fault?: string | undefined;\n}\n\n/** A field with the `id` of a record of a collection of the same layer, for example the circuit of an outlet. */\nexport interface FormRecordField extends FormFieldPart {\n readonly kind: \"record\";\n /** The name of the collection of the record. */\n readonly of: string;\n /** The text of a page for no record, for example `No circuit`. */\n readonly none?: string | undefined;\n /** The sentence of help of a page when the collection has no record. It tells the way to the first record. */\n readonly aid?: string | undefined;\n}\n\n/** A field with the `id` of a placed object of the scene, for example the object of a power feed. */\nexport interface FormObjectField extends FormFieldPart {\n readonly kind: \"object\";\n}\n\n/** A field of a record of a form. */\nexport type FormField = FormTextField | FormNumberField | FormRecordField | FormObjectField;\n\n/**\n * A collection of a form: the records of one field of a layer, for example the circuits.\n *\n * - A collection with `on` has records with a place. A page shows them with the surface of their anchor.\n * - A collection with `owner` has records of an owner. A page shows them with their owner.\n * - Each other collection is a list of the level.\n */\nexport interface FormCollection {\n /** The name of the field of the layer that has the records, for example `circuits`. */\n readonly name: string;\n /** The word of one record for its `id`. For example, `circuit` gives the `id` `circuit-1`. */\n readonly word: string;\n /** The name of one record in a page, for example `Circuit`. */\n readonly label: string;\n /** The title of the records in a page, for example `Circuits`. */\n readonly title: string;\n /** The surfaces of the anchor of a record. A collection with no surfaces has records with no place. */\n readonly on?: readonly AnchorSurface[] | undefined;\n /** The usual height of a record on a wall above the floor, in meters. */\n readonly height?: FormUsual | undefined;\n /** The fields of a record, in the sequence of a page. */\n readonly fields: readonly FormField[];\n /** The name of the text field that gives the words of the `id` of a record. Without it, the `id` has the word and a number. */\n readonly idFrom?: string | undefined;\n /** The name of the field that names the owner of a record. It is a necessary field of the kind `object` or `record`. */\n readonly owner?: string | undefined;\n /** The largest number of records of one owner. */\n readonly most?: number | undefined;\n}\n\n/** The form of a layer. The add-on of the layer gives it as data. */\nexport interface LayerForm {\n /** The name of the format of the layer, for example `electrical/1`. */\n readonly schema: string;\n /** The collections of the layer, in the sequence of a page. */\n readonly collections: readonly FormCollection[];\n}\n\n/** These are the codes of the faults of a form. */\nexport const FORM_CODES: readonly [\"form-schema\", \"form-collection\", \"form-field\"] = [\"form-schema\", \"form-collection\", \"form-field\"];\n\n/** The code of a fault of a form. */\nexport type FormCode = (typeof FORM_CODES)[number];\n\n/** A fault of a form. */\nexport interface FormFault {\n readonly code: FormCode;\n /** The name of the collection, or the names of the collection and of the field with a point between them. For the form, it is empty. */\n readonly at: string;\n /** The fault in plain words, with the values. */\n readonly message: string;\n}\n\n/** The names that a field cannot have: the parts of each record, and a name that changes an object of JavaScript. */\nconst RESERVED: ReadonlySet<string> = new Set([\"id\", \"anchor\", \"__proto__\"]);\n\n/** This function tells if a number is a valid value of a number field. */\nfunction numberFits(field: FormNumberField, value: number): boolean {\n return Number.isFinite(value) && (field.above === undefined || value > field.above) && (field.least === undefined || value >= field.least);\n}\n\n/** This function gives the names that are in a list two times or more. */\nfunction repeated(names: readonly string[]): ReadonlySet<string> {\n const seen = new Set<string>();\n const twice = new Set<string>();\n for (const name of names) (seen.has(name) ? twice : seen).add(name);\n return twice;\n}\n\n/**\n * This function gives the faults of a form. A form with no fault is safe for `formLayer` and `formRecords`.\n * The test of an add-on examines its form with this function.\n */\nexport function checkForm(form: LayerForm): readonly FormFault[] {\n const faults: FormFault[] = [];\n if (!isLayerName(form.schema)) {\n faults.push({ code: \"form-schema\", at: \"\", message: `The form has the name \"${form.schema}\", which is not a word, a slash and a version, for example \"electrical/1\".` });\n }\n const names = new Set(form.collections.map((collection) => collection.name));\n const twice = repeated(form.collections.map((collection) => collection.name));\n for (const collection of form.collections) {\n const at = collection.name;\n const fault = (message: string): void => {\n faults.push({ code: \"form-collection\", at, message: `The collection \"${at}\" ${message}` });\n };\n if (at === \"\" || at === \"schema\" || at === \"__proto__\") fault(\"has a name that a layer cannot have.\");\n if (twice.has(at)) fault(\"is in the form two times.\");\n if (collection.word === \"\") fault(\"has no word for the ids of its records.\");\n if (collection.on !== undefined && (collection.on.length === 0 || repeated(collection.on).size > 0)) fault(\"has a list of surfaces that is empty, or that has a surface two times.\");\n if (collection.height !== undefined && !(collection.on ?? []).includes(\"wall\")) fault(\"has a usual height, and its records are not on a wall.\");\n if (collection.height !== undefined && !FORM_SYSTEMS.every((system) => Number.isFinite(collection.height?.[system]))) fault(\"has a usual height that is not a number.\");\n if (collection.most !== undefined && (!Number.isInteger(collection.most) || collection.most < 1)) fault(`has the largest number ${String(collection.most)}, which is not an integer of 1 or more.`);\n if (collection.most !== undefined && collection.owner === undefined) fault(\"has a largest number of records of one owner, and it has no owner.\");\n const fields = new Map(collection.fields.map((field) => [field.name, field]));\n if (collection.owner !== undefined) {\n const owner = fields.get(collection.owner);\n if (owner === undefined || owner.needed !== true || (owner.kind !== \"object\" && owner.kind !== \"record\")) {\n fault(`has the owner \"${collection.owner}\", which is not a necessary field of the kind \"object\" or \"record\".`);\n }\n }\n if (collection.idFrom !== undefined && fields.get(collection.idFrom)?.kind !== \"text\") fault(`takes its ids from \"${collection.idFrom}\", which is not a text field.`);\n const twiceFields = repeated(collection.fields.map((field) => field.name));\n for (const field of collection.fields) {\n const place = `${at}.${field.name}`;\n const fieldFault = (message: string): void => {\n faults.push({ code: \"form-field\", at: place, message: `The field \"${field.name}\" of the collection \"${at}\" ${message}` });\n };\n if (field.name === \"\" || RESERVED.has(field.name)) fieldFault(\"has a name that a field cannot have.\");\n if (twiceFields.has(field.name)) fieldFault(\"is in the collection two times.\");\n if (field.kind === \"record\" && !names.has(field.of)) fieldFault(`names the collection \"${field.of}\", which the form does not have.`);\n if (field.kind === \"number\") {\n if ((field.above !== undefined && !Number.isFinite(field.above)) || (field.least !== undefined && !Number.isFinite(field.least))) fieldFault(\"has a limit that is not a number.\");\n if (field.usual !== undefined && !FORM_SYSTEMS.every((system) => numberFits(field, field.usual?.[system] ?? Number.NaN))) fieldFault(\"has a usual value that is not a valid value.\");\n }\n }\n }\n return faults;\n}\n\n/** A value of a field: a text, a number, or the `id` of a record or of a placed object. */\nexport type FormValue = string | number;\n\n/** A record of a form: the values that a person gave. */\nexport interface FormRecord {\n readonly id: string;\n /** The place of the record, for a collection with surfaces. */\n readonly anchor?: Anchor | undefined;\n /** The value of each field, by the name of the field. A field with no value is absent. */\n readonly values: Readonly<Record<string, FormValue>>;\n}\n\n/** The records of a form, by the name of each collection. */\nexport type FormRecords = Readonly<Record<string, readonly FormRecord[]>>;\n\n/**\n * The read of a record: its valid values, or the first field that stops the record.\n * The state `empty` tells a necessary field with no value, and the state `bad` tells a value that is not valid. The field of the place is `anchor`.\n */\nexport type FormReading = { readonly state: \"ok\"; readonly values: Readonly<Record<string, FormValue>> } | { readonly state: \"empty\" | \"bad\"; readonly field: string };\n\n/** This function gives the value of a field in the values of a record. A field that the values do not have gives `undefined`. */\nfunction valueOf(values: Readonly<Record<string, FormValue>>, name: string): FormValue | undefined {\n return Object.hasOwn(values, name) ? values[name] : undefined;\n}\n\n/**\n * This function reads the values of a record of a collection.\n *\n * - A number field with no value gets its usual value for the system.\n * - A text loses the spaces at its ends. An empty text is no value.\n * - A number that is not valid, or a value of a different type, stops the record.\n * - A necessary field with no value stops the record. A collection with surfaces needs an anchor on one of them.\n *\n * The function does not examine if a record or an object of a field is there. `formLayer` examines it.\n */\nexport function readFormRecord(collection: FormCollection, record: FormRecord, system: FormSystem): FormReading {\n if (collection.on !== undefined) {\n if (record.anchor === undefined) return { state: \"empty\", field: \"anchor\" };\n if (!collection.on.includes(record.anchor.on)) return { state: \"bad\", field: \"anchor\" };\n }\n const values: [string, FormValue][] = [];\n for (const field of collection.fields) {\n const given = valueOf(record.values, field.name);\n if (field.kind === \"number\") {\n const value = given ?? field.usual?.[system];\n if (value === undefined) {\n if (field.needed === true) return { state: \"empty\", field: field.name };\n continue;\n }\n if (typeof value !== \"number\" || !numberFits(field, value)) return { state: \"bad\", field: field.name };\n values.push([field.name, value]);\n continue;\n }\n if (given !== undefined && typeof given !== \"string\") return { state: \"bad\", field: field.name };\n const text = field.kind === \"text\" ? (given ?? \"\").trim() : (given ?? \"\");\n if (text === \"\") {\n if (field.needed === true) return { state: \"empty\", field: field.name };\n continue;\n }\n values.push([field.name, text]);\n }\n return { state: \"ok\", values: Object.fromEntries(values) };\n}\n\n/** A record that a layer can have: its values are valid. */\ninterface Kept {\n readonly id: string;\n readonly anchor: Anchor | undefined;\n /** The values of the record. `settle` removes a value that names a record that is not there. */\n values: Readonly<Record<string, FormValue>>;\n}\n\n/**\n * This function removes each part that names a record or an object that is not there, one time. It gives true when it removed a part.\n *\n * - A field of a record that is not in its collection and not in `outside` loses its value.\n * - A field of an object that is not in `objects` loses its value too.\n * - A record with no value of a necessary field goes away.\n * - A record after the largest number of records of its owner goes away.\n */\nfunction settleOnce(form: LayerForm, kept: Map<string, Kept[]>, objects: ReadonlySet<string> | undefined, outside: FormOutside | undefined): boolean {\n let changed = false;\n const ids = new Map<string, ReadonlySet<string>>();\n for (const collection of form.collections) ids.set(collection.name, new Set((kept.get(collection.name) ?? []).map((record) => record.id)));\n for (const collection of form.collections) {\n const counts = new Map<string, number>();\n const list: Kept[] = [];\n for (const record of kept.get(collection.name) ?? []) {\n let stays = true;\n for (const field of collection.fields) {\n const value = valueOf(record.values, field.name);\n if (typeof value !== \"string\" || field.kind === \"text\" || field.kind === \"number\") continue;\n const there =\n field.kind === \"record\" ? ids.get(field.of)?.has(value) === true || outside?.get(field.of)?.has(value) === true : objects === undefined || objects.has(value);\n if (there) continue;\n changed = true;\n if (field.needed === true) stays = false;\n else record.values = Object.fromEntries(Object.entries(record.values).filter(([name]) => name !== field.name));\n }\n if (stays && collection.owner !== undefined && collection.most !== undefined) {\n const owner = String(valueOf(record.values, collection.owner) ?? \"\");\n const count = (counts.get(owner) ?? 0) + 1;\n counts.set(owner, count);\n if (count > collection.most) {\n changed = true;\n stays = false;\n }\n }\n if (stays) list.push(record);\n }\n kept.set(collection.name, list);\n }\n return changed;\n}\n\n/**\n * This function removes each part that names a record or an object that is not there. It gives true when it removed a part.\n * A record that goes away can be the record of a field, so the function repeats `settleOnce` until nothing changes.\n */\nfunction settle(form: LayerForm, kept: Map<string, Kept[]>, objects: ReadonlySet<string> | undefined, outside: FormOutside | undefined): boolean {\n let removed = false;\n while (settleOnce(form, kept, objects, outside)) removed = true;\n return removed;\n}\n\n/**\n * The ids of the records outside a layer that a field of the kind `record` can name, by the name of their collection.\n * For example, the layer of one room of a level can name a record of the layer of the level record.\n */\nexport type FormOutside = ReadonlyMap<string, ReadonlySet<string>>;\n\n/** The options of `formLayer`. */\nexport interface FormLayerOptions {\n /** The system of units of the person, for the usual value of each number. */\n readonly system: FormSystem;\n /** The ids of the placed objects of the scene. With it, a field of the kind `object` keeps only an `id` of the set. */\n readonly objects?: ReadonlySet<string> | undefined;\n /** The ids of the records outside the layer. With it, a field of the kind `record` also keeps an `id` of the set of its collection. */\n readonly outside?: FormOutside | undefined;\n}\n\n/** A layer from the records of a form: its name, and the records of each collection that has records. */\nexport type FormLayer = Readonly<Record<string, unknown>> & { readonly schema: string };\n\n/**\n * This function makes the layer of the records of a form. It is total: a record that the layer cannot have is not in the layer.\n *\n * - `readFormRecord` reads each record. A record that it stops is not in the layer.\n * - The ids of a layer are unique. The first record of an `id` stays, in the sequence of the collections.\n * - A field that names a record that is not in the layer and not in `outside` has no value.\n * - A record with no value of a necessary field is not in the layer.\n * - A collection with no record is not in the layer.\n *\n * A record of the layer has its `id`, then its `anchor`, then its values in the sequence of the fields. Thus equal records give equal JSON.\n * The add-on of the layer reads the result with its `parse`, and `checkLayers` examines it.\n */\nexport function formLayer(form: LayerForm, records: FormRecords, options: FormLayerOptions): FormLayer {\n const kept = new Map<string, Kept[]>();\n const seen = new Set<string>();\n for (const collection of form.collections) {\n const list: Kept[] = [];\n for (const record of Object.hasOwn(records, collection.name) ? (records[collection.name] ?? []) : []) {\n if (record.id === \"\" || seen.has(record.id)) continue;\n const reading = readFormRecord(collection, record, options.system);\n if (reading.state !== \"ok\") continue;\n seen.add(record.id);\n list.push({ id: record.id, anchor: collection.on === undefined ? undefined : record.anchor, values: reading.values });\n }\n kept.set(collection.name, list);\n }\n settle(form, kept, options.objects, options.outside);\n const layer: [string, unknown][] = [[\"schema\", form.schema]];\n for (const collection of form.collections) {\n const list = kept.get(collection.name) ?? [];\n if (list.length === 0) continue;\n layer.push([\n collection.name,\n list.map((record) => {\n const item: [string, unknown][] = [[\"id\", record.id]];\n if (record.anchor !== undefined) item.push([\"anchor\", record.anchor]);\n for (const field of collection.fields) {\n const value = valueOf(record.values, field.name);\n if (value !== undefined) item.push([field.name, value]);\n }\n return Object.fromEntries(item);\n }),\n ]);\n }\n return Object.fromEntries(layer) as FormLayer;\n}\n\n/** The records of a form from a layer. */\nexport interface FormRecordsRead {\n /** The records of each collection of the form. A collection with no record has an empty list. */\n readonly records: FormRecords;\n /** This value is true when the layer has data that the form does not keep. */\n readonly more: boolean;\n}\n\n/** The options of `formRecords`. */\nexport interface FormRecordsOptions {\n /** The ids of the records outside the layer. A layer of `formLayer` with an `outside` needs the same `outside` here. */\n readonly outside?: FormOutside | undefined;\n}\n\nconst isObject = (value: unknown): value is Readonly<Record<string, unknown>> => typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/**\n * This function gives the records of a form from a layer. Give it a layer that its add-on read: the function does not examine the form of an anchor.\n *\n * The form does not keep these data, and `more` tells them:\n *\n * - a field of the layer or of a record that the form does not have\n * - a record with no `id`, or with the `id` of an earlier record\n * - a record of a collection with surfaces that has no anchor on one of them\n * - a value that is not a valid value of its field\n * - a field that names a record that the layer and `outside` do not have\n * - a record after the largest number of records of its owner\n *\n * The records of a layer of `formLayer` are the records that the layer has, and `more` is false for them.\n * A layer of `formLayer` with an `outside` needs the same `outside` for this result.\n */\nexport function formRecords(form: LayerForm, layer: unknown, options: FormRecordsOptions = {}): FormRecordsRead {\n const kept = new Map<string, Kept[]>();\n for (const collection of form.collections) kept.set(collection.name, []);\n let more = false;\n if (isObject(layer)) {\n const names = new Set(form.collections.map((collection) => collection.name));\n if (Object.keys(layer).some((key) => key !== \"schema\" && !names.has(key))) more = true;\n const seen = new Set<string>();\n for (const collection of form.collections) {\n const given = Object.hasOwn(layer, collection.name) ? layer[collection.name] : undefined;\n if (given === undefined) continue;\n if (!Array.isArray(given)) {\n more = true;\n continue;\n }\n const known = new Set([\"id\", ...(collection.on === undefined ? [] : [\"anchor\"]), ...collection.fields.map((field) => field.name)]);\n const list: Kept[] = [];\n for (const item of given as readonly unknown[]) {\n const id = isObject(item) ? item[\"id\"] : undefined;\n if (!isObject(item) || typeof id !== \"string\" || id === \"\" || seen.has(id)) {\n more = true;\n continue;\n }\n const anchor = item[\"anchor\"];\n const surfaces: readonly string[] = collection.on ?? [];\n if (collection.on !== undefined && !(isObject(anchor) && typeof anchor[\"on\"] === \"string\" && surfaces.includes(anchor[\"on\"]))) {\n more = true;\n continue;\n }\n if (Object.keys(item).some((key) => !known.has(key))) more = true;\n const values: [string, FormValue][] = [];\n for (const field of collection.fields) {\n const value = Object.hasOwn(item, field.name) ? item[field.name] : undefined;\n if (value === undefined) continue;\n if (field.kind === \"number\") {\n if (typeof value === \"number\" && numberFits(field, value)) values.push([field.name, value]);\n else more = true;\n } else if (typeof value !== \"string\") more = true;\n else if (field.kind === \"text\") {\n // The spaces at the ends of a text are not data, and an empty text is no value.\n if (value.trim() !== \"\") values.push([field.name, value.trim()]);\n } else if (value === \"\") more = true;\n else values.push([field.name, value]);\n }\n seen.add(id);\n list.push({ id, anchor: collection.on === undefined ? undefined : (anchor as Anchor), values: Object.fromEntries(values) });\n }\n kept.set(collection.name, list);\n }\n // A record with no value of a necessary field is not a record of the form.\n for (const collection of form.collections) {\n const needed = collection.fields.filter((field) => field.needed === true);\n // A number with a usual value has a value in each layer of `formLayer`, so it does not stop a record.\n const has = (record: Kept, field: FormField): boolean => valueOf(record.values, field.name) !== undefined || (field.kind === \"number\" && field.usual !== undefined);\n const list = (kept.get(collection.name) ?? []).filter((record) => needed.every((field) => has(record, field)));\n if (list.length !== (kept.get(collection.name) ?? []).length) more = true;\n kept.set(collection.name, list);\n }\n if (settle(form, kept, undefined, options.outside)) more = true;\n } else if (layer !== undefined) more = true;\n const records: [string, readonly FormRecord[]][] = form.collections.map((collection) => [\n collection.name,\n (kept.get(collection.name) ?? []).map((record): FormRecord => ({ id: record.id, ...(record.anchor === undefined ? {} : { anchor: record.anchor }), values: record.values })),\n ]);\n return { records: Object.fromEntries(records), more };\n}\n"],"mappings":";;;;;;;;;AAuBA,SAAgB,UAAU,OAAyB;CACjD,MAAM,EAAE,IAAI,MAAM,QAAQ,UAAU;CACpC,IAAI,MAAM,SAAS,SAAS,OAAO;EAAE,OAAO;EAAI;EAAM;EAAQ,MAAM,MAAM;EAAM,QAAQ,MAAM;EAAG,KAAK,MAAM,IAAI,MAAM;CAAE;CACxH,MAAM,EAAE,KAAK,cAAc;CAC3B,MAAM,OAAO;EACX;GAAE,GAAG,IAAI;GAAG,GAAG,IAAI;GAAG,GAAG,IAAI;EAAE;EAC/B;GAAE,GAAG,IAAI,IAAI,IAAI;GAAG,GAAG,IAAI;GAAG,GAAG,IAAI;EAAE;EACvC;GAAE,GAAG,IAAI,IAAI,IAAI;GAAG,GAAG,IAAI,IAAI,IAAI;GAAG,GAAG,IAAI;EAAE;EAC/C;GAAE,GAAG,IAAI;GAAG,GAAG,IAAI,IAAI,IAAI;GAAG,GAAG,IAAI;EAAE;CACzC,CAAC,CAAC,KAAK,WAAW,gBAAgB,WAAW,MAAM,CAAC;CACpD,MAAM,SAAS,KAAK,EAAE,CAAE;CACxB,MAAM,MAAM,gBAAgB,WAAW;EAAE,GAAG,IAAI;EAAG,GAAG,IAAI;EAAG,GAAG,IAAI,IAAI,IAAI;CAAE,CAAC,CAAC,CAAC;CACjF,OAAO;EAAE,OAAO;EAAI;EAAM;EAAQ,MAAM,KAAK,KAAK,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,CAAU;EAAG,QAAQ,KAAK,IAAI,QAAQ,GAAG;EAAG,KAAK,KAAK,IAAI,QAAQ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J,MAAM,QAAQ,KAAK,IAAI,WAAW,IAAI,KAAK,CAAC,EAAA,CAAG,QAAQ,WAAW,OAAO,OAAO,UAAU,IAAI,QAAQ,KAAK,CAAC,CAAC;GAC7G,IAAI,KAAK,YAAY,KAAK,IAAI,WAAW,IAAI,KAAK,CAAC,EAAA,CAAG,QAAQ,OAAO;GACrE,KAAK,IAAI,WAAW,MAAM,IAAI;EAChC;EACA,IAAI,OAAO,MAAM,MAAM,KAAA,GAAW,QAAQ,OAAO,GAAG,OAAO;CAC7D,OAAO,IAAI,UAAU,KAAA,GAAW,OAAO;CACvC,MAAM,UAA6C,KAAK,YAAY,KAAK,eAAe,CACtF,WAAW,OACV,KAAK,IAAI,WAAW,IAAI,KAAK,CAAC,EAAA,CAAG,KAAK,YAAwB;EAAE,IAAI,OAAO;EAAI,GAAI,OAAO,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,OAAO,OAAO;EAAI,QAAQ,OAAO;CAAO,EAAE,CAC7K,CAAC;CACD,OAAO;EAAE,SAAS,OAAO,YAAY,OAAO;EAAG;CAAK;AACtD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/plan.ts","../src/form.ts"],"sourcesContent":["import { transformPoint3, type Ring } from \"@mark1russell7/layout-contract\";\nimport type { Scene } from \"./room.ts\";\nimport { sceneSolids, type Solid, type SolidKind, type SolidOptions } from \"./solids.ts\";\n\n/** The outline of one solid in the plan of a room: the solid as a camera above the room sees it. */\nexport interface PlanShape {\n /** The `id` of the solid. */\n readonly solid: string;\n readonly kind: SolidKind;\n /** The `id` of the record that the solid comes from. */\n readonly source: string;\n /** The outline in the plan, in meters. */\n readonly ring: Ring;\n /** The height of the bottom of the solid above the floor, in meters. */\n readonly bottom: number;\n /** The height of the top of the solid above the floor, in meters. */\n readonly top: number;\n}\n\n/**\n * This function gives the outline of a solid in the plan.\n * Each box of a model stands on its bottom face, so the outline of a box is that face.\n */\nexport function planShape(solid: Solid): PlanShape {\n const { id, kind, source, shape } = solid;\n if (shape.kind === \"prism\") return { solid: id, kind, source, ring: shape.ring, bottom: shape.z, top: shape.z + shape.d };\n const { box, transform } = shape;\n const face = [\n { x: box.x, y: box.y, z: box.z },\n { x: box.x + box.w, y: box.y, z: box.z },\n { x: box.x + box.w, y: box.y + box.h, z: box.z },\n { x: box.x, y: box.y + box.h, z: box.z },\n ].map((corner) => transformPoint3(transform, corner));\n const bottom = face[0]!.z;\n const top = transformPoint3(transform, { x: box.x, y: box.y, z: box.z + box.d }).z;\n return { solid: id, kind, source, ring: face.map((corner) => [corner.x, corner.y] as const), bottom: Math.min(bottom, top), top: Math.max(bottom, top) };\n}\n\n/** The options of a plan. */\nexport interface PlanOptions extends SolidOptions {\n /**\n * The height of the cut of the plan above the floor, in meters. The plan has only the solids with a bottom below the cut.\n * Thus a cut below the top of a door shows the door as a gap in its wall. Without a cut, the plan has each solid.\n */\n readonly cut?: number | undefined;\n}\n\n/**\n * This function gives the plan of a scene: the outline of each solid of its model.\n * The sequence goes from the solid with the lowest top to the solid with the highest top.\n * Thus a drawing in this sequence shows the room as a camera above it sees the room.\n */\nexport function planShapes(scene: Scene, options: PlanOptions = {}): readonly PlanShape[] {\n const cut = options.cut ?? Infinity;\n return sceneSolids(scene, options)\n .map((solid) => planShape(solid))\n .filter((shape) => shape.bottom < cut)\n .map((shape, index) => ({ shape, index }))\n .sort((a, b) => a.shape.top - b.shape.top || a.index - b.index)\n .map(({ shape }) => shape);\n}\n","import type { Anchor, AnchorSurface } from \"./anchors.ts\";\nimport { isLayerName } from \"./room.ts\";\n\n// The form of a layer: the collections of its records and the fields of each record, as data.\n// A page makes the inputs of an add-on from this data, so the page has no code of a topic.\n// The functions of this file give a layer from the records of a form, and the records of a form from a layer.\n// A record of a layer has this shape: its `id`, its `anchor` when it has a place, and one value for each field.\n\n/** These are the systems of units of a person. A usual value has one number for each system. */\nexport const FORM_SYSTEMS: readonly [\"metric\", \"imperial\"] = [\"metric\", \"imperial\"];\n\n/** A system of units of a person. */\nexport type FormSystem = (typeof FORM_SYSTEMS)[number];\n\n/** The usual value of a number for each system of units. A page shows it in a field that has no value. */\nexport type FormUsual = Readonly<Record<FormSystem, number>>;\n\n/** These are the kinds of a field of a record. */\nexport const FORM_FIELD_KINDS: readonly [\"text\", \"number\", \"record\", \"object\"] = [\"text\", \"number\", \"record\", \"object\"];\n\n/** The kind of a field of a record. */\nexport type FormFieldKind = (typeof FORM_FIELD_KINDS)[number];\n\n/** The parts that each field of a record has. */\nexport interface FormFieldPart {\n /** The name of the field in a record of the layer, for example `breaker`. */\n readonly name: string;\n /** The name of the field in a page, for example `Breaker`. */\n readonly label: string;\n /** This value is true when a record needs a value of the field. A record with no value of it is not in the layer. */\n readonly needed?: boolean | undefined;\n}\n\n/** A field with a text, for example the name of a circuit. */\nexport interface FormTextField extends FormFieldPart {\n readonly kind: \"text\";\n}\n\n/** A field with a number in a fixed unit, for example the rating of a breaker in amperes. */\nexport interface FormNumberField extends FormFieldPart {\n readonly kind: \"number\";\n /** The text of the unit in a page, for example `A`. */\n readonly unit?: string | undefined;\n /** The value of a record that has no value of the field. */\n readonly usual?: FormUsual | undefined;\n /** A valid value is above this number. */\n readonly above?: number | undefined;\n /** A valid value is this number or more. */\n readonly least?: number | undefined;\n /** The sentence of a page for a value that is not valid. It tells the person the value to type. */\n readonly fault?: string | undefined;\n}\n\n/** A field with the `id` of a record of a collection of the same layer, for example the circuit of an outlet. */\nexport interface FormRecordField extends FormFieldPart {\n readonly kind: \"record\";\n /** The name of the collection of the record. */\n readonly of: string;\n /** The text of a page for no record, for example `No circuit`. */\n readonly none?: string | undefined;\n /** The sentence of help of a page when the collection has no record. It tells the way to the first record. */\n readonly aid?: string | undefined;\n}\n\n/** A field with the `id` of a placed object of the scene, for example the object of a power feed. */\nexport interface FormObjectField extends FormFieldPart {\n readonly kind: \"object\";\n}\n\n/** A field of a record of a form. */\nexport type FormField = FormTextField | FormNumberField | FormRecordField | FormObjectField;\n\n/**\n * A collection of a form: the records of one field of a layer, for example the circuits.\n *\n * - A collection with `on` has records with a place. A page shows them with the surface of their anchor.\n * - A collection with `owner` has records of an owner. A page shows them with their owner.\n * - Each other collection is a list of the level.\n */\nexport interface FormCollection {\n /** The name of the field of the layer that has the records, for example `circuits`. */\n readonly name: string;\n /** The word of one record for its `id`. For example, `circuit` gives the `id` `circuit-1`. */\n readonly word: string;\n /** The name of one record in a page, for example `Circuit`. */\n readonly label: string;\n /** The title of the records in a page, for example `Circuits`. */\n readonly title: string;\n /** The surfaces of the anchor of a record. A collection with no surfaces has records with no place. */\n readonly on?: readonly AnchorSurface[] | undefined;\n /** The usual height of a record on a wall above the floor, in meters. */\n readonly height?: FormUsual | undefined;\n /** The fields of a record, in the sequence of a page. */\n readonly fields: readonly FormField[];\n /** The name of the text field that gives the words of the `id` of a record. Without it, the `id` has the word and a number. */\n readonly idFrom?: string | undefined;\n /** The name of the field that names the owner of a record. It is a necessary field of the kind `object` or `record`. */\n readonly owner?: string | undefined;\n /** The largest number of records of one owner. */\n readonly most?: number | undefined;\n}\n\n/** The form of a layer. The add-on of the layer gives it as data. */\nexport interface LayerForm {\n /** The name of the format of the layer, for example `electrical/1`. */\n readonly schema: string;\n /** The collections of the layer, in the sequence of a page. */\n readonly collections: readonly FormCollection[];\n}\n\n/** These are the codes of the faults of a form. */\nexport const FORM_CODES: readonly [\"form-schema\", \"form-collection\", \"form-field\"] = [\"form-schema\", \"form-collection\", \"form-field\"];\n\n/** The code of a fault of a form. */\nexport type FormCode = (typeof FORM_CODES)[number];\n\n/** A fault of a form. */\nexport interface FormFault {\n readonly code: FormCode;\n /** The name of the collection, or the names of the collection and of the field with a point between them. For the form, it is empty. */\n readonly at: string;\n /** The fault in plain words, with the values. */\n readonly message: string;\n}\n\n/** The names that a field cannot have: the parts of each record, and a name that changes an object of JavaScript. */\nconst RESERVED: ReadonlySet<string> = new Set([\"id\", \"anchor\", \"__proto__\"]);\n\n/** This function tells if a number is a valid value of a number field. */\nfunction numberFits(field: FormNumberField, value: number): boolean {\n return Number.isFinite(value) && (field.above === undefined || value > field.above) && (field.least === undefined || value >= field.least);\n}\n\n/** This function gives the names that are in a list two times or more. */\nfunction repeated(names: readonly string[]): ReadonlySet<string> {\n const seen = new Set<string>();\n const twice = new Set<string>();\n for (const name of names) (seen.has(name) ? twice : seen).add(name);\n return twice;\n}\n\n/**\n * This function gives the faults of a form. A form with no fault is safe for `formLayer` and `formRecords`.\n * The test of an add-on examines its form with this function.\n */\nexport function checkForm(form: LayerForm): readonly FormFault[] {\n const faults: FormFault[] = [];\n if (!isLayerName(form.schema)) {\n faults.push({ code: \"form-schema\", at: \"\", message: `The form has the name \"${form.schema}\", which is not a word, a slash and a version, for example \"electrical/1\".` });\n }\n const names = new Set(form.collections.map((collection) => collection.name));\n const twice = repeated(form.collections.map((collection) => collection.name));\n for (const collection of form.collections) {\n const at = collection.name;\n const fault = (message: string): void => {\n faults.push({ code: \"form-collection\", at, message: `The collection \"${at}\" ${message}` });\n };\n if (at === \"\" || at === \"schema\" || at === \"__proto__\") fault(\"has a name that a layer cannot have.\");\n if (twice.has(at)) fault(\"is in the form two times.\");\n if (collection.word === \"\") fault(\"has no word for the ids of its records.\");\n if (collection.on !== undefined && (collection.on.length === 0 || repeated(collection.on).size > 0)) fault(\"has a list of surfaces that is empty, or that has a surface two times.\");\n if (collection.height !== undefined && !(collection.on ?? []).includes(\"wall\")) fault(\"has a usual height, and its records are not on a wall.\");\n if (collection.height !== undefined && !FORM_SYSTEMS.every((system) => Number.isFinite(collection.height?.[system]))) fault(\"has a usual height that is not a number.\");\n if (collection.most !== undefined && (!Number.isInteger(collection.most) || collection.most < 1)) fault(`has the largest number ${String(collection.most)}, which is not an integer of 1 or more.`);\n if (collection.most !== undefined && collection.owner === undefined) fault(\"has a largest number of records of one owner, and it has no owner.\");\n const fields = new Map(collection.fields.map((field) => [field.name, field]));\n if (collection.owner !== undefined) {\n const owner = fields.get(collection.owner);\n if (owner === undefined || owner.needed !== true || (owner.kind !== \"object\" && owner.kind !== \"record\")) {\n fault(`has the owner \"${collection.owner}\", which is not a necessary field of the kind \"object\" or \"record\".`);\n }\n }\n if (collection.idFrom !== undefined && fields.get(collection.idFrom)?.kind !== \"text\") fault(`takes its ids from \"${collection.idFrom}\", which is not a text field.`);\n const twiceFields = repeated(collection.fields.map((field) => field.name));\n for (const field of collection.fields) {\n const place = `${at}.${field.name}`;\n const fieldFault = (message: string): void => {\n faults.push({ code: \"form-field\", at: place, message: `The field \"${field.name}\" of the collection \"${at}\" ${message}` });\n };\n if (field.name === \"\" || RESERVED.has(field.name)) fieldFault(\"has a name that a field cannot have.\");\n if (twiceFields.has(field.name)) fieldFault(\"is in the collection two times.\");\n if (field.kind === \"record\" && !names.has(field.of)) fieldFault(`names the collection \"${field.of}\", which the form does not have.`);\n if (field.kind === \"number\") {\n if ((field.above !== undefined && !Number.isFinite(field.above)) || (field.least !== undefined && !Number.isFinite(field.least))) fieldFault(\"has a limit that is not a number.\");\n if (field.usual !== undefined && !FORM_SYSTEMS.every((system) => numberFits(field, field.usual?.[system] ?? Number.NaN))) fieldFault(\"has a usual value that is not a valid value.\");\n }\n }\n }\n return faults;\n}\n\n/** A value of a field: a text, a number, or the `id` of a record or of a placed object. */\nexport type FormValue = string | number;\n\n/** A record of a form: the values that a person gave. */\nexport interface FormRecord {\n readonly id: string;\n /** The place of the record, for a collection with surfaces. */\n readonly anchor?: Anchor | undefined;\n /** The value of each field, by the name of the field. A field with no value is absent. */\n readonly values: Readonly<Record<string, FormValue>>;\n}\n\n/** The records of a form, by the name of each collection. */\nexport type FormRecords = Readonly<Record<string, readonly FormRecord[]>>;\n\n/**\n * The read of a record: its valid values, or the first field that stops the record.\n * The state `empty` tells a necessary field with no value, and the state `bad` tells a value that is not valid. The field of the place is `anchor`.\n */\nexport type FormReading = { readonly state: \"ok\"; readonly values: Readonly<Record<string, FormValue>> } | { readonly state: \"empty\" | \"bad\"; readonly field: string };\n\n/** This function gives the value of a field in the values of a record. A field that the values do not have gives `undefined`. */\nfunction valueOf(values: Readonly<Record<string, FormValue>>, name: string): FormValue | undefined {\n return Object.hasOwn(values, name) ? values[name] : undefined;\n}\n\n/**\n * This function reads the values of a record of a collection.\n *\n * - A number field with no value gets its usual value for the system.\n * - A text loses the spaces at its ends. An empty text is no value.\n * - A number that is not valid, or a value of a different type, stops the record.\n * - A necessary field with no value stops the record. A collection with surfaces needs an anchor on one of them.\n *\n * The function does not examine if a record or an object of a field is there. `formLayer` examines it.\n */\nexport function readFormRecord(collection: FormCollection, record: FormRecord, system: FormSystem): FormReading {\n if (collection.on !== undefined) {\n if (record.anchor === undefined) return { state: \"empty\", field: \"anchor\" };\n if (!collection.on.includes(record.anchor.on)) return { state: \"bad\", field: \"anchor\" };\n }\n const values: [string, FormValue][] = [];\n for (const field of collection.fields) {\n const given = valueOf(record.values, field.name);\n if (field.kind === \"number\") {\n const value = given ?? field.usual?.[system];\n if (value === undefined) {\n if (field.needed === true) return { state: \"empty\", field: field.name };\n continue;\n }\n if (typeof value !== \"number\" || !numberFits(field, value)) return { state: \"bad\", field: field.name };\n values.push([field.name, value]);\n continue;\n }\n if (given !== undefined && typeof given !== \"string\") return { state: \"bad\", field: field.name };\n const text = field.kind === \"text\" ? (given ?? \"\").trim() : (given ?? \"\");\n if (text === \"\") {\n if (field.needed === true) return { state: \"empty\", field: field.name };\n continue;\n }\n values.push([field.name, text]);\n }\n return { state: \"ok\", values: Object.fromEntries(values) };\n}\n\n/** A record that a layer can have: its values are valid. */\ninterface Kept {\n readonly id: string;\n readonly anchor: Anchor | undefined;\n /** The values of the record. `settle` removes a value that names a record that is not there. */\n values: Readonly<Record<string, FormValue>>;\n}\n\n/**\n * This function removes each part that names a record or an object that is not there, one time. It gives true when it removed a part.\n *\n * - A field of a record that is not in its collection and not in `outside` loses its value.\n * - A field of an object that is not in `objects` loses its value too.\n * - A record with no value of a necessary field goes away.\n * - A record after the largest number of records of its owner goes away.\n */\nfunction settleOnce(form: LayerForm, kept: Map<string, Kept[]>, objects: ReadonlySet<string> | undefined, outside: FormOutside | undefined): boolean {\n let changed = false;\n const ids = new Map<string, ReadonlySet<string>>();\n for (const collection of form.collections) ids.set(collection.name, new Set((kept.get(collection.name) ?? []).map((record) => record.id)));\n for (const collection of form.collections) {\n const counts = new Map<string, number>();\n const list: Kept[] = [];\n for (const record of kept.get(collection.name) ?? []) {\n let stays = true;\n for (const field of collection.fields) {\n const value = valueOf(record.values, field.name);\n if (typeof value !== \"string\" || field.kind === \"text\" || field.kind === \"number\") continue;\n const there =\n field.kind === \"record\" ? ids.get(field.of)?.has(value) === true || outside?.get(field.of)?.has(value) === true : objects === undefined || objects.has(value);\n if (there) continue;\n changed = true;\n if (field.needed === true) stays = false;\n else record.values = Object.fromEntries(Object.entries(record.values).filter(([name]) => name !== field.name));\n }\n if (stays && collection.owner !== undefined && collection.most !== undefined) {\n const owner = String(valueOf(record.values, collection.owner) ?? \"\");\n const count = (counts.get(owner) ?? 0) + 1;\n counts.set(owner, count);\n if (count > collection.most) {\n changed = true;\n stays = false;\n }\n }\n if (stays) list.push(record);\n }\n kept.set(collection.name, list);\n }\n return changed;\n}\n\n/**\n * This function removes each part that names a record or an object that is not there. It gives true when it removed a part.\n * A record that goes away can be the record of a field, so the function repeats `settleOnce` until nothing changes.\n */\nfunction settle(form: LayerForm, kept: Map<string, Kept[]>, objects: ReadonlySet<string> | undefined, outside: FormOutside | undefined): boolean {\n let removed = false;\n while (settleOnce(form, kept, objects, outside)) removed = true;\n return removed;\n}\n\n/**\n * The ids of the records outside a layer that a field of the kind `record` can name, by the name of their collection.\n * For example, the layer of one room of a level can name a record of the layer of the level record.\n */\nexport type FormOutside = ReadonlyMap<string, ReadonlySet<string>>;\n\n/** The options of `formLayer`. */\nexport interface FormLayerOptions {\n /** The system of units of the person, for the usual value of each number. */\n readonly system: FormSystem;\n /** The ids of the placed objects of the scene. With it, a field of the kind `object` keeps only an `id` of the set. */\n readonly objects?: ReadonlySet<string> | undefined;\n /** The ids of the records outside the layer. With it, a field of the kind `record` also keeps an `id` of the set of its collection. */\n readonly outside?: FormOutside | undefined;\n}\n\n/** A layer from the records of a form: its name, and the records of each collection that has records. */\nexport type FormLayer = Readonly<Record<string, unknown>> & { readonly schema: string };\n\n/**\n * This function makes the layer of the records of a form. It is total: a record that the layer cannot have is not in the layer.\n *\n * - `readFormRecord` reads each record. A record that it stops is not in the layer.\n * - The ids of a layer are unique. The first record of an `id` stays, in the sequence of the collections.\n * - A field that names a record that is not in the layer and not in `outside` has no value.\n * - A record with no value of a necessary field is not in the layer.\n * - A collection with no record is not in the layer.\n *\n * A record of the layer has its `id`, then its `anchor`, then its values in the sequence of the fields. Thus equal records give equal JSON.\n * The add-on of the layer reads the result with its `parse`, and `checkLayers` examines it.\n */\nexport function formLayer(form: LayerForm, records: FormRecords, options: FormLayerOptions): FormLayer {\n const kept = new Map<string, Kept[]>();\n const seen = new Set<string>();\n for (const collection of form.collections) {\n const list: Kept[] = [];\n for (const record of Object.hasOwn(records, collection.name) ? (records[collection.name] ?? []) : []) {\n if (record.id === \"\" || seen.has(record.id)) continue;\n const reading = readFormRecord(collection, record, options.system);\n if (reading.state !== \"ok\") continue;\n seen.add(record.id);\n list.push({ id: record.id, anchor: collection.on === undefined ? undefined : record.anchor, values: reading.values });\n }\n kept.set(collection.name, list);\n }\n settle(form, kept, options.objects, options.outside);\n const layer: [string, unknown][] = [[\"schema\", form.schema]];\n for (const collection of form.collections) {\n const list = kept.get(collection.name) ?? [];\n if (list.length === 0) continue;\n layer.push([\n collection.name,\n list.map((record) => {\n const item: [string, unknown][] = [[\"id\", record.id]];\n if (record.anchor !== undefined) item.push([\"anchor\", record.anchor]);\n for (const field of collection.fields) {\n const value = valueOf(record.values, field.name);\n if (value !== undefined) item.push([field.name, value]);\n }\n return Object.fromEntries(item);\n }),\n ]);\n }\n return Object.fromEntries(layer) as FormLayer;\n}\n\n/** The records of a form from a layer. */\nexport interface FormRecordsRead {\n /** The records of each collection of the form. A collection with no record has an empty list. */\n readonly records: FormRecords;\n /** This value is true when the layer has data that the form does not keep. */\n readonly more: boolean;\n}\n\n/** The options of `formRecords`. */\nexport interface FormRecordsOptions {\n /** The ids of the records outside the layer. A layer of `formLayer` with an `outside` needs the same `outside` here. */\n readonly outside?: FormOutside | undefined;\n}\n\nconst isObject = (value: unknown): value is Readonly<Record<string, unknown>> => typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/**\n * This function gives the records of a form from a layer. Give it a layer that its add-on read: the function does not examine the form of an anchor.\n *\n * The form does not keep these data, and `more` tells them:\n *\n * - a field of the layer or of a record that the form does not have\n * - a record with no `id`, or with the `id` of an earlier record\n * - a record of a collection with surfaces that has no anchor on one of them\n * - a value that is not a valid value of its field\n * - a field that names a record that the layer and `outside` do not have\n * - a record after the largest number of records of its owner\n *\n * The records of a layer of `formLayer` are the records that the layer has, and `more` is false for them.\n * A layer of `formLayer` with an `outside` needs the same `outside` for this result.\n */\nexport function formRecords(form: LayerForm, layer: unknown, options: FormRecordsOptions = {}): FormRecordsRead {\n const kept = new Map<string, Kept[]>();\n for (const collection of form.collections) kept.set(collection.name, []);\n let more = false;\n if (isObject(layer)) {\n const names = new Set(form.collections.map((collection) => collection.name));\n if (Object.keys(layer).some((key) => key !== \"schema\" && !names.has(key))) more = true;\n const seen = new Set<string>();\n for (const collection of form.collections) {\n const given = Object.hasOwn(layer, collection.name) ? layer[collection.name] : undefined;\n if (given === undefined) continue;\n if (!Array.isArray(given)) {\n more = true;\n continue;\n }\n const known = new Set([\"id\", ...(collection.on === undefined ? [] : [\"anchor\"]), ...collection.fields.map((field) => field.name)]);\n const list: Kept[] = [];\n for (const item of given as readonly unknown[]) {\n const id = isObject(item) ? item[\"id\"] : undefined;\n if (!isObject(item) || typeof id !== \"string\" || id === \"\" || seen.has(id)) {\n more = true;\n continue;\n }\n const anchor = item[\"anchor\"];\n const surfaces: readonly string[] = collection.on ?? [];\n if (collection.on !== undefined && !(isObject(anchor) && typeof anchor[\"on\"] === \"string\" && surfaces.includes(anchor[\"on\"]))) {\n more = true;\n continue;\n }\n if (Object.keys(item).some((key) => !known.has(key))) more = true;\n const values: [string, FormValue][] = [];\n for (const field of collection.fields) {\n const value = Object.hasOwn(item, field.name) ? item[field.name] : undefined;\n if (value === undefined) continue;\n if (field.kind === \"number\") {\n if (typeof value === \"number\" && numberFits(field, value)) values.push([field.name, value]);\n else more = true;\n } else if (typeof value !== \"string\") more = true;\n else if (field.kind === \"text\") {\n // The spaces at the ends of a text are not data, and an empty text is no value.\n if (value.trim() !== \"\") values.push([field.name, value.trim()]);\n } else if (value === \"\") more = true;\n else values.push([field.name, value]);\n }\n seen.add(id);\n list.push({ id, anchor: collection.on === undefined ? undefined : (anchor as Anchor), values: Object.fromEntries(values) });\n }\n kept.set(collection.name, list);\n }\n // A record with no value of a necessary field is not a record of the form.\n for (const collection of form.collections) {\n const needed = collection.fields.filter((field) => field.needed === true);\n // A number with a usual value has a value in each layer of `formLayer`, so it does not stop a record.\n const has = (record: Kept, field: FormField): boolean => valueOf(record.values, field.name) !== undefined || (field.kind === \"number\" && field.usual !== undefined);\n const list = (kept.get(collection.name) ?? []).filter((record) => needed.every((field) => has(record, field)));\n if (list.length !== (kept.get(collection.name) ?? []).length) more = true;\n kept.set(collection.name, list);\n }\n if (settle(form, kept, undefined, options.outside)) more = true;\n } else if (layer !== undefined) more = true;\n const records: [string, readonly FormRecord[]][] = form.collections.map((collection) => [\n collection.name,\n (kept.get(collection.name) ?? []).map((record): FormRecord => ({ id: record.id, ...(record.anchor === undefined ? {} : { anchor: record.anchor }), values: record.values })),\n ]);\n return { records: Object.fromEntries(records), more };\n}\n"],"mappings":";;;;;;;;;;;AAuBA,SAAgB,UAAU,OAAyB;CACjD,MAAM,EAAE,IAAI,MAAM,QAAQ,UAAU;CACpC,IAAI,MAAM,SAAS,SAAS,OAAO;EAAE,OAAO;EAAI;EAAM;EAAQ,MAAM,MAAM;EAAM,QAAQ,MAAM;EAAG,KAAK,MAAM,IAAI,MAAM;CAA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,YAAwB;EAAE,IAAI,OAAO;EAAI,GAAI,OAAO,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,OAAO,OAAO;EAAI,QAAQ,OAAO;CAAO,EAAE,CAC7K,CAAC;CACD,OAAO;EAAE,SAAS,OAAO,YAAY,OAAO;EAAG;CAAK;AACtD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as WallFrame, s as SolidKind, v as JoinOptions } from "./solids-CdJf0U39.js";
|
|
2
|
+
import { a as PlacedObject, c as Room, m as WallFace, o as PlanPoint, u as Scene } from "./room-BQua5eSs.js";
|
|
2
3
|
import { Point3, Transform3 } from "@mark1russell7/layout-contract";
|
|
3
4
|
/** These are the surfaces that an anchor can be on. */
|
|
4
5
|
declare const ANCHOR_SURFACES: readonly ["wall", "floor", "ceiling", "object"];
|
|
@@ -316,4 +317,4 @@ interface RoomLayers {
|
|
|
316
317
|
*/
|
|
317
318
|
declare function joinLayers(own: Readonly<Record<string, unknown>> | undefined, rooms: readonly RoomLayers[], addOns: readonly AddOn<unknown>[]): LayersMove;
|
|
318
319
|
export { checkRoom as A, FloorAnchor as B, FINDING_LEVELS as C, RECORD_KINDS as D, FindingLevel as E, ANCHOR_SURFACES as F, sceneSpace as G, SceneSpace as H, Anchor as I, AnchorFrame as L, parseRecordName as M, recordName as N, RecordKind as O, solidRecord as P, AnchorSurface as R, FINDING_CODES as S, FindingCode as T, WallAnchor as U, ObjectAnchor as V, scaleAnchor as W, roomName as _, FileKind as a, AnchorFault as b, LayerParse as c, RoomLayers as d, checkLayers as f, readLayer as g, moveLayers as h, FILE_KINDS as i, checkScene as j, checkAnchor as k, LayerPart as l, layerPart as m, AddOnFault as n, LAYER_CODES as o, joinLayers as p, AddOnV1 as r, LayerFinding as s, AddOn as t, LayersMove as u, ANCHOR_CODES as v, Finding as w, CheckOptions as x, AnchorCode as y, CeilingAnchor as z };
|
|
319
|
-
//# sourceMappingURL=layers-
|
|
320
|
+
//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AKlC,QAAQ,OAAO,QAAQ,oBAAoB;;EAE3C,YAAY,OAAO,OAAO,SAAS,oBAAoB,UAAU;;EAEjE,MAAM,OAAO,OAAO,OAAO,sBAAsB;;;;;;;;;;EAUjD,MAAM,gBAAgB,UAAU,WAAW;;;;;WAKlC,KAAK,QAAQ;;;cAIX;;KAGD,mBAAmB;;UAGd,QAAQ;;;;;WAKd,oBAAoB,QAAQ;;;;;;;EAOrC,KAAK,iBAAiB,MAAM,WAAW,WAAW;;;UAInC,UAAU;;WAEhB;WACA,OAAO;;;;;;WAMP,OAAO;;;;;;iBAOF,SAAS,cAAc;;;;;iBAQvB,UAAU,OAAO,OAAO,OAAO,gBAAgB,UAAU;;cAK5D;;UAGI;WACN,OAAO;;WAEP;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;iBAWK,UAAU,OAAO,OAAO,OAAO,OAAO,MAAM,SAAS,WAAW;;;;;;;;;iBAahE,YAAY,OAAO,OAAO,iBAAiB,4BAA4B;;UAkCtE;;WAEN,QAAQ,SAAS;;WAEjB,mBAAmB;;;;;;;;;;;;;;iBAiCd,WACd,QAAQ,SAAS,sCACjB,iBAAiB,kBACjB,OAAO,QAAQ,WAAW,QAC1B,gBACC;;UAiBc;;WAEN;WACA,QAAQ,SAAS;;;;;;;;;;;;;iBAcZ,WAAW,KAAK,SAAS,sCAAsC,gBAAgB,cAAc,iBAAiB,mBAAmB"}
|
|
@@ -1,31 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as wallPoint, a as checkAnchor, g as objectTransforms, w as wallFrames } from "./check-lFfxIUS3.js";
|
|
2
|
+
import { i as metersPer, r as lengthsInRange } from "./units-BZmvVyu4.js";
|
|
3
|
+
import { o as isLayerName } from "./room-CiVZ_07s.js";
|
|
2
4
|
import { length3, rotatePoint3, scalePoint3, transformPoint3 } from "@mark1russell7/layout-contract";
|
|
3
|
-
// src/room.ts
|
|
4
|
-
/** The name of the format of a room record. */
|
|
5
|
-
const ROOM_SCHEMA = "room/2";
|
|
6
|
-
/** The name of the format of a scene record. */
|
|
7
|
-
const SCENE_SCHEMA = "scene/2";
|
|
8
|
-
/**
|
|
9
|
-
* This function tells if a text is the name of a layer: a word, a slash and a version, for example `electrical/1`.
|
|
10
|
-
* The word has lowercase letters, digits and hyphens. Thus a layer name has no colon, and `recordName` gives each record one name.
|
|
11
|
-
*/
|
|
12
|
-
function isLayerName(text) {
|
|
13
|
-
return /^[a-z][a-z0-9-]*\/[0-9]+$/.test(text);
|
|
14
|
-
}
|
|
15
|
-
/** These are the sides of the line of a wall that can have the wall. */
|
|
16
|
-
const WALL_SIDES = [
|
|
17
|
-
"center",
|
|
18
|
-
"left",
|
|
19
|
-
"right"
|
|
20
|
-
];
|
|
21
|
-
/** These are the faces of a wall, for a person who looks from `from` to `to`. */
|
|
22
|
-
const WALL_FACES = ["left", "right"];
|
|
23
|
-
/** These are the kinds of an opening. A window has glass. A door and a gap are empty. */
|
|
24
|
-
const OPENING_KINDS = [
|
|
25
|
-
"door",
|
|
26
|
-
"window",
|
|
27
|
-
"gap"
|
|
28
|
-
];
|
|
29
5
|
// src/anchors.ts
|
|
30
6
|
/** These are the surfaces that an anchor can be on. */
|
|
31
7
|
const ANCHOR_SURFACES = [
|
|
@@ -398,6 +374,6 @@ function joinLayers(own, rooms, addOns) {
|
|
|
398
374
|
findings
|
|
399
375
|
};
|
|
400
376
|
}
|
|
401
|
-
export {
|
|
377
|
+
export { layerPart as a, roomName as c, scaleAnchor as d, sceneSpace as f, joinLayers as i, compareText as l, LAYER_CODES as n, moveLayers as o, checkLayers as r, readLayer as s, FILE_KINDS as t, ANCHOR_SURFACES as u };
|
|
402
378
|
|
|
403
|
-
//# sourceMappingURL=layers-
|
|
379
|
+
//# sourceMappingURL=layers-DmTro5Ny.js.map
|