|
 |
Ummm, ... Wow !
Thanks for helping me with this.
Let me digest this for a bit and I'll probably thank-you again.
Stephen
news:3ee11c25$1@news.povray.org...
> // Hi Stephen,
> //
> // here is some more rhombic dodecahedron (r.d.) stuff, now with faces
> // as individual objects, and with macros to put arbitrary objects
> // onto a face. The xy-area mentioned in my last post matches the
> // face, the points with positive z will go to the inside (so face
> // objects should have z<=0), points with negative z will go to the
> // outside (this way objects are attached to a face).
> // The other maco puts objects on the xz-plane onto a face; -y goes
> // to inside, y to outside.
> //
> // Of course an r.d. with attached r.d.'s may itself be attached to
> // an r.d., and so on ...
> //
> //
> // Sputnik
> //
> //
> // ----------------------------
> // fr### [at] computermuseum fh-kiel de
> // ----------------------------
>
>
> // finish, textures =====================================================
>
>
> #declare Fin =
> finish {
> ambient 0.3
> diffuse 0.5
> specular .2 roughness .02
> }
>
> #declare Wood1 =
> texture {
> pigment { wood
> ramp_wave
> color_map { [.45 rgb <.95, .90, .55> ]
> [.55 rgb <.80, .65, .35> ] }
> turbulence <0.06, 0.01, 0.06> octaves 1
> scale 0.05 rotate 87*y translate -0.3*z
> }
> finish { Fin }
> }
>
> #declare Wood2 =
> texture {
> pigment { wood
> ramp_wave
> color_map { [ 0 rgb <.75, .45, .2> ]
> [.8 rgb <.50, .22, .1> ] }
> turbulence <0.06, 0.01, 0.06>
> scale 0.05 rotate 87*y translate -0.3*z
> }
> finish { Fin }
> }
>
> #declare Test = texture {
> pigment { image_map { png "test" } // test.png is in include directory
> translate <-0.5, -0.5, 0>
> scale <2, sqrt(2), 1>
> }
> finish { Fin }
> }
>
>
> // macros and declarations for rhombic dodecahedron =====================
>
>
> // macro to put an object on xy-plane onto a face
> // z goes inside, -z goes outside
> #macro Put_xy_onto_face ( Object, Rotation )
> object { Object translate -z rotate Rotation }
> #end//macro Put_onto_face
>
>
> // macro to put an object on xz-plane onto a face
> // -y goes inside, y goes outside
> #macro Put_xz_onto_face ( Object, Rotation )
> object { Object translate y rotate Rotation-90*x }
> #end//macro Put_onto_face
>
>
> // macro to create rounded objects for faces
> #macro Face ( Round )
> #local X = <1-sqrt(3)*Round, 0>;
> #local Y = <0, (1-sqrt(3)*Round)*sqrt(.5)>;
> union {
> sphere {-X, Round }
> cylinder {-X, Y, Round }
> sphere { Y, Round }
> cylinder { Y, X, Round }
> sphere { X, Round }
> cylinder { X,-Y, Round }
> sphere {-Y, Round }
> cylinder {-Y,-X, Round }
> prism { linear_spline -Round, Round, 5, -X, Y, X, -Y, -X
> rotate 90*x
> }
> translate Round*z
> // no "}" to allow application of texture etc.
> #end//macro Face
>
>
> // some face objects; scale .96 found by experimentation ...
> #declare Face1 = Face(.03) scale .96
> texture { Wood1 rotate degrees(atan(sqrt(.5)))*z }
> }
>
> #declare Face2 = Face(.03) scale .96
> texture { Wood2 rotate degrees(atan(sqrt(.5)))*z }
> }
>
> #declare Face3 = Face(.2 ) scale 1
> texture { Wood1 rotate degrees(atan(sqrt(.5)))*z }
> }
>
> #declare Face4 = sphere { z, 1 scale <sqrt(.5), .5, .01> texture {
Test } }
>
>
> #declare RhomDo1 =
> union {
> Put_xy_onto_face ( Face1, < 0, 45, 45> ) // front, lower left
> Put_xy_onto_face ( Face2, < 0, 45,-45> ) // front, upper left
> Put_xy_onto_face ( Face1, < 0,-45, 45> ) // front, upper right
> Put_xy_onto_face ( Face2, < 0,-45,-45> ) // front, lower right
> Put_xy_onto_face ( Face3, < 0,225,-45> ) // back, lower right
> Put_xy_onto_face ( Face4, < 0,225, 45> ) // back, upper right
> Put_xy_onto_face ( Face3, < 0,135,-45> ) // back, upper left
> Put_xy_onto_face ( Face4, < 0,135, 45> ) // back, lower left
> Put_xy_onto_face ( Face1, < 90, 0, 0> ) // top
> Put_xy_onto_face ( Face2, < 90, 0, 90> ) // left
> Put_xy_onto_face ( Face1, < 90, 0,180> ) // bottom
> Put_xy_onto_face ( Face2, < 90, 0,-90> ) // right
> }
>
>
> #declare RhomDo2 =
> union {
> object { RhomDo1 }
> Put_xz_onto_face ( object { RhomDo1 translate y }, < 0,-45, 45> )
> Put_xz_onto_face ( object { RhomDo1 translate y }, < 0,225, 45> )
> Put_xz_onto_face ( object { RhomDo1 translate y }, < 0,135,-45> )
> }
>
>
> // simple scene with textured rhombic dodecahedrons etc. on plane =======
>
>
> object { RhomDo1 scale .5 translate <-1, 0.5, 0> }
>
> object { RhomDo2 scale .5 translate <0.8, 0.5, 1> }
>
> #declare Rand = seed(876);
> #declare Snake = RhomDo1;
> #declare I = 0;
> #while (I<15)
> #declare Snake =
> union {
> // get a new RhomDo
> object { RhomDo1 }
> // put on one of it's upper faces the snake created so far:
> Put_xz_onto_face (
> // get the snake so far (centered around 0)
> object { Snake
> // put onto xz-plane pointing to y
> translate y },
> // choose one of the upper fife faces
> #switch (rand(Rand))
> #range(0 , .15) < 0, 45,-45> ) #break
> #range(.15, .3 ) < 0,-45, 45> ) #break
> #range(.3 , .45) < 0,225, 45> ) #break
> #range(.45, .6 ) < 0,135,-45> ) #break
> #else < 90, 0, 0> )
> #end//switch
> }//union
> #declare I = I+1;
> #end//while I
>
> object { Snake translate y scale 0.1 rotate 0*y translate <-0.2,
0, -0.7> }
>
>
> plane { y, 0
> texture {
> pigment { checker rgb <1, .9, .8>, rgb <.8, .7, .6> }
> finish { Fin }
> }
> }
>
> light_source { <-1500, 2500, -2000>, color rgb 1 }
>
> camera { location -10*z look_at 0 angle 20
> rotate <25, 20, 0> translate <0, 1, 0> }
>
>
> // END ==================================================================
>
>
Post a reply to this message
|
 |