//
// GravityFr.java (200810094) Fuat Bahadir
import java.applet.Applet;
import java.awt.*;
import java.awt.image.*;
public class GravityFr extends Applet
{
Image img;
int wd,ht,pix[],alpha;
public void init()
{
wd=getSize().width;ht=getSize().height;alpha=255;
pix=new int[wd*ht];
gr();
img=createImage(new MemoryImageSource(wd,ht,pix,0,wd));
}
public void paint(Graphics g)
{
g.drawImage(img,0,0,this);
// Refresh Periodically
long t=System.currentTimeMillis();
while((System.currentTimeMillis()-t)<10000) {;}
// delete the old graph
for(int i=0;i0)
double dmin = 10.0; // min allowed distance between objects
int mx, my, k, j, ix, iy;
mx = wd-1;my = ht-1;
double ang, v, dx, dy, d, a, ax, ay;
double x[], y[], xnew[], ynew[], m[], vx[], vy[];
double x0[], y0[], vx0[], vy0[];
m=new double[n];
x=new double[n];y=new double[n];
xnew=new double[n];ynew=new double[n];
vx=new double[n];vy=new double[n];
x0=new double[n];y0=new double[n];
vx0=new double[n];vy0=new double[n];
double Sx, Sy, Svx, Svy, Sm;
Sx = Sy = Svx = Svy = Sm = 0;
for(k=0;k