Wednesday, 5 March 2014

I'd just like to show you a couple of photos I took of an alder tree that fell across a river near here. The first pic was taken just after it fell - May 2003:

The second was taken in February 2014:

I am amazed that a tree could hold on in a fast flowing burn like this for such a long time. Some of the beggest differences in the images are due more to the time of year, rather than the decade that separates the them. Hopefully I'll remember to revisit in May and get a clearer comparison...

Tuesday, 4 March 2014

I wrote a while back about how elegant spirals can be in computer games - in particular, they are useful if you want to iteratively cover a space with evenly distributed points, with the range expanding out from a single starting location and with one growing tip - I have used them in the past for searching for a suitable placement point in a landscape for a game object, but I'm sure there are many other applications.

Anyway, I didn't include any code in that post, so here below is a Spiral function that is ready to use. This is written in C# for Unity, but should be easy enough to convert to whatever you happen to be using.

'dist' is the distance along the line of the spiral from the origin, and 'spacing' is how far apart you want the coils of the spiral to be from each other (this spiral has the handy attribute of maintaining a constant radial distance between each concentric coil.)

To achieve an even distribution of points, increment the distance param by the value of spacing - that way points will be equally distant form their neighbours on the line as they are from the neighbouring coils.

Here is a screen shot of the points generated by calling Spiral( dist, 1.0f ) with dist = [0,1,2,3...] As you can see, the unit spheres are packed pretty close to 1 unit apart:

Changing the spacing to 2.0f and iterating Spiral( dist, 2.0f) with dist = [0,2,4,6,8...] will lead to each of the unit spheres having 1 unit's space between them: