//***************************************** public class Cylindre { float d,h,d2,h2,dc,ds; public Cylindre(float d,float h){ set(d,h); } void set(float d,float h){ this.d=d; this.h=h; d2=d/2; h2=h/2; ds=d2*si; dc=d2*co; } void dessinerY(){ pushMatrix(); //rotateZ(PI/2); dessinerX(); popMatrix(); } void dessinerZ(){ pushMatrix(); translate(0,0,-h2-200); rotateY(PI/2); dessinerX(); popMatrix(); } void dessinerX(){ noStroke(); fill(25); beginShape(QUADS); texture(acacia); vertex(h2,d2,0,0,0); vertex(h2,dc,ds,200,0); vertex(-h2,dc,ds,200,20); vertex(-h2,d2,0,0,20); endShape(); beginShape(QUADS); texture(acacia); vertex(h2,dc,ds,0,0); vertex(h2,-dc,ds,200,0); vertex(-h2,-dc,ds,200,20); vertex(-h2,dc,ds,0,20); endShape(); beginShape(QUADS); texture(acacia); vertex(h2,-dc,ds,0,0); vertex(h2,-d2,0,200,0); vertex(-h2,-d2,0,200,20); vertex(-h2,-dc,ds,0,20); endShape(); beginShape(QUADS); texture(acacia); vertex(h2,-d2,0,0,0); vertex(h2,-dc,-ds,200,0); vertex(-h2,-dc,-ds,200,20); vertex(-h2,-d2,0,0,20); endShape(); beginShape(QUADS); texture(acacia); vertex(h2,-dc,-ds,0,0); vertex(h2,dc,-ds,200,0); vertex(-h2,dc,-ds,200,20); vertex(-h2,-dc,-ds,0,20); endShape(); beginShape(QUADS); texture(acacia); vertex(h2,d2,0,0,0); vertex(h2,dc,-ds,200,0); vertex(-h2,dc,-ds,200,20); vertex(-h2,d2,0,0,20); endShape(); } }