daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   for(i=0;i<num_balls;i++){
  2.         for(j=i+1;j<num_balls;j++)          
  3.            if(are_colliding(positions[i],positions[j],velocities[i],velocities[j],
  4.               ball_radius)==true)
  5.                 collide(positions[i],positions[j],velocities[i],velocities[j]);
  6.         enforce_walls(positions[i],velocities[i],ball_radius,width,height);
  7.    }
  8.    /*second loop, updates everything according to time_step*/
  9.    for(i=0;i<num_balls;i++)
  10.        for(j=0;j<2;j++)
  11.            positions[i][j]=positions[i][j]+velocities[i][j]*time_step;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top