-
Notifications
You must be signed in to change notification settings - Fork 0
/
classwork4-6-2012.js
1689 lines (1494 loc) · 63.2 KB
/
classwork4-6-2012.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!function(exports){
var domain2d = DOMAIN([[0,1],[0,1]])([50,1]);
var domain = INTERVALS(1)(20);
var domainR = DOMAIN([[0,1],[0,2*PI]])([40,30]);
var xBaseTimpano = 8.52;
var bColor = [1,1,0.9];
var wallX;
var Point = function() {};
Point.rotate = function(pointList, angolo, asse) {
if (asse === 0) {
var alfa = angolo;
return pointList.map( function(pt) {
return [ pt[0], pt[1]*COS(alfa) + (-1)*pt[2]*SIN(alfa), pt[1]*SIN(alfa) + pt[2]*COS(alfa) ];
});
} else if (asse === 1) {
var beta = angolo;
return pointList.map( function(pt) {
return [ pt[0]*COS(beta) + pt[2]*SIN(beta), pt[1], (-1)*pt[0]*SIN(beta) + pt[2]*COS(beta) ];
});
} else if (asse === 2) {
var gamma = angolo;
return pointList.map( function(pt) {
return [ pt[0]*COS(gamma) + (-1)*pt[1]*SIN(gamma), pt[0]*SIN(gamma) + pt[1]*COS(gamma), pt[2] ];
});
}
return pointList;
};
Point.translate = function(pointList, asse, qty) {
if (asse === 0) {
return pointList.map( function(pt) {
return [ pt[0]+qty, pt[1], pt[2] ];
});
} else if (asse === 1) {
return pointList.map( function(pt) {
return [ pt[0], pt[1]+qty, pt[2] ];
});
} else if (asse === 2) {
return pointList.map( function(pt) {
return [ pt[0], pt[1], pt[2]+qty ];
});
}
};
Point.scale = function(pointList, scalamento) {
return pointList.map( function(pt) {
return [ pt[0] * scalamento, pt[1], pt[2]];
});
};
Point.scaleAllPoints = function(pointList,scale){
return pointList.map(function(pt) {
return [ pt[0] * scale, pt[1]*scale, pt[2]*scale];
});
};
Point.scaleY = function(pointList, scalamento) {
return pointList.map( function(pt) {
return [ pt[0], pt[1]*scalamento, pt[2]];
});
};
var makeKnots = function(points){
var knots = [0,0,0];
var tot = points.length;
for(var i=1;i<=tot-3;i++)
knots.push(i);
knots.push(i);
knots.push(i);
knots.push(i);
return knots;}
var buildStatue = function(){
var points =[[4.9,25.7],[6,25.1],[7,24.8],[7.9,24.5],
[7.4,22],[7.4,22.2],[7.5,21.4],[7.4,20.8],[7.1,19.6],
[6.8,18.5],[7,18.4],[7.1,18.3],[7.2,18.1],
[7.1,18],[7.2,17.8],[7.1,17.5],[7.2,17.4],
[7.2,17.2],[7.1,17.1],[7.2,16.9],[7.1,16.7],
[7.2,16.5],[7.2,16.2],[6.9,16],[7.2,14.5],
[7.2,14],[7.5,13],[7.4,12.6 ],[7.6,11.3 ],
[7.5,11.2 ],[7.5,10.2 ],[1.5,10.8],
[1.1,11.1],[1,13.5],[0.9,14.4],[1,16],[1,16.7],
[0.9,16.7],[0.9,17.2],[1.1,17.5],[0.9,17.6],[1.2,17.8],[1.6,18.5],
[1.4,18.5],[1.3,18.8],[1.5,19],[1.4,19.1],[1.5,19.3],
[1.4,19.5],[1.5,19.6],[1.2,19.6],[1.5,20],[0.9,23.4],
[0.7,23.8],[1.3,24.9],[1.5,25.5],[2,25.4],[2.5,25],
[3.5,25.2],[4.9,25.7]];
var points2 = [[7.5,11.2 ],[7.5,10.2 ],[7.3,10 ],[7.3,9 ],
[7.1,8.6 ],[7.9,7 ],[8,6 ],[8.4,3],[7.1,3.7],[7.1,4.1],[6,6.5],[5.9,7.6],
[5.8,7.8],[5.3,9],[5.1,10.1],[5,11.2],[7.5,11.2 ]];
var points3 = [[4.4,11.4],
[4.3,8.2],[4.5,8.4],[4.6,5.3],[4.5,4.9],[4.8,1.8],[3.3,2.3],[2.8,4.6],
[2.8,4.9],[2.5,6.1],[2.6,7.6],[1,12],[4.4,11.4]];
var points4 = [[6.5,25],[7.9,24.5],
[8.4,24],[8.8,23],[9.3,21],[9.7,19.4],[8.3,19.5],
[7.4,22.2],[8.2,20],[6.5,25]];
var points7 = [
[9.59,20],[9,18.1],[8.7,18],[8.4,18.1],
[8.1,18.8],[8.1,20],[9.59,20]];
var points5 = [[8.2,3.9 ],
[8.9,2.6 ],[9.4,1.8 ],[9.4,1 ],[9.1,0.8 ],[9,1 ],
[8.9,0.9 ],[8.4,0.8 ],[8.1,1],[7.7,2.4],[7.1,3.4],
[7.2,4],[8.2,3.9 ]];
var points6 = [[4.6,2.3],
[4.6,1.2],[4.2,1],[4,0.6],[2.7,0.5],[2.5,0.6],
[2.2,0.6],[1.9,1.2],[2.9,1.4],[3.4,2],[3.5,2.8],[4.6,2.3]];
var statue = [];
var knots = makeKnots(points);
var profile = NUBS(S0)(2)(knots)(points);
var body = CONICAL_SURFACE([6,17.5])(profile)
body = MAP(body)(domain2d);
statue.push(body);
var knots = makeKnots(points2);
var profile = NUBS(S0)(2)(knots)(points2);
var leftLeg = CONICAL_SURFACE([6.8,7.5])(profile)
leftLeg = MAP(leftLeg)(domain2d);
statue.push(leftLeg);
var knots = makeKnots(points3);
var profile = NUBS(S0)(2)(knots)(points3);
var rightLeg = CONICAL_SURFACE([4,5])(profile)
rightLeg = MAP(rightLeg)(domain2d);
statue.push(rightLeg);
var knots = makeKnots(points4);
var profile = NUBS(S0)(2)(knots)(points4);
var arm = CONICAL_SURFACE([8,23])(profile)
arm = MAP(arm)(domain2d);
statue.push(arm);
var knots = makeKnots(points7);
var profile = NUBS(S0)(2)(knots)(points7);
var arm2 = CONICAL_SURFACE([9,19.5])(profile)
arm2 = MAP(arm2)(domain2d);
statue.push(arm2);
var knots = makeKnots(points5);
var profile = NUBS(S0)(2)(knots)(points5);
var leftFoot = CONICAL_SURFACE([8.5,2.2])(profile)
leftFoot = MAP(leftFoot)(domain2d);
statue.push(leftFoot);
var knots = makeKnots(points6);
var profile = NUBS(S0)(2)(knots)(points6);
var rightFoot = CONICAL_SURFACE([4,1.5])(profile)
rightFoot = MAP(rightFoot)(domain2d);
statue.push(rightFoot);
statue = COLOR(bColor)(STRUCT(statue));
statue = EXTRUDE([0.7])(statue);
statue = S([0,1,2])([0.05,0.05,0.05])(statue);
var pedestal = COLOR(bColor)(SIMPLEX_GRID([[0.4],[0.1],[0.4]]));
pedestal = T([0,1,2])([0.1,-0.07,-0.175])(pedestal);
var completeStatue = STRUCT([pedestal,statue]);
return completeStatue;
}
var buildStatue2 = function(){
var points = [[5,24],[6.1,23.8],[6.6,23],[6.8,21],[8.1,19.8],
[8.6,17.2],[9.1,15],[9.4,12.2],[8.9,11.9],[8.7,12.1],
[8.6,12],[8.8,10.2],[8.6,9.8],[8.6,9.2],[8.1,8.8],
[8.1,8.5],[8,8.2],[7.9,1.3],[8.2,0.8],[8.2,0.5],[1.4,0.5],
[1.5,1],[2.2,1.7],[2.2,4.4],[2.1,9.9],[1.6,10.7],
[1.6,11.3],[0.9,11.1],[0.8,11.4],[1.3,15],[1.8,19],
[2.3,20],[3.3,20.8],[3.6,23],[4,23.7],[5,24]];
var knots = makeKnots(points);
var profile = NUBS(S0)(2)(knots)(points);
var statueSur = CONICAL_SURFACE([6,14])(profile);
statueSur = MAP(statueSur)(domain2d);
var statue = EXTRUDE([0.7])(statueSur);
statue = COLOR(bColor)(statue);
statue = S([0,1,2])([0.05,0.05,0.05])(statue);
return statue;
}
var buildProfBasRelief = function(){
var points = [[5,24],[6.1,23.8],[6.6,23],[6.8,21],[8.1,19.8],
[8.6,17.2],[9.1,15],[9.4,12.2],[8.9,11.9],[8.7,12.1],
[8.6,12],[8.8,10.2],[8.6,9.8],[8.6,9.2],[8.1,8.8],
[8.1,8.5],[8,8.2],[7.9,1.3],[8.2,0.8],[8.2,0.5],[1.4,0.5],
[1.5,1],[2.2,1.7],[2.2,4.4],[2.1,9.9],[1.6,10.7],
[1.6,11.3],[0.9,11.1],[0.8,11.4],[1.3,15],[1.8,19],
[2.3,20],[3.3,20.8],[3.6,23],[4,23.7],[5,24]];
points = points.map(function(p){return [p[0],p[1],0];});
points = Point.scaleAllPoints(points,0.05);
var knots = makeKnots(points);
var profile = NUBS(S0)(2)(knots)(points);
profile = MAP(profile)(INTERVALS(1)(200));
return profile;
}
var buildColumnBase = function(){
var points = [[0,0,0],[4,0,0],[4,0,1],[3,0,1],[3,0,2],[2,0,2],[2,0,3],[0,0,3]];
var knots = makeKnots(points);
var curve = NUBS(S0)(2)(knots)(points);
var mappingBase = ROTATIONAL_SURFACE(curve);
var base = R([1,2])([-PI/2])(MAP(mappingBase)(domainR));
base = T([0,1,2])([4.5,-43,2.5])(base);
base = COLOR(bColor)(base);
return base;
}
var buildcapital = function(){
var zcapital = 16;
var prof = 0.6;
var capital = [];
var points = [[3,4,0],[3,6,0],[5,7.5,0],[8,6,0],[8,2,0],[5,0,0],[1,1,0],[-0.5,4,0],[0,7,0],[2,9,0],[6,9.5,0],[9,8,0],[10.5,4,0],[9.5,0.5,0],[7,-2,0],[-1,-1,0],[-3.5,4,0],[-2,9,0],[2,12.5,0],[8,13,0],[20,13,0]];
var knots = makeKnots(points);
var center = [5,4,0];
var spes = 0.8;
var points2 = points.map(function(p){return [ spes*p[0] + (1-spes)*center[0], spes*p[1] + (1-spes)*center[1], 0 ]});
var curve = NUBS(S0)(2)(knots)(points);
var curve2 = NUBS(S0)(2)(knots)(points2);
var capit = BEZIER(S1)([curve,curve2]);
var frontSurface1 = MAP(capit)(domain2d);
capital.push(frontSurface1);
var latSurface = [];
var latSurface2 = [];
latSurface.push(curve);
latSurface2.push(curve2);
var points = points.map(function(p){return [p[0],p[1],p[2]+zcapital]});
var points2 = points2.map(function(p){return [p[0],p[1],p[2]+zcapital]});
var curve = NUBS(S0)(2)(knots)(points);
var curve2 = NUBS(S0)(2)(knots)(points2);
var capit2 = BEZIER(S1)([curve,curve2]);
var frontSurface2 = MAP(capit2)(domain2d);
capital.push(frontSurface2);
latSurface.push(curve);
latSurface2.push(curve2);
var latSurface = BEZIER(S1)(latSurface);
var latSurface = MAP(latSurface)(domain2d);
capital.push(latSurface);
var latSurface2 = BEZIER(S1)(latSurface2);
var latSurface2 = MAP(latSurface2)(domain2d);
capital.push(latSurface2);
var center = [5,4,prof];
var pointsProfile = points2.map(function(p){return [p[0],p[1],p[2] - zcapital+ prof]});
var curve = NUBS(S0)(2)(knots)(pointsProfile);
var fakePoint = BEZIER(S0)([center,center]);
var riempimento = BEZIER(S1)([fakePoint, curve]);
var riempimento = MAP(riempimento)(domain2d);
capital.push(riempimento);
var center = [5,4,zcapital - prof];
var pointsProfile = points2.map(function(p){return [p[0],p[1],p[2] - prof]});
var curve = NUBS(S0)(2)(knots)(pointsProfile);
var fakePoint = BEZIER(S0)([center,center]);
var riempimento = BEZIER(S1)([fakePoint, curve]);
var riempimento = MAP(riempimento)(domain2d);
capital.push(riempimento);
//otherside
var l = 30;
var points = [[3,4,0],[3,6,0],[5,7.5,0],[8,6,0],
[8,2,0],[5,0,0],[1,1,0],[-0.5,4,0],
[0,7,0],[2,9,0],[6,9.5,0],[9,8,0],
[10.5,4,0],[9.5,0.5,0],[7,-2,0],[-1,-1,0],
[-3.5,4,0],[-2,9,0],[2,12.5,0],[8,13,0],[20,13,0]];
var points = points.map(function(p){return [- p[0] + l , p[1],p[2]]});
var knots = makeKnots(points);
var center = [5+l-7,4,0];
var spes = 0.8;
var points2 = points.map(function(p){return [ spes*p[0] + (1-spes)*center[0], spes*p[1] + (1-spes)*center[1], 0 ]});
var curve = NUBS(S0)(2)(knots)(points);
var curve2 = NUBS(S0)(2)(knots)(points2);
var capit = BEZIER(S1)([curve,curve2]);
var frontSurface1 = MAP(capit)(domain2d);
capital.push(frontSurface1);
var latSurface = [];
var latSurface2 = [];
latSurface.push(curve);
latSurface2.push(curve2);
var points = points.map(function(p){return [p[0],p[1],p[2]+zcapital]});
var points2 = points2.map(function(p){return [p[0],p[1],p[2]+zcapital]});
var curve = NUBS(S0)(2)(knots)(points);
var curve2 = NUBS(S0)(2)(knots)(points2);
var capit2 = BEZIER(S1)([curve,curve2]);
var frontSurface2 = MAP(capit2)(domain2d);
capital.push(frontSurface2);
latSurface.push(curve);
latSurface2.push(curve2);
var latSurface = BEZIER(S1)(latSurface);
var latSurface = MAP(latSurface)(domain2d);
capital.push(latSurface);
var latSurface2 = BEZIER(S1)(latSurface2);
var latSurface2 = MAP(latSurface2)(domain2d);
capital.push(latSurface2);
var center = [5+l-7,4,prof];
var pointsProfile = points2.map(function(p){return [p[0],p[1],p[2] - zcapital+ prof]});
var curve = NUBS(S0)(2)(knots)(pointsProfile);
var fakePoint = BEZIER(S0)([center,center]);
var riempimento = BEZIER(S1)([fakePoint, curve]);
var riempimento = MAP(riempimento)(domain2d);
capital.push(riempimento);
var center = [5+l-7,4,zcapital - prof];
var pointsProfile = points2.map(function(p){return [p[0],p[1],p[2] - prof]});
var curve = NUBS(S0)(2)(knots)(pointsProfile);
var fakePoint = BEZIER(S0)([center,center]);
var riempimento = BEZIER(S1)([fakePoint, curve]);
var riempimento = MAP(riempimento)(domain2d);
capital.push(riempimento);
var base = T([1])([4.2])(SIMPLEX_GRID([[-8,14],[6.2],[-prof,zcapital-2*prof]]));
var torusSurface = R([1,2])([PI/2])(TORUS_SURFACE([3, 6.5])([50,10]));
var torusSurface = T([0,1,2])([15,6,8])(torusSurface);
capital.push(base);
capital.push(torusSurface);
var capital = STRUCT(capital);
var capital = S([0,1,2])([0.3,0.15,0.3])(capital);
capital = T([1])([-0.77])(capital);
capital = COLOR(bColor)(capital);
return capital;
}
var buildColumnBody = function(){
var hColumn = 4.2;
var rColumn = 0.2;
var points = [[rColumn, 0, 0],[rColumn*6.3/5,0,1/3*hColumn],[rColumn,0,hColumn]];
var pColumn = NUBS(S0)(2)([0,0,0,1,1,1])(points);
var mappingColumn = ROTATIONAL_SURFACE(pColumn);
var column = S([0,1,2])([10,10,10])(MAP(mappingColumn)(domainR));
column = R([1,2])([-PI/2])(column);
column = T([0,1,2])([4.5,-40-0.8,2.5])(column);
column = COLOR(bColor)(column);
return column;
}
var buildTunnel = function(){
var points = [[0.3,3,0.1],[1.15,3,0.1],[2,3,0.1]];
var points2 = [[0.3,1.9,0.1],[1.15,2.6,0.1],[2,1.9,0.1]];
var rect = NUBS(S0)(2)([0,0,0,1,1,1])(points);
var curve = NUBS(S0)(2)([0,0,0,1,1,1])(points2);
var upperlayer = BEZIER(S1)([curve,rect]);
var upperlayer = MAP(upperlayer)(domain2d);
var upperlayer2 = T([2])([5.8])(upperlayer);
var upperlayer = STRUCT([upperlayer,upperlayer2]);
var points = [[0.3,1.9,0.1],[1.15,2.6,0.1],[2,1.9,0.1]];
var points2 = points.map(function(n){return [n[0],n[1],n[2] + 5.8]});
var curve1 = NUBS(S0)(2)([0,0,0,1,1,1])(points);
var curve2 = NUBS(S0)(2)([0,0,0,1,1,1])(points2);
var roof = BEZIER(S1)([curve1,curve2]);
var roof = MAP(roof)(domain2d);
var solid1 = SIMPLEX_GRID([[0.3],[0.6],[6]]);
var solid2 = SIMPLEX_GRID([[0.3],[-0.6,0.4],[-0.05,5.9]]);
var solid3 = SIMPLEX_GRID([[0.3],[-1, 1.7],[-0.1,5.8]]);
var solid4 = SIMPLEX_GRID([[0.3],[-2.7,0.3],[-0.05,5.9]]);
var solid = STRUCT([solid1,solid2,solid3,solid4]);
var solid1 = SIMPLEX_GRID([[-2,1.5],[0.6],[6]]);
var solid2 = SIMPLEX_GRID([[-2,1.5],[-0.6,0.4],[-0.05,5.9]]);
var solid3 = SIMPLEX_GRID([[-2,1.5],[-1, 1.7],[-0.1,5.8]]);
var solid4 = SIMPLEX_GRID([[-2,1.5],[-2.7,0.3],[-0.05,5.9]]);
var solid5 = SIMPLEX_GRID([[-0.3,1.7],[-2.7,0.3],[-0.05,5.9]]);
var solid2 = STRUCT([solid1,solid2,solid3,solid4,solid5]);
var tunnel = STRUCT([solid,solid2,roof,upperlayer]);
tunnel = R([0,2])([PI/2])(tunnel);
tunnel = T([2])([6.9])(tunnel);
tunnel = COLOR(bColor)(tunnel);
tunnel = S([0])([1.4])(tunnel);
return tunnel;
}
var buildLateralArchway = function(){
var hBase = 0.4;
var xBase = 0.5;
var zBase = 1.9;
var base = [];
var base1 = T([0,1,2])([0.09,3,4.1])(SIMPLEX_GRID([[xBase],[hBase],[zBase]]));
base.push(base1);
var base2 = T([0])([7.72])(base1);
base.push(base2);
var base3 = T([0,1,2])([0.14,3,4.15])(SIMPLEX_GRID([[xBase-0.1],[hBase+0.4],[zBase-0.05]]));
base.push(base3);
var base4 = T([0])([7.72])(base3);
base.push(base4);
var hPillar = 2.3;
var spacePillars = 0.8;
var zPillar=(zBase-0.05- spacePillars) / 2;
var pillars = SIMPLEX_GRID([[-0.14,xBase-0.1],[-3-hBase-0.4,hPillar],[-4.15,zPillar,-spacePillars,zPillar]])
base.push(pillars);
var pillars2 = T([0])([7.72])(pillars);
base.push(pillars2);
var baseMiddlePillars = SIMPLEX_GRID([[-0.09,xBase],[-3-hBase-0.4-hPillar,hBase],[-4.1,zPillar+0.1,-spacePillars+0.1,zPillar+0.05]]);
base.push(baseMiddlePillars);
var baseMiddlePillars2 = T([0])([7.72])(baseMiddlePillars);
base.push(baseMiddlePillars2);
var lateralArchway = [];
var pointsArco1 = [[0,0,0],[0.05,0.5,0],[spacePillars-0.05,0.5,0],[spacePillars,0,0]];
var knots = makeKnots(pointsArco1);
var curve = NUBS(S0)(2)(knots)(pointsArco1);
var hArco = 1;
var points = [[0,hArco,0],[spacePillars,hArco,0],[spacePillars,hArco,0]];
var curve2 = NUBS(S0)(2)([0,0,0,1,1,1])(points);
var arco = BEZIER(S1)([curve,curve2]);
var arco1 = MAP(arco)(domain2d);
lateralArchway.push(arco1);
var arco2 = T([2])([xBase-0.1])(arco1);
lateralArchway.push(arco2);
var zPezzo = xBase;
points = [[0.375,0.49,-0.05],[0.525,0.49,-0.05],[0.625,hArco,-0.05],[0.275,hArco,-0.05]];
var points2 = points.map(function(p){return [p[0], p[1], p[2]+zPezzo]});
points = points.concat(points2);
var pezzo = SIMPLICIAL_COMPLEX(points)([[0,1,2,3],[4,0,3,7],[1,5,6,2],[3,2,6,7],[5,4,7,6],[4,5,1,0]]);
var pezzo = T([0])([-0.05])(pezzo);
lateralArchway.push(pezzo);
var pointsArco2 = pointsArco1.map(function(p){return [p[0],p[1],p[2]+(xBase-0.1)]});
knots = makeKnots(pointsArco2);
curve2 = NUBS(S0)(2)(knots)(pointsArco2);
var volta = BEZIER(S1)([curve,curve2]);
volta = MAP(volta)(domain2d);
lateralArchway.push(volta);
var zBase = 1.9;
var hPillar2= hArco;
hBase = 0.3;
var pillar = SIMPLEX_GRID([[-spacePillars,zPillar],[hPillar2],[xBase-0.1]]);
lateralArchway.push(pillar);
var pillar2 = T([0])([-spacePillars-zPillar])(pillar);
lateralArchway.push(pillar2);
lateralArchway = STRUCT(lateralArchway);
lateralArchway = R([0,2])([PI/2])(lateralArchway);
lateralArchway = T([0,1,2])([0.14,3+hBase+0.4+hPillar+hBase+0.2,4.15+spacePillars+zPillar])(lateralArchway);
base.push(lateralArchway);
var lateralArchway2 = T([0])([7.72])(lateralArchway);
base.push(lateralArchway2);
base = S([2])([1.45])(STRUCT(base));
base = T([2])([-1.8])(base);
base = COLOR(bColor)(base);
return base;
}
var buildSteps = function(){
var stepH = 0.13;
var stepZ = 0.155;
////frontal
//borders
var stepsBorder = [];
var stepsBorder1 = SIMPLEX_GRID([[0.6, -4.8, 0.6],[0.6],[3.4]]);
stepsBorder.push(stepsBorder1);
var stepsBorder2 = SIMPLEX_GRID([[-0.05, 0.5,-0.05,-4.8,-0.05,0.5,-0.05],[-0.6, 0.4],[-0.05,3.35]]);
stepsBorder.push(stepsBorder2);
var stepsBorder3 = SIMPLEX_GRID([[-0.1, 0.4,-0.1,-4.8,-0.1,0.4,-0.1],[-1, 1.7],[-0.1,2.5]]);
stepsBorder.push(stepsBorder3);
var stepsBorder4 = SIMPLEX_GRID([[-0.1, 0.4,-0.1,-4.8,-0.1,0.4,-0.1],[-1-0.6-0.6, 0.5],[-0.1 - 2.5,0.8]]);
stepsBorder.push(stepsBorder4);
var stepsBorder5 = SIMPLEX_GRID([[-0.05, 0.5,-0.05,-4.8,-0.05,0.5,-0.05],[-2.7,0.3],[-0.05,3.35]]);
stepsBorder.push(stepsBorder5);
var stepsBorder6 = SIMPLEX_GRID([[-0.1, 0.4,-0.1,-4.8,-0.1,0.4,-0.1],[-1,0.4],[-0.1 - 2.5,0.8]]);
stepsBorder.push(stepsBorder6);
stepsBorder = COLOR(bColor)(STRUCT(stepsBorder));
var finalStepsBorder = [];
finalStepsBorder.push(stepsBorder);
var hole1 = COLOR([0,0,0.1])(SIMPLEX_GRID([[-0.5,0.01],[-1-0.4,0.8],[-0.1-2.5,0.8]]));
finalStepsBorder.push(hole1);
var hole2 = T([0])([5])(hole1);
finalStepsBorder.push(hole2);
var grid = R([1,2])([PI/2])(CYL_SURFACE([0.02, 0.8])(20));
grid = T([0,1,2])([0.3,2.2,2.7])(grid);
var grid1 = T([2])([0.3])(grid);
var grid2 = T([2])([0.3])(grid1);
var vGrid1 = STRUCT([grid,grid1,grid2]);
var grid = T([0,1,2])([0.3,1.5,2.6])(CYL_SURFACE([0.02, 0.8])(20));
var grid1 = T([1])([0.3])(grid);
var grid2 = T([1])([0.3])(grid1);
var vGrid2 = STRUCT([grid,grid1,grid2]);
var vGrid = STRUCT([vGrid1,vGrid2]);
var vGridRight = T([0])([5.4])(vGrid);
finalStepsBorder = STRUCT(finalStepsBorder);
//steps
var steps = [];
var steps1 = SIMPLEX_GRID([[-0.5, 5, -0.5],[stepH],[stepZ]]);
var trans = T([1,2])([stepH, stepZ]);
var nSteps = 22;
var steps = COLOR(bColor)(STRUCT(REPLICA(nSteps)([steps1,trans])));
var steps = STRUCT([finalStepsBorder,steps]);
var statue1 = buildStatue();
var statue2 = R([0,2])([PI])(buildStatue());
statue2 = T([0,1,2])([0.6,3.07,0.5])(statue2);
statue1 = T([0,1,2])([5.4,3.07,0.5])(statue1);
var finalSteps = STRUCT([steps,vGrid,vGridRight,hole1,hole2,statue1,statue2]);
var finalSteps = S([0])([1.4])(finalSteps);
return finalSteps;}
var buildcolonnade = function(){
var capital = buildcapital();
var column = buildColumnBody();
var base = buildColumnBase();
var qBase = T([0,1,2])([0.5,-43.5,-1.5])(CUBOID([8,1,8]));
column = STRUCT([capital, column,base,qBase]);
column = S([0,1,2])([0.07,0.1,0.07])(column);
column = T([0,1,2])([0.1,7.35,3.55])(column);
var t = T([0])([1.52]);
var colonnade = STRUCT([column,t,column,t,column,t,column,t,column,t,column]);
colonnade = COLOR(bColor)(colonnade);
return colonnade;}
var buildTimpano = function(){
//base
var xBaseTimpano = 8.52;
var zBaseTimpano = 3.55;
var timpano = [];
var pointsNS = [[0.2,0,0],[0.2,0.15,0],[0.15,0.2,0],[0.15,0.3,0],[0.2,0.4,0],[0.15,0.45,0],[0.15,0.55,0],[0.2,0.65,0],[0.1,0.72,0],[0.05,0.75,0],[0.05,0.85,0],[0.1,0.88,0],[0.2,0.9,0],[0.15,0.95,0],[0.15,1.05,0],[0.2,1.1,0],[0.2,1.51,0]];
pointsNS = Point.scaleY(pointsNS,0.5);
var pointsNSR = Point.rotate(pointsNS,-PI/4,1);
var points = Point.scale(pointsNS, SQRT(2));
points = Point.rotate(points,-PI/4,1);
var points2 = Point.rotate(points,-PI/2,1);
points2 = Point.translate(points2,0,xBaseTimpano);
var points3 = Point.rotate(pointsNSR,+ PI/4,1);
points3 = Point.translate(points3,2,zBaseTimpano);
var points4 = Point.rotate(pointsNSR,-PI/2-PI/4,1);
points4 = Point.translate(points4,0,xBaseTimpano);
points4 = Point.translate(points4,2,zBaseTimpano);
////
////
var knots = makeKnots(points);
var profile = NUBS(S0)(2)(knots)(points);
var profile2 = NUBS(S0)(2)(knots)(points2);
var profile3 = NUBS(S0)(2)(knots)(points3);
var profile4 = NUBS(S0)(2)(knots)(points4);
var curve = BEZIER(S1)([profile,profile2]);
var curve2 = BEZIER(S1)([profile,profile3]);
var curve3 = BEZIER(S1)([profile2,profile4]);
var surface = MAP(curve)(domain2d);
var surface2 = MAP(curve2)(domain2d);
var surface3 = MAP(curve3)(domain2d);
timpano.push(surface);
timpano.push(surface2);
timpano.push(surface3);
//spessore
var spessore = SIMPLEX_GRID([[-0.2,xBaseTimpano-0.4],[0.05],[-0.2,0.366]]);
timpano.push(spessore);
var spessoreLaterale1 = SIMPLEX_GRID([[-0.2,0.45],[0.05],[-0.2-0.366,zBaseTimpano-0.565]]);
timpano.push(spessoreLaterale1);
var spessoreLaterale2 = T([0])([xBaseTimpano-0.85])(spessoreLaterale1);
timpano.push(spessoreLaterale2);
var smallWall1 = SIMPLEX_GRID([[-0.2 - 0.45,xBaseTimpano-1.25],[-0.05,0.65],[-0.2 - 0.366 + 0.05, 0.05]]);
timpano.push(smallWall1);
var smallWall2 = SIMPLEX_GRID([[-0.2 - 0.4,0.05],[-0.05,0.65],[-0.2-0.366,zBaseTimpano-0.565]]);
timpano.push(smallWall2);
var smallWall3 = T([0])([xBaseTimpano-1.25])(smallWall2);
timpano.push(smallWall3);
var smallWall4 = SIMPLEX_GRID([[-0.2 - 0.4,xBaseTimpano-1.2],[-0.7,0.05],[-0.2 - 0.366 + 0.05, zBaseTimpano-0.565]]);
timpano.push(smallWall4);
//latoInferiore
var cornice = [];
var xBaseTriangolo = xBaseTimpano+0.2;
var hTriangolo = 2.5;
var ipotenusa = SQRT((hTriangolo*hTriangolo) + (xBaseTriangolo/2*xBaseTriangolo/2));
var alpha = Math.asin(hTriangolo/ipotenusa)+PI/4.8;
var pointsNR = [[0,0,0.3],[0,0,0.1],[0,0.05,0.05],[0,0.1,0.1],[0,0.15,0.05],[0,0.2,0.1],[0,0.2,0.3]];
pointsNR = Point.translate(pointsNR,1,0.01);
var points=Point.rotate(pointsNR,-alpha,2);
points = Point.scaleY(points,1.5);
var points2 = Point.rotate(pointsNR,alpha,2);
points2 = Point.translate(points2,0,xBaseTriangolo);
points2 = Point.scaleY(points2,1.5);
var knots = makeKnots(points);
var profile = NUBS(S0)(2)(knots)(points);
var profile2 = NUBS(S0)(2)(knots)(points2);
var latoInferiore = BEZIER(S1)([profile,profile2]);
var lateraleSottoP1 = points[0];
var lateraleSottoP1L = points2[0];
var curve = MAP(latoInferiore)(domain2d);
cornice.push(curve);
var punto1Sfondo = points[points.length-1];
var punto2Sfondo = points2[points2.length-1];
//lati superiori
var points = [[0,0.1,0.4],[0,0.1,0.1],[0,0.1,0.05],[0,0.15,0.1],[0,0.2,0.1],[0,0.25,0.05],[0,0.3,0.1],[0,0.35,0],[0,0.4,0.05],[0,0.4,0.1],[0,0.4,0.4]];
points = Point.translate(points,1,-0.088);
points = Point.translate(points,0,0.03);
var points2 = Point.translate(points,0,xBaseTriangolo/2);
points2 = Point.translate(points2,1,hTriangolo);
var points3 = Point.translate(points,0,xBaseTriangolo-0.05);
var knots = makeKnots(points);
var profile = NUBS(S0)(2)(knots)(points);
var profile2 = NUBS(S0)(2)(knots)(points2);
var profile3 = NUBS(S0)(2)(knots)(points3);
var latoSuperiore1 = BEZIER(S1)([profile,profile2]);
var latoSuperiore2 = BEZIER(S1)([profile3,profile2]);
var curve = MAP(latoSuperiore1)(domain2d);
var curve2 = MAP(latoSuperiore2)(domain2d);
cornice.push(curve);
cornice.push(curve2);
var punto3Sfondo = points2[0];
var zLaterale = zBaseTimpano - 0.3;
var tettoPunto1 = points[points.length-1];
var tettoPunto2 = points2[points2.length-1];
var tettoPunto3 = [tettoPunto2[0],tettoPunto2[1],tettoPunto2[2]+zLaterale];
var tetto2Punto1 = points3[points3.length-1];
//laterali
//laterale1
var pointsLato1 = [[points[0][0],points[0][1],points[0][2]+zLaterale],[points[points.length-1][0],points[points.length-1][1],points[points.length-1][2]+zLaterale]];
pointsLato1.push(pointsLato1[1]);
var tettoPunto4 = pointsLato1[1];
var profiloLato1 = NUBS(S0)(2)([0,0,0,1,1,1])(pointsLato1);
var lato1 = BEZIER(S1)([profiloLato1,profile]);
lato1 = MAP(lato1)(domain2d);
cornice.push(lato1);
var punto3Sfondo = points2[0];
var lateraleSottoP2 = pointsLato1[0];
var lateraleSotto = NUBS(S0)(2)([0,0,0,1,1,1])([lateraleSottoP2,lateraleSottoP1,lateraleSottoP1]);
var lateraleSopraP1 = [lateraleSottoP1[0]+0.4,lateraleSottoP1[1],lateraleSottoP1[2]];
var lateraleSopraP2 = [lateraleSottoP2[0]+0.4,lateraleSottoP2[1],lateraleSottoP2[2]];
var lateraleSopra = NUBS(S0)(2)([0,0,0,1,1,1])([lateraleSopraP2,lateraleSopraP2,lateraleSopraP1]);
var laterale = BEZIER(S1)([lateraleSopra,lateraleSotto]);
laterale = MAP(laterale)(domain2d);
cornice.push(laterale);
//laterale2
var pointsLato1 = [[points3[0][0],points3[0][1],points3[0][2]+zLaterale],[points3[points3.length-1][0],points3[points3.length-1][1],points3[points3.length-1][2]+zLaterale]];
pointsLato1.push(pointsLato1[1]);
var tetto2Punto4 = pointsLato1[1];
var profiloLato1 = NUBS(S0)(2)([0,0,0,1,1,1])(pointsLato1);
var lato1 = BEZIER(S1)([profiloLato1,profile3]);
lato1 = MAP(lato1)(domain2d);
cornice.push(lato1);
var lateraleSottoP2L = pointsLato1[0];
var lateraleSotto = NUBS(S0)(2)([0,0,0,1,1,1])([lateraleSottoP2L,lateraleSottoP1L,lateraleSottoP1L]);
var lateraleSopraP1 = [lateraleSottoP1L[0]-0.4,lateraleSottoP1L[1],lateraleSottoP1L[2]];
var lateraleSopraP2 = [lateraleSottoP2L[0]-0.4,lateraleSottoP2L[1],lateraleSottoP2L[2]];
var lateraleSopra = NUBS(S0)(2)([0,0,0,1,1,1])([lateraleSopraP2,lateraleSopraP2,lateraleSopraP1]);
var laterale = BEZIER(S1)([lateraleSopra,lateraleSotto]);
laterale = MAP(laterale)(domain2d);
cornice.push(laterale);
cornice = STRUCT(cornice);
cornice = T([0,1,2])([-0.13,0.75,-0.1])(cornice);
timpano.push(cornice);
//cubetti
var xCubo = 0.1;
var yCubo = 0.15;
var zCubo = 0.1;
var nCubi = 35;
var space = (xBaseTimpano- 0.45 - xCubo*nCubi)/(nCubi-1);
var cubo = CUBOID([xCubo,yCubo,zCubo]);
var t = T([0])([space+xCubo]);
var cubetti = STRUCT(REPLICA(nCubi)([cubo,t]));
cubetti = T([0,1,2])([0.15+0.06,8.08-7.465,3.44-3.35])(cubetti);
timpano.push(cubetti);
//sfondo
var sfondo = SIMPLICIAL_COMPLEX([punto1Sfondo,punto2Sfondo,punto3Sfondo])([[0,1,2]]);
sfondo = T([0,1,2])([-0.13,0.75,-0.1])(sfondo);
timpano.push(sfondo);
//cubetti sfondo
var xCubo = 0.1;
var yCubo = 0.15;
var zCubo = 0.1;
var nCubi = 15;
var cubo = CUBOID([xCubo,yCubo,zCubo]);
cubo = T([0,1,2])([xBaseTriangolo/2-0.21,hTriangolo+8.1,3.42])(cubo);
var space = (ipotenusa + 1 - xCubo*nCubi)/(nCubi-1);
var tx = space*SIN(alpha-PI/24);
var ty = space*COS(alpha-PI/24);
var t = T([0,1])([-tx,-ty]);
var cubetti = T([0,1,2])([0.02,-7.465,-3.35])(STRUCT(REPLICA(nCubi)([cubo,t])));
var t2 = T([0,1])([tx,-ty]);
var cubetti2 = T([0,1,2])([0.06,-7.465,-3.35])(STRUCT(REPLICA(nCubi)([cubo,t2])));
timpano.push(cubetti);
timpano.push(cubetti2);
//cubetti laterali
var xCubo = 0.1;
var yCubo = 0.15;
var zCubo = 0.1;
var nCubi = 15;
var space = (zBaseTimpano- 0.27 - xCubo*nCubi)/(nCubi-1);
var cubo = CUBOID([xCubo,yCubo,zCubo]);
cubo = T([0,1,2])([0.15+0.06-xCubo-0.02,8.08-7.465,3.42-3.35+zCubo+0.05])(cubo);
var tz = T([2])([space+zCubo]);
var cubettiLaterali1 = STRUCT(REPLICA(nCubi)([cubo,tz]));
timpano.push(cubettiLaterali1);
var cubettiLaterali2 = T([0])([xBaseTimpano + xCubo - 0.38])(cubettiLaterali1);
timpano.push(cubettiLaterali2);
//tetto
var tetto = SIMPLICIAL_COMPLEX([tettoPunto1,tettoPunto2,tettoPunto3,tettoPunto4,tettoPunto1])([[0,1,3],[2,3,1]]);
var tetto2 = SIMPLICIAL_COMPLEX([tetto2Punto1,tettoPunto2,tettoPunto3,tetto2Punto4,tetto2Punto1])([[0,1,3],[2,3,1]]);
tetto = STRUCT([tetto,tetto2]);
tetto = T([0,1,2])([-0.13,0.75,-0.1])(tetto);
tetto = COLOR([205/255,92/255,92/255])(tetto);
var plate = SIMPLEX_GRID([[1],[0.5],[0.1]]);
plate = T([0,2])([xBaseTimpano/2 - 0.5,0.05])(plate);
timpano.push(plate);
var basRelief = buildStatue2();
basRelief = T([0,1,2])([4,1.3,0.01])(basRelief);
timpano.push(basRelief);
var profBasRelief = buildProfBasRelief();
profBasRelief = T([0,1,2])([4,1.3,0.01])(profBasRelief);
var ornament1 = TORUS_SURFACE([0.05, 0.2])([50,10]);
ornament1 = T([0,1,2])([1.5,1.5,0.2])(ornament1);
ornament1 = S([0])([1.6])(ornament1);
timpano.push(ornament1);
var ornament2 = T([0])([3.8])(ornament1);
timpano.push(ornament2);
//ornament3
var ornPoints = [[0,1,0],[0.5,1,0],[0.5,0.2,0],[0.5,0.0,0],
[0.5,-0.2,0],[0.5,-0.6,0],[0,-0.8,0],[-0.5,-0.6,0],
[-0.5,-0.2,0],[-0.5,0,0],[-0.5,0.2,0],[-0.5,1,0],[0,1,0]];
var ornProfile = NUBS(S0)(2)(makeKnots(ornPoints))(ornPoints);
var fake = [0,0,0];
var fakeProfile = NUBS(S0)(3)([0,0,0,1,1,1])([fake,fake]);
var ornSurface = BEZIER(S1)([fakeProfile,ornProfile]);
var ornPoints2 = Point.translate(ornPoints,2,0.2);
var ornProfile2 = NUBS(S0)(2)(makeKnots(ornPoints2))(ornPoints2);
var latOrnSurface = BEZIER(S1)([ornProfile,ornProfile2]);
var ornament3 = [];
ornSurface = MAP(ornSurface)(domain2d);
ornament3.push(ornSurface);
latOrnSurface = MAP(latOrnSurface)(domain2d);
ornament3.push(latOrnSurface);
ornament3 = STRUCT(ornament3);
ornament3 = T([0,1,2])([4.25,1.8,0.08])(ornament3);
timpano.push(ornament3);
timpano = STRUCT(timpano);
timpano = COLOR(bColor)(timpano);
var statue1 = buildStatue();
var pedestal2 = T([0,1,2])([0.15,-0.35,-0.125])(SIMPLEX_GRID([[0.3],[0.3],[0.3]]));
pedestal2 = COLOR(bColor)(pedestal2);
var finalStatue1 = STRUCT([statue1,pedestal2]);
finalStatue1 = T([0,1,2])([0.2,1.6,0.8])(finalStatue1);
var statue2 = buildStatue();
var pedestal2 = T([0,1,2])([0.15,-0.35,-0.125])(SIMPLEX_GRID([[0.3],[0.3],[0.3]]));
pedestal2 = COLOR(bColor)(pedestal2);
var finalStatue2 = STRUCT([statue2,pedestal2]);
finalStatue2 = R([0,2])([PI])(finalStatue2);
finalStatue2 = T([0,1,2])([8.3,1.6,0.8])(finalStatue2);
var statue3 = T([0,1,2])([-0.05,0.05,0.2])(buildStatue2());
var pedestal1 = COLOR(bColor)(SIMPLEX_GRID([[0.4],[0.1],[0.4]]));
var pedestal2 = T([0,1,2])([0.05,-0.3,0.05])(SIMPLEX_GRID([[0.3],[0.3],[0.3]]));
pedestal2 = COLOR(bColor)(pedestal2);
var finalStatue3 = STRUCT([statue3,pedestal2,pedestal1]);
finalStatue3 = R([0,2])([PI])(finalStatue3);
finalStatue3 = T([0,1,2])([4.475,3.6,0.8])(finalStatue3);
timpano = STRUCT([timpano,tetto,finalStatue1,finalStatue2,finalStatue3,profBasRelief]);
timpano = T([0,1,2])([-0.06,7.465,3.35])(timpano);
return timpano;
}
var buildCorniceDown = function(){
var zBaseTimpano = 3.55;
var corniceDown = [];
var pointsNS = [[0.2,0,0],[0.2,0.15,0],[0.15,0.2,0],[0.15,0.3,0],[0.2,0.4,0],[0.15,0.45,0],[0.15,0.55,0],[0.2,0.65,0],[0.1,0.72,0],[0.05,0.75,0],[0.05,0.85,0],[0.1,0.88,0],[0.2,0.9,0],[0.15,0.95,0],[0.15,1.05,0],[0.2,1.1,0],[0.2,1.51,0]];
pointsNS = Point.scaleY(pointsNS,0.5);
var pointsCornicione1 = Point.rotate(pointsNS,-PI/4,1);
var knots = makeKnots(pointsNS);
var pointsCornicioneLeft1 = Point.rotate(pointsCornicione1,-PI/2,1);
pointsCornicione1 = Point.translate(pointsCornicione1,2,zBaseTimpano-0.15);
pointsCornicione1 = Point.translate(pointsCornicione1,0,0.1);
var pointsCornicione2 = Point.translate(pointsCornicione1,0,-3.805);
var profileCornicione1 = NUBS(S0)(2)(knots)(pointsCornicione1);
var profileCornicione2 = NUBS(S0)(2)(knots)(pointsCornicione2);
var cornicione = BEZIER(S1)([profileCornicione1,profileCornicione2]);
cornicione = MAP(cornicione)(domain2d);
corniceDown.push(cornicione);
//cornicione left
pointsCornicioneLeft1 = Point.translate(pointsCornicioneLeft1,2,zBaseTimpano-0.15);
pointsCornicioneLeft1 = Point.translate(pointsCornicioneLeft1,0,xBaseTimpano-0.1);
var pointsCornicioneLeft2 = Point.translate(pointsCornicioneLeft1,0,3.81);
var profileCornicioneLeft1 = NUBS(S0)(2)(knots)(pointsCornicioneLeft1);
var profileCornicioneLeft2 = NUBS(S0)(2)(knots)(pointsCornicioneLeft2);
var cornicioneLeft = BEZIER(S1)([profileCornicioneLeft1,profileCornicioneLeft2]);
cornicioneLeft = MAP(cornicioneLeft)(domain2d);
corniceDown.push(cornicioneLeft);
corniceDown = STRUCT(corniceDown);
corniceDown = T([0,1,2])([-0.06+ 3.6,7.465 ,3.35])(corniceDown);;
return corniceDown;
}
var buildCornice = function(){
var zBaseTimpano = 3.55;
var cornice = [];
var points = [[0.4,0,0],
[0.25,0,0],[0.22,0.02,0],[0.2,0.05,0],
[0.18,0.07,0],[0.1,0.1,0],[0.05,0.15,0],
[0.1,0.2,0],[0.25,0.2,0],[0.4,0.2,0]];
var pointsLeft = Point.rotate(points,-PI/2 - PI/4,1);
points = Point.rotate(points,-PI/4,1);
points = Point.translate(points,2,zBaseTimpano);
var points2 = Point.translate(points,0,-3.85);
var knots = makeKnots(points);
var profile = NUBS(S0)(2)(knots)(points);
var profile2 = NUBS(S0)(2)(knots)(points2);
var corniceRight = BEZIER(S1)([profile,profile2]);
corniceRight = MAP(corniceRight)(domain2d);
cornice.push(corniceRight);
//cornice left
pointsLeft = Point.translate(pointsLeft,2,zBaseTimpano);
pointsLeft = Point.translate(pointsLeft,0,xBaseTimpano-0.2);
var points2 = Point.translate(pointsLeft,0,4.06);
var profileLeft1 = NUBS(S0)(2)(knots)(pointsLeft);
var profileLeft2 = NUBS(S0)(2)(knots)(points2);
var corniceLeft = BEZIER(S1)([profileLeft1,profileLeft2]);
corniceLeft = MAP(corniceLeft)(domain2d);
cornice.push(corniceLeft);
cornice = STRUCT(cornice);
cornice = T([0,1,2])([-0.06,8.3,3.05])(cornice);
return cornice;
}
var buildCorniceUp = function(){
var zBaseTimpano = 3.55;
var pointsNR = [[0.4,0,0],[0.25,0,0],[0.22,0.02,0],
[0.2,0.05,0],[0.18,0.07,0],[0.1,0.1,0],[
0.05,0.15,0],[0.1,0.2,0]];
var points = Point.rotate(pointsNR,-PI/4,1);
var points2 = Point.rotate(points,-PI/2,1);
points = Point.translate(points,2,zBaseTimpano);
points = Point.translate(points,0,-3.85);
points2 = Point.translate(points2,0,xBaseTimpano-0.2+4.06);
points2 = Point.translate(points2,2,zBaseTimpano);
var knots = makeKnots(points);
var profile = NUBS(S0)(2)(knots)(points);
var profile2 = NUBS(S0)(2)(knots)(points2);
var corniceUp = BEZIER(S1)([profile,profile2]);
corniceUp = MAP(corniceUp)(domain2d);
corniceUp = T([0,1,2])([-0.06,10.3,3.05])(corniceUp);
return corniceUp;
}
var buildFacade = function(){
var xBaseTimpano = 8.52;
var facade = [];
exports.steps = buildSteps();
facade.push(steps);
exports.tunnel = buildTunnel();
facade.push(tunnel);
exports.colonnade = buildcolonnade();
facade.push(colonnade);
exports.lateralArchway = buildLateralArchway();
facade.push(lateralArchway);
exports.timpano = buildTimpano();
facade.push(timpano);
facade = STRUCT(facade);
return facade;}
var buildWinOrnament = function(){
var frame = [];
var xBaseTimpano = 8.52;
var zBaseTimpano = 3.55;
var xBaseTriangle = xBaseTimpano+0.2;
var hTriangle = 2.5;
var hypotenuse = SQRT((hTriangle*hTriangle) + (xBaseTriangle/2*xBaseTriangle/2));
var alpha = Math.asin(hTriangle/hypotenuse)+PI/4.8;
var pointsNR = [[0,0,0.3],[0,0,0.1],[0,0.05,0.05],
[0,0.1,0.1],[0,0.15,0.05],[0,0.2,0.1],
[0,0.2,0.3]];
pointsNR = Point.translate(pointsNR,1,0.01);
var points=Point.rotate(pointsNR,-alpha,2);
points = Point.scaleY(points,1.5);
var points2 = Point.rotate(pointsNR,alpha,2);
points2 = Point.translate(points2,0,xBaseTriangle);
points2 = Point.scaleY(points2,1.5);
var knots = makeKnots(points);
var profile = NUBS(S0)(2)(knots)(points);
var profile2 = NUBS(S0)(2)(knots)(points2);
var lowerSide = BEZIER(S1)([profile,profile2]);
var LatDownP1 = points[0];
var LatDownP1L = points2[0];
var curve = MAP(lowerSide)(domain2d);
frame.push(curve);
//lati superiori
var points = [[0,0.1,0.4],[0,0.1,0.1],[0,0.1,0.05],[0,0.15,0.1],
[0,0.2,0.1],[0,0.25,0.05],[0,0.3,0.1],[0,0.35,0],
[0,0.4,0.05],[0,0.4,0.1],[0,0.4,0.4]];
points = Point.translate(points,1,-0.088);
points = Point.translate(points,0,0.03);
var points2 = Point.translate(points,0,xBaseTriangle/2);
points2 = Point.translate(points2,1,hTriangle);
var points3 = Point.translate(points,0,xBaseTriangle-0.05);
var knots = makeKnots(points);
var profile = NUBS(S0)(2)(knots)(points);
var profile2 = NUBS(S0)(2)(knots)(points2);
var profile3 = NUBS(S0)(2)(knots)(points3);
var upperSide1 = BEZIER(S1)([profile,profile2]);
var upperSide2 = BEZIER(S1)([profile3,profile2]);
var curve = MAP(upperSide1)(domain2d);
var curve2 = MAP(upperSide2)(domain2d);
frame.push(curve);
frame.push(curve2);
var zLat = zBaseTimpano - 0.3;
var roofPoint1 = points[points.length-1];
var roofPoint2 = points2[points2.length-1];
var roofPoint3 = [roofPoint2[0],roofPoint2[1],roofPoint2[2]+zLat];
var roof2Point1 = points3[points3.length-1];
//lateral closure 1
var fakePoint = [points[0],points[0], points[points.length-1]];
var fakePointNubs = NUBS(S0)(2)([0,0,0,1,1,1])(fakePoint);
var cLat1 = BEZIER(S1)([fakePointNubs,profile]);
cLat1 = MAP(cLat1)(domain2d);
frame.push(cLat1);