POV-Ray : Newsgroups : povray.binaries.images : Small Stellated Dodecahedron : Small Stellated Dodecahedron Server Time
4 May 2024 02:18:07 EDT (-0400)
  Small Stellated Dodecahedron  
From: PM 2Ring
Date: 21 May 2006 09:35:00
Message: <web.44706a4ad959e4bc76ba2c900@news.povray.org>
Here's one of the Kepler-Poinsot solids: the small stellated dodecahedron,
on a Penrose tiling floor. The code also contains a slightly simpler & more
accurate dodecahedron than the one in the shapes2.inc.

Enjoy!

// Persistence of Vision Ray Tracer Scene Description File
// File: Dodec.pov
// Vers: 3.5
// Desc: Dodecahedron & small stellated dodecahedron
// Date: 2006.13.05
// Auth: PM 2Ring
//
// -d +A0.2 +AM2 +R4
// -F -A0.4 +AM2 +R1
// +A0.5 +AM2 +R2
// -d +A0.1 +AM2 +R4 +w1200 +h900
// +A0.3 +AM2 +R3
// -d +A0.5 +AM2 +R2 +w1200 +h900
// +A0.2 +AM2 +R2 +w1200 +h900 +FN
//

global_settings {
  assumed_gamma 1
  max_trace_level 50 //  7
}

#include "colors.inc"

#declare Area_Lights = 0;
#declare Do_Floor = 1*8;

#declare Reflect = 1*.75;

#declare WorldRad = 40;

//#declare CamLoc = <0, 15, -6.25> * .95;
//#declare CamLoc = <0, 4, -5> * 1;

#declare CamLoc = <0, 2, -6.25>* 2.0;
//#declare LookAt = 0;

//#declare CamLoc = <2.5, -3, 0.75>;
#declare LookAt = y*1.2;

camera {
  location CamLoc
  look_at LookAt
  right x*image_width/image_height up y
  direction z
  angle 30
}

#if(1)
light_source {
  <-0.75, 5, -3> * 4.5
  //rgb 1
  rgb 100 fade_distance 2.0 fade_power 2        //1.65 2.25

  #if(Area_Lights)
    #declare AL = 9;
    #declare ASize = 0.75;
    area_light x*ASize, z*ASize, AL, AL
    adaptive 1 // 2
    jitter
    circular
    orient
  #end
}
#end

light_source {CamLoc rgb .1 shadowless}

//---Textures--------------------------------------------------------------

//For sky
#declare CMGray0 = color_map {[0.2 rgb 0.1][0.8 rgb .9]}

//For ground
#declare CMGray1 = color_map {[0 rgb .60][1 rgb 1.0]}

//Block finish
#declare FShiny =
finish{
  ambient 0.075
  diffuse .8
  specular .75 roughness 3e-4
  phong .5 phong_size 5

  #if(Reflect)
    //reflection .175*Reflect
    reflection {0.05, 1 fresnel}
  #end
  conserve_energy
}

#declare FGlass =
finish
{
  ambient 0
  diffuse 0.15 //.2

  #if(Reflect)
    reflection {0.05*Reflect, 1*Reflect fresnel}
  #end

  specular .75
  roughness 1E-4
  //brilliance 1.5
  conserve_energy
}

#declare TGlass = texture
{
  pigment { color rgbf <0.985, .9975, .990, 1> }
  //pigment { color rgbf <0.985, .9975, 1, 1> }
  finish{FGlass}
}

#declare FGround =
finish{
  ambient 0.05
  specular .25 roughness 3e-4
  reflection .75*Reflect diffuse .7 //2
}

#declare TGround =
texture{
  //pigment{granite scale 75 colour_map{CMGray1}}
  //pigment{checker rgb 0, rgb 1 rotate 45*y scale 2}
  pigment{rgb 0*.75}
  finish{FGround}
}

//Tile textures
#declare Tex1=
texture{
  pigment{rgb 0}
  finish{FGround}
}

#declare Tex2=
texture{
  pigment{rgb 1}
  finish{FGround}
}

#declare Tex3=
texture{
  pigment{rgb 0.5}
  finish{FGround}
}

#declare TSky =
texture{
  pigment {
    function{abs(y)}
    color_map{CMGray0}
  }
  finish{ambient 0.1 diffuse 0.85}
}

//---Macros-------------------------------------------

#macro FaceColour0(N)#end

#macro FaceColour(N)
  #local Hue = 180 + 240*(mod(7+N,11))/11;
  //#local Hue = 240*mod(N,2);

  pigment{colour CHSV2RGB(<Hue, .75, .95>)filter 0.9}  // transmit 0.65
  //pigment{colour CHSV2RGB(<Hue, .65, .85>)}
  //pigment{rgb x}
  finish{FShiny}
  //finish{FGlass}
#end

#macro Pentamid(A, B, C, D, E, F)
  intersection
  {
    object{Planes[A] inverse}
    object{Planes[B]}
    object{Planes[C]}
    object{Planes[D]}
    object{Planes[E]}
    object{Planes[F]}
  }
#end

// ---Penrose triangle macros-------------------------------------

#declare Phi=(sqrt(5)+1)/2;            //The Golden ratio
#declare phi=Phi-1;

//Interpolate from A to B
#macro inter(A,B,r) (A*(1-r)+B*r) #end

#macro PutSlim(A,B,C,P)
  #if(P)
    #local T1 = Tex1;
    #local T2 = Tex2;
  #else
    #local T1 = Tex2;
    #local T2 = Tex1;
  #end

  #local E = inter(A,B,.5);
  #local F = inter(A,C,phi);
  #local G = inter(B,C,Phi/2);

  triangle{A,E,F texture{T1}}
  triangle{C,F,G texture{Tex3}}
  triangle{B,E,F texture{T2}}
  triangle{B,G,F texture{T2}}
#end

#macro PutWide(A,B,C,P)
  #if(P)
    #local T2 = Tex2;
  #else
    #local T2 = Tex1;
  #end

  #local E = inter(B,A,Phi/2);
  #local F = inter(B,C,phi);

  triangle{B,E,F texture{T2}}
  triangle{A,F,E texture{Tex3}}
  triangle{A,F,C texture{Tex3}}
#end

#macro Slim(A,B,C,D,P)
  #if(D=0)
    PutSlim(A,B,C,P)
  #else
    #local E = inter(A,B,phi);
    #local F = inter(C,A,phi);

    Wide(F,E,A,D-1,P)
    Slim(C,E,F,D-1,P)
    Slim(C,E,B,D-1,P)
  #end
#end

#macro Wide(A,B,C,D,P)
  #if(D=0)
    PutWide(A,B,C,P)
  #else
    #local E = inter(C,B,phi);

    Wide(E,A,B,D-1,1-P)
    Slim(C,A,E,D-1,1-P)
  #end
#end

// ----------------------------------------

#declare Top = 0*-1E-4;     //Tile top height
#declare Ang = pi/5;
#declare Ang0 = radians(-117);
#declare Ang1 = radians(-81);
#declare Rad = WorldRad;
#declare Rdepth = Do_Floor;

#if(Do_Floor)
#declare Wedge=mesh{
  Slim(0, <cos(Ang0), 0, sin(Ang0)>*Rad, <cos(Ang1), 0, sin(Ang1)>*Rad,
Rdepth, 0)
  translate Top*y
}

#declare Floor =
union{
#declare I=0;
#while(I<5)
  object {Wedge rotate y*72*I}
  object {Wedge matrix <0,0,-1, 0,1,0, -1,0,0, 0,0,0> rotate y*72*I}
  #declare I=I+1;
#end
  rotate 9*y
}
#end

//--------------------------The objects-------------------

//Pre-compute dodecahedron planes
#declare Planes = array[12];
#declare Planes[0] = plane { y, 1 FaceColour(0)};
#declare Planes[11] = plane {-y, 1 FaceColour(11)};
#declare I=1;
#while(I<=5)
  #declare Planes[I] =   plane {<0,  1, -2>, 1 rotate y*(36+72*I)
FaceColour(I)};
  #declare Planes[I+5] = plane {<0, -1, -2>, 1 rotate y*72*I
FaceColour(I+5)};
  #declare I=I+1;
#end

#declare Dodecahedron =
intersection
{
  #declare I=0;
  #while(I<12)
    object{Planes[I]}
    #declare I=I+1;
  #end

  bounded_by {sphere {0, 1.258409}}      //(2-Phi)*sqrt(3*Phi+6)
}

#declare SSDodec =
//union
merge
{
  Pentamid(0, 1, 2, 3, 4, 5)
  Pentamid(1, 0, 2, 5, 6, 7)
  Pentamid(2, 0, 1, 3, 7, 8)
  Pentamid(3, 0, 2, 4, 8, 9)
  Pentamid(4, 0, 3, 5, 9, 10)
  Pentamid(5, 0, 1, 4, 6, 10)
  Pentamid(6, 11, 10, 7, 5, 1)
  Pentamid(7, 11, 8, 6, 2, 1)
  Pentamid(8, 11, 9, 7, 3, 2)
  Pentamid(9, 11, 10, 8, 4, 3)
  Pentamid(10, 11, 9, 6, 5, 4)
  Pentamid(11, 10, 9, 8, 7, 6)
  object{Dodecahedron}

  //interior{ior 1.5 dispersion 1.1 dispersion_samples 5}
  interior{ior 1.5}

  bounded_by {sphere {0, sqrt(5)}}
  rotate x*degrees(atan(3-sqrt(5)))

  translate y*1.7761
}

#declare Ground =
  cylinder{
  -y, Top*y, WorldRad
  texture{TGround}
}

#declare Sky =
sphere {0,1 inverse
  texture{TSky}
  scale WorldRad
}

//--------------------------The actual scene-------------------

#if(1)
  object{Sky}
#else
  background{rgb 0.5}
#end

#if(Do_Floor)
  object{Floor}
#else
  object{Ground}
#end

#if(1)
object{
  //Dodecahedron
  SSDodec
  //texture{TGlass}

  //translate y
  rotate y*(180 - 3*18)

  //scale 1.25
  //translate -Phi*z
}
#end

//-------------------------End of file-------------------------


Post a reply to this message


Attachments:
Download 'dodecf0ws.jpg' (114 KB)

Preview of image 'dodecf0ws.jpg'
dodecf0ws.jpg


 

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