I don't know if people still wanted a tutorial like this, I know I saw it mentioned before.
Anyway I suppose its sort of a follow up to the last 3D engine tutorial, as if you ever intend to implement your own 3D engine you'll need a fast way to render the image.
I felt as a shell program this was just too boring so I had it render a fractal to spice it up, don't worry its commented to allow you easily remove that code if you don't want it.
If anyones wants an explanation of how the fractal is rendered just ask, its actually quite simple.
Anyway get the tutorial here GDI Tutorial
Good Luck
Zadkiel

Wow!!! I can't believe (again)!!!! I finished, yesterday, a program that create a picture that looks like very much your fractal!!! Thats funny. My picture was a subdivision of one random triangle in n small triangles. It's used in a mesh generator for finite element calculation.
Man... your work is very good. Thanks. By anyway, how to record the coordinates of each node of the fractal? (I thought in translate your fractal to a mesh generator...)
Did you write other tutorial about the 3D engine?
I'm writing a routine to convert 3D coordinates to 2D screen coordinates. If we know the angles that the 3D axis will be in the 2D screen, the job will be easy. I do that by multipling the points by this matrix:

```
_ _ _ _
| cosAx cosAy cosAz | | x0 x1 xNpoint |
| sinAx sinAy sinAz |*| y0 y1 ... yNpoint |
|_ 0 0 0 _| |_ z0 z1 zNPoint_|
```

Ax,Ay,Ax are the angles that the X,Y,Z axis do with the horizontal screen coordinate.
I'm still working in the determination of what angles will be the axis given one rotation of axis...
Have you any idea?
Thanks in advance.Thats what I love about this paticular fractal, its generated solely be the random movement of a dot and yet the image created is one of perfect order. Its the embodiment of Order in Chaos.
And even though the method you used to draw it is quite ordered theres an even more beautiful mathamatical way. Have you ever heard of Pascals triangle, if not heres the first few lines of it

```
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
```

Each number is the sum of the two numbers above it. If you get a load of black and white beads and start to make a triangle out of them using a black bead of every odd number and a white one for every odd number you get the exact same triangle, unitl the fractal was discoverd the triangle, I think it aslo know as the binomial triangle, was considered to be perfect order, its exact replication by randomness is a little scary
Also about your 3D engine, I don't quite know what you want to do, in my program the spiral never moves, its the camera that moves.
Also its easier to assume the z axis points directly at the screen and the x & Y are at right angles, that way once you've translated the points you take the X & Y as literal X & Y coordinates and use the Z fir depht buffer or fog.
This message was edited by Zadkiel, on 5/5/2001 5:55:34 AMThe fractal itself is called the sierpinski triangle. I have written a dos program (in assembly of course) that draws the triangle. I used the pascal triangle to draw it, not the 'random'-method, but without calculating the numbers. This is not necessary as you can predict if a number will be odd or even: odd+odd = always even, even+even= always even, even+odd/odd+even = always odd. This exacly matches a XOR operation. I posted the source code that assembled to 52 bytes to a newsgroup and after some people had optimized it further the executable was reduced to 34 bytes!
If you want to read the thread it's here.
Thomas