public class Helice{ int n; float longueur, pas, rayon; public Helice(float longueur,int nombreSpire){ this.n=nombreSpire; this.longueur=longueur; } public void dessiner0(float hauteur){ stroke(0); if(longueur>hauteur){ rayon=sqrt(longueur*longueur-hauteur*hauteur)/(TWO_PI*n); pas=hauteur/n; beginShape(LINE_STRIP); for(float t=0;t<=TWO_PI*n;t+=0.1f){ vertex(rayon*cos(t),rayon*sin(t),pas*t/TWO_PI); } endShape(); } else{ line(0,0,0,0,0,hauteur); } } public void dessiner(Vecteur u){ Vecteur axe=(new Vecteur(-u.y,u.x,0)).normalize(); float l=u.length(); pushMatrix(); rotate(acos(u.z/l),axe.x,axe.y,axe.z); dessiner0(l); popMatrix(); } }//fin Helice