Assignment 3 – Generative Art OOP: Particles

 

For this Assignment i wanted to create something simple but dynamic as well so I came up with the idea of particles interacting and creating a network.

I started by creating an array to hold particles as each objects and then pushed each new particle instance inside the array. The class for particle stored the position of each particle as coordinates inside a vector which would be initialized by random spawn positions on the canvas. It also had a random velocity so that some particles would move faster.

The class had an update method that allowed the position to be updates according to its respective velocity. It also called another method called the edges method which did all the error checking to ensure that the particle stayed on the canvas and bounced off the edge.

The draw class was simple a circle with a fill and random color with no stroke. My most important method was the check particle which uses the distance dist() function to check if there are any other particles within a certain distance and if so a line is drawn.

The concept of this was to visualize how gas particles would be able to behave in a certain container. A thing that i wanted to achieve was to somehow incorporate collision detection to show how they would be able to collide with each other and bounce off.

I also tried to use the map feature by following Dan Shiffman’s video but I couldn’t figure out how differently i could make use of it in my sketch.

Leave a Reply