@mark1russell7/room-view 0.2.0 → 0.2.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 +52 -5
- package/build/{layers-bgJ3OTId.js → anchors-J6mcUeJn.js} +572 -90
- package/build/anchors-J6mcUeJn.js.map +1 -0
- package/build/index.d.ts +189 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +340 -3
- package/build/index.js.map +1 -1
- package/build/layers-CtgTEnmt.js +90 -0
- package/build/layers-CtgTEnmt.js.map +1 -0
- package/build/{layers-CKx0dcM0.d.ts → layers-D_HqUjYu.d.ts} +8 -3
- package/build/layers-D_HqUjYu.d.ts.map +1 -0
- package/build/loads-Bp8aH2HJ.d.ts +73 -0
- package/build/loads-Bp8aH2HJ.d.ts.map +1 -0
- package/build/marks.d.ts +1 -1
- package/build/marks.js +2 -1
- package/build/marks.js.map +1 -1
- package/build/{loads-CriZuwcu.d.ts → solids-BHLnvDVu.d.ts} +38 -72
- package/build/solids-BHLnvDVu.d.ts.map +1 -0
- package/build/three.d.ts +51 -17
- package/build/three.d.ts.map +1 -1
- package/build/three.js +288 -674
- package/build/three.js.map +1 -1
- package/package.json +2 -2
- package/build/joins-2p01wnr_.d.ts +0 -39
- package/build/joins-2p01wnr_.d.ts.map +0 -1
- package/build/layers-CKx0dcM0.d.ts.map +0 -1
- package/build/layers-bgJ3OTId.js.map +0 -1
- package/build/loads-CriZuwcu.d.ts.map +0 -1
- package/build/solids-BKb-izIP.js +0 -567
- package/build/solids-BKb-izIP.js.map +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { p as Scene } from "./room-NREa6vXr.js";
|
|
2
|
+
import { Ring } from "@mark1russell7/layout-contract";
|
|
3
|
+
/** These are the levels of the load of a circuit. */
|
|
4
|
+
declare const LOAD_LEVELS: readonly ["unknown", "ok", "near", "over"];
|
|
5
|
+
/** A level of the load of a circuit. A viewer gives each level a color. */
|
|
6
|
+
type LoadLevel = (typeof LOAD_LEVELS)[number];
|
|
7
|
+
/** The state of one circuit of a scene. */
|
|
8
|
+
interface CircuitState {
|
|
9
|
+
/** The `id` of the circuit. */
|
|
10
|
+
readonly circuit: string;
|
|
11
|
+
/** The sum of the loads of the circuit, in watts. */
|
|
12
|
+
readonly watts: number;
|
|
13
|
+
/** The limit of the circuit, in watts. */
|
|
14
|
+
readonly limit: number;
|
|
15
|
+
/** The load as a part of the limit. It is 0 for a limit that is not above 0. */
|
|
16
|
+
readonly ratio: number;
|
|
17
|
+
readonly level: LoadLevel;
|
|
18
|
+
/** The `id` of each outlet of the circuit. */
|
|
19
|
+
readonly outlets: readonly string[];
|
|
20
|
+
/** The `id` of each placed object with an outlet of the circuit. */
|
|
21
|
+
readonly objects: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
/** The options of the levels. */
|
|
24
|
+
interface LoadOptions {
|
|
25
|
+
/** A circuit with this part of its limit, or more, has the level `near`. The default is 0.8. */
|
|
26
|
+
readonly near?: number | undefined;
|
|
27
|
+
}
|
|
28
|
+
/** The default part of the limit at which a circuit has the level `near`. */
|
|
29
|
+
declare const NEAR_LIMIT = .8;
|
|
30
|
+
/**
|
|
31
|
+
* This function gives the state of each circuit of a scene, in the sequence of the circuits.
|
|
32
|
+
*
|
|
33
|
+
* The loads are input data: a calculation or a meter gives them. A circuit that no load record names has the level `unknown`,
|
|
34
|
+
* and so has a circuit with a limit that is not above 0. A load above the limit has the level `over`.
|
|
35
|
+
*/
|
|
36
|
+
declare function circuitStates(scene: Scene, options?: LoadOptions): readonly CircuitState[];
|
|
37
|
+
/**
|
|
38
|
+
* This function gives the level of each outlet of a scene: the level of its circuit. The key is the `id` of the outlet.
|
|
39
|
+
* An outlet with no circuit of the room has no level, and the map does not have it.
|
|
40
|
+
*/
|
|
41
|
+
declare function outletLevels(scene: Scene, options?: LoadOptions): ReadonlyMap<string, LoadLevel>;
|
|
42
|
+
/** These are the shapes of the sign of a level. */
|
|
43
|
+
declare const LEVEL_SHAPES: readonly ["ring", "disc", "triangle", "square"];
|
|
44
|
+
/** A shape of the sign of a level. A person who does not see a color reads the level from the shape. */
|
|
45
|
+
type LevelShape = (typeof LEVEL_SHAPES)[number];
|
|
46
|
+
/**
|
|
47
|
+
* This function gives the shape of the sign of a level: a disc for `ok`, a triangle for `near` and a square for `over`.
|
|
48
|
+
* The level `unknown` has a ring, and so has an outlet with no level.
|
|
49
|
+
*/
|
|
50
|
+
declare function levelShape(level: LoadLevel | undefined): LevelShape;
|
|
51
|
+
/** The outline of the sign of a shape, as a regular polygon. A circle is a polygon with 40 sides. */
|
|
52
|
+
interface ShapeOutline {
|
|
53
|
+
/** The radius of the circle through the corners, for a disc with the radius 1. */
|
|
54
|
+
readonly radius: number;
|
|
55
|
+
/** The number of the sides. */
|
|
56
|
+
readonly sides: number;
|
|
57
|
+
/** The angle of the first corner, in radians, counter-clockwise from the x axis. */
|
|
58
|
+
readonly start: number;
|
|
59
|
+
/** The radius of the hole of the sign, for a disc with the radius 1. A sign with no hole has 0. */
|
|
60
|
+
readonly hole: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The outline of the sign of each shape. Each viewer draws the signs from these values, so each viewer shows the same signs.
|
|
64
|
+
* A triangle and a square with the radius of the disc look small, so they are larger.
|
|
65
|
+
*/
|
|
66
|
+
declare const SHAPE_OUTLINES: Readonly<Record<LevelShape, ShapeOutline>>;
|
|
67
|
+
/**
|
|
68
|
+
* This function gives the corners of the outline of a sign, counter-clockwise, with the y axis up.
|
|
69
|
+
* The center of the sign is the origin, and `radius` is the radius of a disc.
|
|
70
|
+
*/
|
|
71
|
+
declare function shapeRing(shape: LevelShape, radius?: number): Ring;
|
|
72
|
+
export { LoadLevel as a, SHAPE_OUTLINES as c, levelShape as d, outletLevels as f, LevelShape as i, ShapeOutline as l, LEVEL_SHAPES as n, LoadOptions as o, shapeRing as p, LOAD_LEVELS as r, NEAR_LIMIT as s, CircuitState as t, circuitStates as u };
|
|
73
|
+
//# sourceMappingURL=loads-Bp8aH2HJ.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loads-Bp8aH2HJ.d.ts","names":[],"sources":["../src/loads.ts"],"mappings":";;;cAIa;;KAGD,oBAAoB;;UAGf;;WAEN;;WAEA;;WAEA;;WAEA;WACA,OAAO;;WAEP;;WAEA;;;UAIM;;WAEN;;;cAIE;;;;;;;iBAQG,cAAc,OAAO,OAAO,UAAS,uBAA4B;;;;;iBAyBjE,aAAa,OAAO,OAAO,UAAS,cAAmB,oBAAoB;;cAS9E;;KAGD,qBAAqB;;;;;iBAMjB,WAAW,OAAO,wBAAwB;;UAKzC;;WAEN;;WAEA;;WAEA;;WAEA;;;;;;cAOE,gBAAgB,SAAS,OAAO,YAAY;;;;;iBAWzC,UAAU,OAAO,YAAY,kBAAqB"}
|
package/build/marks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as SceneSpace } from "./anchors-BEnxNnSV.js";
|
|
2
|
-
import { t as AddOn } from "./layers-
|
|
2
|
+
import { t as AddOn } from "./layers-D_HqUjYu.js";
|
|
3
3
|
import { p as Scene } from "./room-NREa6vXr.js";
|
|
4
4
|
import { Mark } from "@mark1russell7/visuals/marks";
|
|
5
5
|
/**
|
package/build/marks.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as sceneSpace } from "./anchors-J6mcUeJn.js";
|
|
2
|
+
import { i as compareText, r as readLayer } from "./layers-CtgTEnmt.js";
|
|
2
3
|
// src/marks.ts
|
|
3
4
|
/**
|
|
4
5
|
* This function gives the marks of the layers of a scene. Each value of `marks` gives the marks of the layer of its name.
|
package/build/marks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marks.js","names":[],"sources":["../src/marks.ts"],"sourcesContent":["import type { Mark } from \"@mark1russell7/visuals/marks\";\nimport { sceneSpace, type SceneSpace } from \"./anchors.ts\";\nimport { readLayer, type AddOn } from \"./layers.ts\";\nimport { compareText } from \"./order.ts\";\nimport type { Scene } from \"./room.ts\";\n\n// The marks of the layers of a scene. A mark is a record that a viewer draws: plain data of `@mark1russell7/visuals/marks`.\n// This module is the entry `/marks` of the package. The root entry has no mark, so a host with no viewer does not get this module.\n\n/**\n * The marks of one add-on. This value is in the entry `/marks` of the add-on, so the root entry of the add-on has no visual part.\n * A host gives a list of these values to `layerMarks`, with the add-ons that read the layers.\n */\nexport interface AddOnMarks<Layer> {\n /** The name of the format of the layer, for example `electrical/1`. It is the `schema` of the add-on that reads the layer. */\n readonly schema: string;\n /**\n * This function gives the marks of a layer. Each point is in the space of the frames: meters, with the z axis up.\n * The record name of a mark is `recordName(schema, id)`, so a finding of the layer selects its mark.\n */\n marks(layer: Layer, space: SceneSpace): readonly Mark[];\n}\n\n/**\n * This function gives the marks of the layers of a scene. Each value of `marks` gives the marks of the layer of its name.\n * The add-on of the same name reads the layer.\n *\n * A layer that the scene does not have gives no marks. A layer with a fault of its form gives no marks, and `checkLayers` tells the fault.\n * The marks are in the order of the layer names, then of the record names. Thus equal inputs give equal marks.\n * The first value of a name is used, for `addOns` and for `marks`.\n *\n * @throws RangeError when a value of `marks` names a layer that no add-on of the list reads\n */\nexport function layerMarks(scene: Scene, addOns: readonly AddOn<unknown>[], marks: readonly AddOnMarks<unknown>[]): readonly Mark[] {\n const makers = new Map<string, AddOnMarks<unknown>>();\n for (const maker of marks) if (!makers.has(maker.schema)) makers.set(maker.schema, maker);\n const readers = new Map<string, AddOn<unknown>>();\n for (const addOn of addOns) if (!readers.has(addOn.schema)) readers.set(addOn.schema, addOn);\n for (const name of makers.keys()) {\n if (!readers.has(name)) throw new RangeError(`The marks of the layer \"${name}\" have no add-on in the list. Give the add-on that reads the layer.`);\n }\n\n const found: Mark[] = [];\n let space: SceneSpace | undefined;\n for (const name of [...makers.keys()].sort(compareText)) {\n const maker = makers.get(name);\n const addOn = readers.get(name);\n if (maker === undefined || addOn === undefined) continue;\n const read = readLayer(scene, addOn);\n if (read === undefined || !read.ok) continue;\n space ??= sceneSpace(scene);\n // The sort is stable, so the marks of one record keep their order.\n found.push(...[...maker.marks(read.layer, space)].sort((a, b) => compareText(a.record, b.record)));\n }\n return found;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"marks.js","names":[],"sources":["../src/marks.ts"],"sourcesContent":["import type { Mark } from \"@mark1russell7/visuals/marks\";\nimport { sceneSpace, type SceneSpace } from \"./anchors.ts\";\nimport { readLayer, type AddOn } from \"./layers.ts\";\nimport { compareText } from \"./order.ts\";\nimport type { Scene } from \"./room.ts\";\n\n// The marks of the layers of a scene. A mark is a record that a viewer draws: plain data of `@mark1russell7/visuals/marks`.\n// This module is the entry `/marks` of the package. The root entry has no mark, so a host with no viewer does not get this module.\n\n/**\n * The marks of one add-on. This value is in the entry `/marks` of the add-on, so the root entry of the add-on has no visual part.\n * A host gives a list of these values to `layerMarks`, with the add-ons that read the layers.\n */\nexport interface AddOnMarks<Layer> {\n /** The name of the format of the layer, for example `electrical/1`. It is the `schema` of the add-on that reads the layer. */\n readonly schema: string;\n /**\n * This function gives the marks of a layer. Each point is in the space of the frames: meters, with the z axis up.\n * The record name of a mark is `recordName(schema, id)`, so a finding of the layer selects its mark.\n */\n marks(layer: Layer, space: SceneSpace): readonly Mark[];\n}\n\n/**\n * This function gives the marks of the layers of a scene. Each value of `marks` gives the marks of the layer of its name.\n * The add-on of the same name reads the layer.\n *\n * A layer that the scene does not have gives no marks. A layer with a fault of its form gives no marks, and `checkLayers` tells the fault.\n * The marks are in the order of the layer names, then of the record names. Thus equal inputs give equal marks.\n * The first value of a name is used, for `addOns` and for `marks`.\n *\n * @throws RangeError when a value of `marks` names a layer that no add-on of the list reads\n */\nexport function layerMarks(scene: Scene, addOns: readonly AddOn<unknown>[], marks: readonly AddOnMarks<unknown>[]): readonly Mark[] {\n const makers = new Map<string, AddOnMarks<unknown>>();\n for (const maker of marks) if (!makers.has(maker.schema)) makers.set(maker.schema, maker);\n const readers = new Map<string, AddOn<unknown>>();\n for (const addOn of addOns) if (!readers.has(addOn.schema)) readers.set(addOn.schema, addOn);\n for (const name of makers.keys()) {\n if (!readers.has(name)) throw new RangeError(`The marks of the layer \"${name}\" have no add-on in the list. Give the add-on that reads the layer.`);\n }\n\n const found: Mark[] = [];\n let space: SceneSpace | undefined;\n for (const name of [...makers.keys()].sort(compareText)) {\n const maker = makers.get(name);\n const addOn = readers.get(name);\n if (maker === undefined || addOn === undefined) continue;\n const read = readLayer(scene, addOn);\n if (read === undefined || !read.ok) continue;\n space ??= sceneSpace(scene);\n // The sort is stable, so the marks of one record keep their order.\n found.push(...[...maker.marks(read.layer, space)].sort((a, b) => compareText(a.record, b.record)));\n }\n return found;\n}\n"],"mappings":";;;;;;;;;;;;;AAiCA,SAAgB,WAAW,OAAc,QAAmC,OAAwD;CAClI,MAAM,yBAAS,IAAI,IAAiC;CACpD,KAAK,MAAM,SAAS,OAAO,IAAI,CAAC,OAAO,IAAI,MAAM,MAAM,GAAG,OAAO,IAAI,MAAM,QAAQ,KAAK;CACxF,MAAM,0BAAU,IAAI,IAA4B;CAChD,KAAK,MAAM,SAAS,QAAQ,IAAI,CAAC,QAAQ,IAAI,MAAM,MAAM,GAAG,QAAQ,IAAI,MAAM,QAAQ,KAAK;CAC3F,KAAK,MAAM,QAAQ,OAAO,KAAK,GAC7B,IAAI,CAAC,QAAQ,IAAI,IAAI,GAAG,MAAM,IAAI,WAAW,2BAA2B,KAAK,oEAAoE;CAGnJ,MAAM,QAAgB,CAAC;CACvB,IAAI;CACJ,KAAK,MAAM,QAAQ,CAAC,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,WAAW,GAAG;EACvD,MAAM,QAAQ,OAAO,IAAI,IAAI;EAC7B,MAAM,QAAQ,QAAQ,IAAI,IAAI;EAC9B,IAAI,UAAU,KAAA,KAAa,UAAU,KAAA,GAAW;EAChD,MAAM,OAAO,UAAU,OAAO,KAAK;EACnC,IAAI,SAAS,KAAA,KAAa,CAAC,KAAK,IAAI;EACpC,UAAU,WAAW,KAAK;EAE1B,MAAM,KAAK,GAAG,CAAC,GAAG,MAAM,MAAM,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;CACnG;CACA,OAAO;AACT"}
|
|
@@ -1,6 +1,41 @@
|
|
|
1
|
+
import { t as WallFrame } from "./frames-BYMK5ZId.js";
|
|
1
2
|
import { d as Room, p as Scene } from "./room-NREa6vXr.js";
|
|
2
|
-
import { n as JoinOptions } from "./joins-2p01wnr_.js";
|
|
3
3
|
import { Box3, Point3, Ring, Transform3 } from "@mark1russell7/layout-contract";
|
|
4
|
+
/** The outline of one wall in the plan, after its corners with the other walls. */
|
|
5
|
+
interface WallFootprint {
|
|
6
|
+
/** The `id` of the wall. */
|
|
7
|
+
readonly wall: string;
|
|
8
|
+
/** 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. */
|
|
9
|
+
readonly ring: Ring;
|
|
10
|
+
/**
|
|
11
|
+
* The part of the wall that has its full thickness: two distances along the wall, in meters.
|
|
12
|
+
* An opening must be in this part. A wall with no such part has the two distances 0.
|
|
13
|
+
*/
|
|
14
|
+
readonly clear: readonly [number, number];
|
|
15
|
+
}
|
|
16
|
+
/** The options of the corners of the walls. */
|
|
17
|
+
interface JoinOptions {
|
|
18
|
+
/** 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. */
|
|
19
|
+
readonly tolerance?: number | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The limit of a sharp corner. The faces of two walls meet at a point. When that point is farther from the corner
|
|
22
|
+
* than this number of thicknesses, the two walls get square ends. The default is 4. A value that is not finite gives the default.
|
|
23
|
+
*/
|
|
24
|
+
readonly miterLimit?: number | undefined;
|
|
25
|
+
}
|
|
26
|
+
/** The default distance in meters at which two ends of walls make one corner. */
|
|
27
|
+
declare const JOIN_TOLERANCE = 1e-6;
|
|
28
|
+
/** The default limit of a sharp corner, in thicknesses. */
|
|
29
|
+
declare const MITER_LIMIT = 4;
|
|
30
|
+
/**
|
|
31
|
+
* This function gives the outline of each wall in the plan, in the sequence of the frames.
|
|
32
|
+
*
|
|
33
|
+
* 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.
|
|
34
|
+
* 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.
|
|
35
|
+
* 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.
|
|
36
|
+
* A wall with no outline (`wallHasOutline`) gets an empty outline, and it makes no corner.
|
|
37
|
+
*/
|
|
38
|
+
declare function wallFootprints(frames: readonly WallFrame[], options?: JoinOptions): readonly WallFootprint[];
|
|
4
39
|
/** These are the kinds of a solid. */
|
|
5
40
|
declare const SOLID_KINDS: readonly ["floor", "wall", "glass", "outlet", "object"];
|
|
6
41
|
/** A kind of solid. */
|
|
@@ -81,74 +116,5 @@ declare function solidCorners(solid: Solid): readonly Point3[];
|
|
|
81
116
|
declare function boundsOfSolids(solids: readonly Solid[]): Box3 | undefined;
|
|
82
117
|
/** This function gives the volume of a solid in cubic meters. */
|
|
83
118
|
declare function solidVolume(solid: Solid): number;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
/** A level of the load of a circuit. A viewer gives each level a color. */
|
|
87
|
-
type LoadLevel = (typeof LOAD_LEVELS)[number];
|
|
88
|
-
/** The state of one circuit of a scene. */
|
|
89
|
-
interface CircuitState {
|
|
90
|
-
/** The `id` of the circuit. */
|
|
91
|
-
readonly circuit: string;
|
|
92
|
-
/** The sum of the loads of the circuit, in watts. */
|
|
93
|
-
readonly watts: number;
|
|
94
|
-
/** The limit of the circuit, in watts. */
|
|
95
|
-
readonly limit: number;
|
|
96
|
-
/** The load as a part of the limit. It is 0 for a limit that is not above 0. */
|
|
97
|
-
readonly ratio: number;
|
|
98
|
-
readonly level: LoadLevel;
|
|
99
|
-
/** The `id` of each outlet of the circuit. */
|
|
100
|
-
readonly outlets: readonly string[];
|
|
101
|
-
/** The `id` of each placed object with an outlet of the circuit. */
|
|
102
|
-
readonly objects: readonly string[];
|
|
103
|
-
}
|
|
104
|
-
/** The options of the levels. */
|
|
105
|
-
interface LoadOptions {
|
|
106
|
-
/** A circuit with this part of its limit, or more, has the level `near`. The default is 0.8. */
|
|
107
|
-
readonly near?: number | undefined;
|
|
108
|
-
}
|
|
109
|
-
/** The default part of the limit at which a circuit has the level `near`. */
|
|
110
|
-
declare const NEAR_LIMIT = .8;
|
|
111
|
-
/**
|
|
112
|
-
* This function gives the state of each circuit of a scene, in the sequence of the circuits.
|
|
113
|
-
*
|
|
114
|
-
* The loads are input data: a calculation or a meter gives them. A circuit that no load record names has the level `unknown`,
|
|
115
|
-
* and so has a circuit with a limit that is not above 0. A load above the limit has the level `over`.
|
|
116
|
-
*/
|
|
117
|
-
declare function circuitStates(scene: Scene, options?: LoadOptions): readonly CircuitState[];
|
|
118
|
-
/**
|
|
119
|
-
* This function gives the level of each outlet of a scene: the level of its circuit. The key is the `id` of the outlet.
|
|
120
|
-
* An outlet with no circuit of the room has no level, and the map does not have it.
|
|
121
|
-
*/
|
|
122
|
-
declare function outletLevels(scene: Scene, options?: LoadOptions): ReadonlyMap<string, LoadLevel>;
|
|
123
|
-
/** These are the shapes of the sign of a level. */
|
|
124
|
-
declare const LEVEL_SHAPES: readonly ["ring", "disc", "triangle", "square"];
|
|
125
|
-
/** A shape of the sign of a level. A person who does not see a color reads the level from the shape. */
|
|
126
|
-
type LevelShape = (typeof LEVEL_SHAPES)[number];
|
|
127
|
-
/**
|
|
128
|
-
* This function gives the shape of the sign of a level: a disc for `ok`, a triangle for `near` and a square for `over`.
|
|
129
|
-
* The level `unknown` has a ring, and so has an outlet with no level.
|
|
130
|
-
*/
|
|
131
|
-
declare function levelShape(level: LoadLevel | undefined): LevelShape;
|
|
132
|
-
/** The outline of the sign of a shape, as a regular polygon. A circle is a polygon with 40 sides. */
|
|
133
|
-
interface ShapeOutline {
|
|
134
|
-
/** The radius of the circle through the corners, for a disc with the radius 1. */
|
|
135
|
-
readonly radius: number;
|
|
136
|
-
/** The number of the sides. */
|
|
137
|
-
readonly sides: number;
|
|
138
|
-
/** The angle of the first corner, in radians, counter-clockwise from the x axis. */
|
|
139
|
-
readonly start: number;
|
|
140
|
-
/** The radius of the hole of the sign, for a disc with the radius 1. A sign with no hole has 0. */
|
|
141
|
-
readonly hole: number;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* The outline of the sign of each shape. Each viewer draws the signs from these values, so each viewer shows the same signs.
|
|
145
|
-
* A triangle and a square with the radius of the disc look small, so they are larger.
|
|
146
|
-
*/
|
|
147
|
-
declare const SHAPE_OUTLINES: Readonly<Record<LevelShape, ShapeOutline>>;
|
|
148
|
-
/**
|
|
149
|
-
* This function gives the corners of the outline of a sign, counter-clockwise, with the y axis up.
|
|
150
|
-
* The center of the sign is the origin, and `radius` is the radius of a disc.
|
|
151
|
-
*/
|
|
152
|
-
declare function shapeRing(shape: LevelShape, radius?: number): Ring;
|
|
153
|
-
export { solidVolume as A, SolidShape as C, roomSolids as D, objectTransforms as E, sceneSolids as O, SolidOptions as S, boundsOfSolids as T, PlacedBox as _, LoadLevel as a, Solid as b, SHAPE_OUTLINES as c, levelShape as d, outletLevels as f, OUTLET_PLATE as g, GLASS_THICKNESS as h, LevelShape as i, solidCorners as k, ShapeOutline as l, FLOOR_DEPTH as m, LEVEL_SHAPES as n, LoadOptions as o, shapeRing as p, LOAD_LEVELS as r, NEAR_LIMIT as s, CircuitState as t, circuitStates as u, Prism as v, TO_Y_UP as w, SolidKind as x, SOLID_KINDS as y };
|
|
154
|
-
//# sourceMappingURL=loads-CriZuwcu.d.ts.map
|
|
119
|
+
export { wallFootprints as S, solidVolume as _, Prism as a, MITER_LIMIT as b, SolidKind as c, TO_Y_UP as d, boundsOfSolids as f, solidCorners as g, sceneSolids as h, PlacedBox as i, SolidOptions as l, roomSolids as m, GLASS_THICKNESS as n, SOLID_KINDS as o, objectTransforms as p, OUTLET_PLATE as r, Solid as s, FLOOR_DEPTH as t, SolidShape as u, JOIN_TOLERANCE as v, WallFootprint as x, JoinOptions as y };
|
|
120
|
+
//# sourceMappingURL=solids-BHLnvDVu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solids-BHLnvDVu.d.ts","names":[],"sources":["../src/joins.ts","../src/solids.ts"],"mappings":";;;;UAIiB;;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;;cAGA;WAAyB;WAAwB;WAAyB;;;;;;cAM1E,SAAS;;;;;;;;;iBA4HN,WAAW,MAAM,MAAM,UAAS,wBAA6B;;;;;;;iBAiD7D,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,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as SolidKind, l as SolidOptions, s as Solid } from "./solids-BHLnvDVu.js";
|
|
2
|
+
import { a as LoadLevel, o as LoadOptions } from "./loads-Bp8aH2HJ.js";
|
|
3
|
+
import { p as Scene } from "./room-NREa6vXr.js";
|
|
3
4
|
import { Point3, Rotation3 } from "@mark1russell7/layout-contract";
|
|
4
5
|
import { BufferGeometry } from "three";
|
|
6
|
+
import { MarkersOptions } from "@mark1russell7/visuals/markers";
|
|
7
|
+
import { Mark } from "@mark1russell7/visuals/marks";
|
|
8
|
+
import "@mark1russell7/visuals/three";
|
|
5
9
|
/**
|
|
6
10
|
* The three.js geometry of a solid, and its place in the room.
|
|
7
11
|
* The origin of the geometry is the center of the solid. Thus three.js puts clear solids in the correct sequence.
|
|
@@ -37,10 +41,17 @@ interface ViewerTheme {
|
|
|
37
41
|
readonly glassOpacity: number;
|
|
38
42
|
/** The color of an outlet with no circuit. */
|
|
39
43
|
readonly outlet: string;
|
|
40
|
-
/** The color of the outlets of a circuit at each level of its load. */
|
|
44
|
+
/** The color of the marks of each level, and of the plates of the outlets of a circuit at each level of its load. */
|
|
41
45
|
readonly levels: Readonly<Record<LoadLevel, string>>;
|
|
42
|
-
/** The color of the line around the
|
|
46
|
+
/** 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. */
|
|
43
47
|
readonly halo: string;
|
|
48
|
+
/**
|
|
49
|
+
* The colors of a field mark, from the value `min` of its scale to the value `max`.
|
|
50
|
+
* A theme with no such list gives a field the color of its level.
|
|
51
|
+
*/
|
|
52
|
+
readonly field?: readonly string[] | undefined;
|
|
53
|
+
/** The part of a field mark that is not clear, from 0 to 1. The default is 0.8. */
|
|
54
|
+
readonly fieldOpacity?: number | undefined;
|
|
44
55
|
/** The color of a placed object whose kind has no color in `objects`. */
|
|
45
56
|
readonly object: string;
|
|
46
57
|
/** The color of the placed objects of each kind. The key is the field `kind` of a placed object. */
|
|
@@ -70,34 +81,56 @@ interface ViewerPick extends ViewerRecord {
|
|
|
70
81
|
type ViewName = "home" | "top";
|
|
71
82
|
/** The options of a viewer. */
|
|
72
83
|
interface RoomViewerOptions {
|
|
73
|
-
readonly scene: Scene
|
|
84
|
+
readonly scene: Scene;
|
|
74
85
|
/** The colors. The default is `LIGHT_THEME`. */
|
|
75
86
|
readonly theme?: ViewerTheme | undefined;
|
|
76
87
|
/** The options of the model. */
|
|
77
88
|
readonly solids?: SolidOptions | undefined;
|
|
78
89
|
/** The options of the levels of the circuits. */
|
|
79
90
|
readonly loads?: LoadOptions | undefined;
|
|
91
|
+
/** The options of the picture of the marks, for example the radius of a sign. */
|
|
92
|
+
readonly markers?: MarkersOptions | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* The marks of the scene, in the space of the scene: meters, with the z axis up. `layerMarks` of the entry `/marks` gives them.
|
|
95
|
+
* With no list, the viewer makes the marks of the outlets of the scene. An empty list gives a picture with no mark.
|
|
96
|
+
* The viewer draws no mark with a fault. `checkMarks` of `@mark1russell7/visuals/marks` tells each fault.
|
|
97
|
+
*/
|
|
98
|
+
readonly marks?: readonly Mark[] | undefined;
|
|
80
99
|
/** The name of the picture for a screen reader. */
|
|
81
100
|
readonly label?: string | undefined;
|
|
82
|
-
/**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
101
|
+
/**
|
|
102
|
+
* The viewer starts this function when the pointer goes to a different record, or to no record.
|
|
103
|
+
* `mark` is the mark under the pointer. `pick` is then the first solid of the record of the mark, or `undefined` for a record with no solid.
|
|
104
|
+
*/
|
|
105
|
+
readonly onHover?: ((pick: ViewerPick | undefined, mark?: Mark) => void) | undefined;
|
|
106
|
+
/** The viewer starts this function when a person selects a record with the pointer, or selects no record. The parameters are those of `onHover`. */
|
|
107
|
+
readonly onSelect?: ((pick: ViewerPick | undefined, mark?: Mark) => void) | undefined;
|
|
86
108
|
}
|
|
87
109
|
/** A viewer of one scene in a page. */
|
|
88
110
|
interface RoomViewer {
|
|
89
111
|
/** The canvas of the viewer. It is in the container. */
|
|
90
112
|
readonly canvas: HTMLCanvasElement;
|
|
91
|
-
/**
|
|
92
|
-
|
|
113
|
+
/**
|
|
114
|
+
* This function shows a different scene, with its marks. The view stays if a person moved it.
|
|
115
|
+
* With no list of marks, the viewer makes the marks of the outlets of the scene.
|
|
116
|
+
*/
|
|
117
|
+
setScene(scene: Scene, marks?: readonly Mark[]): void;
|
|
93
118
|
/** This function changes the colors. */
|
|
94
119
|
setTheme(theme: ViewerTheme): void;
|
|
95
120
|
/** This function moves the camera to a view that shows all of the model. */
|
|
96
121
|
setView(view: ViewName): void;
|
|
97
|
-
/**
|
|
98
|
-
|
|
122
|
+
/**
|
|
123
|
+
* This function highlights records, as the pointer does. An empty list removes the highlights.
|
|
124
|
+
* A record is a record of a solid, or the record name of a mark, for example `electrical/1:nook-2`.
|
|
125
|
+
*/
|
|
126
|
+
highlight(records: readonly (ViewerRecord | string)[]): void;
|
|
99
127
|
/** This function selects one record, or no record. It does not start `onSelect`. */
|
|
100
|
-
select(record: ViewerRecord | undefined): void;
|
|
128
|
+
select(record: ViewerRecord | string | undefined): void;
|
|
129
|
+
/**
|
|
130
|
+
* This function shows only the marks that a test accepts, for example the marks of one kind. The pointer does not find a mark that the picture does not show.
|
|
131
|
+
* The test stays for each subsequent scene. A test that accepts each mark shows all of them again.
|
|
132
|
+
*/
|
|
133
|
+
showMarks(test: (mark: Mark) => boolean): void;
|
|
101
134
|
/** This function removes the canvas and releases the memory of the graphics card. */
|
|
102
135
|
dispose(): void;
|
|
103
136
|
}
|
|
@@ -105,11 +138,12 @@ interface RoomViewer {
|
|
|
105
138
|
* This function makes a viewer of a scene in a container of a page. The viewer fills the container, so give the container a size.
|
|
106
139
|
*
|
|
107
140
|
* A person turns the model with a drag, and moves nearer with the wheel after a click in the picture.
|
|
108
|
-
* The walls between the camera and the room become almost clear. A click selects the record of a solid.
|
|
109
|
-
* Each outlet has a marker with the color and the shape of the level of its circuit. A marker keeps its size in the picture.
|
|
110
|
-
* A marked outlet or object shows a line from the outlet to each object that takes its power from it.
|
|
141
|
+
* The walls between the camera and the room become almost clear. A click selects the record of a solid or of a mark.
|
|
111
142
|
* With the keyboard, the arrow keys turn the model, `+` and `-` change the distance, `Home` shows the first view and `T` shows the plan.
|
|
112
143
|
*
|
|
144
|
+
* 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.
|
|
145
|
+
* 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.
|
|
146
|
+
*
|
|
113
147
|
* The function gives `undefined` when the browser has no WebGL 2. It does not throw, and it writes no error to the console.
|
|
114
148
|
*/
|
|
115
149
|
export declare function createRoomViewer(container: HTMLElement, options: RoomViewerOptions): RoomViewer | undefined;
|
package/build/three.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"three.d.ts","names":[
|
|
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"}
|