@mark1russell7/room-view 0.2.4 → 0.3.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.
Files changed (53) hide show
  1. package/README.md +64 -34
  2. package/build/{anchors-Ba3OUmhF.js → check-lFfxIUS3.js} +11 -260
  3. package/build/check-lFfxIUS3.js.map +1 -0
  4. package/build/index.d.ts +5 -5
  5. package/build/index.js +6 -5
  6. package/build/index.js.map +1 -1
  7. package/build/{layers-BO_MMtQJ.d.ts → layers-BiiyFJwZ.d.ts} +35 -9
  8. package/build/layers-BiiyFJwZ.d.ts.map +1 -0
  9. package/build/{layers-B5nL_lVW.js → layers-DmTro5Ny.js} +158 -26
  10. package/build/layers-DmTro5Ny.js.map +1 -0
  11. package/build/{level-CXCIX08K.js → level-CvbiwvhH.js} +12 -37
  12. package/build/level-CvbiwvhH.js.map +1 -0
  13. package/build/{level-Cjcf3u20.d.ts → level-DmEftWYn.d.ts} +11 -19
  14. package/build/level-DmEftWYn.d.ts.map +1 -0
  15. package/build/marks.d.ts +2 -2
  16. package/build/marks.js +1 -2
  17. package/build/marks.js.map +1 -1
  18. package/build/plan-import.d.ts +325 -0
  19. package/build/plan-import.d.ts.map +1 -0
  20. package/build/plan-import.js +855 -0
  21. package/build/plan-import.js.map +1 -0
  22. package/build/room-BQua5eSs.d.ts +124 -0
  23. package/build/room-BQua5eSs.d.ts.map +1 -0
  24. package/build/room-CiVZ_07s.js +29 -0
  25. package/build/room-CiVZ_07s.js.map +1 -0
  26. package/build/sample.d.ts +4 -4
  27. package/build/sample.d.ts.map +1 -1
  28. package/build/sample.js +21 -217
  29. package/build/sample.js.map +1 -1
  30. package/build/schema.d.ts +59 -9
  31. package/build/schema.d.ts.map +1 -1
  32. package/build/schema.js +251 -91
  33. package/build/schema.js.map +1 -1
  34. package/build/solids-CdJf0U39.d.ts +148 -0
  35. package/build/solids-CdJf0U39.d.ts.map +1 -0
  36. package/build/three.d.ts +9 -16
  37. package/build/three.d.ts.map +1 -1
  38. package/build/three.js +13 -106
  39. package/build/three.js.map +1 -1
  40. package/build/units-BZmvVyu4.js +30 -0
  41. package/build/units-BZmvVyu4.js.map +1 -0
  42. package/package.json +7 -1
  43. package/build/anchors-Ba3OUmhF.js.map +0 -1
  44. package/build/layers-B5nL_lVW.js.map +0 -1
  45. package/build/layers-BO_MMtQJ.d.ts.map +0 -1
  46. package/build/level-CXCIX08K.js.map +0 -1
  47. package/build/level-Cjcf3u20.d.ts.map +0 -1
  48. package/build/loads-CtHa4EHo.js +0 -103
  49. package/build/loads-CtHa4EHo.js.map +0 -1
  50. package/build/loads-Diy6-Ekz.d.ts +0 -73
  51. package/build/loads-Diy6-Ekz.d.ts.map +0 -1
  52. package/build/solids-S_j17vFJ.d.ts +0 -313
  53. package/build/solids-S_j17vFJ.d.ts.map +0 -1
@@ -0,0 +1,148 @@
1
+ import { c as Room, u as Scene } from "./room-BQua5eSs.js";
2
+ import { Box3, Point, Point3, Ring, Transform3 } from "@mark1russell7/layout-contract";
3
+ /**
4
+ * The frame of a wall, in meters. A point of the wall has a distance along the line and a distance across it.
5
+ * The distance across is positive to the left, for a person who looks from the start to the end.
6
+ */
7
+ interface WallFrame {
8
+ /** The `id` of the wall. */
9
+ readonly id: string;
10
+ readonly start: Point;
11
+ readonly end: Point;
12
+ /** 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). */
13
+ readonly along: Point;
14
+ /** The unit vector to the left of `along`. */
15
+ readonly left: Point;
16
+ readonly length: number;
17
+ readonly thickness: number;
18
+ readonly height: number;
19
+ /** The distance across of the left face. It is 0 or more. */
20
+ readonly leftOffset: number;
21
+ /** The distance across of the right face. It is 0 or less. */
22
+ readonly rightOffset: number;
23
+ }
24
+ /** This function gives the frame of each wall of a room, in the sequence of the walls. */
25
+ declare function wallFrames(room: Room): readonly WallFrame[];
26
+ /**
27
+ * 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,
28
+ * 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.
29
+ */
30
+ declare function wallHasOutline(frame: WallFrame): boolean;
31
+ /** This function gives the point of the plan at a distance along a wall and a distance across it, in meters. */
32
+ declare function wallPoint(frame: WallFrame, along: number, across: number): Point;
33
+ /**
34
+ * This function gives the transform from the frame of a wall to the room.
35
+ * 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.
36
+ */
37
+ declare function wallTransform(frame: WallFrame): Transform3;
38
+ /** The outline of one wall in the plan, after its corners with the other walls. */
39
+ interface WallFootprint {
40
+ /** The `id` of the wall. */
41
+ readonly wall: string;
42
+ /** 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. */
43
+ readonly ring: Ring;
44
+ /**
45
+ * The part of the wall that has its full thickness: two distances along the wall, in meters.
46
+ * An opening must be in this part. A wall with no such part has the two distances 0.
47
+ */
48
+ readonly clear: readonly [number, number];
49
+ }
50
+ /** The options of the corners of the walls. */
51
+ interface JoinOptions {
52
+ /** 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. */
53
+ readonly tolerance?: number | undefined;
54
+ /**
55
+ * The limit of a sharp corner. The faces of two walls meet at a point. When that point is farther from the corner
56
+ * than this number of thicknesses, the two walls get square ends. The default is 4. A value that is not finite gives the default.
57
+ */
58
+ readonly miterLimit?: number | undefined;
59
+ }
60
+ /** The default distance in meters at which two ends of walls make one corner. */
61
+ declare const JOIN_TOLERANCE = 1e-6;
62
+ /** The default limit of a sharp corner, in thicknesses. */
63
+ declare const MITER_LIMIT = 4;
64
+ /**
65
+ * This function gives the outline of each wall in the plan, in the sequence of the frames.
66
+ *
67
+ * 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.
68
+ * 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.
69
+ * 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.
70
+ * A wall with no outline (`wallHasOutline`) gets an empty outline, and it makes no corner.
71
+ */
72
+ declare function wallFootprints(frames: readonly WallFrame[], options?: JoinOptions): readonly WallFootprint[];
73
+ /** These are the kinds of a solid. */
74
+ declare const SOLID_KINDS: readonly ["floor", "wall", "glass", "object"];
75
+ /** A kind of solid. */
76
+ type SolidKind = (typeof SOLID_KINDS)[number];
77
+ /** A prism: an outline in the plan, from the height `z` up by `d`. The unit is the meter. */
78
+ interface Prism {
79
+ readonly kind: "prism";
80
+ readonly ring: Ring;
81
+ readonly z: number;
82
+ readonly d: number;
83
+ }
84
+ /** A placed box: a box in its own frame, and the transform from that frame to the room. The unit is the meter. */
85
+ interface PlacedBox {
86
+ readonly kind: "box";
87
+ readonly box: Box3;
88
+ readonly transform: Transform3;
89
+ }
90
+ /** The shape of a solid. */
91
+ type SolidShape = Prism | PlacedBox;
92
+ /**
93
+ * 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.
94
+ * 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.
95
+ */
96
+ interface Solid {
97
+ /** The name of the solid. Each solid of a model has a different name. */
98
+ readonly id: string;
99
+ readonly kind: SolidKind;
100
+ /** The `id` of the record that the solid comes from: a wall, a floor, an opening or a placed object. */
101
+ readonly source: string;
102
+ readonly shape: SolidShape;
103
+ }
104
+ /** The options of the model of a room. */
105
+ interface SolidOptions {
106
+ /** 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. */
107
+ readonly floorDepth?: number | undefined;
108
+ /** The options of the corners of the walls. */
109
+ readonly joins?: JoinOptions | undefined;
110
+ }
111
+ /** The default depth of the floor, in meters. */
112
+ declare const FLOOR_DEPTH = .1;
113
+ /** The thickness of the glass of a window, in meters. */
114
+ declare const GLASS_THICKNESS = .02;
115
+ /**
116
+ * The transform from the room, where the z axis points up, to a space where the y axis points up.
117
+ * 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.
118
+ */
119
+ declare const TO_Y_UP: Transform3;
120
+ /**
121
+ * This function gives the 3D model of a room as a list of solids.
122
+ * 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.
123
+ *
124
+ * The function does not stop for a record with a fault. It skips each part that it cannot make.
125
+ * One example is a wall with no length. A second example is an opening on a wall that the room does not have.
126
+ * 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.
127
+ */
128
+ declare function roomSolids(room: Room, options?: SolidOptions): readonly Solid[];
129
+ /**
130
+ * This function gives the transform of each placed object of a scene, from the frame of the object to the room, in meters.
131
+ * 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.
132
+ * An object has no transform when a parent is not in the scene, or when its parents make a loop.
133
+ * An object also has no transform when one value of its place is not finite or not in the range of the model.
134
+ */
135
+ declare function objectTransforms(scene: Scene): ReadonlyMap<string, Transform3>;
136
+ /**
137
+ * This function gives the 3D model of a scene: the solids of its room, then one box for each placed object.
138
+ * 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.
139
+ */
140
+ declare function sceneSolids(scene: Scene, options?: SolidOptions): readonly Solid[];
141
+ /** 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. */
142
+ declare function solidCorners(solid: Solid): readonly Point3[];
143
+ /** This function gives the smallest box along the axes that holds each solid, or `undefined` for no solids. */
144
+ declare function boundsOfSolids(solids: readonly Solid[]): Box3 | undefined;
145
+ /** This function gives the volume of a solid in cubic meters. */
146
+ declare function solidVolume(solid: Solid): number;
147
+ export { wallFrames as C, wallTransform as E, WallFrame as S, wallPoint as T, JOIN_TOLERANCE as _, SOLID_KINDS as a, WallFootprint as b, SolidOptions as c, boundsOfSolids as d, objectTransforms as f, solidVolume as g, solidCorners as h, Prism as i, SolidShape as l, sceneSolids as m, GLASS_THICKNESS as n, Solid as o, roomSolids as p, PlacedBox as r, SolidKind as s, FLOOR_DEPTH as t, TO_Y_UP as u, JoinOptions as v, wallHasOutline as w, wallFootprints as x, MITER_LIMIT as y };
148
+ //# sourceMappingURL=solids-CdJf0U39.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solids-CdJf0U39.d.ts","names":[],"sources":["../src/frames.ts","../src/joins.ts","../src/solids.ts"],"mappings":";;;;;;UAQiB;;WAEN;WACA,OAAO;WACP,KAAK;;WAEL,OAAO;;WAEP,MAAM;WACN;WACA;WACA;;WAEA;;WAEA;;;iBA2BK,WAAW,MAAM,gBAAgB;;;;;iBASjC,eAAe,OAAO;;iBAKtB,UAAU,OAAO,WAAW,eAAe,iBAAiB;;;;;iBAW5D,cAAc,OAAO,YAAY;;UCvEhC;;WAEN;;WAEA,MAAM;;;;;WAKN;;;UAIM;;WAEN;;;;;WAKA;;;cAIE;;cAGA;;;;;;;;;iBA8IG,eAAe,iBAAiB,aAAa,UAAS,uBAA4B;;cCzJrF;;KAGD,oBAAoB;;UAGf;WACN;WACA,MAAM;WACN;WACA;;;UAIM;WACN;WACA,KAAK;WACL,WAAW;;;KAIV,aAAa,QAAQ;;;;;UAMhB;;WAEN;WACA,MAAM;;WAEN;WACA,OAAO;;;UAID;;WAEN;;WAEA,QAAQ;;;cAIN;;cAGA;;;;;cAMA,SAAS;;;;;;;;;iBA4HN,WAAW,MAAM,MAAM,UAAS,wBAA6B;;;;;;;iBAwB7D,iBAAiB,OAAO,QAAQ,oBAAoB;;;;;iBAiCpD,YAAY,OAAO,OAAO,UAAS,wBAA6B;;iBAqBhE,aAAa,OAAO,iBAAiB;;iBAUrC,eAAe,iBAAiB,UAAU;;iBAK1C,YAAY,OAAO"}
package/build/three.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { B as Scene, c as SolidKind, l as SolidOptions, s as Solid } from "./solids-S_j17vFJ.js";
2
- import { a as LoadLevel, o as LoadOptions } from "./loads-Diy6-Ekz.js";
1
+ import { c as SolidOptions, o as Solid, s as SolidKind } from "./solids-CdJf0U39.js";
2
+ import { u as Scene } from "./room-BQua5eSs.js";
3
3
  import { Point3, Rotation3 } from "@mark1russell7/layout-contract";
4
4
  import { BufferGeometry } from "three";
5
5
  import { MarkersOptions } from "@mark1russell7/visuals/markers";
6
- import { Mark } from "@mark1russell7/visuals/marks";
6
+ import { Level, Mark } from "@mark1russell7/visuals/marks";
7
7
  import "@mark1russell7/visuals/three";
8
8
  /**
9
9
  * The three.js geometry of a solid, and its place in the room.
@@ -38,10 +38,8 @@ interface ViewerTheme {
38
38
  readonly glass: string;
39
39
  /** The part of the glass that is not clear, from 0 to 1. */
40
40
  readonly glassOpacity: number;
41
- /** The color of an outlet with no circuit. */
42
- readonly outlet: string;
43
- /** The color of the marks of each level, and of the plates of the outlets of a circuit at each level of its load. */
44
- readonly levels: Readonly<Record<LoadLevel, string>>;
41
+ /** The color of the marks of each level. */
42
+ readonly levels: Readonly<Record<Level, string>>;
45
43
  /** The color of the line around the sign of a mark. It is the color of the page, so a sign is clear on each solid. */
46
44
  readonly halo: string;
47
45
  /**
@@ -64,7 +62,7 @@ interface ViewerTheme {
64
62
  export declare const LIGHT_THEME: ViewerTheme;
65
63
  /** The colors of a blueprint, for a dark page. */
66
64
  export declare const DARK_THEME: ViewerTheme;
67
- /** A record of a scene that the viewer shows: a floor, a wall, a window, an outlet or a placed object. */
65
+ /** A record of a scene that the viewer shows: a floor, a wall, a window or a placed object. */
68
66
  interface ViewerRecord {
69
67
  /** The kind of the solids of the record. A window has the kind `glass`. */
70
68
  readonly kind: SolidKind;
@@ -85,13 +83,11 @@ interface RoomViewerOptions {
85
83
  readonly theme?: ViewerTheme | undefined;
86
84
  /** The options of the model. */
87
85
  readonly solids?: SolidOptions | undefined;
88
- /** The options of the levels of the circuits. */
89
- readonly loads?: LoadOptions | undefined;
90
86
  /** The options of the picture of the marks, for example the radius of a sign. */
91
87
  readonly markers?: MarkersOptions | undefined;
92
88
  /**
93
89
  * The marks of the scene, in the space of the scene: meters, with the z axis up. `layerMarks` of the entry `/marks` gives them.
94
- * With no list, the viewer makes the marks of the outlets of the scene. An empty list gives a picture with no mark.
90
+ * With no list, the picture has no mark.
95
91
  * The viewer draws no mark with a fault. `checkMarks` of `@mark1russell7/visuals/marks` tells each fault.
96
92
  */
97
93
  readonly marks?: readonly Mark[] | undefined;
@@ -109,10 +105,7 @@ interface RoomViewerOptions {
109
105
  interface RoomViewer {
110
106
  /** The canvas of the viewer. It is in the container. */
111
107
  readonly canvas: HTMLCanvasElement;
112
- /**
113
- * This function shows a different scene, with its marks. The view stays if a person moved it.
114
- * With no list of marks, the viewer makes the marks of the outlets of the scene.
115
- */
108
+ /** This function shows a different scene, with its marks. The view stays if a person moved it. With no list, the picture has no mark. */
116
109
  setScene(scene: Scene, marks?: readonly Mark[]): void;
117
110
  /** This function changes the colors. */
118
111
  setTheme(theme: ViewerTheme): void;
@@ -141,7 +134,7 @@ interface RoomViewer {
141
134
  * With the keyboard, the arrow keys turn the model, `+` and `-` change the distance, `Home` shows the first view and `T` shows the plan.
142
135
  *
143
136
  * The viewer draws the marks of the scene with `@mark1russell7/visuals/markers`. A point is a sign with the color and the shape of its level.
144
- * With no list of marks, each outlet has a sign. An outlet or an object with a highlight then shows a line from the outlet to each object on it.
137
+ * A link shows while its record, or the record of one of its ends, has a highlight. A sign that a solid hides is less clear.
145
138
  *
146
139
  * The function gives `undefined` when the browser has no WebGL 2. It does not throw, and it writes no error to the console.
147
140
  */
@@ -1 +1 @@
1
- {"version":3,"file":"three.d.ts","names":[],"sources":["../src/viewer/geometry.ts","../src/viewer/theme.ts","../src/viewer/content.ts","../src/viewer/viewer.ts"],"mappings":";;;;;;;;;;;UAQiB;;WAEN,UAAU;;WAEV,UAAU;;WAEV,UAAU;;;;;;;;wBAYL,cAAc,OAAO,QAAQ;;;;;UCpB5B;;WAEN;;WAEA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA,QAAQ,SAAS,OAAO;;WAExB;;;;;WAKA;;WAEA;;WAEA;;WAEA,SAAS,SAAS;;WAElB;;WAEA;;;qBAIE,aAAa;;qBAiBb,YAAY;;UC7CR;;WAEN,MAAM;;WAEN;;;UAIM,mBAAmB;;WAEzB;;;KCNC;;UAGK;WACN,OAAO;;WAEP,QAAQ;;WAER,SAAS;;WAET,QAAQ;;WAER,UAAU;;;;;;WAMV,iBAAiB;;WAEjB;;;;;WAKA,YAAY,MAAM,wBAAwB,OAAO;;WAEjD,aAAa,MAAM,wBAAwB,OAAO;;;UAI5C;;WAEN,QAAQ;;;;;EAKjB,SAAS,OAAO,OAAO,iBAAiB;;EAExC,SAAS,OAAO;;EAEhB,QAAQ,MAAM;;;;;EAKd,UAAU,mBAAmB;;EAE7B,OAAO,QAAQ;;;;;EAKf,UAAU,OAAO,MAAM;;EAEvB;;;;;;;;;;;;;;wBAkGc,iBAAiB,WAAW,aAAa,SAAS,oBAAoB"}
1
+ {"version":3,"file":"three.d.ts","names":[],"sources":["../src/viewer/geometry.ts","../src/viewer/theme.ts","../src/viewer/content.ts","../src/viewer/viewer.ts"],"mappings":";;;;;;;;;;;UAQiB;;WAEN,UAAU;;WAEV,UAAU;;WAEV,UAAU;;;;;;;;wBAYL,cAAc,OAAO,QAAQ;;;;;UCpB5B;;WAEN;;WAEA;WACA;WACA;WACA;;WAEA;;WAEA,QAAQ,SAAS,OAAO;;WAExB;;;;;WAKA;;WAEA;;WAEA;;WAEA,SAAS,SAAS;;WAElB;;WAEA;;;qBAIE,aAAa;;qBAgBb,YAAY;;UC3CR;;WAEN,MAAM;;WAEN;;;UAIM,mBAAmB;;WAEzB;;;KCPC;;UAGK;WACN,OAAO;;WAEP,QAAQ;;WAER,SAAS;;WAET,UAAU;;;;;;WAMV,iBAAiB;;WAEjB;;;;;WAKA,YAAY,MAAM,wBAAwB,OAAO;;WAEjD,aAAa,MAAM,wBAAwB,OAAO;;;UAI5C;;WAEN,QAAQ;;EAEjB,SAAS,OAAO,OAAO,iBAAiB;;EAExC,SAAS,OAAO;;EAEhB,QAAQ,MAAM;;;;;EAKd,UAAU,mBAAmB;;EAE7B,OAAO,QAAQ;;;;;EAKf,UAAU,OAAO,MAAM;;EAEvB;;;;;;;;;;;;;;wBAkGc,iBAAiB,WAAW,aAAa,SAAS,oBAAoB"}
package/build/three.js CHANGED
@@ -1,6 +1,6 @@
1
- import { A as wallPoint, C as solidCorners, F as metersPer, O as wallFrames, S as sceneSolids, f as recordName, g as OUTLET_PLATE, k as wallHasOutline, p as solidRecord, r as sceneSpace, v as TO_Y_UP, y as boundsOfSolids } from "./anchors-Ba3OUmhF.js";
2
- import { s as outletLevels } from "./loads-CtHa4EHo.js";
3
- import { addPoints3, pointInRing, scalePoint3, transformPoint3 } from "@mark1russell7/layout-contract";
1
+ import { E as wallPoint, T as wallHasOutline, h as boundsOfSolids, m as TO_Y_UP, u as solidRecord, v as sceneSolids, w as wallFrames, y as solidCorners } from "./check-lFfxIUS3.js";
2
+ import { i as metersPer } from "./units-BZmvVyu4.js";
3
+ import { pointInRing, transformPoint3 } from "@mark1russell7/layout-contract";
4
4
  import { BoxGeometry, Color, EdgesGeometry, ExtrudeGeometry, Group, Mesh, MeshLambertMaterial, Shape, Vector2 } from "three";
5
5
  import { fitView } from "@mark1russell7/visuals";
6
6
  import { createMarkers } from "@mark1russell7/visuals/markers";
@@ -77,7 +77,6 @@ const LIGHT_THEME = {
77
77
  wall: "#fcfcfb",
78
78
  glass: "#8fc4e8",
79
79
  glassOpacity: .35,
80
- outlet: "#55677a",
81
80
  levels: {
82
81
  unknown: "#55677a",
83
82
  ok: "#1f5fa8",
@@ -104,7 +103,6 @@ const DARK_THEME = {
104
103
  wall: "#1f4a73",
105
104
  glass: "#9fd0ff",
106
105
  glassOpacity: .25,
107
- outlet: "#a9bfd4",
108
106
  levels: {
109
107
  unknown: "#a9bfd4",
110
108
  ok: "#6fb3f2",
@@ -231,7 +229,6 @@ const EDGE_WIDTH = {
231
229
  floor: 1.25,
232
230
  wall: 1.25,
233
231
  glass: 1,
234
- outlet: 1,
235
232
  object: 1.25
236
233
  };
237
234
  /** The part of a clear box of objects that is not clear. */
@@ -262,11 +259,9 @@ function holders(scene) {
262
259
  * This function makes the three.js objects of a scene: one mesh with its edges for each solid.
263
260
  * The parts have no colors until `paintPart` gives them. The caller disposes the model with `disposeModel`.
264
261
  */
265
- function buildModel(scene, options = {}, loads = {}) {
262
+ function buildModel(scene, options = {}) {
266
263
  const solids = sceneSolids(scene, options);
267
- const levels = outletLevels(scene, loads);
268
264
  const wallOfOpening = new Map((scene.room.openings ?? []).map((opening) => [opening.id, opening.wall]));
269
- const wallOfOutlet = new Map((scene.room.outlets ?? []).map((outlet) => [outlet.id, outlet.wall]));
270
265
  const parentOf = new Map((scene.objects ?? []).map((object) => [object.id, object.parent]));
271
266
  const holding = holders(scene);
272
267
  const group = new Group();
@@ -289,10 +284,9 @@ function buildModel(scene, options = {}, loads = {}) {
289
284
  return {
290
285
  solid,
291
286
  record: solidRecord(solid.kind, solid.source),
292
- wall: solid.kind === "wall" ? solid.source : solid.kind === "glass" ? wallOfOpening.get(solid.source) : solid.kind === "outlet" ? wallOfOutlet.get(solid.source) : void 0,
287
+ wall: solid.kind === "wall" ? solid.source : solid.kind === "glass" ? wallOfOpening.get(solid.source) : void 0,
293
288
  holder: parent === void 0 ? void 0 : solidRecord("object", parent),
294
289
  holds: solid.kind === "object" && holding.has(solid.source),
295
- level: solid.kind === "outlet" ? levels.get(solid.source) : void 0,
296
290
  mesh,
297
291
  lines,
298
292
  fade: 0
@@ -330,7 +324,6 @@ function setOpacity(material, opacity) {
330
324
  /** This function gives the color of a part in a theme, before a mark. */
331
325
  function baseColor(part, scene, theme) {
332
326
  const kind = part.solid.kind;
333
- if (kind === "outlet") return part.level === void 0 ? theme.outlet : theme.levels[part.level];
334
327
  if (kind !== "object") return theme[kind];
335
328
  const object = (scene.objects ?? []).find((candidate) => candidate.id === part.solid.source);
336
329
  return (object === void 0 ? void 0 : theme.objects[object.kind]) ?? theme.object;
@@ -338,7 +331,6 @@ function baseColor(part, scene, theme) {
338
331
  /**
339
332
  * This function gives a part its colors: the colors of the theme, the fade of the part and its highlight.
340
333
  * A part with a highlight has some of the color `accent` of the theme, and a selected part has wide edges.
341
- * An outlet has the color of the level of its circuit.
342
334
  */
343
335
  function paintPart(part, scene, theme, mark) {
344
336
  const kind = part.solid.kind;
@@ -355,7 +347,7 @@ function paintPart(part, scene, theme, mark) {
355
347
  if (kind === "wall") {
356
348
  opacity *= .08 + .92 * still;
357
349
  edge = .3 + .7 * still;
358
- } else if (kind === "glass" || kind === "outlet") {
350
+ } else if (kind === "glass") {
359
351
  opacity *= .35 + .65 * still;
360
352
  edge = .35 + .65 * still;
361
353
  }
@@ -377,14 +369,14 @@ function disposeModel(model) {
377
369
  const FADE_TIME = .11;
378
370
  /**
379
371
  * This function makes the content of a stage that shows the solids of a scene.
380
- * The solids are the floors, the walls, the windows, the plates of the outlets and the placed objects.
372
+ * The solids are the floors, the walls, the windows and the placed objects.
381
373
  *
382
374
  * The walls between the camera and the room become almost clear, and the pointer goes through them.
383
375
  * An object in a clear box of objects gets the pick before the box. Each pick has its distance, so a mark in front of a solid gets the pick.
384
376
  * The space of the content has the y axis up: the z axis of the scene becomes the y axis.
385
377
  */
386
- function createRoomContent(scene, solids = {}, loads = {}) {
387
- const model = buildModel(scene, solids, loads);
378
+ function createRoomContent(scene, solids = {}) {
379
+ const model = buildModel(scene, solids);
388
380
  const first = /* @__PURE__ */ new Map();
389
381
  for (const part of model.parts) if (!first.has(part.record)) first.set(part.record, part);
390
382
  const byMesh = new Map(model.parts.map((part) => [part.mesh, part]));
@@ -457,91 +449,6 @@ function createRoomContent(scene, solids = {}, loads = {}) {
457
449
  }
458
450
  };
459
451
  }
460
- // src/viewer/outlets.ts
461
- /** This function gives the center of a solid, in the space of the scene: the mean of its corners. */
462
- function centerOf(solid) {
463
- const corners = solidCorners(solid);
464
- const sum = corners.reduce((total, corner) => addPoints3(total, corner), {
465
- x: 0,
466
- y: 0,
467
- z: 0
468
- });
469
- return scalePoint3(sum, 1 / Math.max(corners.length, 1));
470
- }
471
- /**
472
- * This function gives the marks of the outlets of a scene, in the space of the scene: meters, with the z axis up.
473
- *
474
- * - An outlet gives a point on the front of its plate. Its level is the level of its circuit, and `unknown` for no circuit of the room.
475
- * - A placed object with an outlet gives a link from that outlet to the center of the object.
476
- *
477
- * The record name of a point is the name of the record of its outlet, so the sign and the plate are one record.
478
- * The record name of a link is the name of the record of its object: that record has the outlet.
479
- * `solids` are the solids of the scene. An outlet or an object with no solid gives no mark. The first record of an `id` gives the mark.
480
- */
481
- function outletMarks(scene, solids, loads = {}) {
482
- const space = sceneSpace(scene);
483
- const levels = outletLevels(scene, loads);
484
- /** The first solid of each outlet and of each placed object, by the name of its record. */
485
- const made = /* @__PURE__ */ new Map();
486
- for (const solid of solids) {
487
- const name = recordName(solid.kind, solid.source);
488
- if ((solid.kind === "outlet" || solid.kind === "object") && !made.has(name)) made.set(name, solid);
489
- }
490
- const circuits = new Map((scene.room.circuits ?? []).map((circuit) => [circuit.id, circuit.name ?? circuit.id]));
491
- const marks = [];
492
- const fronts = /* @__PURE__ */ new Map();
493
- for (const outlet of scene.room.outlets ?? []) {
494
- if (fronts.has(outlet.id) || !made.has(recordName("outlet", outlet.id))) continue;
495
- const frame = space.frame({
496
- on: "wall",
497
- wall: outlet.wall,
498
- face: outlet.face,
499
- offset: outlet.offset,
500
- height: outlet.height
501
- });
502
- if (frame === void 0) continue;
503
- const front = addPoints3(frame.at, scalePoint3(frame.out, OUTLET_PLATE.depth));
504
- fronts.set(outlet.id, front);
505
- const level = levels.get(outlet.id);
506
- const circuit = level === void 0 || outlet.circuit === void 0 ? "" : `, circuit ${circuits.get(outlet.circuit) ?? outlet.circuit}`;
507
- const point = {
508
- type: "point",
509
- record: recordName("outlet", outlet.id),
510
- kind: "outlet",
511
- level: level ?? "unknown",
512
- label: `Outlet ${outlet.id}${circuit}`.replace(/\s+/g, " ").trim(),
513
- frame: {
514
- at: front,
515
- out: frame.out
516
- }
517
- };
518
- marks.push(point);
519
- }
520
- const linked = /* @__PURE__ */ new Set();
521
- for (const object of scene.objects ?? []) {
522
- const from = object.outlet === void 0 ? void 0 : fronts.get(object.outlet);
523
- const solid = made.get(recordName("object", object.id));
524
- if (object.outlet === void 0 || from === void 0 || solid === void 0 || linked.has(object.id)) continue;
525
- linked.add(object.id);
526
- const link = {
527
- type: "link",
528
- record: recordName("object", object.id),
529
- kind: "feed",
530
- level: levels.get(object.outlet) ?? "unknown",
531
- label: `Outlet ${object.outlet} to ${object.name ?? object.id}`.replace(/\s+/g, " ").trim(),
532
- from: {
533
- record: recordName("outlet", object.outlet),
534
- at: from
535
- },
536
- to: {
537
- record: recordName("object", object.id),
538
- at: centerOf(solid)
539
- }
540
- };
541
- marks.push(link);
542
- }
543
- return marks;
544
- }
545
452
  // src/viewer/viewer.ts
546
453
  /** This function gives the name of a record for the stage. */
547
454
  function nameOf(record) {
@@ -572,12 +479,12 @@ function marksThemes() {
572
479
  /**
573
480
  * This function makes the content of a viewer for a scene: the solids, and the marks above them.
574
481
  *
575
- * `marks` are in the space of the scene: meters, with the z axis up. With no list, the function makes the marks of the outlets of the scene.
482
+ * `marks` are in the space of the scene: meters, with the z axis up. With no list, the content has no mark.
576
483
  * A mark with a fault is not in the content. The space of the content has the y axis up.
577
484
  */
578
485
  function createViewerContent(scene, marks, options = {}) {
579
- const room = createRoomContent(scene, options.solids, options.loads);
580
- const given = marks ?? outletMarks(scene, room.solids, options.loads);
486
+ const room = createRoomContent(scene, options.solids);
487
+ const given = marks ?? [];
581
488
  const faulty = new Set(checkMarks(given).map((fault) => fault.index));
582
489
  const good = given.filter((_, index) => !faulty.has(index));
583
490
  const onStage = transformMarks(good, TO_Y_UP);
@@ -618,7 +525,7 @@ function createViewerContent(scene, marks, options = {}) {
618
525
  * With the keyboard, the arrow keys turn the model, `+` and `-` change the distance, `Home` shows the first view and `T` shows the plan.
619
526
  *
620
527
  * The viewer draws the marks of the scene with `@mark1russell7/visuals/markers`. A point is a sign with the color and the shape of its level.
621
- * With no list of marks, each outlet has a sign. An outlet or an object with a highlight then shows a line from the outlet to each object on it.
528
+ * A link shows while its record, or the record of one of its ends, has a highlight. A sign that a solid hides is less clear.
622
529
  *
623
530
  * The function gives `undefined` when the browser has no WebGL 2. It does not throw, and it writes no error to the console.
624
531
  */