wx
wy
wz
running=true; //First give the variables some initial values // setballs ballx[0]=Array(-.5,1,0); ballx[1]=Array(-.5,-1,0); ballx[2]=Array(1,0,0); jx=0; //Calculate the principal moments jy=0; jz=0; for(i=0;i
dwx=(jy-jz)/jx*wy*wz; dwy=(jz-jx)/jy*wz*wx; dwz=(jx-jy)/jz*wx*wy; wx+=dwx*dt; wy+=dwy*dt; wz+=dwz*dt; omega(wx,wy,wz); //rotate and show the balls document.inputs.posx.value = wx; document.inputs.posy.value = wy; document.inputs.posz.value = wz; if(running==true){setTimeout('StepModel()',10);}