POV-Ray : Newsgroups : povray.text.scene-files : "Infinite" reflection in a dodecahedron : "Infinite" reflection in a dodecahedron Server Time
28 Jul 2024 18:25:06 EDT (-0400)
  "Infinite" reflection in a dodecahedron  
From: Lummox JR
Date: 4 Oct 1999 12:41:53
Message: <37F8D963.733E@aol.com>
As requested, this is the source code for the dodecahedron reflection
image I posted on povray.binaries.images.
Note that the union keyword, not merge, is used here because it allows
the cylinders and spheres to appear outside the shape as well as inside,
if you set ShapeSize to a smaller value. (At its current setting, the
camera is inside the shape boundary, but it is capable of looking into
the dodecahedron from the outside because of the reflective surface's
setting.)
Forgive the wraparound on some of these lines... you may have to fix up
the #declare statements to use this code.

Lummox JR

/* "Infinite" reflection */

#include "colors.inc"
#include "textures.inc"

global_settings {max_trace_level 20}

camera {location -10*z direction 1.5*z right x*4/3 up y look_at 0}

light_source {<-3,5,-2>, color White}

#declare ShapeSize=10;
#declare z1=-ShapeSize;

union {
    merge {
        plane {z,z1} plane {-z,z1}
        plane {z,z1 rotate -x*degrees(atan2(2,1))} plane {-z,z1 rotate
-x*degrees(atan2(2,1))}
        plane {z,z1 rotate -x*degrees(atan2(2,1)) rotate <0,0,72>} plane
{-z,z1 rotate -x*degrees(atan2(2,1)) rotate <0,0,72>}
        plane {z,z1 rotate -x*degrees(atan2(2,1)) rotate <0,0,144>}
plane {-z,z1 rotate -x*degrees(atan2(2,1)) rotate <0,0,144>}
        plane {z,z1 rotate -x*degrees(atan2(2,1)) rotate <0,0,-72>}
plane {-z,z1 rotate -x*degrees(atan2(2,1)) rotate <0,0,-72>}
        plane {z,z1 rotate -x*degrees(atan2(2,1)) rotate <0,0,-144>}
plane {-z,z1 rotate -x*degrees(atan2(2,1)) rotate <0,0,-144>}
        texture {pigment {color rgbt 1} finish {reflection 1 diffuse 0
ambient 1}}
        hollow
        no_shadow
        }
    merge {
        sphere {-x*ShapeSize/4,ShapeSize/8 texture {Chrome_Metal pigment
{color Blue}}}
        sphere {x*ShapeSize/4,ShapeSize/8 texture {Chrome_Metal pigment
{color Red}}}
        sphere {-y*ShapeSize/4,ShapeSize/8 texture {Chrome_Metal pigment
{color Green}}}
        #declare y1=z1*(sqrt(5)-1)/2;
        #declare x1=y1*tan(radians(36));
        #declare tetraP=array[20]
        #declare tetraP[0]=<x1,y1,z1>;
        #declare tetraP[15]=<-x1,-y1,-z1>;
        #declare
tetraP[5]=vrotate(vrotate(<0,2*x1,0>,-z*18),-x*degrees(atan2(2,1)))+tetraP[0];
        #declare
tetraP[10]=vrotate(vrotate(<0,-2*x1,0>,-z*18),-x*degrees(atan2(2,1)))+tetraP[15];
        #declare a1=0;
        #while (a1<20)
          #declare tetraP[a1+1]=vrotate(tetraP[a1],z*72);
          #declare tetraP[a1+2]=vrotate(tetraP[a1],z*144);
          #declare tetraP[a1+3]=vrotate(tetraP[a1],-z*144);
          #declare tetraP[a1+4]=vrotate(tetraP[a1],-z*72);
          #declare a1=a1+5;
        #end
        #declare a1=0;
        #while (a1<5)
          cylinder {tetraP[a1],tetraP[mod(a1+1,5)],0.1 texture
{Chrome_Metal}}
          cylinder {tetraP[a1+15],tetraP[mod(a1+1,5)+15],0.1 texture
{Chrome_Metal}}
          cylinder {tetraP[a1],tetraP[a1+5],0.1 texture {Chrome_Metal}}
          cylinder {tetraP[a1+15],tetraP[a1+10],0.1 texture
{Chrome_Metal}}
          cylinder {tetraP[a1+5],tetraP[mod(a1+2,5)+10],0.1 texture
{Chrome_Metal}}
          cylinder {tetraP[a1+5],tetraP[mod(a1+3,5)+10],0.1 texture
{Chrome_Metal}}
          sphere {tetraP[a1],0.1 texture {Chrome_Metal}}
          sphere {tetraP[a1+5],0.1 texture {Chrome_Metal}}
          sphere {tetraP[a1+10],0.1 texture {Chrome_Metal}}
          sphere {tetraP[a1+15],0.1 texture {Chrome_Metal}}
          #declare a1=a1+1;
        #end
        }
    rotate y*20
    rotate -30*z
    }


Post a reply to this message

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