Yay for Gravity!

So its been a while since I have posted I know, but I have something cool to show.  I made this yesterday instead of doing my homework, a spiffy physics simulation!  The basic premise is that the blue things are gravity wells and the red things are particles.  Each of the particles has a direction and speed while the wells have a magnitude.  At regular intervals each particle 1) figures out the vector between itself and each gravity well 2) calculates the distance between itself and a gravity well 3) divides the well magnitude by distance, multiplies that by the well vector, and adds that resulting vector to its current speed and direction.  So basically this means the particles get attracted to the larger wells more and to the closer wells more then the further away wells.  Makes sense to me.  You can also turn friction on and off, which simply shrinks the current direction vector by a set amount. In addition you can start and stop the simulation, add or take away gravity wells, change the number of particles, and draw a grid so you can place the wells more precisely if you please.  Hope you all have fun with it!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: