/* Copyright F. P. Marin ( May 22 16:18:46 1997 ) E-mail: felix@bloch.ciens.ucv.ve Permission to use, copy, modify and distribute this software and its documentation for NON-COMERCIAL purposes and without fee is hereby granted provided that this copyright notice appears in all copies. F. P. Marin makes no representations or warranties about the suitability of the software, either express or implied, including but no limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. F. P. Marin shall not be liable for any damage suffered by license as a result of using, modifying or distributing this software or its derivatives. HTML code is: */ import java.awt.*; public class IdealGas extends java.applet.Applet implements Runnable { double X,Y; Graphics gr; int delay,diam,dx,dy,ip,maxv,np,rad,x[],y[],z[],vx[],vy[]; Image img; Thread point=null; public void init() { int t; String s=getParameter("npoints"); np=( s!=null ) ? Integer.parseInt(s):10; s=getParameter("maxv"); maxv=( s!=null ) ? Integer.parseInt(s):3; s=getParameter("radius"); rad=( s!=null ) ? Integer.parseInt(s):2; diam=2*rad; s=getParameter("delay"); delay=( s!=null ) ? Integer.parseInt(s):42; x=new int[np]; y=new int[np]; vx=new int[np]; vy=new int[np]; dx=size().width - diam -1; dy=size().height - diam -1; for ( int i=0 ; i0.0 ) { Y/=X; X*=Math.sqrt(1.0 + Y*Y); } return ( X<=diam ); } public void update(Graphics g) { paint(g); } public void paint(Graphics g) { gr.setColor(Color.blue); gr.fillRect(0,0,size().width,size().height); gr.setColor(Color.yellow); for ( int i=0 ; i