Pascal's Pyramid Scheme
Fun with fractals, notably "Pascal's Pyramid" (hence the name).
Pascal's Pyramid is very similar to the Serpinski Gasket
(aka Pascal's Triangle), only 3D. There are four other fractals that are
similar to this (the other platonic solids). Then there is a plant
fractal, and some sphere tests.
I've done a lot of experimentation and learning with this program so
some of the fractals may seem misplaced. The plant was add during an
experiment for a CS class, the basis of it comes from the book
"The Algorithmic Beauty of Plants". I plan to
create a full 3D L-system generator to handle a lot more plants, but
at this time I haven't yet done so.
I was curious about the challenge of simulating planets on MU*s. In
such environments whole planets are a major challenge, if you're
simulating planets at their real size the amount of terrain is
huge. Even for someone with a great deal of bandwidth,
downloading the terrain of a whole planet would take a long time. Worse
if you allow FTL travel (which you must unless you confine everyone to
one planet). The general category of "plasma" fractals work well for the
terrain generation with very little data needing to be shared (less
then 1K for a simple planet). The trick then becomes dividing things in
a consistant way. Well, use a couple of the platonic solids for a basis
and see how well they turn into planet-like spheres. Well, surprise, surprise,
it works best to start with the solid that has the most sides. The
icosehedron needs fewer sides to become more spherical, and the sides
stay closest to equalateral triangles rather then being scalene.
Three libraries and associated headers will need to be present. The
OpenGL libraries, GL and GLU; plus the GL UTility library, glut. Many
systems will ship with these libraries installed. Other systems may have
to explicitly install them. For the few remaining systems the
Mesa implementation will work
fine.
The above download link points to a gzip/tar archive.
Download and unpack it.
A directory "pascal" will be created with the files inside of it.
Build
For some systems the shipped Makefile will work "out of the box".
Others will need to make adjustments. The most likely one is changing
the value of LIBS, INCPATH or LIBPATH at the top of the Makefile.
These point to extra libraries needed for building, these dependancies
originate in the GL and glut libraries. As I'm building on a Unix system
with X11, the shipped lines should work for most Unicies (known for
Linux, FreeBSD and Solaris). On other OSes the GL/glut libraries will
need a different set, set them here.
You might also consider changing the valueof EXOPTS. The possible
extra options are listed in the Makefile. Finally simply run make.
Not the most advanced Makefile, but it should work.
Install
The program will be the file "pascal". You may choose to run
it directly or install it in your binary directory of choice. Only
the one file is required.
Historic Versions
- Version 2
- Version 1
- Version 0
Run the main program, the controls are described below.
Controls
- ESCape key
- Pressing the escape key will cause the program to exit at any time.
- Mouse Button 1 Drag
- Clicking on the first mouse button and dragging over the main window
will rotate the object being displayed.
- 0-9 on keyboard
- The number keys change the level of detail/number of iterations.
In general increasing the level results in an exponential increase in work,
so I recommend against increasing the level by more than one at a time.
I recommend against starting above level 3 when switching between fractals,
particularly #4 and #5 require a lot of work even at that level. As a rule
level 0 displays the basic polyhedra or shape used as the basis of higher
levels.
- )!@#$%^&*( on keyboard (shift+0-9)
- Detail/texturing level. A new feature simply to show off texturing.
Draws a 2D variation of the full 3D fractals on the sides of the 3D
fractal. This provides the illusion of higher quality while not needing to
go as deep on the display lists.
- T on keyboard New!
- Switches between transparency textures and black textures. In
transparency mode, the center of faces are discarded via alpha
testing. In black mode, the centers are simply drawn black rather than
colored.
- F1 on keyboard
- The tetrahedron fractal (aka Pascal's Pyramid, this program's namesake).
A fun little fractal to see displayed. Level 5 or 6 can be used with decent
response time.
- F2 on keyboard
- The hexahedron (cube) version of the main fractal. Level 3 is reasonable
on most machines.
- F3 on keyboard
- The octahedron version of the main fractal. Level 3 is reasonable on
most machines.
- F4 on keyboard
- The dodecahedron version of the main fractal. Level 2 will be
accessible with reasonable response times. Be very cautious about
exploring higher levels, as each additional level entails
much more than an order of magnitude additional work.
- F5 on keyboard
- The icosahedron version of the main fractal. Level 2 will be accessible
with reasonable response times. Be very cautious about
exploring higher levels, as each additional level entails
more than an order of magnitude additional work.
- F6 on keyboard
- A fractal (L-system) plant. Certainly the most pleasing of the fractals.
Level 3 is the sweet spot, too much higher and the leaves become too small.
This one actually suffers the least with each additional level due to a low
branching factor, but has the most complex base shape.
- F7 on keyboard
- Tetrahedron-based sphere. Each additional level tessellates one more time.
At levels 1-3 this looks like a very lumpy sphere. In order to reduce memory
usage, the maximum level is capped at 5 (because heirarchical display lists
don't work here, memory consumption grows fast).
- F8 on keyboard
- Octahedron-based sphere. Similar to directly above, each additional level
tessellates one more time. At levels 1 and 2 though lumpy, this looks very
much more spherical than the above. At level 3 the faces are already
disappearing.
- F9 on keyboard
- Icosahedron-base sphere. Another sphere aproximation by tesselation. Due
to the higher number of triangles at the base level we get an extra level's
worth of triangles over the tetrahedron, and about half a level's worth over
the octahedron. Note though that we get a much smoother sphere for the same
number of sides because the triangles are closer to being equilateral and so
they're close in size rather than the tetrahedron producing triangles that are
quite different in size. Here level 2 looks very spherical and at level 3 the
sides are getting very small.
Copyright © 2005 Elliott Mitchell
I make no guarentees that these will work on anyone else's
system. I make no guarentees these will not damage anyone else's systems. I
make no guarentees whatsoever about these projects.
I retain copyright on all code. You may download, unpack, and compile,
but you are not permitted to retain code on a permanent basis. In many cases
I may be willing to release this under GPL, but unless explicitly stated none
of this available under GPL.
Last updated: $Date: 2005/07/14 05:59:52 $