@mark1russell7/room-view 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,863 @@
1
+ // src/sample.ts
2
+ /**
3
+ * A sample room in meters. It is not a real room.
4
+ *
5
+ * The outline is an L shape. Each outer wall has its line on the inner face: `side` is `right` on a counter-clockwise outline.
6
+ * A short wall makes a nook at the top. The floor goes around that wall.
7
+ */
8
+ const SAMPLE_ROOM = {
9
+ schema: "room/1",
10
+ name: "Sample room",
11
+ unit: "m",
12
+ height: 2.5,
13
+ wallThickness: .15,
14
+ walls: [
15
+ {
16
+ id: "south",
17
+ from: [0, 0],
18
+ to: [6, 0],
19
+ side: "right"
20
+ },
21
+ {
22
+ id: "east",
23
+ from: [6, 0],
24
+ to: [6, 3],
25
+ side: "right"
26
+ },
27
+ {
28
+ id: "inset-north",
29
+ from: [6, 3],
30
+ to: [4, 3],
31
+ side: "right"
32
+ },
33
+ {
34
+ id: "inset-east",
35
+ from: [4, 3],
36
+ to: [4, 5],
37
+ side: "right"
38
+ },
39
+ {
40
+ id: "north",
41
+ from: [4, 5],
42
+ to: [0, 5],
43
+ side: "right"
44
+ },
45
+ {
46
+ id: "west",
47
+ from: [0, 5],
48
+ to: [0, 0],
49
+ side: "right"
50
+ },
51
+ {
52
+ id: "nook",
53
+ from: [2.5, 5],
54
+ to: [2.5, 3.6],
55
+ thickness: .1
56
+ }
57
+ ],
58
+ openings: [
59
+ {
60
+ id: "door",
61
+ wall: "south",
62
+ kind: "door",
63
+ offset: .6,
64
+ width: .9,
65
+ height: 2.05
66
+ },
67
+ {
68
+ id: "window-east",
69
+ wall: "east",
70
+ kind: "window",
71
+ offset: .8,
72
+ width: 1.4,
73
+ sill: .9,
74
+ height: 1.2
75
+ },
76
+ {
77
+ id: "window-west",
78
+ wall: "west",
79
+ kind: "window",
80
+ offset: 1.5,
81
+ width: 1.6,
82
+ sill: .9,
83
+ height: 1.2
84
+ }
85
+ ],
86
+ floors: [{
87
+ id: "floor",
88
+ name: "Room",
89
+ ring: [
90
+ [0, 0],
91
+ [6, 0],
92
+ [6, 3],
93
+ [4, 3],
94
+ [4, 5],
95
+ [2.55, 5],
96
+ [2.55, 3.6],
97
+ [2.45, 3.6],
98
+ [2.45, 5],
99
+ [0, 5]
100
+ ]
101
+ }],
102
+ outlets: [
103
+ {
104
+ id: "south-1",
105
+ wall: "south",
106
+ face: "left",
107
+ offset: 2.4,
108
+ height: .3,
109
+ circuit: "a"
110
+ },
111
+ {
112
+ id: "south-2",
113
+ wall: "south",
114
+ face: "left",
115
+ offset: 4.6,
116
+ height: .3,
117
+ circuit: "a"
118
+ },
119
+ {
120
+ id: "east-1",
121
+ wall: "east",
122
+ face: "left",
123
+ offset: .4,
124
+ height: .3,
125
+ circuit: "a"
126
+ },
127
+ {
128
+ id: "west-1",
129
+ wall: "west",
130
+ face: "left",
131
+ offset: 4.2,
132
+ height: .3,
133
+ circuit: "a"
134
+ },
135
+ {
136
+ id: "north-1",
137
+ wall: "north",
138
+ face: "left",
139
+ offset: 2.8,
140
+ height: .3,
141
+ circuit: "a"
142
+ },
143
+ {
144
+ id: "nook-1",
145
+ wall: "north",
146
+ face: "left",
147
+ offset: .7,
148
+ height: .3,
149
+ circuit: "b"
150
+ },
151
+ {
152
+ id: "nook-2",
153
+ wall: "inset-east",
154
+ face: "left",
155
+ offset: 1.2,
156
+ height: .3,
157
+ circuit: "b"
158
+ }
159
+ ],
160
+ circuits: [{
161
+ id: "a",
162
+ name: "Circuit A",
163
+ limit: 1440
164
+ }, {
165
+ id: "b",
166
+ name: "Circuit B",
167
+ limit: 1440
168
+ }]
169
+ };
170
+ /** A sample scene of the sample room: a desk, a sofa, and a rack of four computers in the nook. Circuit B is near its limit. */
171
+ const SAMPLE_SCENE = {
172
+ schema: "scene/1",
173
+ name: "Sample scene",
174
+ room: SAMPLE_ROOM,
175
+ objects: [
176
+ {
177
+ id: "desk",
178
+ kind: "desk",
179
+ name: "Desk",
180
+ size: [
181
+ 1.6,
182
+ .75,
183
+ .74
184
+ ],
185
+ at: [1.2, 4.55]
186
+ },
187
+ {
188
+ id: "display",
189
+ kind: "display",
190
+ name: "Display",
191
+ size: [
192
+ .6,
193
+ .2,
194
+ .4
195
+ ],
196
+ at: [0, .2],
197
+ lift: .74,
198
+ parent: "desk"
199
+ },
200
+ {
201
+ id: "tower",
202
+ kind: "computer",
203
+ name: "Tower",
204
+ size: [
205
+ .22,
206
+ .45,
207
+ .45
208
+ ],
209
+ at: [2.2, 4.6],
210
+ outlet: "north-1"
211
+ },
212
+ {
213
+ id: "sofa",
214
+ kind: "sofa",
215
+ name: "Sofa",
216
+ size: [
217
+ 2,
218
+ .9,
219
+ .8
220
+ ],
221
+ at: [4.4, .6]
222
+ },
223
+ {
224
+ id: "rack",
225
+ kind: "rack",
226
+ name: "Rack",
227
+ size: [
228
+ .6,
229
+ .8,
230
+ 1.2
231
+ ],
232
+ at: [3.3, 4.5]
233
+ },
234
+ {
235
+ id: "node-1",
236
+ kind: "computer",
237
+ name: "Node 1",
238
+ size: [
239
+ .48,
240
+ .6,
241
+ .18
242
+ ],
243
+ at: [0, 0],
244
+ lift: .08,
245
+ parent: "rack",
246
+ outlet: "nook-1"
247
+ },
248
+ {
249
+ id: "node-2",
250
+ kind: "computer",
251
+ name: "Node 2",
252
+ size: [
253
+ .48,
254
+ .6,
255
+ .18
256
+ ],
257
+ at: [0, 0],
258
+ lift: .34,
259
+ parent: "rack",
260
+ outlet: "nook-1"
261
+ },
262
+ {
263
+ id: "node-3",
264
+ kind: "computer",
265
+ name: "Node 3",
266
+ size: [
267
+ .48,
268
+ .6,
269
+ .18
270
+ ],
271
+ at: [0, 0],
272
+ lift: .6,
273
+ parent: "rack",
274
+ outlet: "nook-2"
275
+ },
276
+ {
277
+ id: "node-4",
278
+ kind: "computer",
279
+ name: "Node 4",
280
+ size: [
281
+ .48,
282
+ .6,
283
+ .18
284
+ ],
285
+ at: [0, 0],
286
+ lift: .86,
287
+ parent: "rack",
288
+ outlet: "nook-2"
289
+ }
290
+ ],
291
+ loads: [{
292
+ circuit: "a",
293
+ watts: 420
294
+ }, {
295
+ circuit: "b",
296
+ watts: 1260
297
+ }]
298
+ };
299
+ /**
300
+ * The survey of the sample room: its six outer walls as a walk along their inner faces. The diagonal of the large part is a check.
301
+ * It does not have the short wall of the nook, because that wall is not a side of the walk.
302
+ * Its objects are the objects of the sample scene, each with its measurements from a wall, from the desk or from the rack.
303
+ */
304
+ const SAMPLE_SURVEY = {
305
+ schema: "survey/1",
306
+ name: "Sample room",
307
+ unit: "m",
308
+ height: 2.5,
309
+ wallThickness: .15,
310
+ sides: [
311
+ {
312
+ id: "south",
313
+ length: 6,
314
+ turn: "left"
315
+ },
316
+ {
317
+ id: "east",
318
+ length: 3,
319
+ turn: "left"
320
+ },
321
+ {
322
+ id: "inset-north",
323
+ length: 2,
324
+ turn: "right"
325
+ },
326
+ {
327
+ id: "inset-east",
328
+ length: 2,
329
+ turn: "left"
330
+ },
331
+ {
332
+ id: "north",
333
+ length: 4,
334
+ turn: "left"
335
+ },
336
+ {
337
+ id: "west",
338
+ length: 5,
339
+ turn: "left"
340
+ }
341
+ ],
342
+ checks: [{
343
+ id: "diagonal",
344
+ from: "south",
345
+ to: "inset-east",
346
+ length: 5
347
+ }],
348
+ openings: [
349
+ {
350
+ id: "door",
351
+ wall: "south",
352
+ kind: "door",
353
+ offset: .6,
354
+ width: .9,
355
+ height: 2.05
356
+ },
357
+ {
358
+ id: "window-east",
359
+ wall: "east",
360
+ kind: "window",
361
+ offset: .8,
362
+ width: 1.4,
363
+ sill: .9,
364
+ height: 1.2
365
+ },
366
+ {
367
+ id: "window-west",
368
+ wall: "west",
369
+ kind: "window",
370
+ offset: 1.5,
371
+ width: 1.6,
372
+ sill: .9,
373
+ height: 1.2
374
+ }
375
+ ],
376
+ outlets: [
377
+ {
378
+ id: "south-1",
379
+ wall: "south",
380
+ offset: 2.4,
381
+ height: .3,
382
+ circuit: "a"
383
+ },
384
+ {
385
+ id: "south-2",
386
+ wall: "south",
387
+ offset: 4.6,
388
+ height: .3,
389
+ circuit: "a"
390
+ },
391
+ {
392
+ id: "east-1",
393
+ wall: "east",
394
+ offset: .4,
395
+ height: .3,
396
+ circuit: "a"
397
+ },
398
+ {
399
+ id: "west-1",
400
+ wall: "west",
401
+ offset: 4.2,
402
+ height: .3,
403
+ circuit: "a"
404
+ },
405
+ {
406
+ id: "north-1",
407
+ wall: "north",
408
+ offset: 2.8,
409
+ height: .3,
410
+ circuit: "a"
411
+ },
412
+ {
413
+ id: "nook-1",
414
+ wall: "north",
415
+ offset: .7,
416
+ height: .3,
417
+ circuit: "b"
418
+ },
419
+ {
420
+ id: "nook-2",
421
+ wall: "inset-east",
422
+ offset: 1.2,
423
+ height: .3,
424
+ circuit: "b"
425
+ }
426
+ ],
427
+ circuits: [{
428
+ id: "a",
429
+ name: "Circuit A",
430
+ limit: 1440
431
+ }, {
432
+ id: "b",
433
+ name: "Circuit B",
434
+ limit: 1440
435
+ }],
436
+ objects: [
437
+ {
438
+ id: "desk",
439
+ kind: "desk",
440
+ name: "Desk",
441
+ wall: "north",
442
+ offset: 2,
443
+ width: 1.6,
444
+ depth: .75,
445
+ height: .74,
446
+ gap: .075
447
+ },
448
+ {
449
+ id: "display",
450
+ kind: "display",
451
+ name: "Display",
452
+ on: "desk",
453
+ offset: .5,
454
+ width: .6,
455
+ depth: .2,
456
+ height: .4,
457
+ gap: .075
458
+ },
459
+ {
460
+ id: "tower",
461
+ kind: "computer",
462
+ name: "Tower",
463
+ wall: "north",
464
+ offset: 1.69,
465
+ width: .22,
466
+ depth: .45,
467
+ height: .45,
468
+ gap: .175,
469
+ outlet: "north-1"
470
+ },
471
+ {
472
+ id: "sofa",
473
+ kind: "sofa",
474
+ name: "Sofa",
475
+ wall: "south",
476
+ offset: 3.4,
477
+ width: 2,
478
+ depth: .9,
479
+ height: .8,
480
+ gap: .15
481
+ },
482
+ {
483
+ id: "rack",
484
+ kind: "rack",
485
+ name: "Rack",
486
+ wall: "north",
487
+ offset: .4,
488
+ width: .6,
489
+ depth: .8,
490
+ height: 1.2,
491
+ gap: .1
492
+ },
493
+ {
494
+ id: "node-1",
495
+ kind: "computer",
496
+ name: "Node 1",
497
+ on: "rack",
498
+ offset: .06,
499
+ width: .48,
500
+ depth: .6,
501
+ height: .18,
502
+ gap: .1,
503
+ lift: .08,
504
+ outlet: "nook-1"
505
+ },
506
+ {
507
+ id: "node-2",
508
+ kind: "computer",
509
+ name: "Node 2",
510
+ on: "rack",
511
+ offset: .06,
512
+ width: .48,
513
+ depth: .6,
514
+ height: .18,
515
+ gap: .1,
516
+ lift: .34,
517
+ outlet: "nook-1"
518
+ },
519
+ {
520
+ id: "node-3",
521
+ kind: "computer",
522
+ name: "Node 3",
523
+ on: "rack",
524
+ offset: .06,
525
+ width: .48,
526
+ depth: .6,
527
+ height: .18,
528
+ gap: .1,
529
+ lift: .6,
530
+ outlet: "nook-2"
531
+ },
532
+ {
533
+ id: "node-4",
534
+ kind: "computer",
535
+ name: "Node 4",
536
+ on: "rack",
537
+ offset: .06,
538
+ width: .48,
539
+ depth: .6,
540
+ height: .18,
541
+ gap: .1,
542
+ lift: .86,
543
+ outlet: "nook-2"
544
+ }
545
+ ]
546
+ };
547
+ /**
548
+ * A sample apartment in meters. It is not a real apartment.
549
+ *
550
+ * The living room is the sample room. A hall is below it in the plan, with a bathroom on its right. A bedroom is below the hall and the bathroom.
551
+ * Each survey starts at its own corner, and the three doors give the places of the rooms.
552
+ * The walk of the bathroom starts along its west wall, so the bathroom turns. A wall between two rooms has a thickness of 0.1 m.
553
+ *
554
+ * Each room has objects: the hall has a shelf, the bathroom has a vanity, and the bedroom has a bed and a wardrobe.
555
+ */
556
+ const SAMPLE_LEVEL = {
557
+ schema: "level/1",
558
+ name: "Sample apartment",
559
+ unit: "m",
560
+ rooms: [
561
+ {
562
+ id: "living",
563
+ survey: {
564
+ ...SAMPLE_SURVEY,
565
+ name: "Living room"
566
+ }
567
+ },
568
+ {
569
+ id: "hall",
570
+ survey: {
571
+ schema: "survey/1",
572
+ name: "Hall",
573
+ unit: "m",
574
+ height: 2.5,
575
+ wallThickness: .15,
576
+ sides: [
577
+ {
578
+ id: "south",
579
+ length: 4,
580
+ turn: "left"
581
+ },
582
+ {
583
+ id: "east",
584
+ length: 1.2,
585
+ turn: "left"
586
+ },
587
+ {
588
+ id: "north",
589
+ length: 4,
590
+ turn: "left"
591
+ },
592
+ {
593
+ id: "west",
594
+ length: 1.2,
595
+ turn: "left"
596
+ }
597
+ ],
598
+ openings: [
599
+ {
600
+ id: "bedroom",
601
+ wall: "south",
602
+ kind: "door",
603
+ offset: .4,
604
+ width: .8,
605
+ height: 2.05
606
+ },
607
+ {
608
+ id: "bathroom",
609
+ wall: "east",
610
+ kind: "door",
611
+ offset: .2,
612
+ width: .75,
613
+ height: 2.05
614
+ },
615
+ {
616
+ id: "living",
617
+ wall: "north",
618
+ kind: "door",
619
+ offset: 2.5,
620
+ width: .9,
621
+ height: 2.05
622
+ },
623
+ {
624
+ id: "entry",
625
+ wall: "west",
626
+ kind: "door",
627
+ offset: .15,
628
+ width: .9,
629
+ height: 2.05
630
+ }
631
+ ],
632
+ outlets: [{
633
+ id: "south-1",
634
+ wall: "south",
635
+ offset: 2.6,
636
+ height: .3,
637
+ circuit: "c"
638
+ }],
639
+ objects: [{
640
+ id: "shelf",
641
+ kind: "shelf",
642
+ name: "Shoe shelf",
643
+ wall: "south",
644
+ offset: 1.6,
645
+ width: 1.2,
646
+ depth: .3,
647
+ height: .9
648
+ }]
649
+ }
650
+ },
651
+ {
652
+ id: "bathroom",
653
+ survey: {
654
+ schema: "survey/1",
655
+ name: "Bathroom",
656
+ unit: "m",
657
+ height: 2.5,
658
+ wallThickness: .15,
659
+ sides: [
660
+ {
661
+ id: "west",
662
+ length: 2.5,
663
+ turn: "left"
664
+ },
665
+ {
666
+ id: "south",
667
+ length: 1.9,
668
+ turn: "left"
669
+ },
670
+ {
671
+ id: "east",
672
+ length: 2.5,
673
+ turn: "left"
674
+ },
675
+ {
676
+ id: "north",
677
+ length: 1.9,
678
+ turn: "left"
679
+ }
680
+ ],
681
+ openings: [{
682
+ id: "door",
683
+ wall: "west",
684
+ kind: "door",
685
+ offset: .25,
686
+ width: .75,
687
+ height: 2.05
688
+ }, {
689
+ id: "window",
690
+ wall: "east",
691
+ kind: "window",
692
+ offset: .9,
693
+ width: .7,
694
+ sill: 1.3,
695
+ height: .8
696
+ }],
697
+ outlets: [{
698
+ id: "east-1",
699
+ wall: "east",
700
+ offset: 2.1,
701
+ height: 1.1,
702
+ circuit: "c"
703
+ }],
704
+ objects: [{
705
+ id: "vanity",
706
+ kind: "cabinet",
707
+ name: "Vanity",
708
+ wall: "east",
709
+ offset: 1.7,
710
+ width: .7,
711
+ depth: .45,
712
+ height: .85
713
+ }]
714
+ }
715
+ },
716
+ {
717
+ id: "bedroom",
718
+ survey: {
719
+ schema: "survey/1",
720
+ name: "Bedroom",
721
+ unit: "m",
722
+ height: 2.5,
723
+ wallThickness: .15,
724
+ sides: [
725
+ {
726
+ id: "south",
727
+ length: 6,
728
+ turn: "left"
729
+ },
730
+ {
731
+ id: "east",
732
+ length: 2.3,
733
+ turn: "left"
734
+ },
735
+ {
736
+ id: "inset-north",
737
+ length: 2,
738
+ turn: "right"
739
+ },
740
+ {
741
+ id: "inset-east",
742
+ length: 1.3,
743
+ turn: "left"
744
+ },
745
+ {
746
+ id: "north",
747
+ length: 4,
748
+ turn: "left"
749
+ },
750
+ {
751
+ id: "west",
752
+ length: 3.6,
753
+ turn: "left"
754
+ }
755
+ ],
756
+ openings: [{
757
+ id: "door",
758
+ wall: "north",
759
+ kind: "door",
760
+ offset: 2.8,
761
+ width: .8,
762
+ height: 2.05
763
+ }, {
764
+ id: "window",
765
+ wall: "south",
766
+ kind: "window",
767
+ offset: 2.2,
768
+ width: 1.6,
769
+ sill: .9,
770
+ height: 1.2
771
+ }],
772
+ outlets: [
773
+ {
774
+ id: "south-1",
775
+ wall: "south",
776
+ offset: 1,
777
+ height: .3,
778
+ circuit: "c"
779
+ },
780
+ {
781
+ id: "south-2",
782
+ wall: "south",
783
+ offset: 5,
784
+ height: .3,
785
+ circuit: "c"
786
+ },
787
+ {
788
+ id: "west-1",
789
+ wall: "west",
790
+ offset: 1.8,
791
+ height: .3,
792
+ circuit: "c"
793
+ }
794
+ ],
795
+ objects: [{
796
+ id: "bed",
797
+ kind: "bed",
798
+ name: "Bed",
799
+ wall: "west",
800
+ offset: 1,
801
+ width: 1.6,
802
+ depth: 2,
803
+ height: .5
804
+ }, {
805
+ id: "wardrobe",
806
+ kind: "cabinet",
807
+ name: "Wardrobe",
808
+ wall: "east",
809
+ offset: .3,
810
+ width: 1.8,
811
+ depth: .6,
812
+ height: 2
813
+ }]
814
+ }
815
+ }
816
+ ],
817
+ connections: [
818
+ {
819
+ id: "living-hall",
820
+ from: {
821
+ room: "living",
822
+ opening: "door"
823
+ },
824
+ to: {
825
+ room: "hall",
826
+ opening: "living"
827
+ },
828
+ thickness: .1
829
+ },
830
+ {
831
+ id: "hall-bathroom",
832
+ from: {
833
+ room: "hall",
834
+ opening: "bathroom"
835
+ },
836
+ to: {
837
+ room: "bathroom",
838
+ opening: "door"
839
+ },
840
+ thickness: .1
841
+ },
842
+ {
843
+ id: "hall-bedroom",
844
+ from: {
845
+ room: "hall",
846
+ opening: "bedroom"
847
+ },
848
+ to: {
849
+ room: "bedroom",
850
+ opening: "door"
851
+ },
852
+ thickness: .1
853
+ }
854
+ ],
855
+ circuits: [{
856
+ id: "c",
857
+ name: "Circuit C",
858
+ limit: 1440
859
+ }]
860
+ };
861
+ export { SAMPLE_LEVEL, SAMPLE_ROOM, SAMPLE_SCENE, SAMPLE_SURVEY };
862
+
863
+ //# sourceMappingURL=sample.js.map