Jump to content

Mandelbrot set: Difference between revisions

m (→‎ASCII output: fix links)
Line 1,861:
[[File:Mandelbrot-bc.jpg|thumb|right]]
Producing a [https://fr.wikipedia.org/wiki/Portable_pixmap PGM] image.
 
To work properly, this needs to run with the environment variable BC_LINE_LENGTH set to 0.
 
<syntaxhighlight lang=bc>max_iter = 50
width = 400; height =400 401
scale = 10
xmin = -2; xmax = 1/2
Line 1,891 ⟶ 1,894:
print "P2\n", width, " ", height, "\n255\n"
 
for (i = 0; i < widthheight; i++) {
xy = xminymin + (xmaxymax - xminymin) / widthheight * i
for (j = 0; j < heightwidth; j++) {
yx = yminxmin + (ymaxxmax - yminxmin) / heightwidth * j
tmp_scale = scale
scale = 0
m = (255 * mandelbrot(x, y) + max_iter + 1) / max_iter
print m
if ( j < heightwidth - 1 ) print " "
scale = tmp_scale
 
1,934

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.