|
1 |
| - |
2 |
| - |
3 | 1 | 'Written for Smallbasic
|
4 | 2 | 'Aug 2013 - S Virjee
|
5 |
| -centerx = xmax / 2 |
6 |
| -centery = ymax / 2 |
7 |
| -iter = 20 |
8 |
| -zoom = 2.8 |
9 |
| -p=-.745 |
10 |
| -q=.113 |
| 3 | + |
| 4 | +const centerx = xmax / 2 |
| 5 | +const centery = ymax / 2 |
| 6 | +const iter = 20 |
| 7 | +const zoom = 2.8 |
| 8 | +const p=-.745 |
| 9 | +const q=.113 |
| 10 | + |
11 | 11 | rect xmin,ymin, xmax, ymax color 1 FILLED
|
12 | 12 | oldi=1
|
13 | 13 | pqsq = (p*p + q*q)
|
| 14 | + |
14 | 15 | L = (sqr(p*p + q*q) - 1/iter)*(sqr(p*p + q*q) - 1/iter)
|
15 | 16 | H = (sqr(p*p + q*q) + 1/iter)*(sqr(p*p + q*q) + 1/iter)
|
16 | 17 |
|
17 |
| - for x = -centerx to centerx |
18 |
| - for y = 0 to ymax |
19 |
| - c = x/xmax * (1-zoom*1.5) |
20 |
| - d = y/ymax * (1-zoom) |
21 |
| - ztot = 0 |
22 |
| - i = 1 |
23 |
| - z = 1 |
24 |
| - while i < iter and z< zoom*1.5 |
25 |
| - real = c*c - d*d + p |
26 |
| - imag = 2* c * d + q |
27 |
| - c = real/sgn(d-i) |
28 |
| - d = imag |
29 |
| - z = (c * c + d * d) |
30 |
| - if (z < H) then |
31 |
| - if (z > L) and (i > 0) then |
32 |
| - ztot = ztot + ( 1- (abs((z - pqsq)/z) /(i/(iter)))) |
33 |
| - oldi=i |
34 |
| - 'if i<25 and z>0 then i=abs((c*d+q))*i |
35 |
| - end if |
36 |
| - end if |
37 |
| - i = i + 1 |
38 |
| - wend |
39 |
| - if ztot => 0 then i = cint(sqr(ztot) * 256) |
40 |
| - if i < 256 then red = i :green=0:blue=0 |
41 |
| - if i > 255 and i <= 512 then green = i - 256:blue=0:red=255 |
42 |
| - if i > 511 then green=255:blue=0:red=255 |
43 |
| - if i > 511 and i <= 768 then blue = i - 512:red=255:green=255 |
44 |
| - if i > 768 and i<= 1026 then blue = 255:red=255:green=255 |
45 |
| - if i > 1026 then blue=55:red=255:green=55 |
46 |
| - gray = int((red+green+blue) * .33) |
47 |
| - hot = if(max(red,green,blue)<255,max(red,green,blue),0) |
48 |
| -if oldi=1 then red = hot: 'Outer Circle 1 Figure 8 |
49 |
| -if oldi=2 then green = hot'Outer Circle 2 |
50 |
| -if oldi=3 then red = hot:blue=gray 'Inner Circle Figure 8 - Yellow |
51 |
| -if oldi=4 then blue=hot:green=red:red=gray 'Inner to 2/Outer Circle 4 Loops top |
52 |
| -if oldi=>5 then red = int((hot+blue+green)*.33)/(oldi):'This is main color |
| 18 | +for x = -centerx to centerx |
| 19 | + for y = 0 to ymax |
| 20 | + c = x/xmax * (1-zoom*1.5) |
| 21 | + d = y/ymax * (1-zoom) |
| 22 | + ztot = 0 |
| 23 | + i = 1 |
| 24 | + z = 1 |
| 25 | + while i < iter and z< zoom*1.5 |
| 26 | + real = c*c - d*d + p |
| 27 | + imag = 2* c * d + q |
| 28 | + c = real/sgn(d-i) |
| 29 | + d = imag |
| 30 | + z = (c * c + d * d) |
| 31 | + if (z < H) then |
| 32 | + if (z > L) and (i > 0) then |
| 33 | + ztot = ztot + ( 1- (abs((z - pqsq)/z) /(i/(iter)))) |
| 34 | + oldi=i |
| 35 | + 'if i<25 and z>0 then i=abs((c*d+q))*i |
| 36 | + end if |
| 37 | + end if |
| 38 | + i = i + 1 |
| 39 | + wend |
| 40 | + if ztot => 0 then i = int(sqr(ztot) * 256) |
| 41 | + if i < 256 then red = i :green=0:blue=0 |
| 42 | + if i > 255 and i <= 512 then green = i - 256:blue=0:red=255 |
| 43 | + if i > 511 then green=255:blue=0:red=255 |
| 44 | + if i > 511 and i <= 768 then blue = i - 512:red=255:green=255 |
| 45 | + if i > 768 and i<= 1026 then blue = 255:red=255:green=255 |
| 46 | + if i > 1026 then blue=55:red=255:green=55 |
| 47 | + gray = int((red+green+blue) * .33) |
| 48 | + hot = if(max(red,green,blue)<255,max(red,green,blue),0) |
| 49 | + if oldi=1 then red = hot: 'Outer Circle 1 Figure 8 |
| 50 | + if oldi=2 then green = hot'Outer Circle 2 |
| 51 | + if oldi=3 then red = hot:blue=gray 'Inner Circle Figure 8 - Yellow |
| 52 | + if oldi=4 then blue=hot:green=red:red=gray 'Inner to 2/Outer Circle 4 Loops top |
| 53 | + if oldi=>5 then red = int((hot+blue+green)*.33)/(oldi):'This is main color |
53 | 54 | col = -red+(256*-green)+(256*256* -blue)
|
54 |
| -'col=rgb(red,green,blue) |
55 |
| -pset centerx+x, centery-y color col |
56 |
| -pset xmax-centerx-x,centery+y color col |
57 |
| - next y |
58 |
| - showpage |
59 |
| - delay 1 |
60 |
| - next x |
| 55 | + 'col=rgb(red,green,blue) |
| 56 | + pset centerx+x, centery-y color col |
| 57 | + pset xmax-centerx-x,centery+y color col |
| 58 | + next y |
| 59 | + showpage |
| 60 | + delay 1 |
| 61 | +next x |
61 | 62 | showpage
|
62 | 63 | pause
|
0 commit comments