Path: utzoo!attcan!uunet!cs.utexas.edu!csd4.csd.uwm.edu!uxc.cso.uiuc.edu!uxc.cso.uiuc.edu!m.cs.uiuc.edu!s.cs.uiuc.edu!mccaugh From: mccaugh@s.cs.uiuc.edu Newsgroups: comp.graphics Subject: Re: Mandelbrot and fracta generators fo Message-ID: <207400016@s.cs.uiuc.edu> Date: 16 Aug 89 23:22:00 GMT References: <2266@eds.ericsson.se> Lines: 61 Nf-ID: #R:eds.ericsson.se:2266:s.cs.uiuc.edu:207400016:000:3221 Nf-From: s.cs.uiuc.edu!mccaugh Aug 16 18:22:00 1989 By PD I take it you mean: Public Domain, but SW (ShareWare?) -- anyway, if by "generator" you mean a "generalized fractalizer" that takes as its input one user's procedure for fractalizing a line (classic example: von Koch), then I may have just what you're looking for: it is in Turbo Pascal:V-4, and accepts CGA or EGA. As you are on the MacII, I would need to know how to compatible- ize it for your machine. I originally wrote my system to ferret out the limits of turtle geometry as applied to fractals, so all the user's procedure has to do is: * take as input a RECORD-type baseline (x1,y1 and x2,y2) * use TURN(+/- theta) and MoveToPt(distance) as primitives to generate an array-of-record successors to the given base-line For example (von Koch): given original line (x1,y1),(x2,y2): * provide length(original base-line) as a given; (so: point[1].x := Xo;) * set new distance d' = distance/3 (and: point[1].y := Yo;) * submit 4 new line-segments to replace the old: > MoveToPt(d') (assuming heading is same as for current line) then record globals Xo,Yo as the point moved to via: point[2].x := Xo; point[2].y := Yo; then use: point[1] and point[2] to define line[1]; > Turn(+Pi/3) > MoveToPt(d') and record Xo,Yo as the next point moved to, say, as: point[3].x := Xo; point[3].y := Yo; then use: point[2] and point[3] to define line[2]; > Turn(-2*Pi/3) > MoveToPt(d') likewise; > Turn(+Pi/3) > MoveToPt(d') likewise. So now, the generated line-segments have been recorded, and we are done. To be more specific, the user-defined proc. would include as parameters: * n = number of line-segments to replace the base-line (up to 20) * VAR-type array-of-linetype in which to place generated line-segments Again, the turtle-geometry primitives are meant to be a convenience for the users supplying their own generators (as well as to test efficacy). As usual, globals include: current-point and angle of inclination: only the "distance-to-move" is a local (following standard practice). The original length(base-line) should be supplied as a CONST, and the whole user-supplied code should be submitted as a ".INC" in a graphics pro- gram that also $INCLUDEs my procedure (which of course in turn takes the user's procedure as parameter P). The end result of all this should be: Given: an arbitrarily-long array A of line-type records ~~~~~ Find: for each line-segment entry, its n<21 successors and replace ~~~~ Clearly, then, the user doing the generating must manage this array (which in the case of von Koch, consists of 1 entry, then 4, then 16, etc.) so that there is always space in it to accomodate a newly-generated line-segment sequence. Once his/her array gets filled up, it is finally time to display the fractal via LINE-calls from the array. All my proc. does is to use relative geoemtry to facilitate generation of the line- segments constituting the replacements.