POV-Ray : Newsgroups : povray.text.scene-files : Archimedean Tiling macros Server Time
3 Jul 2024 02:27:37 EDT (-0400)
  Archimedean Tiling macros (Message 1 to 1 of 1)  
From: Ron Parker
Subject: Archimedean Tiling macros
Date: 16 May 2001 19:06:31
Message: <slrn9g61vp.qa3.ron.parker@fwi.com>
/* Archimedean tiling pigments */

/* To use, uncomment one of the planes at the end of the file */

#macro _6_6_6(G1)
  #local G=pigment {G1 scale sqrt(3)/1.999999 warp {repeat 2*z flip z}}
  #local B=pigment{
    radial 
    pigment_map{
      #local i=0;
      #while(i<6)
        [i/6 G rotate(30+60*i)*y]
        [(i+1)/6 G rotate(30+60*i)*y]
        #local i=i+1;
      #end
    }
  }
  radial 
  pigment_map{
    [1/3 B translate<.5,0,-sqrt(3)/2>]
    [1/3 B translate<-1,0,0>]
    [2/3 B translate<-1,0,0>]
    [2/3 B translate<.5,0,sqrt(3)/2>]
  }
  translate x 
  warp{repeat 1.5*x flip x}
  warp{repeat .5*sqrt(3)*z flip z}
#end

#macro _8_8_4(G1)
  #local G=pigment {G1 scale .5000001 warp {repeat 2*z flip z}}
  #local H=pigment {
    gradient x
    pigment_map {
      [.5 G][.5 G translate -.5*x scale <-1,1,1> translate .5*x]
    }
  }
        
  radial 
  pigment_map{
    #local i=0;  
    #local j=8;
    #while(i<j)
      [i/j H rotate(180/j+360/j*i)*y]
      [(i+1)/j H rotate(180/j+360/j*i)*y]
      #local i=i+1;
    #end
  }

  rotate 180/j*y

  warp{repeat .5*x flip x}
  warp{repeat .5*z flip z}
#end

#macro _12_6_4(G1)
  #local G=pigment {G1 scale .5000001 warp {repeat 2*z flip z}}

  #local T15=tan(pi/12);

  #local Hx=pigment {
    radial 
    pigment_map{
      #local i=0;
      #while(i<6)
        [i/6 G translate -T15*x rotate(30+60*i)*y]
        [(i+1)/6 G translate -T15*x rotate(30+60*i)*y]
        #local i=i+1;
      #end
    }
    rotate 30*y
  }

  #local H=pigment{
    gradient x
    pigment_map {[.5 G][.5 Hx translate (.5+T15*sqrt(3)/2)*x]}
  }                                                               

  #local J=pigment{
    gradient x
    pigment_map {[T15/2 G translate (T15/2-.5)*x]
        [T15/2 Hx translate (T15*(1+sqrt(3)))/2*x]}
  }

  #local Sq=pigment {
    radial 
    pigment_map{
      #local i=0;
      #while(i<4)
        [i/4 J rotate(45+90*i)*y]
        [(i+1)/4 J rotate(45+90*i)*y]
        #local i=i+1;
      #end
    }
    rotate 45*y
  }
  #local I=pigment{
    gradient x
    pigment_map {[.5 G][.5 Sq translate (.5+.5*T15)*x]}
  }

  #local B=pigment{
    radial 
    pigment_map{
      #local i=0;
      #while(i<12)
        [i/12 #if (i/2 = int(i/2)) I #else H #end rotate(15+30*i)*y]
        [(i+1)/12 #if (i/2 = int(i/2)) I #else H #end rotate(15+30*i)*y]
        #local i=i+1;
      #end
    }  
    rotate 15*y
  }
          
  #local T2=sqrt(3)/2;
  radial 
  pigment_map{
    [1/3 B translate<.5,0,-T2>*(.5+T15*sqrt(3)/2)]
    [1/3 B translate<-1,0,0>*(.5+T15*sqrt(3)/2)]
    [2/3 B translate<-1,0,0>*(.5+T15*sqrt(3)/2)]
    [2/3 B translate<.5,0,T2>*(.5+T15*sqrt(3)/2)]
  }                                   
  translate (.5+T15*sqrt(3)/2)*x
  warp{repeat 1.5*x*(.5+T15*sqrt(3)/2) flip x}
  warp{repeat .5*sqrt(3)*z*(.5+T15*sqrt(3)/2) flip z}
#end

#macro _12_12_3(G1)
  #local G=pigment {G1 scale 1.000001 warp {repeat 2*z flip z}}
  #local P=tan(15*pi/180)/sqrt(3);
  #local H=pigment {gradient x
    pigment_map {[.5/(1+P) G scale .5/(1+P)]
                 [.5/(1+P) G scale .5/(1+P) translate -.5/(1+P)*x 
                   scale <-1,1,1> translate .5/(1+P)*x]} 
    scale <2,1,1>
  }
  #local B=pigment{
    radial 
    pigment_map{
      #local i=0;
      #local j=12;
      #while(i<j)
        [i/j H rotate(180/j+360/j*i)*y]
        [(i+1)/j H rotate(180/j+360/j*i)*y]
        #local i=i+1;
      #end
    }
    rotate 180/j*y
  }     
  #local T2=sqrt(3)/2;
  radial 
  pigment_map{
    [1/3 B translate<.5,0,-T2>]
    [1/3 B translate<-1,0,0>]
    [2/3 B translate<-1,0,0>]
    [2/3 B translate<.5,0,T2>]
  }
  translate x 
  warp{repeat 1.5*x flip x}
  warp{repeat .5*sqrt(3)*z flip z}
#end

#macro _6_4_3_4(G1)
  #local G=pigment {G1 scale .5000001 warp {repeat 2*z flip z}}

  #local SquG=pigment {gradient x pigment_map {[.5/sqrt(3) G 
       translate (.5/sqrt(3)-.5)*x][.5/sqrt(3) G scale <-1,1,1> 
       translate (.5+.5/sqrt(3))*x]}}
  
  #local Sq = pigment {
    radial 
    pigment_map {
      #local i=0;
      #while(i<4)
        [i/4 SquG rotate(45+90*i)*y]
        [(i+1)/4 SquG rotate(45+90*i)*y]
        #local i=i+1;
      #end
      }
    rotate 45*y
    }

  #local HexG=pigment {gradient x pigment_map {[.5 G]
                 [.5 Sq translate (.5/sqrt(3)+.5)*x]}}

  #local Hex = pigment {
    radial 
    pigment_map {
      #local i=0;
      #while(i<6)
        [i/6 HexG rotate(30+60*i)*y]
        [(i+1)/6 HexG rotate(30+60*i)*y]
        #local i=i+1;
      #end
      }
    }
                     
  #local F = 1/3+1/sqrt(3);
  radial                                       
  pigment_map{
    [1/3 Hex translate<.5,0,-sqrt(3)/2>*F]
    [1/3 Hex translate<-1,0,0>*F]
    [2/3 Hex translate<-1,0,0>*F]
    [2/3 Hex translate<.5,0,sqrt(3)/2>*F]
  }                                   
  translate F*x
  warp{repeat 1.5*x*F flip x}
  warp{repeat .5*sqrt(3)*z*F flip z}
  
#end

#macro _4_4_4_4(G1)
  #local G=pigment {G1 scale .50001 warp {repeat 2*z flip z}}
  radial 
  pigment_map{
    #local i=0;
    #while(i<4)
      [i/4 G rotate(45+90*i)*y]
      [(i+1)/4 G rotate(45+90*i)*y]
      #local i=i+1;
    #end
  }
  rotate 45*y
  translate <.5,0,.5>
  warp{repeat x}
  warp{repeat z}
#end

#macro _3_3_3_3_3_3(G1)
  #local G=pigment {G1 scale .50001 warp {repeat 2*z flip z}}
  
  radial 
  pigment_map{
    #local i=0;
    #while(i<3)
      [i/3 G rotate(60+120*i)*y]
      [(i+1)/3 G rotate(60+120*i)*y]
      #local i=i+1;
    #end
  }
  rotate 120*y
  translate .5*x
  warp {repeat 2*x flip x}
  rotate 30*y     
  translate <sqrt(3)/4,0,3/4>   
  warp {repeat sqrt(3)/2*x flip x}
  warp {repeat 1.5*z flip z}
#end

#macro _4_4_3_3_3(G1)
  gradient z pigment_map {
    [1/(1+sqrt(3)/2) _4_4_4_4(G1) scale 1/(1+sqrt(3)/2)]
    [1/(1+sqrt(3)/2) _3_3_3_3_3_3(pigment{G1 scale sqrt(3) 
       translate (1-sqrt(3))*x}) scale 1/sqrt(3)/(1+sqrt(3)/2) 
       translate 1/(1+sqrt(3)/2)*z]
  }
  warp {repeat z offset 1/(1+sqrt(3)/2)/2*x}
  scale 2
    
#end

#macro _4_3_4_3_3(G1)
  #local G=pigment {G1 scale 1.000001 warp {repeat 2*z flip z}}

  #local TriG=pigment {G scale .5/sqrt(3) translate (.5/3-.5/sqrt(3))*x}
  #local Tri=pigment {
    radial pigment_map {
      #local i=0;
      #while(i<3)
        [i/3 TriG rotate(60+120*i)*y]
        [(i+1)/3 TriG rotate(60+120*i)*y]
        #local i=i+1;
      #end
    }
  }
    
  #local SquG=pigment {gradient x pigment_map {[.5/sqrt(3) G scale .5/sqrt(3)]
                 [.5/sqrt(3) Tri translate (.5/sqrt(3)+.5/3)*x]} scale 2}
  radial 
  pigment_map {
    #local i=0;
    #while(i<4)
      [i/4 SquG rotate(45+90*i)*y]
      [(i+1)/4 SquG rotate(45+90*i)*y]
      #local i=i+1;
    #end
    }        
  translate sqrt(2)/sqrt(3)*x
  rotate -75*y
  translate x/sqrt(3)
  
  warp {repeat x+x/sqrt(3) flip x}
  warp {repeat z+z/sqrt(3) flip z}
  scale .75
#end

#macro _6_3_3_3_3(G1)
  #local G=pigment {G1 scale 1.000001 warp {repeat 2*z flip z}}

  #local TriG=pigment {G scale .75 translate (.25-.75)*x}
  #local Tri=pigment {
    radial pigment_map {
      #local i=0;
      #while(i<3)
        [i/3 TriG rotate(60+120*i)*y]
        [(i+1)/3 TriG rotate(60+120*i)*y]
        #local i=i+1;
      #end
    }
  }
  #local TriG2=pigment {gradient x pigment_map {[.25 TriG]
                                            [.25 Tri translate .5*x]}}
  #local Tri2=pigment {
    radial pigment_map {
      #local i=0;
      #while(i<3)
        [i/3 TriG2 rotate(60+120*i)*y]
        [(i+1)/3 TriG2 rotate(60+120*i)*y]
        #local i=i+1;
      #end
    }
  }
  #local HexG=pigment {gradient x pigment_map {[.375 G scale .375]
                              [.375 Tri2 translate x scale .5]}}
  #local Hex=pigment {
    radial pigment_map {
      #local i=0;
      #while(i<6)
        [i/6 HexG rotate(30+60*i)*y]
        [(i+1)/6 HexG rotate(30+60*i)*y]
        #local i=i+1;
      #end
    }              
    rotate 30*y
    translate <.625,0,.125*sqrt(3)>
  } 

  radial pigment_map {
    #local i=0;
    #while(i<3)
      [i/3 Hex rotate(60+120*i)*y]
      [(i+1)/3 Hex rotate(60+120*i)*y]
      #local i=i+1;
    #end     
  } 
  translate <.625,0,.375*sqrt(3)>   
  warp {repeat 1.125*x offset .125*sqrt(3)*z}    
  rotate 60*y warp {repeat 1.125*x offset .125*sqrt(3)*z}    
  rotate 60*y warp {repeat 1.125*x offset .125*sqrt(3)*z}    
  rotate -30*y warp {repeat .75*z offset .5*sqrt(3)*x} 
  translate 7*.25*sqrt(3)*x warp {repeat 7*.25*sqrt(3)*x}
#end


#local G=pigment {gradient x pigment_map {[.95 rgb <.5,.3,0>][.95 rgb .8]}}
//#local G=pigment {bozo color_map {[0 rgb 0][1 rgb 1]} scale .2 }

//plane {y 0 pigment {_3_3_3_3_3_3(G)} finish {ambient 1}}  
//plane {y 0 pigment {_4_3_4_3_3(G)} finish {ambient 1}}  
//plane {y 0 pigment {_4_4_3_3_3(G)} finish {ambient 1}}  
//plane {y 0 pigment {_4_4_4_4(G)} finish {ambient 1}}  
//plane {y 0 pigment {_6_3_3_3_3(G)} finish {ambient 1}}  
//plane {y 0 pigment {_6_3_3_3_3(G) scale <-1,1,1>} finish {ambient 1}} 
//plane {y 0 pigment {_6_4_3_4(G)} finish {ambient 1}}  
//plane {y 0 pigment {_6_6_6(G)} finish {ambient 1}}
//plane {y 0 pigment {_8_8_4(G)} finish {ambient 1}}
//plane {y 0 pigment {_12_6_4(G)} finish {ambient 1}}
//plane {y 0 pigment {_12_12_3(G)} finish {ambient 1}}

camera {location 3*y sky z look_at 0}


Post a reply to this message

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