-
Notifications
You must be signed in to change notification settings - Fork 0
/
piedistallo-scale.js
52 lines (40 loc) · 1.02 KB
/
piedistallo-scale.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
var building;
var mkCubiTraGradoni = function () {
var dominio_cubi = SIMPLEX_GRID([
REPLICA(10)([1,-3]),
[-2,3],
[1]
]);
var mapping = function(p){
var alfa = (p[0]*2*PI)/40;
var mod = p[1];
var w = p[2];
return [mod*COS(alfa),mod*SIN(alfa),w];
};
return MAP(mapping)(dominio_cubi);
};
var mkCylinderPieno = function(r,h,n,m,p,color) {
r = (r === 0? 0 : (r || 1));
h = (h===0? 0 : (h || 1));
n = n || 16;
m = m || 1;
p = p || 1;
color = color || [0,1,1];
var dominioSolido = SIMPLEX_GRID([ REPEAT(n)(2*PI/n), REPEAT(m)((r)/m), REPEAT(p)(h/p) ]);
var mappingSolido = function(pt) {
return [pt[1]*SIN(pt[0]), pt[1]*COS(pt[0]), pt[2]];
};
dominioSolido = MAP(mappingSolido)(dominioSolido);
return dominioSolido;
};
var mkGradoni = function () {
var gradoni = [];
for(var i = 0; i<5; i++){
gradoni.push(mkCylinderPieno(5-(0.5*i),0.25*i,40));
}
return STRUCT([gradoni]);
}
building = STRUCT([mkCubiTraGradoni(),mkGradoni()]);
COLOR([0,0,0])(building);
DRAW(building);
//TODO non funzia gradoni