Tuesday, January 16, 2007

hamster's revenge, a first step towards geodesic domes

For no real good reason, I thought it'd be fun to try to write a script to generate geodesic domes. Other people have already successfully used programs outside of SL (Blender), and then imported the coordinates into SL and used scripts to rez the objects there. Seifert Surface has a huge one that houses his sculpture garden.

But it seemed like it'd be an interesting challenge to try to do it fully in SL. First off, though, I had no idea what a geodesic dome _really_ was. Google is a great tool... A bunch of Google'ing, with fun-filled sites like: Geodesic Dome -- from Wolfram MathWorld, and I started to understand it. A potentially useful site is "Desert Domes," which includes calculators if you actually wanted to build one in real life. The calculators will eventually be useful to make sure I stay within the 10m maximum size prim limit.

One common way to generate a geodesic is to start with a icosahedron, which is a 20-sided object composed entirely of twenty identical equilateral triangles. From the center of the icosahedron, ALL vertices lie on the surface of a sphere, so the icosahedron is a decent 20-faced approximation of a sphere.

To make a geodesic sphere, you divide up each triangular face into n^2 identical triangles, and then "push out" the points of those triangles to the surface of the sphere. The bigger 'n' is, the smoother your geodesic dome will be. (And the huger the number of triangles you'll need.)

Back in November, Seifert Surface posted a set of scripts that would generate parametric surfaces in SL. I didn't care about that part, BUT, it included a nice set of functions to rez a triangle if you fed it the corners, which is exactly what I'd need.

I figured, since the basis of a geodesic sphere is an icosahedron, I'd start with trying to rez that. Bizarrely, it worked on my first try.

Here's the rezzer in action:


And if you happen to be sitting on the rezzer while it's doing its work...


...you get your very own hamster ball to run around in!


Loads of fun, if you make it physical, and allow anyone to move it. Let's play "Roll the dorky scripter around"!

Next step towards making geodesic domes will be to subdivide each of the 20 triangles of the icosahedron into n^2 triangles, and "pushing" them out to the surface of a sphere, and then connecting all the new vertices with smaller triangles.