Jan 12, 2010
Spherical distribution
Wow holly cow, I finally got some time off, and spent a few hours messing arround with AS3. There’s something I’ve been wanting to do lately, and that was, write something a little nicer than C command line apps and stuff.
So anyway, I was reading some of Paul Bourke’s articles and came across this. I know it’s been done before, countless time, by this dude for example. So I tried out this implementation using DirectX9, and it was slow as fuck. So either I did something wrong, or it’s no the best algorithm to be using if you moving stuff arround. I ended up reading the entire page (for once), and then implemented the last algorithm on the page: (0 <= theta < 360) and phi (0 <= phi <= pi/2).
For an in depth explanation, read this: http://local.wasp.uwa.edu.au/~pbourke/geometry/spherepoints/.
OK, so that was well faster since none of the points are being moved arround to be equidistant from each other.
All I did after that was use the sound spectrum to alter the distance from the points to the middle of the sphere to make it less boring to look at. Then added some glow where there is a little point aggregation or whatever you want to call it.
Long story short, this lets you quickly plot out random points arround a sphere or a circle, or even a square or cube. Even though it’s random, the distribution still looks nice enough.
Anyway, here it is.
And here is the AS3 source.