POV-Ray : Newsgroups : povray.binaries.scene-files : - fractics.inc (0/1) Fractal Macro : - fractics.inc (0/1) Fractal Macro Server Time
3 Sep 2024 02:18:42 EDT (-0400)
  - fractics.inc (0/1) Fractal Macro  
From: Jerry Stratton
Date: 29 Jun 1999 01:43:16
Message: <280619992243169344%newsw@hoboes.com>
This is a macro I wrote based on software I 'ported' to OS-9/6809
about, oh, a billion years ago, from an article (now lost) in Dr.
Dobb's Journal.

See povray.binaries.images for some examples of what it produces.

You'll notice right off that it is currently only two-dimensional. It
is currently not much more than the old C program converted into a
macro. I plan to add more to it as I have the time. The obvious first
step is to make it three dimensional!

All of the examples use the following code:

#include "colors.inc"
#include "fractics.inc"

camera {
   location <0,0,-14>
   look_at <0,0,0>
}

light_source {
   <0,100,-100>
   color White
}

background {
   color White
}


Here is Sierpinsky's triangle:

//sierpinsky
#declare children = 3;
#declare object_points = 3;
#declare object_lines = array[object_points][2] {
   {-5,-5}
   {5,-5}
   {0,sqrt(10*10 + 2.5*2.5)-5}
}
#declare squaresizes = array[children][2] {
   {1/2,1/2}
   {1/2,1/2}
   {.5,.5}
}
#declare squarespins = array[children][2] {
   {0,0}
   {0,0}
   {0,0}
}
#declare squareweights = array[children] {
   1
   1
   1
}
#declare squaremoves = array[children][2] {
   {0,2.5}
   {-2.5,-2.5}
   {2.5,-2.5}
}
#declare bRadius = .05;
#declare aSphere = sphere {<0,0,0>,bRadius}
#declare lineRadius = -bRadius;
#declare levelcount = 6;
#declare dotcount = 10000;
#declare bStrength = .9;
#declare minBound = <-200,-200,-200>;
#declare maxBound = <200,200,200>;
#declare center = <0,0,0>;
//blob {
// threshold 1
union {
  
//fractics_draw(center,lineRadius,levelcount,children,object_points,obje
ct_lines,squaresizes,squarespins,squaremoves,squareweights,minBound,maxB
ound)
  
fractics_paint(center,aSphere,dotcount,children,squaresizes,squarespins,
squaremoves,squareweights,minBound,maxBound)
  
//fractics_paint_blob(center,bStrength,bRadius,dotcount,children,squares
izes,squarespins,squaremoves,squareweights,minBound,maxBound)
   pigment {
      color Red
   }
   finish {
      ambient .5
   }
}

Try running each of the fractics_draw, fractics_paint, and
fractics_paint_blob versions. (Fractics_paint_blob looks like it would
make a nice cracker, with the right texture :*)

Note that when you uncomment a "blob" version, you also need to
uncomment the blob object start (and comment out the union object
start).


This is a two-branch tree. Each branch has two branches coming off of
it.
#declare children = 2;
#declare object_points = 2;
#declare object_lines = array[object_points][2] {
   {0,-5}
   {0,0}
}
#declare squaresizes = array[children][2] {
   {tan(radians(30)),tan(radians(30))}
   {tan(radians(30)),tan(radians(30))}
}
#declare squarespins = array[children][2] {
   {-30,-30}
   {30,30}
}
#declare squareweights = array[children] {
   1
   1
}
#declare squaremoves = array[children][2] {
   {1.8,2.5}
   {-1.8,2.5}
}
#declare randomspins = array[children][2] {
   {-5,5}
   {-5,5}
}
#declare bRadius = .05;
#declare aSphere = sphere {<0,0,0>,bRadius}
#declare lineRadius = .2;
#declare levelcount = 8;
#declare levelcolors = array[levelcount] {
   texture { pigment { color Brown }},
   texture { pigment { color Tan }},
   texture { pigment { color (Tan+Green)/2 }},
   texture { pigment { color Green/2 }},
   texture { pigment { color Green }},
   texture { pigment { color Green }},
   texture { pigment { color Green }},
   texture { pigment { color Yellow }}
}
#declare dotcount = 10000;
#declare theStrength = 1;
#declare minBound = <-200,-200,-200>;
#declare maxBound = <200,200,200>;
#declare center = <0,0,0>;
//union {
blob {
   threshold 1
  
fractics_draw_blob(center,lineRadius,levelcount,theStrength,levelcolors,
children,object_points,object_lines,squaresizes,squarespins,squaremoves,
squareweights,minBound,maxBound)
  
//fractics_paint(center,aSphere,dotcount,children,squaresizes,squarespin
s,squaremoves,squareweights,minBound,maxBound)
   pigment {
      color Green
   }
   finish {
      ambient .5
   }
}

If you uncomment *both* the fractics_draw_blob and fractics_paint, you
get a cool "canopy" over your tree!



This one, I don't recall what it was supposed to be.

//blood?
#declare children = 3;
#declare squaresizes = array[children][2] {
   {.9,.9},
   {.8,.8},
   {.7,.7}
}
#declare squarespins = array[children][2] {
   {45,0},
   {0,45},
   {45,0}
}
#declare squareweights = array[children] {
   1,1,1
}
#declare squaremoves = array[children][2] {
   {1,1},
   {1,1},
   {-1,-1}
}
#declare aSphere = sphere {<0,0,0>,.2 }
#declare blobStrength = 1;
#declare blobRadius = .2;
#declare dotcount = 100000;
#declare minBound = <-200,-200,-200>;
#declare maxBound = <200,200,200>;
#declare center = <0,0,0>;
//blob {
// threshold 1
//
fractics_paint_blob(center,blobStrength,blobRadius,dotcount,children,squ
aresizes,squarespins,squaremoves,squareweights,minBound,maxBound)
union {
  
fractics_paint(center,aSphere,dotcount,children,squaresizes,squarespins,
squaremoves,squareweights,minBound,maxBound)
   pigment {
      color Red
   }
   finish {
      ambient .5
   }
}

I ran this one with 100,000 spheres. POV-Ray can handle that many
spheres just fine. Turn it into a blob, and it takes forever, but if
you turn it into a blob you don't *need8 100,000 spherical components.

Anyway, I've been having fun with this, hope you do to.

-- 
http://www.hoboes.com/jerry/


Post a reply to this message

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