Created
October 17, 2012 05:00
-
-
Save dmboyd/3903785 to your computer and use it in GitHub Desktop.
2000x2000 Gibney Fractal Attempt
This file contains 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
## Author: dmboyd - Public Domain | |
## directly derived from descriptions given by http://www.gibney.de/does_anybody_know_this_fractal | |
xdimension=1000; | |
ydimension=xdimension; | |
scale=xdimension; | |
xoffset=xdimension/2; | |
yoffset=xoffset; | |
sensitivity=0.3; | |
gscale=50; | |
c=ones(xdimension,ydimension); | |
xvector=[]; | |
yvector=[]; | |
gdivc=[]; | |
imagex=[]; | |
#load up two vectors to 1..n | |
[x,y]=meshgrid(0:xdimension,0:ydimension); | |
x=x/scale; | |
y=y/scale; | |
xvector=x(:); | |
yvector=y(:); | |
c=complex(xvector,yvector); | |
g=complex(0:gscale,0:gscale); | |
#create complex numbers from the two vectors | |
n=length(c); | |
c(1)=0.01; #cant divide by zero; | |
#vectorised loop begin | |
cmul=1./c; | |
gdivc=cmul*g; | |
imagex=((((mod(real(gdivc),1)).*(mod(imag(gdivc),1)))-1).**2); | |
#end vectorised loop | |
#shape the vector to 2d | |
fractal=reshape(sum(imagex'),xdimension+1,ydimension+1); | |
# convert quadrants back into one big image | |
fractal=[rot90(fractal,2),flipud(fractal);fliplr(fractal),fractal]; | |
image(fractal); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could potentially change the code to restrict c to complex numbers a+bi where a>=b as it is symetric accross the diagonal axis. Would mean that you could fit twice the amount of complex numbers in memory.