POV-Ray : Newsgroups : povray.text.scene-files : 3d Snowflake curve.. : 3d Snowflake curve.. Server Time
28 Jul 2024 22:22:24 EDT (-0400)
  3d Snowflake curve..  
From: Alex Vandiver
Date: 2 May 1999 22:25:38
Message: <372CFB02.1031E814@tiac.net>
Here's one way to make a 3d Koch snowflake fractal.  Unfortunatly, the
prisms arn't terribly accurate, but t'works..
-Alex

---- Code follows ----
#declare rt = sqrt(3)/6;
#declare scal = 0.5;

#macro koch(depth)
prism {
  conic_sweep
  linear_spline
  0,
  1,
  4,
  <-0.5,-rt>,<0,rt*2>,<0.5,-rt>,<-0.5,-rt>
  rotate x*180
  translate y
  scale <1,rt*3,1>
  scale 0.5
}
#if (depth > 0)
  #local rot = 0;
  #while (rot < 3)
    #if (depth = 1)
    object {
    #else
    union {
    #end
      koch(depth-1)
      scale scal
      rotate y*60
      translate rt*z/2
      rotate x*-70
      translate -rt*z/2
      rotate y*(rot*120-60)
    }
    #declare rot = (rot+1);
  #end
#end
#end


Post a reply to this message

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