Data update
This commit is contained in:
parent
5af6d93694
commit
796d366b97
455 changed files with 7413 additions and 1900 deletions
|
|
@ -1,3 +1,5 @@
|
|||
# Mandelbrot
|
||||
#
|
||||
res = 4
|
||||
maxiter = 200
|
||||
#
|
||||
|
|
@ -14,14 +16,15 @@ scale = mid
|
|||
background 000
|
||||
textsize 2
|
||||
#
|
||||
fastproc iter cx cy . it .
|
||||
while xx + yy < 4 and it > 0
|
||||
fastfunc iter cx cy maxiter .
|
||||
while xx + yy < 4 and it < maxiter
|
||||
y = 2 * x * y + cy
|
||||
x = xx - yy + cx
|
||||
xx = x * x
|
||||
yy = y * y
|
||||
it -= 1
|
||||
it += 1
|
||||
.
|
||||
return it
|
||||
.
|
||||
proc draw . .
|
||||
clear
|
||||
|
|
@ -29,10 +32,8 @@ proc draw . .
|
|||
cy = (scr_y - center_y) / scale
|
||||
for scr_x = 0 to 2 * mid - 1
|
||||
cx = (scr_x - center_x) / scale
|
||||
it = maxiter
|
||||
call iter cx cy it
|
||||
if it > 0
|
||||
it = maxiter - it
|
||||
it = iter cx cy maxiter
|
||||
if it < maxiter
|
||||
color3 it / 20 it / 100 it / 150
|
||||
move scr_x / res scr_y / res
|
||||
rect 1 / res 1 / res
|
||||
|
|
@ -58,6 +59,6 @@ on mouse_up
|
|||
center_y += (mid - center_y) * 3 / 4
|
||||
scale /= 4
|
||||
.
|
||||
call draw
|
||||
draw
|
||||
.
|
||||
call draw
|
||||
draw
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ gr(aspect_ratio=:equal, axis=true, ticks=true, legend=false, dpi=200)
|
|||
d, h = 800, 500 # pixel density (= image width) and image height
|
||||
n, r = 200, 500 # number of iterations and escape radius (r > 2)
|
||||
|
||||
direction, height = 45, 1.5 # direction and height of the light
|
||||
direction, height = 45.0, 1.5 # direction and height of the light
|
||||
density, intensity = 4.0, 0.5 # density and intensity of the stripes
|
||||
|
||||
x = range(0, 2, length=d+1)
|
||||
|
|
|
|||
2
Task/Mandelbrot-set/Maxima/mandelbrot-set.maxima
Normal file
2
Task/Mandelbrot-set/Maxima/mandelbrot-set.maxima
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
mandelbrot ([iterations, 30], [x, -2.4, 0.75], [y, -1.2, 1.2],
|
||||
[grid,320,320])$
|
||||
|
|
@ -4,7 +4,7 @@ import matplotlib.pyplot as plt
|
|||
d, h = 800, 500 # pixel density (= image width) and image height
|
||||
n, r = 200, 500 # number of iterations and escape radius (r > 2)
|
||||
|
||||
direction, height = 45, 1.5 # direction and height of the light
|
||||
direction, height = 45.0, 1.5 # direction and height of the light
|
||||
density, intensity = 4.0, 0.5 # density and intensity of the stripes
|
||||
|
||||
x = np.linspace(0, 2, num=d+1)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
constant MAX-ITERATIONS = 1000;
|
||||
my $width = +(@*ARGS[0] // 800);
|
||||
my $height = $width + $width %% 2;
|
||||
say "P3";
|
||||
say "P1";
|
||||
say "$width $height";
|
||||
say "255";
|
||||
|
||||
sub cut(Range $r, UInt $n where $n > 1 --> Seq) {
|
||||
$r.min, * + ($r.max - $r.min) / ($n - 1) ... $r.max
|
||||
|
|
@ -15,17 +14,14 @@ my @im = cut( 0 .. 5/4, 1 + ($height div 2)) X* 1i;
|
|||
sub mandelbrot(Complex $z is copy, Complex $c --> Int) {
|
||||
for 1 .. MAX-ITERATIONS {
|
||||
$z = $z*$z + $c;
|
||||
return $_ if $z.abs > 2;
|
||||
return 0 if $z.abs > 2;
|
||||
}
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
my @lines = hyper for @im X+ @re {
|
||||
use Color;
|
||||
my $i = (255 * sqrt(mandelbrot(0i, $_) / (MAX-ITERATIONS + 1))).Int;
|
||||
(state @)[$i] //= Color.new(hsv => $i xx 3).rgb
|
||||
mandelbrot(0i, $_);
|
||||
}.rotor($width);
|
||||
|
||||
.put for @lines[1..*].reverse;
|
||||
.put for @lines[0];
|
||||
.put for @lines[1..*];
|
||||
.put for @lines;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue