home *** CD-ROM | disk | FTP | other *** search
- Sierpinski
- ~~~~~~~~~~
-
-
- What is Sierpinski?
- ---- -- -----------
- This function plots an infamous fractal function, the Sierpinski Triange, which
- is a collection of triangles within triangles within triangles... etc. etc.
- Although this sounds quite boring (like Bifurcation diagrams) this fractal has
- become a symbol of the evolving science of fractal geometry. No decent fractal
- plotter should be without one.
- Wot? There is one - in fact several - they can be plotted with IFSs, L-systems,
- and the list goes on and on. Sierpinski plots the triangle deterministically,
- i.e. performs an escape time algorithm:
- If M is a positive integer,
- Sp,q = { a+p((c-a)/Mx), b+q((d-b)/My) } for p,q={0,0}{...,..},{Mx,My}.
- Which is easy to understand and contains no complex numbers (Don't ask).
-
- Algorithm
- ---------
- while ((iter < maxiter) && (x*x+y*y < R))
- {
- if (y > 0.5) then x = 2 * x : y = 2 * y - 1;
- else if (x > 0.5) then x = 2 * x - 1 : y = 2 * y;
- else x = 2 * x : y = 2 * y;
- iter ++;
- }
-
- Variables
- ---------
- As can be seen from the algorithm, R is the escape value - set it to 200 (the
- default) for a 3Dish effect, and 5 for a nice curvy look. MaxIter is the maximum
- number of iterations carried out, and may need to be increased as you zoom in.
- The picture will be plotted using floating point if the 'full precision maths'
- option is selected, otherwise integer maths (faster unless you are rich and
- have a co-processor) until it becomes inaccurate, at which stage the system will
- switch to double precision floating point maths anyway.
- Integer is about 150% of the speed of floating point on a co-processorless Arc.
- If you want to use this function from a script, it behaves in the standard
- !Fractal way. No specific commands are provided.
-
- Copyright
- ---------
- The copyright of
- RayCast, Stereogram, Sierpinski
- belongs to Neil A Carson. No part of the code may be used in any other program
- whatsoever without the author's permission.
- However, Mike Curnow's word is my word, so if he says you can do something with
- it, then it's fine by me.
- Source code is obtainable together with the source for the rest of Fractal
- (since it is not much use on its own) from Mike (with his permission) at the
- address below.
-
- Author
- ------
- I can be contacted at:
- 1 Penn Close,
- Abingdon,
- Oxon OX14 2NX
-
- Or on packet email, I am: neil@g7kqy.ampr.org [44.141.6.229]
- (on ax25, Ben g7kqy@gb7avm may forward the odd message if you ask
- him nicely).
-