Created
December 8, 2024 00:07
-
-
Save georgemsavva/0636532ce3335e29d6fcfae2d06689d6 to your computer and use it in GitHub Desktop.
A frosty fractal
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
par(mfrow=c(1,1)) | |
par(mar=c(0,0,0,0)) | |
l=1.2 | |
# variables | |
res=2000 | |
n=1000 | |
x <- y <- seq(-l,l, length.out=res) | |
c <- outer(x,y*1i,FUN="+") | |
z <- matrix(0.0, nrow=res, ncol=res) | |
o <- matrix(1e5, nrow=res, ncol=res) | |
index <- which(Mod(z) < 5) | |
o[index] <- pmin(o[index] , abs(1-Mod(z[index]))) | |
for (rep in 1:1) { | |
#print(rep) | |
index <- which(Mod(z) < 5) | |
z[index] <- | |
1*z[index]^(7) + | |
1*c[index] | |
z[index] <- | |
-z[index]^(13)+ | |
1*c[index] | |
} | |
z=z^3*2 | |
for (rep in 1:n) { | |
z[index] <- (z[index]^2)-(0.48-.62i) | |
o[index] <- pmin(o[index] , abs(Mod((z[index])))) | |
} | |
o2 <- -log(o) | |
o2 <- (o2 - min(o2)) / (max(o2)-min(o2)) | |
pal=sample(hcl.pals(),1) | |
print(pal) | |
image(x,y,pmax(o2^1.1,0), | |
col=hcl.colors(pal="Broc",1000, rev=F | |
), | |
asp=1,axes=F,ann=F,useRaster=TRUE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment