POV-Ray : Newsgroups : povray.general : Recursion re...uh..iterated? : Re: Recursion re...uh..iterated? Server Time
31 Jul 2024 10:25:42 EDT (-0400)
  Re: Recursion re...uh..iterated?  
From: Tim Attwood
Date: 5 Apr 2007 05:42:08
Message: <4614c470$1@news.povray.org>
> Seriously, though, It's great, but it's going to take me a while to figure
> out what you did, I'm not familiar with some of the functions you used.

The inner workings aren't that bad really, it just keeps track of the
turtle direction by rotating a unit vector when you turn. I threw in
tilt because POV is so 3D, vcross of the up and dir vectors is a
vector perpendicular... a right vector.

> But what I'm working on may not be compatible with a logo approach.  I'm
> trying to generate fractal snowflakes and ice crystals.  It's more a
> learning experience than anything else.

Well, maybe, in general POV has trouble with heavy recursion, but
if you don't go crazy it'll work ok.

> I'm already thinking up uses for these macros though.  You should submit
> them for inclusion in the libraries with version 4.

Fine by me, anything that can make things better.

#macro KochCurve(a, n)
   #if (n = 1)
      FD(a/3)
      RT(60)
      FD(a/3)
      LT(120)
      FD(a/3)
      RT(60)
      FD(a/3)
   #else
      KochCurve(a/3, n-1)
      RT(60)
      KochCurve(a/3, n-1)
      LT(120)
      KochCurve(a/3, n-1)
      RT(60)
      KochCurve(a/3, n-1)
   #end
#end

#macro KochStar(a,n)
   RT(30)
   KochCurve(a,n)
   LT(120)
   KochCurve(a,n)
   LT(120)
   KochCurve(a,n)
   LT(150)
#end

TiltUp(90)
PU()
BK(10)
PD()
#declare PenSize = 0.005;
KochStar(20,5)


Post a reply to this message

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