Jump to content

Julia set: Difference between revisions

173 bytes removed ,  8 years ago
m
→‎{{header|Sidef}}: switched to complex numbers
m (→‎{{header|Sidef}}: minor code simplification)
m (→‎{{header|Sidef}}: switched to complex numbers)
Line 170:
 
var maxIter = 50
var (cX, cY)c = Complex(-0.388, 0.613)
 
var color = %s'Imager::Color'.new('#000000')
 
for x,y in (^w ~X ^h) {
var (tmp1, tmp2, i, zx, zy) = (maxIter
var z = Complex((x - w/2) / w * 3, (y - h/2) / h * 2)
0, 0, maxIter,
while (z.abs < 4 float((x&& - w/2-i) / w * 3),{
float((yz -= h/2)(z*z / h *+ 2c),
)
loop {
(tmp1, tmp2) = (zx*zx, zy*zy)
((tmp1+tmp2 < 4) && (--i -> is_pos)) || break
(zy, zx) = (float(2 * zx*zy + cY), float(tmp1 - tmp2 + cX))
}
color.set(hsv => [i / maxIter * 360, 1, i])
2,747

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.