func checkMandelbrot(c complex128, res chan int) {
	z := settings.z0
	for i := 0; i < settings.repeat; i++ {
		z = cmath.Pow(z, settings.n) + c
		if 2.0 < cmath.Abs(cmath.Pow(z, 2)) {
			res <- i + 1
			return
		}
	}
	res <- -1
}
Beispiel #2
0
func mandelbrot(c complex128) int {
	z := c

	for i := 0; i < 127; i++ {
		if cmath.Abs(z) > 2 {
			return i
		}

		z = z*z + c
	}

	return 127
}