-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathObjetArmoire.pde
157 lines (152 loc) · 6.58 KB
/
ObjetArmoire.pde
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
class ObjetArmoire extends Objet {
ObjetArmoire(PVector pos, PVector taille, float epaisseurPlanche, float angle, int nombrePlanche) {
this(pos, taille, epaisseurPlanche, angle, nombrePlanche, false);
}
ObjetArmoire(PVector pos, PVector taille, float epaisseurPlanche, float angle, int nombrePlanche, color[] couleur) {
this(pos, taille, epaisseurPlanche, angle, nombrePlanche, false, couleur);
}
ObjetArmoire(PVector pos, PVector taille, float epaisseurPlanche, float angle, int nombrePlanche, PImage[] texture) {
this(pos, taille, epaisseurPlanche, angle, nombrePlanche, false, texture);
}
ObjetArmoire(PVector pos, PVector taille, float epaisseurPlanche, float angle, int nombrePlanche, boolean isMirrored) {
// Fond
add(new Partie(
new PVector(epaisseurPlanche, taille.y - epaisseurPlanche, 0),
new PVector(taille.x - epaisseurPlanche*2, taille.y - epaisseurPlanche, epaisseurPlanche),
angle));
// Contour
add(new Partie(
new PVector(0, taille.y - epaisseurPlanche, 0),
new PVector(epaisseurPlanche, taille.y - epaisseurPlanche, taille.z),
angle));
add(new Partie(
new PVector(taille.x - epaisseurPlanche, taille.y - epaisseurPlanche, 0),
new PVector(epaisseurPlanche, taille.y - epaisseurPlanche, taille.z),
angle));
add(new Partie(
new PVector(0, taille.y, 0), new PVector(taille.x, epaisseurPlanche, taille.z),
angle));
// Planche
for (int i = 0; i < nombrePlanche; i++) {
add(new Partie(
new PVector(epaisseurPlanche, i * ((taille.y) / nombrePlanche) + epaisseurPlanche, epaisseurPlanche),
new PVector(taille.x - epaisseurPlanche*2, epaisseurPlanche, taille.z - epaisseurPlanche*2),
angle));
}
// Porte
add(new Partie(
new PVector(epaisseurPlanche, taille.y - epaisseurPlanche, taille.z -epaisseurPlanche),
new PVector(taille.x - epaisseurPlanche*2, taille.y - epaisseurPlanche, epaisseurPlanche),
angle));
// Poigné
add(new Partie(
new PVector((isMirrored ? taille.x - epaisseurPlanche*4 : epaisseurPlanche*3), taille.y/2, taille.z),
new PVector(epaisseurPlanche, epaisseurPlanche, epaisseurPlanche/3),
angle));
add(new Partie(
new PVector((isMirrored ? taille.x - epaisseurPlanche*7 : epaisseurPlanche*7), taille.y/2, taille.z + epaisseurPlanche/3),
new PVector((isMirrored ? 1 : -1) * epaisseurPlanche*4, epaisseurPlanche, epaisseurPlanche/3),
angle));
moveTo(pos);
}
ObjetArmoire(PVector pos, PVector taille, float epaisseurPlanche, float angle, int nombrePlanche, boolean isMirrored, color[] couleur) {
// Fond
add(new Partie(
new PVector(epaisseurPlanche, taille.y - epaisseurPlanche, 0),
new PVector(taille.x - epaisseurPlanche*2, taille.y - epaisseurPlanche, epaisseurPlanche),
angle,
couleur[0]));
// Contour
add(new Partie(
new PVector(0, taille.y - epaisseurPlanche, 0),
new PVector(epaisseurPlanche, taille.y - epaisseurPlanche, taille.z),
angle,
couleur[1]));
add(new Partie(
new PVector(taille.x - epaisseurPlanche, taille.y - epaisseurPlanche, 0),
new PVector(epaisseurPlanche, taille.y - epaisseurPlanche, taille.z),
angle,
couleur[2]));
add(new Partie(
new PVector(0, taille.y, 0),
new PVector(taille.x, epaisseurPlanche, taille.z),
angle,
couleur[3]));
// Planche
for (int i = 0; i < nombrePlanche; i++) {
add(new Partie(
new PVector(epaisseurPlanche, i * ((taille.y) / nombrePlanche) + epaisseurPlanche, epaisseurPlanche),
new PVector(taille.x - epaisseurPlanche*2, epaisseurPlanche, taille.z - epaisseurPlanche*2),
angle,
couleur[4]));
}
// Porte
add(new Partie(
new PVector(epaisseurPlanche, taille.y - epaisseurPlanche, taille.z -epaisseurPlanche),
new PVector(taille.x - epaisseurPlanche*2, taille.y - epaisseurPlanche, epaisseurPlanche),
angle,
couleur[5]));
// Poigné
add(new Partie(
new PVector((isMirrored ? taille.x - epaisseurPlanche*4 : epaisseurPlanche*3), taille.y/2, taille.z),
new PVector(epaisseurPlanche, epaisseurPlanche, epaisseurPlanche/3),
angle,
couleur[6]));
add(new Partie(
new PVector((isMirrored ? taille.x - epaisseurPlanche*7 : epaisseurPlanche*7), taille.y/2, taille.z + epaisseurPlanche/3),
new PVector((isMirrored ? 1 : -1) * epaisseurPlanche*4, epaisseurPlanche, epaisseurPlanche/3),
angle,
couleur[7]));
moveTo(pos);
}
ObjetArmoire(PVector pos, PVector taille, float epaisseurPlanche, float angle, int nombrePlanche, boolean isMirrored, PImage[] texture) {
// Fond
add(new Partie(
new PVector(epaisseurPlanche, taille.y - epaisseurPlanche, 0),
new PVector(taille.x - epaisseurPlanche*2, taille.y - epaisseurPlanche, epaisseurPlanche),
angle,
texture[0]));
// Contour
add(new Partie(
new PVector(0, taille.y - epaisseurPlanche, 0),
new PVector(epaisseurPlanche, taille.y - epaisseurPlanche, taille.z),
angle,
texture[1]));
add(new Partie(
new PVector(taille.x - epaisseurPlanche, taille.y - epaisseurPlanche, 0),
new PVector(epaisseurPlanche, taille.y - epaisseurPlanche, taille.z),
angle,
texture[2]));
add(new Partie(
new PVector(0, taille.y, 0),
new PVector(taille.x, epaisseurPlanche, taille.z),
angle,
texture[3]));
// Planche
for (int i = 0; i < nombrePlanche; i++) {
add(new Partie(
new PVector(epaisseurPlanche, i * ((taille.y) / nombrePlanche) + epaisseurPlanche, epaisseurPlanche),
new PVector(taille.x - epaisseurPlanche*2, epaisseurPlanche, taille.z - epaisseurPlanche*2),
angle,
texture[4]));
}
// Porte
add(new Partie(
new PVector(epaisseurPlanche, taille.y - epaisseurPlanche, taille.z -epaisseurPlanche),
new PVector(taille.x - epaisseurPlanche*2, taille.y - epaisseurPlanche, epaisseurPlanche),
angle,
texture[5]));
// Poigné
add(new Partie(
new PVector((isMirrored ? taille.x - epaisseurPlanche*4 : epaisseurPlanche*3), taille.y/2, taille.z),
new PVector(epaisseurPlanche, epaisseurPlanche, epaisseurPlanche/3),
angle,
texture[6]));
add(new Partie(
new PVector((isMirrored ? taille.x - epaisseurPlanche*7 : epaisseurPlanche*7), taille.y/2, taille.z + epaisseurPlanche/3),
new PVector((isMirrored ? 1 : -1) * epaisseurPlanche*4, epaisseurPlanche, epaisseurPlanche/3),
angle,
texture[7]));
moveTo(pos);
}
}