games Open Menu Banner Image Black Hole

java processing p5 archimedes spiral array access john beech markavian mkv25

Scrapbook / Black Hole
-0001/11/30 00:11:00

Thought 1: This website is Part blog part project listing.

Thought 2: Damnit I just lost the whole of the last article I wrote.

So here goes <i>again</i>.

After seeing a <a href="//;action=display;num=1119147851;">problem</a> on the processing message board to do with accessing an array from the centre and spiraling outwards I decided that <a href="//">Archimedes Spiral</a> was the best solution.

The equation for Archimedes Spiral is very simple:

<b>radius = constant * theta;</b>

So as theta (the angle) increases the radius gets bigger and bigger. The distance between two points on the curve 360o away from each other is always the same, this is useful for converting constant rotary motion into constant linear motion. (<i>useful fact??</i><Wink>

The program does a very tight spiral attempting to hit all the pixels in the vicinity. To reduce redundancy I put a few crafty bits of logic in.

In this example, my array is made up of the pixels on the screen. The applet features pressing 1 through to 7 adjusts the speed.

No prizes for guessing why it was called

Black hole!

You need to have Java installed for this applet to work correctly.