Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Colors, Images
- x_max = 1.2
- x_min = -x_max
- y_max = x_max
- y_min = -y_max
- width = 1920
- height = width
- function f(z)
- return z^5 + im*z^6*conj(z) - z^3/(conj(z)^2) + im*z^7*conj(z)^6
- end
- function coloured(z)
- θ = angle(z)
- # Convert from [-pi,pi] to [0,2pi]
- if θ < 0
- θ += 2pi
- end
- h = 180/pi*θ % 360
- s = 1
- # Circles
- v1 = abs(z)%1*0.2 + 0.8
- # Radial lines
- v2 = (θ/2pi)%0.125 + 0.875
- # Uncomment for more contrast
- v1 = abs(z)%1
- v2 = (θ/2pi)%0.125 *8
- v = (v1+v2)/2
- return HSV(h,s,v)
- end
- image = Array{Union{Nothing,HSV}}(nothing, height, width)
- for j in 1:height
- for i in 1:width
- x = (x_max-x_min)*(j-width/2)/width
- y = (y_max-y_min)*(i-height/2)/height
- # Iterate function
- pt = x + y*im
- for k in 1:1 # only iterating once for now
- pt = f(pt)
- end
- colour = coloured(pt)
- # Incase we divide by zero
- if isnan(colour.h)
- colour = HSV(0, colour.s, colour.v)
- end
- if isnan(colour.v)
- colour = HSV(colour.h, colour.s, 0)
- end
- image[i, j] = colour
- end
- end
- save("out.png", image)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement