POV-Ray : Newsgroups : povray.binaries.images : snowflakes macro v1 [23.2kb] : snowflakes macro v1 [23.2kb] Server Time
17 Aug 2024 00:19:03 EDT (-0400)
  snowflakes macro v1 [23.2kb]  
From: Tom Melly
Date: 6 Dec 2001 11:50:00
Message: <3c0fa1b8@news.povray.org>
What I really like about POV is if the PHB walks by, it looks like you're
working....

#macro MakeFlake(FlakeSeed)
  #declare Rand1    = seed(FlakeSeed);
  #declare S1Len    = rand(Rand1)*2 + 0.5;
  #declare S2Len    = rand(Rand1)/2 + 0.1;
  #declare S1Wid    = rand(Rand1)/10 + 0.005;
  #declare S2Wid    = rand(Rand1)/50 + 0.005;
  #declare S2Count  = (rand(Rand1)+1)*10;
  #declare S2Rot    = (rand(Rand1)-0.5)*180;

  #declare CountB = 0;
  #declare Flake =
  union{
    #while(CountB < 6)
      union{
        cylinder{0,y*S1Len, S1Wid}
        #declare CountA = 0;
        #while(CountA < S2Count)
          cylinder{0,x*S2Len, S2Wid rotate z*S2Rot translate
y*(CountA*S1Len/S2Count)}
          cylinder{0,x*-S2Len, S2Wid rotate z*-S2Rot translate
y*(CountA*S1Len/S2Count)}
          #declare CountA = CountA + 1;
        #end
        rotate z*CountB*(360/6)
      }
      #declare CountB = CountB + 1;
    #end
  }
#end

#declare CountC = 0;
#declare Rand2 = seed(6545);
#declare Rand3 = seed(8435);
#while(CountC < 150)
  MakeFlake(int(rand(Rand2)*1000))
  object{
    Flake
    scale (rand(Rand3)*2)+0.5
    rotate z*rand(Rand3)*180
    rotate y*rand(Rand3)*180
    rotate x*rand(Rand3)*180
    #declare YTrans = (rand(Rand3)*50)+10;
    translate<(rand(Rand3)-0.5)*(YTrans+10),YTrans,(rand(Rand3)-0.5)*YTrans>
    pigment{White}
    finish{ambient 1}
  }
  #declare CountC = CountC + 1;
#end


--
#macro G(D,E,F)#local I=array[3]{D,E,F}#local B=0;triangle{#while(
B<3)#while(I[B])A[mod(I[B],10)]+#local I[B]=div(I[B],10);#end<-5,-
2,9>#local B=B+1;#end}#end #local A=array[7]{x,x*2,x*4,y,y*2,y*4,z
}light_source{-x*6-z*9,1}mesh{G(105,10,146)G(105,246,10)G(105,56,
146)G(105,1256,246)G(1256,126,220)G(22156,2216,201)pigment{rgb 1}}//TM


Post a reply to this message


Attachments:
Download 'sflake1.gif' (24 KB)

Preview of image 'sflake1.gif'
sflake1.gif


 

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