Part 1 - The Asteroid

Scott Manley

First thing I wanted to do was build something which looked vaguely like an asteroid. Povray has lots of nice geometrical primitives, but asteroids are messy irregular things. So, I hacked together a bit of code to generate asteroids as a mesh of smooth trianlges. The code has an odd history , it was written about a year ago, I gave it to a load of other people and then somehow managed to lose my copy of it. I finally managed to get back a modified copy of it which was then hacked back into shape to get it to work under GCC (and fix a couple of bugs which my friend had introduced).

The program basically works by starting with a low detail object made of 8 triangles and then splitting the largest vertex and displacing it slightly from its position. It's not optimised for speed or anything fancy like that - after all most of the CPU time will be spent rendering the asteroid - the time I might save by optimising this won't be noticed.

The asteroid I created has a long axis 1.5 times longer than the other axes.

Image of the Asteroid

You can download an mpeg animation of the rotating asteroid by clicking on the image.

The C source code for the asteroid generator is also available here - you may use it under the terms of the Gnu Public License II - if you've any questions on how to get it working then I might have an answer.....

Last Revised: 2009 November 10th