POV-Ray : Newsgroups : povray.binaries.images : Geodesic Dome : Re: Geodesic Dome Server Time
14 Aug 2024 20:15:09 EDT (-0400)
  Re: Geodesic Dome  
From: J  Diehl
Date: 12 Sep 2002 13:45:09
Message: <web.3d80d15bc6ede976717ea7a0@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.