@mark1russell7/room-view 0.1.0 → 0.1.1
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 +1 -1
- package/build/index.d.ts +5 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +18 -14
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -223,7 +223,7 @@ Two rooms have one wall between them, but each survey gives the full thickness t
|
|
|
223
223
|
| `error` | The model cannot show the record correctly. | An opening that is longer than its wall, an outlet on a wall that the room does not have. |
|
|
224
224
|
| `warning` | The record is possible, but it is probably a mistake. | Two objects that overlap, an object in a wall, an outlet in a door. |
|
|
225
225
|
|
|
226
|
-
Each finding has a code, the kind and the `id` of the record, and a message with the values. `FINDING_CODES` has each code.
|
|
226
|
+
Each finding has a code, the kind and the `id` of the record, and a message with the values. `FINDING_CODES` has each code. A fault between two records also has the `id` of the second record in `other`. An example is the other object of an overlap.
|
|
227
227
|
|
|
228
228
|
The model does not stop on a record with faults. It does not make the solids that it cannot make, and the checks tell why.
|
|
229
229
|
|
package/build/index.d.ts
CHANGED
|
@@ -57,6 +57,11 @@ export interface Finding {
|
|
|
57
57
|
readonly at: string;
|
|
58
58
|
/** The fault in plain words, with the values. */
|
|
59
59
|
readonly message: string;
|
|
60
|
+
/**
|
|
61
|
+
* The `id` of the second record of the fault. It is the other opening or the other object of an overlap, or the opening that an outlet is in.
|
|
62
|
+
* It is also the wall that an object overlaps, or the parent or the outlet that an object names. A fault of one record has none.
|
|
63
|
+
*/
|
|
64
|
+
readonly other?: string | undefined;
|
|
60
65
|
}
|
|
61
66
|
/** The options of the checks. Give the options that the model gets. */
|
|
62
67
|
export interface CheckOptions {
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/plan.ts","../src/check.ts"],"mappings":";;;;;iBAKiB;;WAEN;WACA,MAAM;;WAEN;;WAEA,MAAM;;WAEN;;WAEA;;;;;;wBAOK,UAAU,OAAO,QAAQ;;iBAgBxB,oBAAoB;;;;;WAK1B;;;;;;;wBAQK,WAAW,OAAO,OAAO,UAAS,uBAA4B;;qBC5CjE;;YAGD,uBAAuB;;qBAGtB;;YAYD,qBAAqB;;qBAGpB;;YAuDD,sBAAsB;;iBAGjB;WACN,OAAO;WACP,MAAM;;WAEN,QAAQ;;WAER;;WAEA;;;iBAIM;;WAEN,QAAQ;;;;;;;wBA2CH,UAAU,MAAM,MAAM,UAAS,wBAA6B;;;;;wBAsK5D,WAAW,OAAO,OAAO,UAAS,wBAA6B"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/plan.ts","../src/check.ts"],"mappings":";;;;;iBAKiB;;WAEN;WACA,MAAM;;WAEN;;WAEA,MAAM;;WAEN;;WAEA;;;;;;wBAOK,UAAU,OAAO,QAAQ;;iBAgBxB,oBAAoB;;;;;WAK1B;;;;;;;wBAQK,WAAW,OAAO,OAAO,UAAS,uBAA4B;;qBC5CjE;;YAGD,uBAAuB;;qBAGtB;;YAYD,qBAAqB;;qBAGpB;;YAuDD,sBAAsB;;iBAGjB;WACN,OAAO;WACP,MAAM;;WAEN,QAAQ;;WAER;;WAEA;;;;;WAKA;;;iBAIM;;WAEN,QAAQ;;;;;;;wBA2CH,UAAU,MAAM,MAAM,UAAS,wBAA6B;;;;;wBAsK5D,WAAW,OAAO,OAAO,UAAS,wBAA6B"}
|
package/build/index.js
CHANGED
|
@@ -146,22 +146,24 @@ function repeated(ids) {
|
|
|
146
146
|
*/
|
|
147
147
|
function checkRoom(room, options = {}) {
|
|
148
148
|
const findings = [];
|
|
149
|
-
const error = (code, record, at, message) => {
|
|
149
|
+
const error = (code, record, at, message, other) => {
|
|
150
150
|
findings.push({
|
|
151
151
|
level: "error",
|
|
152
152
|
code,
|
|
153
153
|
record,
|
|
154
154
|
at,
|
|
155
|
-
message
|
|
155
|
+
message,
|
|
156
|
+
...other === void 0 ? {} : { other }
|
|
156
157
|
});
|
|
157
158
|
};
|
|
158
|
-
const warning = (code, record, at, message) => {
|
|
159
|
+
const warning = (code, record, at, message, other) => {
|
|
159
160
|
findings.push({
|
|
160
161
|
level: "warning",
|
|
161
162
|
code,
|
|
162
163
|
record,
|
|
163
164
|
at,
|
|
164
|
-
message
|
|
165
|
+
message,
|
|
166
|
+
...other === void 0 ? {} : { other }
|
|
165
167
|
});
|
|
166
168
|
};
|
|
167
169
|
const scale = metersPer(room.unit);
|
|
@@ -243,7 +245,7 @@ function checkRoom(room, options = {}) {
|
|
|
243
245
|
for (let i = 1; i < list.length; i++) {
|
|
244
246
|
const before = list[i - 1];
|
|
245
247
|
const hole = list[i];
|
|
246
|
-
if (hole.from < before.to - SMALL) error("opening-overlap", "opening", hole.id, `The openings "${before.id}" and "${hole.id}" of the wall "${wall}" overlap
|
|
248
|
+
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);
|
|
247
249
|
}
|
|
248
250
|
}
|
|
249
251
|
const circuitIds = new Set(circuits.map((circuit) => circuit.id));
|
|
@@ -261,7 +263,7 @@ function checkRoom(room, options = {}) {
|
|
|
261
263
|
continue;
|
|
262
264
|
}
|
|
263
265
|
const hole = (holes.get(outlet.wall) ?? []).find((item) => along > item.from && along < item.to && height > item.sill && height < item.top);
|
|
264
|
-
if (hole !== void 0) warning("outlet-in-opening", "outlet", outlet.id, `The outlet "${outlet.id}" is in the opening "${hole.id}" of the wall "${outlet.wall}"
|
|
266
|
+
if (hole !== void 0) warning("outlet-in-opening", "outlet", outlet.id, `The outlet "${outlet.id}" is in the opening "${hole.id}" of the wall "${outlet.wall}".`, hole.id);
|
|
265
267
|
}
|
|
266
268
|
for (const floor of floors) if (floor.ring.length < 3 || !(regionArea({
|
|
267
269
|
kind: "polygon",
|
|
@@ -299,22 +301,24 @@ function extentOf(object, transform, scale) {
|
|
|
299
301
|
*/
|
|
300
302
|
function checkScene(scene, options = {}) {
|
|
301
303
|
const findings = [...checkRoom(scene.room, options)];
|
|
302
|
-
const error = (code, record, at, message) => {
|
|
304
|
+
const error = (code, record, at, message, other) => {
|
|
303
305
|
findings.push({
|
|
304
306
|
level: "error",
|
|
305
307
|
code,
|
|
306
308
|
record,
|
|
307
309
|
at,
|
|
308
|
-
message
|
|
310
|
+
message,
|
|
311
|
+
...other === void 0 ? {} : { other }
|
|
309
312
|
});
|
|
310
313
|
};
|
|
311
|
-
const warning = (code, record, at, message) => {
|
|
314
|
+
const warning = (code, record, at, message, other) => {
|
|
312
315
|
findings.push({
|
|
313
316
|
level: "warning",
|
|
314
317
|
code,
|
|
315
318
|
record,
|
|
316
319
|
at,
|
|
317
|
-
message
|
|
320
|
+
message,
|
|
321
|
+
...other === void 0 ? {} : { other }
|
|
318
322
|
});
|
|
319
323
|
};
|
|
320
324
|
const room = scene.room;
|
|
@@ -347,9 +351,9 @@ function checkScene(scene, options = {}) {
|
|
|
347
351
|
object.lift
|
|
348
352
|
], 1e6 / 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.`);
|
|
349
353
|
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.`);
|
|
350
|
-
if (object.parent !== void 0 && !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
|
|
354
|
+
if (object.parent !== void 0 && !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);
|
|
351
355
|
else if (holders(object) === void 0) error("object-cycle", "object", object.id, `The parents of the object "${object.id}" make a loop.`);
|
|
352
|
-
if (object.outlet !== void 0 && !outletIds.has(object.outlet)) error("object-outlet", "object", object.id, `The object "${object.id}" uses the outlet "${object.outlet}", which the room does not have
|
|
356
|
+
if (object.outlet !== void 0 && !outletIds.has(object.outlet)) error("object-outlet", "object", object.id, `The object "${object.id}" uses the outlet "${object.outlet}", which the room does not have.`, object.outlet);
|
|
353
357
|
}
|
|
354
358
|
const transforms = objectTransforms(scene);
|
|
355
359
|
const extents = [];
|
|
@@ -366,7 +370,7 @@ function checkScene(scene, options = {}) {
|
|
|
366
370
|
if (object.parent === void 0 && floors.length > 0 && !floors.some((ring) => pointInRing(transform.position.x, transform.position.y, ring))) warning("object-outside", "object", object.id, `The center of the object "${object.id}" is not on a floor of the room.`);
|
|
367
371
|
footprints.forEach((footprint, index) => {
|
|
368
372
|
if (footprint.ring.length < 3 || !(extent.z < frames[index].height - SMALL) || !(convexOverlap(footprint.ring, extent.ring) > SMALL)) return;
|
|
369
|
-
warning("object-in-wall", "object", object.id, `The object "${object.id}" overlaps the wall "${footprint.wall}"
|
|
373
|
+
warning("object-in-wall", "object", object.id, `The object "${object.id}" overlaps the wall "${footprint.wall}".`, footprint.wall);
|
|
370
374
|
});
|
|
371
375
|
}
|
|
372
376
|
for (let i = 0; i < extents.length; i++) for (let j = i + 1; j < extents.length; j++) {
|
|
@@ -374,7 +378,7 @@ function checkScene(scene, options = {}) {
|
|
|
374
378
|
const b = extents[j];
|
|
375
379
|
if (holders(a.object)?.has(b.object.id) === true || holders(b.object)?.has(a.object.id) === true) continue;
|
|
376
380
|
if (!(Math.min(a.top, b.top) - Math.max(a.z, b.z) > SMALL) || !(convexOverlap(a.ring, b.ring) > SMALL)) continue;
|
|
377
|
-
warning("object-overlap", "object", a.object.id, `The objects "${a.object.id}" and "${b.object.id}" overlap
|
|
381
|
+
warning("object-overlap", "object", a.object.id, `The objects "${a.object.id}" and "${b.object.id}" overlap.`, b.object.id);
|
|
378
382
|
}
|
|
379
383
|
for (const load of scene.loads ?? []) {
|
|
380
384
|
if (!circuitIds.has(load.circuit)) error("load-circuit", "load", load.circuit, `A load is on the circuit "${load.circuit}", which the room does not have.`);
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/plan.ts","../src/check.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 { convexOverlap, pointInRing, regionArea, transformPoint3, type Ring, type Transform3 } from \"@mark1russell7/layout-contract\";\nimport { wallFrames, wallHasOutline } from \"./frames.ts\";\nimport { wallFootprints, type JoinOptions } from \"./joins.ts\";\nimport type { PlacedObject, Room, Scene } from \"./room.ts\";\nimport { objectTransforms } from \"./solids.ts\";\nimport { LARGEST_LENGTH, 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\", \"outlet\", \"circuit\", \"object\", \"load\"] = [\n \"room\",\n \"wall\",\n \"opening\",\n \"floor\",\n \"outlet\",\n \"circuit\",\n \"object\",\n \"load\",\n];\n\n/** A kind of record. */\nexport type RecordKind = (typeof RECORD_KINDS)[number];\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 \"outlet-wall\",\n \"outlet-circuit\",\n \"outlet-range\",\n \"outlet-in-opening\",\n \"floor-ring\",\n \"circuit-limit\",\n \"object-parent\",\n \"object-cycle\",\n \"object-outlet\",\n \"object-outside\",\n \"object-overlap\",\n \"object-in-wall\",\n \"load-circuit\",\n \"load-watts\",\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 \"outlet-wall\",\n \"outlet-circuit\",\n \"outlet-range\",\n \"outlet-in-opening\",\n \"floor-ring\",\n \"circuit-limit\",\n \"object-parent\",\n \"object-cycle\",\n \"object-outlet\",\n \"object-outside\",\n \"object-overlap\",\n \"object-in-wall\",\n \"load-circuit\",\n \"load-watts\",\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 a load, it is the `id` of the circuit. 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\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): void => {\n findings.push({ level: \"error\", code, record, at, message });\n };\n const warning = (code: FindingCode, record: RecordKind, at: string, message: string): void => {\n findings.push({ level: \"warning\", code, record, at, message });\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 outlets = room.outlets ?? [];\n const circuits = room.circuits ?? [];\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 [\"outlet\", outlets],\n [\"circuit\", circuits],\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 // The limit of a circuit is a power, not a length.\n if (record !== \"circuit\" && 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.`);\n }\n }\n\n const circuitIds = new Set(circuits.map((circuit) => circuit.id));\n for (const outlet of outlets) {\n if (outlet.circuit !== undefined && !circuitIds.has(outlet.circuit)) error(\"outlet-circuit\", \"outlet\", outlet.id, `The outlet \"${outlet.id}\" is on the circuit \"${outlet.circuit}\", which the room does not have.`);\n const found = frameOf.get(outlet.wall);\n if (found === undefined) {\n error(\"outlet-wall\", \"outlet\", outlet.id, `The outlet \"${outlet.id}\" is on the wall \"${outlet.wall}\", which the room does not have.`);\n continue;\n }\n const along = outlet.offset * scale;\n const height = outlet.height * scale;\n if (!(along >= 0 && along <= found.frame.length + SMALL && height >= 0 && height <= found.frame.height + SMALL)) {\n error(\n \"outlet-range\",\n \"outlet\",\n outlet.id,\n `The outlet \"${outlet.id}\" is at ${show(outlet.offset)} along the wall \"${outlet.wall}\" and at the height ${show(outlet.height)}. The wall has the length ${show(found.frame.length / scale)} and the height ${show(found.frame.height / scale)}.`,\n );\n continue;\n }\n const hole = (holes.get(outlet.wall) ?? []).find((item) => along > item.from && along < item.to && height > item.sill && height < item.top);\n if (hole !== undefined) warning(\"outlet-in-opening\", \"outlet\", outlet.id, `The outlet \"${outlet.id}\" is in the opening \"${hole.id}\" of the wall \"${outlet.wall}\".`);\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 for (const circuit of circuits) {\n if (!(circuit.limit > 0)) error(\"circuit-limit\", \"circuit\", circuit.id, `The limit of the circuit \"${circuit.id}\" is ${show(circuit.limit)} W. It must be above 0.`);\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 and its loads.\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): void => {\n findings.push({ level: \"error\", code, record, at, message });\n };\n const warning = (code: FindingCode, record: RecordKind, at: string, message: string): void => {\n findings.push({ level: \"warning\", code, record, at, message });\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 const outletIds = new Set((room.outlets ?? []).map((outlet) => outlet.id));\n const circuitIds = new Set((room.circuits ?? []).map((circuit) => circuit.id));\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.`);\n else if (holders(object) === undefined) error(\"object-cycle\", \"object\", object.id, `The parents of the object \"${object.id}\" make a loop.`);\n if (object.outlet !== undefined && !outletIds.has(object.outlet)) error(\"object-outlet\", \"object\", object.id, `The object \"${object.id}\" uses the outlet \"${object.outlet}\", which the room does not have.`);\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}\".`);\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.`);\n }\n }\n\n for (const load of scene.loads ?? []) {\n if (!circuitIds.has(load.circuit)) error(\"load-circuit\", \"load\", load.circuit, `A load is on the circuit \"${load.circuit}\", which the room does not have.`);\n if (!(load.watts >= 0 && Number.isFinite(load.watts))) error(\"load-watts\", \"load\", load.circuit, `A load of the circuit \"${load.circuit}\" is ${show(load.watts)} W. It must be a finite number, 0 or more.`);\n }\n return findings;\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,IAA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AAiC;EAC1J,IAAI,EAAE,KAAK,SAAS,KAAK,OAAO,SAAS,KAAK,KAAK,IAAI,MAAM,cAAc,QAAQ,KAAK,SAAS,0BAA0B,KAAK,QAAQ,OAAO,KAAK,KAAK,KAAK,EAAE,2CAA2C;CAC7M;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/plan.ts","../src/check.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 { convexOverlap, pointInRing, regionArea, transformPoint3, type Ring, type Transform3 } from \"@mark1russell7/layout-contract\";\nimport { wallFrames, wallHasOutline } from \"./frames.ts\";\nimport { wallFootprints, type JoinOptions } from \"./joins.ts\";\nimport type { PlacedObject, Room, Scene } from \"./room.ts\";\nimport { objectTransforms } from \"./solids.ts\";\nimport { LARGEST_LENGTH, 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\", \"outlet\", \"circuit\", \"object\", \"load\"] = [\n \"room\",\n \"wall\",\n \"opening\",\n \"floor\",\n \"outlet\",\n \"circuit\",\n \"object\",\n \"load\",\n];\n\n/** A kind of record. */\nexport type RecordKind = (typeof RECORD_KINDS)[number];\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 \"outlet-wall\",\n \"outlet-circuit\",\n \"outlet-range\",\n \"outlet-in-opening\",\n \"floor-ring\",\n \"circuit-limit\",\n \"object-parent\",\n \"object-cycle\",\n \"object-outlet\",\n \"object-outside\",\n \"object-overlap\",\n \"object-in-wall\",\n \"load-circuit\",\n \"load-watts\",\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 \"outlet-wall\",\n \"outlet-circuit\",\n \"outlet-range\",\n \"outlet-in-opening\",\n \"floor-ring\",\n \"circuit-limit\",\n \"object-parent\",\n \"object-cycle\",\n \"object-outlet\",\n \"object-outside\",\n \"object-overlap\",\n \"object-in-wall\",\n \"load-circuit\",\n \"load-watts\",\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 a load, it is the `id` of the circuit. 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, or the opening that an outlet is in.\n * It is also the wall that an object overlaps, or the parent or the outlet 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 outlets = room.outlets ?? [];\n const circuits = room.circuits ?? [];\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 [\"outlet\", outlets],\n [\"circuit\", circuits],\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 // The limit of a circuit is a power, not a length.\n if (record !== \"circuit\" && 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 const circuitIds = new Set(circuits.map((circuit) => circuit.id));\n for (const outlet of outlets) {\n if (outlet.circuit !== undefined && !circuitIds.has(outlet.circuit)) error(\"outlet-circuit\", \"outlet\", outlet.id, `The outlet \"${outlet.id}\" is on the circuit \"${outlet.circuit}\", which the room does not have.`);\n const found = frameOf.get(outlet.wall);\n if (found === undefined) {\n error(\"outlet-wall\", \"outlet\", outlet.id, `The outlet \"${outlet.id}\" is on the wall \"${outlet.wall}\", which the room does not have.`);\n continue;\n }\n const along = outlet.offset * scale;\n const height = outlet.height * scale;\n if (!(along >= 0 && along <= found.frame.length + SMALL && height >= 0 && height <= found.frame.height + SMALL)) {\n error(\n \"outlet-range\",\n \"outlet\",\n outlet.id,\n `The outlet \"${outlet.id}\" is at ${show(outlet.offset)} along the wall \"${outlet.wall}\" and at the height ${show(outlet.height)}. The wall has the length ${show(found.frame.length / scale)} and the height ${show(found.frame.height / scale)}.`,\n );\n continue;\n }\n const hole = (holes.get(outlet.wall) ?? []).find((item) => along > item.from && along < item.to && height > item.sill && height < item.top);\n if (hole !== undefined) warning(\"outlet-in-opening\", \"outlet\", outlet.id, `The outlet \"${outlet.id}\" is in the opening \"${hole.id}\" of the wall \"${outlet.wall}\".`, hole.id);\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 for (const circuit of circuits) {\n if (!(circuit.limit > 0)) error(\"circuit-limit\", \"circuit\", circuit.id, `The limit of the circuit \"${circuit.id}\" is ${show(circuit.limit)} W. It must be above 0.`);\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 and its loads.\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 const outletIds = new Set((room.outlets ?? []).map((outlet) => outlet.id));\n const circuitIds = new Set((room.circuits ?? []).map((circuit) => circuit.id));\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 if (object.outlet !== undefined && !outletIds.has(object.outlet)) error(\"object-outlet\", \"object\", object.id, `The object \"${object.id}\" uses the outlet \"${object.outlet}\", which the room does not have.`, object.outlet);\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 for (const load of scene.loads ?? []) {\n if (!circuitIds.has(load.circuit)) error(\"load-circuit\", \"load\", load.circuit, `A load is on the circuit \"${load.circuit}\", which the room does not have.`);\n if (!(load.watts >= 0 && Number.isFinite(load.watts))) error(\"load-watts\", \"load\", load.circuit, `A load of the circuit \"${load.circuit}\" is ${show(load.watts)} W. It must be a finite number, 0 or more.`);\n }\n return findings;\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,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UAAU,KAAK,KAAK,UAAU,IAAI;EACnI,CAAC;CACH;CACA,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAClC,KAAK,IAAI,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;EAC3C,MAAM,IAAI,QAAQ;EAClB,MAAM,IAAI,QAAQ;EAClB,IAAI,QAAQ,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,QAAQ,QAAQ,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM;EAClG,IAAI,EAAE,KAAK,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,KAAK,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,IAAI,QAAQ;EACxG,QAAQ,kBAAkB,UAAU,EAAE,OAAO,IAAI,gBAAgB,EAAE,OAAO,GAAG,SAAS,EAAE,OAAO,GAAG,aAAa,EAAE,OAAO,EAAE;CAC5H;CAGF,KAAK,MAAM,QAAQ,MAAM,SAAS,CAAC,GAAG;EACpC,IAAI,CAAC,WAAW,IAAI,KAAK,OAAO,GAAG,MAAM,gBAAgB,QAAQ,KAAK,SAAS,6BAA6B,KAAK,QAAQ,iCAAiC;EAC1J,IAAI,EAAE,KAAK,SAAS,KAAK,OAAO,SAAS,KAAK,KAAK,IAAI,MAAM,cAAc,QAAQ,KAAK,SAAS,0BAA0B,KAAK,QAAQ,OAAO,KAAK,KAAK,KAAK,EAAE,2CAA2C;CAC7M;CACA,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@mark1russell7/room-view",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "A room as data, and its 3D model from that data: walls with openings, floors, outlets, circuits and placed objects.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|