mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
examples/mandelbrot: Refactoring
This commit is contained in:
parent
8c1cafd6ae
commit
3d65f92040
@ -58,14 +58,13 @@ func updateOffscreen(centerX, centerY, size float64) {
|
||||
x := float64(i)*size/screenWidth - size/2 + centerX
|
||||
y := (screenHeight-float64(j))*size/screenHeight - size/2 + centerY
|
||||
c := complex(x, y)
|
||||
z := c
|
||||
z := complex(0, 0)
|
||||
it := 0
|
||||
for ; it < maxIt; it++ {
|
||||
nz := z*z + c
|
||||
if real(nz)*real(nz)+imag(nz)*imag(nz) > 4 {
|
||||
z = z*z + c
|
||||
if real(z)*real(z)+imag(z)*imag(z) > 4 {
|
||||
break
|
||||
}
|
||||
z = nz
|
||||
}
|
||||
r, g, b := color(it)
|
||||
p := 4 * (i + j*screenWidth)
|
||||
|
Loading…
Reference in New Issue
Block a user