Created
September 9, 2010 10:18
-
-
Save GiorgioRegni/571688 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For each pixel on the screen do: | |
{ | |
x0 = scaled x co-ordinate of pixel (must be scaled to lie somewhere in the interval (-2.5 to 1) | |
y0 = scaled y co-ordinate of pixel (must be scaled to lie somewhere in the interval (-1, 1) | |
ESCAPE = 2*2 | |
x = 0 | |
y = 0 | |
iteration = 0 | |
MAX_ITERATION = 100 | |
while ( x*x + y*y <= ESCAPE AND iteration < MAX_ITERATION ) | |
{ | |
xtemp = x*x - y*y + x0 | |
y = 2*x*y + y0 | |
x = xtemp | |
iteration = iteration + 1 | |
} | |
if ( iteration == max_iteration ) | |
then | |
color = black | |
else | |
color = iteration | |
plot(x0,y0,color) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment