IFS editor documentation ------------------------ IFS Edit is an attempt at a 3D IFS fractal editor. IFS fractals are those fractals that look like clouds of points, with each cloud having the same form of the collection of clouds (the most famous one looks like a fern). 2D and 3D IFS fractals have been used a lot in demos (in Verses/EMF and Nonstop Ibiza Experience/Orange f.e), but those were either static or randomized, never moving 3D fractals that actually look designed. I wanted to make a program that allowes one to design 3D fractals quickly, interactively and in a visual way, without having to manipulate numbers directly. Hence this editor. How IFS fractals work (boring, but usefull to know) --------------------- IFS stands for Iterative Function System (if I remember correctly). Basically you take a random startpoint in 2D or 3D space. You choose one of several affine transformations, apply it to the point, and you get a new point. You draw this new point, and transform it again. You draw the new result, and repeat ad infinitum. If you choose your transformations correctly, the points will form a certain shape, the so-called Strange Attractor or fractal. So, how do we choose the affine transformations? First we need to know the number of transforms we want to use, at least 2 are needed if we want our fractal to look good, but more allow for more complex fractals. Fractals with more than 4 transforms usually look rather messy, unless you have a specific form in mind you're trying to make. In case you forgot from your math lessons at school: an affine transform has two components: the matrix and the vector. The matrix allows you to rotate a point around the origin, to scale points closer or furter to the origin etc. The vector moves a point a certain distance, regardless of the origin. Let's make a 1-dimensional IFS fractal (you'll quickly understand why those are never shown in demos) with only 1 transform, which will make our fractal look extremely simple. As we're working 1-dimensionally, we cannot rotate points, only scale them with respect to the origin (actually they're not "points" but "values", but . For our transform, we choose: [1/2] * x + 10, which means the "matrix" will halve the distance to the origin, and the "vector" will add 10 to the point. As the startpoint, we choose the random value 234. Now, image a line from - infinity to + infinity, with the origin 0 in the middle, and our startpoint at 234. We plot the startpoint (imagine a red dot at position 234), choose a transform, which is easy since we only have one, and then transform our startpoint with it. New point = 234 * 1/2 + 10 = 127. We plot another red dot at 127, and repeat: 127 * 1/2 + 10 = 73.5 73.5 * 1/2 + 10 = 46.75 46.75 * 1/2 + 10 = 23.375 23.375 * 1/2 + 10 = 21.6875 21.6875 * 1/2 + 10 = 20.84375 20.84375 * 1/2 + 10 = 20.421875 You'll notice the points start to get closer to each other. In fact they converge to 20, because 20 * 1/2 + 10 = 20. So 20 is the Strange Attractor in this case, and our fractal is a single point. This strange attractor is the same for every startpoint you take, so you could start form -26987690 or 0.23645785 and you'll still converge to the same point. (However, it takes several iterations to get so close to your strange attractor that the points will blend together. For this reasons, it's better not to draw the first 100 points or so of an IFS fractal). The simple transform above has 2 important characteristics: 1) the matrix scales down, it brings points closer to the origin. This is very important to give your fractals coherence: if it would scale up, successive points would lie further and further away from each other. 2) the vector must be nonzero. If it was zero, the strange attractor will always be the origin. So basically the matrix pulls points closer to the origin, and the vector pushes them away. The matrix is proportional (points far away are moved lot, points close to the origin move very little) and the vector is constant (all points move exactly as much). Therefor, the matrix and the vector will balance each other, and in the point of equilibrium lies the strange attractor. Lets's make things more complicated: what if we have a 1-dimensional fractal with 2 different transforms? Obviously, each transform has a different attractor. Let's say point A is the attractor of the first transform, and B from the second. We choose a startpoint, plot it, and then have to choose the transform to find the next point. If we would always choose the first, our new points will move to A, if we choose always the second, we'll move to B. If we choose randomly between both of them, our points will move around between A and B. So the attractor is a line between A and B. (But on this line, the "density" of the points will not be uniform. There will be more points near the A and B endpoints). How would a a 2-dimensional fractal with 1 transform look like? If the matrix also contains a rotation (and it's not exactly 180 or 90 degrees or a similar weird number) in addition to the down-scaling, the strange attractor would probably look like a squashed cirle or an ellips. Still not very interesting. But what happens if you have a 2-dimensional fractal with 2 transforms? The succeeding points would hop arround between two strange attractors shaped like circles, and the result often looks like a kind of spiral composed of smaller spirals composed of... etc. Start up IFS edit and play around with 2 transforms if you want to know how it looks :) The GUI ------- (currently all keyboard-base, I hope to change it to something more intuitive later) The GUI of IFS Edit consists of a single screen, no popup windows or menus or whatever. There's a help screen that appears if you press F1, and disappears pressing the "any" key :) Escape closes the program, even from the help screen. (The screen at startup shows a Sierpinski fractal, it's very triangular and ugly and overused, but easy to define so that's why it's the default.) There are two large windows visible, the one on the left shows the fractal, the one on the right shows the transforms. Both windows show three perpendicular axises (sp? Dutch-English dictionary not reinstalled yet...) Notice that they are colored, pretty much everything related to a specific axis is colored in the same way. The transforms on the right are visualised as white boxes. In fact the boxes ARE the transforms, if you draw a reference box of size 1 by 1 by 1 around the origin, transform the corner points and connect these new corners, you get the white boxes on your screen. Notice that 3 of the edges of each box are colored like the axises, otherwise it would be impossible to know the orientation of a cube. One of the boxes is shown in red, this is the current selected transform. You can switch between the transfrom by pressing TAB or SHIFT-TAB. The four windows below show the selected transform in more detail. The leftmost window shows some general information, plus the 12 basic operations you can use to change your transform, 4 for each axis: - a scaling along the axis - a rotation around the axis - skewing, or changing the orientation of the axises so they're not perpendicular anymore. This is the most non-intuitive operation. If you skew along X, the Y and Z axises will rotate around X so they form a sharper corner where they intersect with X. The current selected operation is shown with a colored letter (same color as the axis is applies to). use the arrow keys to choose an operation, use the numeric + and - to increase or decrease them. The other three windows show a sideview, top view and front view of the selected box. Each view has 4 numbers in the topleft corner. These relate to the basic operations you can do: while they don't show anything you can't see directly, it's sometimes easier to have exact numbers if you want for example to rotate two boxes the exact same amount. - The first number is the scaling along an axis. 100 means no scaling, less is scaling down, more is scaling up. Default is 50. - The second number is the nr of degrees that the edge of the box forms with the corresponding main axis (the blue edge of the box with the large blue axis for example). 0 is parallel, 90 is perpendicular. - The third number is the "skew" of an axis, it's related to the number above. If you skew 10 degrees along X, X will have a skew of 10 (obviously), and the Y and Z axises will both have 5 as the second number in their window. - the last number is the vector, it shows how far away you are from the origin, measured along that axis. So to change a transform, use the arrows and the numeric plus/minus keys, and look carefully at the 5 windows. After some experimenations things should be much clearer :) To change the number of transforms, you can press: - SHIFT-F4 to copy the current transform (you'll need to move it before you can see it) - SHIFT-F5 to make a new default transfom in the middel - SHIFT-F8 to delete the current transform. - Shift-F11 to restart with 2 transforms You can move the camera view by pressing CTRL and the arrows, numeric keys etc, plus CTRL-SPACE to stop all motion. I really need to change it so it doesn't use coninuous motion... (be sure NOT to press space alone, as this is an undocumented key that will reset you fractal (kindof. related to animated fractals(half-implemented at the moment))). Press F1 to get some more detailed help in an ugly font. Saving/Loading: Due to the limitations of the freamework I started this under, and my own gruelling lazyness, the filename specification sucks like few other GUI things have sucked before. ANY ALPHABETIC OR NUMERIC KEY YOU PRESS AT ANY TIME CHANGES THE FILENAME (if you wonder why I use so much SHIFT/CTRL combinations for all other functionality, that's because most single keystrokes change the filename. Yes, I suck). so just type in the name you want (8.3 format, how lovely. and you can only change the first 8), then press SHIFT-S to save. To load, type the name (from memory, directory view is for lamers) and press SHIFT-L Again, pressing F1 gibves you a little more info, but I'm really tired of writing this doc. Maybe I can bring myself to improve it if I get some feedback (hint, hint) Known bugs/ Todo ---------------- - UI sucks, needs total overhaul - Have to change keystrokes, so making fractals is easier (instead of viewing them) - Need to fix mess/remains of animated fractals.