Skip to content

Simulation of gravitational attraction with the purpose of generating cool pictures

Notifications You must be signed in to change notification settings

jensenr30/GravityChaos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gravity chaos banner

GravityChaos

Simulation of gravitational attraction, and motion of particles in 2D space. The purpose is to generate satisfying images.

How it Works

I found the concept for this program in this video: Chaos, by Rudy Rucker. Between 3:37 and 5:00, it provides a concise visual explanation of how these images are generated.

A number of particles are created and kept stationary; these are the targets.

One particle is created that is mobile; this is the projectile.

The projectile is placed at a certain pixel on the screen, <x,y>. The projectile experiences a force exerted upon it by the stationary targets. This force is calculated to mimic gravity, so it follows the inverse-square law. The projectile is accelerated and travels in 2D space. If it hits one of the targets during its travels, the initial starting point (the pixel at <x,y>) is set to the color of the target.

Therefore, the color of each pixel on the image indicates which target the projectile will eventually hit.

If a pixel is black, that indicates the simulation terminated before the projectile hit any target.

Each target is rendered as a large, color-filled circle.

Chaotic Regions

In some areas of the image, small changes in the starting position of the projectile can make it land on different targets. Because of this sensitivity to initial conditions, the image tends to look chaotic in some regions. An example of a chaotic region is the following:

chaotic region example

In other regions of the map, the terminal location of the projectile is not very sensitive to initial conditions. In these areas, the image does not look chaotic; rather, it appears simple and well-behaved.

User Interface

Currently, no user interface exists. As this is just an experimental program, all the particles are specified in the source code.

Image Gallery

Click on images to view them at full-resolution in a new tab.

Granular Lava Lamp

Ornate Linear Array

Matrix Gradient

Hexagonal Grayscale

snow drift

More images can be found in the pics folder in this repository.

Videos

Here are some animations that were created by generating a sequence of images, and using ffmpeg to compile them into a video.

Click on any of the pictures below to open the video.

Gelatinous Alien Clockwork

Chameleon

About

Simulation of gravitational attraction with the purpose of generating cool pictures

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages