PImage limage=new PImage(); int w,h; float dEcranEye,dEcranCentre,distance; GrandCylindre grandCylindre; Vecteur X0= new Vecteur(1,0,0); Vecteur Y0= new Vecteur(0,1,0); Vecteur Z0= new Vecteur(0,0,1); Vecteur centre, eye; Trajectoire letrajet; //------------------------------------------------ //------------------------------------------------ //------------------------------------------------ void setup(){ size(800, 600, P3D); letrajet=new Trajectoire(); limage=loadImage("visages.jpg"); w=limage.width; h= limage.height; dEcranEye=0.5*height/tan(PI/6); dEcranCentre=0; centre=new Vecteur(width/2.0,height/2.0,dEcranCentre); eye=new Vecteur(width/2.0,height/2.0,dEcranEye); distance=dEcranCentre+dEcranEye; grandCylindre=new GrandCylindre(); } //------------------------------------------------ //------------------------------------------------ //------------------------------------------------ void draw(){ background(245,238,255); if (keyPressed == true) { letrajet.azero(); } grandCylindre.bouger(); //camera(eye.x,eye.y,eye.z,centre.x,centre.y,centre.z, 0, 1, 0);utilisation de la camera par defaut lights(); directionalLight(150,200,255,10,1,1); stroke(150); strokeWeight(5); line(0,0,0,centre.x,centre.y,centre.z); stroke(0); line(mouseX,mouseY,0,mouseX-100*(mouseX-eye.x),mouseY-100*(mouseY-eye.y),0-100*(0-eye.z)); stroke(255,0,0);strokeWeight(1); line(mouseX,mouseY,0,centre.x,centre.y,centre.z);//mouseX+1000*(mouseX-centre.x) stroke(255,0,255); line(mouseX,mouseY,0,0,0,0);//mouseX+1000*(mouseX-centre.x) float[] u=grandCylindre.quatCyl.getValue(); grandCylindre.intersectionRayonCylindre(); Vecteur www=grandCylindre.vectCentreImpact; pushMatrix(); translate(centre.x,centre.y,centre.z); pushMatrix(); rotate(u[0],u[1],u[2],u[3]); repere(200,4); grandCylindre.dessiner(); popMatrix(); letrajet.dessiner(); popMatrix(); } void repere(int lo,float e){ strokeWeight(e); stroke(255,0,0);line(0,0,0,lo,0,0); stroke(0,255,0);line(0,0,0,0,lo,0); stroke(0,0,255);line(0,0,0,0,0,lo); } /* omega est le coin en haut à gauche de l' écran Eye.=(width/2.0, height/2.0, (height/2.0) / tan(PI/6.0)) centre=(width/2.0, height/2.0, 0) orientation=( 0, 1, 0) Description Sets the position of the camera through setting the eye position, the center of the scene, and which axis is facing upward. Moving the eye position and the direction it is pointing (the center of the scene) allows the images to be seen from different angles. The version without any parameters sets the camera to the default position, pointing to the center of the display window with the Y axis as up. The default values are: camera(width/2.0, height/2.0, (height/2.0) / tan(PI*60.0 / 360.0), width/2.0, height/2.0, 0, 0, 1, 0). This function is similar to gluLookAt() in OpenGL, but it first clears the current camera settings. */