Une petite liste de lien pour l'atelier :
Explication :
// Rotate a rectangle around the y-axis and x-axis
void setup() {
size(400, 400, P3D); // ne pas oublier le 3eme argument pour avoir un environnement 3D
fill(204);
}
void draw() {
background(0);
translate(width / 2, height / 2, -width/2);
rotateY(map(mouseX, 0, width, -PI, PI));
rotateX(map(-mouseY, 0, height, -PI, PI));
noStroke();
fill(204);
rect(-200, -200, 400, 400);
stroke(255);
line(0, 0, -200, 0, 0, 200);
}
Ce qu'il faut retenir : quand on souhaite faire une rotation il faut toujours penser à la faire à l'origine.