Julia set: Difference between revisions

Content added Content deleted
(Kotlin entry)
m (→‎{{header|Julia}}: code simplifications)
Line 602:
<lang julia>using Images
 
const w, h = 800, 600
const img = Array(UInt8RGB{Float64}, h, w, 3)
 
const maxIter = 50
const c = -0.8+0.156im
 
@inline function hsv2rgb(h, s, v)
const c = v * s
const x = c * (1 - abs(((h/60) % 2) - 1))
const m = v - c
 
const r,g,b =
if h < 60
(c, x, 0)
Line 628:
end
 
r(b =+ round(UInt8m), (rg + m), *(r 255+ m)
g = round(UInt8, (g + m) * 255)
b = round(UInt8, (b + m) * 255)
 
b,g,r
end
 
Line 643 ⟶ 639:
end
r,g,b = hsv2rgb(i / maxIter * 360, 1, i > 1 ? 1 : 0)
img[y,x,1] = RGB{Float64}(r, g, b)
img[y,x,2] = g
img[y,x,3] = b
end
end
 
save("JuliaSet.png", colorim(img, "RGB"))</lang>
 
=={{header|Kotlin}}==