/* -*-ePiX-*- */ /* koch.xp -- April 02, 2003 */ #include "epix.h" using namespace ePiX; double len = 6.0; const double ratio = 0.65; const int N = 3; const int COUNT = 5; const int seed[] = {6, 4, 0, -1, 1, 0}; // Other examples to try (set COUNT = 4 for each) // const int seed[] = {4, 8, 0, 1, 0, -1, -1, 0, 1, 0}; // const int seed[] = {6, 6, 0, 1, -1, -1, 1, 0}; int main() { bounding_box(P(-6,-6), P(6, 6)); picture(500, 500); unitlength("0.01in"); begin(); bold(); for (int i=COUNT; i > 0; i--) { rgb(0.75+0.125*i, 0.125*(i)*(4-i), 0.25-0.125*i); for (int j=0; j < N; ++j) fractal(polar(len, 2*j*M_PI/N), polar(len, 2*(j+1)*M_PI/N), i, seed); len *= ratio; } end(); }