//--------------------------------------------- // den globala variabeln som innehåller masspartiklarna SpaceObject objs; Star[] stars; float G; int pelletCount; int clickX,clickY; float rotX, rotY; float scl; boolean drawFrameOfReference; //--------------------------------------------- void setup(){ size(500,500,P3D); framerate(40); initStars( 1000 ); initLagrange(); drawFrameOfReference = false; scl = 1f; } //--------------------------------------------- void draw(){ background(0); pushMatrix(); translate(width/2,width/2,0); if(mousePressed){ rotX += -(mouseY-clickY)*0.0003; rotY += (mouseX-clickX)*0.0003; } rotateX( rotX ); rotateY( rotY ); scale(scl,scl,scl); noFill(); stroke(64); if(drawFrameOfReference) box(300); for( SpaceObject n = objs ; n!=null ; n = n.next ) n.computeForces(); for( SpaceObject n = objs ; n!=null ; n = n.next ) n.update(); for( SpaceObject n = objs ; n!=null ; n = n.next ) n.visualize(); for(int i=0;i