Tag Archive for code

push

This time round we’ll assert some basic forces on our particles. First of all we’ll add a repulsion force between all particles, pushing them away from each other. Secondly we’ll insert some boundaries for the particles to remain within, with the walls of the sketch forming a boundary pressure keeping the particles constrained.Source Code

Related Posts:

distance

Now we’re going to begin doing more interesting things with our particles. Since we have a decent (yet small) PVec class to maintain details about location and motion, we’ll begin to map out interactions between particles.For this to work, we need to be able to pass the entire arraylist of particles to each particle, which we then use to compare a local particle with a remote particle, one by one each time we redraw.This first example will loop through all available particles, drawing lines between particles within a particular distance (in this case, ~100 pixels).Source Code

Related Posts:

particle vectors

Now that we have animated particles, moving on sin waves, we can test each one to see how far away it’s neighbours are. In this example, we’ll use the PVec class again to check the distance (by finding the square root of the squares of each distance direction, x-y-z). Once we know the distance between two particles, we can use that to check if two are between an upper distance limit – if so, we’ll draw a line between them.Source Code

Related Posts:

particle patterns

We’ll be using our little PVec class to form the basis of some more interesting animated interactions between particles. In this case, all we’re doing is moving particles based on a grid relationship, but already we can see some ‘macro’ behaviours popping up through the iteration of localised calculations.Source Code

Related Posts:

Sin and Cos

Sin and waves can be used to create simple and visually interesting patterns. This example uses the sin function to create a two dimensional pattern, with the sin value adjusting the radius of each circle.Source Code

Related Posts:

exploring pvec

Might as well use our little PVec class to do something interesting, wouldn’t you say?Source Code

Related Posts: