|
|
Here is a quick and dirty geodome I developed. The easiest code to get the
shape, I think. Dirty, because spheres and cylinders are drawn several
times. This is because the algorithm was developed to create a mesh and not
a wireframe model.
I don't know the exact definition of a geodesic dome, but all I heard about
it my shape seems to be one: the algorithm starts with an octahedron with 6
points and 8 triangles. Every triangle is recursively divided into four new
ones and each new point is projected onto the surface of the sphere.
So can anybody tell me if this is one?
//basic values
#declare node_rad=0.1;
#declare link_rad=0.04;
#declare dome_rad=3;
#declare dome_rec_depth=3;
//recursive geodesic triangle subdivision
#macro tri1(a,b,c,depth)
#if (depth < dome_rec_depth)
#local ab= vnormalize(a+b)*dome_rad;
#local bc= vnormalize(b+c)*dome_rad;
#local ca= vnormalize(c+a)*dome_rad;
tri1(bc,ca,ab,depth+1)
tri1(a,ab,ca,depth+1)
tri1(ab,b,bc,depth+1)
tri1(ca,bc,c,depth+1)
#else
sphere{a, node_rad}
sphere{c, node_rad}
cylinder{a,b,link_rad}
cylinder{b,c,link_rad}
cylinder{c,a,link_rad}
#end
#end
//declare corners of octahedron
#declare v1=-x * dome_rad;
#declare v2=-y * dome_rad;
#declare v3= x * dome_rad;
#declare v4= y * dome_rad;
#declare v5= z * dome_rad;
#declare v6=-z * dome_rad;
//draw scene
camera{location < 5,6,-3> look_at < 0,0,0>}
light_source {< -90,140,-190> color rgb 1}
union{
tri1(v1,v2,v5,0)
tri1(v2,v3,v5,0)
tri1(v3,v4,v5,0)
tri1(v4,v1,v5,0)
tri1(v1,v2,v6,0)
tri1(v2,v3,v6,0)
tri1(v3,v4,v6,0)
tri1(v4,v1,v6,0)
pigment{color rgb < 1,0.8,0.5>}
finish{specular 1}
}
Post a reply to this message
|
|