fonction pas(){ return ((Math.random()*2-1)/2); } fonction affinerU(){ var arriveeX=0; var arriveeY=0; var indiceX; var indiceY; teta=0; teta+=pas()*b; d=1+pas()*a; if (nbE>0) { arriveeY+=d*Math.cos(teta); arriveeX+=d*Math.sin(teta); teta+=pas()*b; d=1+pas()*a; YT=1; XT=0; } if (nbE>1) { arriveeY+=-d*Math.sin(teta); arriveeX+=d*Math.cos(teta); teta+=pas()*b; d=1+pas()*a; YT=1; XT=1; } if (nbE>2){ arriveeY+=-d*Math.cos(teta); arriveeX+=-d*Math.sin(teta); teta+=pas()*b; d=1+pas()*a; YT=0; XT=1; } if (nbE>3){ arriveeY+=d*Math.sin(teta); arriveeX+=-d*Math.cos(teta); teta+=pas()*b; d=1+pas()*a; YT=0; XT=0; } indiceX=Math.round((arriveeX-XT)*100+100); indiceY=Math.round((arriveeY-YT)*100+100); si (indiceX<201&&indiceY<201&&indiceX>-1&&indiceY>-1) { U[indiceX][indiceY]=U[indiceX][indiceY]+1/nPoints; } } fonction afficherU(){ pour i allant de 1 à 200 { pour j allant de 1 à 200 { si (U[i][j]>0.000001) { Point3D((i-100)/100+XT,(j-100)/100+YT,"d*"+U[i][j]); } } } } // -------------------------- nPoints=10000000; a=GetExpressionValue("deltaD"); b=GetExpressionValue("deltaA"); //deltaAngle nbE=GetExpressionValue("nbE"); U=[]; pour i allant de 0 à 200 { U[i]=[]; pour j allant de 0 à 200 { U[i][j]=0; } } pour r allant de 0 à nPoints { affinerU(); } afficherU();