1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/* -*-ePiX-*- */
/* koch.c -- May 29, 2002 */
#include "epix.h"
using namespace ePiX;
const int koch_seed[] = {6, 4, 0, 1, -1, 0};
int main()
{
picture(P(0,0), P(4, 1), "6 x 1.5in");
begin();
degrees();
for (int i=1; i <= 4; ++i)
{
// draw von Koch curve at "depth" i
screen tmp(P(-1,-1), P(1,1));
activate(tmp);
if (i==1)
{
bold(Red());
fractal(cis(150), cis(30), i, koch_seed);
plain(Black());
}
else
fractal(cis(150), cis( 30), i, koch_seed);
fractal(cis( 30), cis(-90), i, koch_seed);
fractal(cis(-90), cis(150), i, koch_seed);
inset(tmp, P(i-1,0), P(i,1));
deactivate(tmp);
}
end();
}
|