Gravitation

Center of Mass

Equal Mass 2:1 Mass 10:1 Mass

Script

id1=document.animator.addObject("circle","r=5");
document.animator.setShowFVector(id1,true);
document.animator.setMass(id1,mass1);
document.animator.setTrail(id1,1000);

id2=document.animator.addObject("circle","r=5");
document.animator.setTrail(id2,1000);
document.animator.setShowFVector(id2,true);
document.animator.setMass(id2,mass2);

document.animator.setForce(id1,"0","0",10,0,-3,4);
document.animator.setForce(id2,"0","0",-10,0,3*mass1/mass2,-4*mass1/mass2);
document.animator.addInteraction(id1,id2,"-500/(r*r)","r");
.
gid=document.datagraph.getGraphID();
.
document.animator.makeDataConnection(id1,gid,1,"t","m*(vx*vx+vy*vy)/2.0");
document.animator.makeDataConnection(id2,gid,2,"t","m*(vx*vx+vy*vy)/2.0");
document.animator.updateDataConnections();