class Tetraedre{ Arc arcp,arcq,arcpq; Vecteur vecDepart; Secteur secp,secq,secpq; Quat qverification; public Tetraedre(){ arcp=new Arc(); arcq=new Arc(); arcpq=new Arc(); } void initialiser(float rougeNu,float rougeMu,float phi,float bleuNu,float bleuMu,float psi,float dpsi,float dphi) { vecDepart=new Vecteur(sin(dpsi)*cos(dphi),sin(dpsi)*sin(dphi),cos(dpsi)); vecDepart.normalize(rayon); Vecteur arrivep=arcp.initialiser(rougeNu,rougeMu,phi,vecDepart); Vecteur arriveq=arcq.initialiser(bleuNu,bleuMu,psi,arrivep); arcpq.initialiser(arcq.qua,arcp.qua,vecDepart); initSecteurp(); initSecteurq(); initSecteurpq(); secpq.premDansLePlan(arcp.axe);//tourner les aiguilles pour que la prem soit dans le plan (axep, axepq) } void afficherLesArcs(){ arcp.afficherArc(50,255,100,100); arcq.afficherArc(50,100,100,255); arcpq.afficherArc(50,100,255,100); secp.dessiner(" secteur p",#ff0000); secq.dessiner(" secteur q",#0000ff); secpq.dessiner(" secteur composé pq",#00ff00); if(montresphere) { afficherSphere(); } else{ affichercone(arcp.axe,arcp.points[0],200,0,0); affichercone(arcq.axe,arcq.points[0],0,0,200); affichercone(arcpq.axe,arcpq.points[0],0,200,0); } if(montrecercles){ afficherCercle1(arcp.axe,arcp.points[0],255,245,245); afficherCercle1(arcq.axe,arcq.points[0],240,240,255); afficherCercle1(arcpq.axe,arcpq.points[0],240,255,240); } dessinerPlans(); } void initSecteurp(){ float lambda=arcp.axe.dot(arcp.axe)/arcp.axe.dot(arcq.axe); Vecteur der1=Vecteur.comb(-1,arcp.axe,lambda,arcq.axe).normalize(); Quat q=new Quat(arcp.axe,-arcp.angle/2,1); Vecteur prem1=q.tourner(der1).normalize(); secp=new Secteur(prem1,der1,arcp.axe,arcp.qua,arcp.angle); } void initSecteurq(){ float lambda=arcq.axe.dot(arcq.axe)/arcq.axe.dot(arcp.axe); Vecteur prem1=Vecteur.comb(-1,arcq.axe,lambda,arcp.axe).normalize(); Quat q=new Quat(arcq.axe,arcq.angle/2,1); Vecteur der1=q.tourner(prem1).normalize(); secq=new Secteur(prem1,der1,arcq.axe,arcq.qua,arcq.angle); } void initSecteurpq(){ Vecteur ax1,ax2, ww,vv; ax1=secp.axe.normerCopie(1); vv=ax1.cross(secp.prem.normerCopie(1)); vv.normalize(); ax2=secq.axe.normerCopie(1); ww=(secq.der.normerCopie(1)).cross(ax2); ww.normalize(); secpq=new Secteur(vv,ww,arcpq.axe,arcpq.qua,arcpq.angle); qverification=new Quat(vv.dot(ww),vv.cross(ww)); } void dessinerPlans(){ /*Vecteur i12=intersection12(); Vecteur i23=intersection23(); Vecteur i13=intersection13();*/ Vecteur a1= arcp.axe.normerCopie(4000); Vecteur a2= arcq.axe.normerCopie(4000); Vecteur a3= arcpq.axe.normerCopie(4000); Vecteur dif=a1.ajouter(a2,-1.0f); Vecteur a012=a1.ajouter(dif,0.5f); Vecteur a021=a2.ajouter(dif,-0.5f); beginShape(TRIANGLES); fill(155,80,80); vertex(0,0,0); fill(255); vertex(a012.x,a012.y,a012.z); vertex(a021.x,a021.y,a021.z); dif=a2.ajouter(a3,-1.0f); a012=a2.ajouter(dif,0.5f); a021=a3.ajouter(dif,-0.5f); fill(80,80,155); vertex(0,0,0);fill(255); vertex(a012.x,a012.y,a012.z); vertex(a021.x,a021.y,a021.z); dif=a3.ajouter(a1,-1.0f); a012=a3.ajouter(dif,0.5f); a021=a1.ajouter(dif,-0.5f); fill(80,155,80); vertex(0,0,0); fill(255); vertex(a012.x,a012.y,a012.z); vertex(a021.x,a021.y,a021.z); endShape(); } Vecteur intersection12(){ Vecteur dif=arcp.axe.ajouter(arcq.axe,-1.0f); float lambda= dif.dot(arcp.axe)/secq.prem.dot(arcp.axe); Vecteur sol=(arcq.axe).ajouter(secq.prem,lambda); return sol.normalize(4000); } Vecteur intersection23(){ Vecteur dif=arcq.axe.ajouter(arcpq.axe,-1.0f); float lambda= dif.dot(arcq.axe)/secpq.der.dot(arcq.axe); Vecteur sol=(arcpq.axe).ajouter(secpq.der,lambda); return sol.normalize(4000); } Vecteur intersection13(){ Vecteur dif=arcp.axe.ajouter(arcpq.axe,-1.0f); float lambda= dif.dot(arcp.axe)/secpq.prem.dot(arcp.axe); Vecteur sol=(arcpq.axe).ajouter(secpq.prem,lambda); sol.normalize(4000); return sol; } }