Fix color scaling with high iteration count
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Steven Polley 2019-01-06 17:22:25 -07:00
parent ff0ca4030c
commit 63e25ba2d5
1 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"fmt"
"image" "image"
"image/color" "image/color"
"image/png" "image/png"
@ -47,7 +48,7 @@ func main() {
} }
colorStep := float64(Iterations) colorStep := float64(Iterations)
colors = interpolateColors("Hippi", colorStep) colors = interpolateColors("Plan9", colorStep)
log.Fatal(http.ListenAndServe(":6161", nil)) log.Fatal(http.ListenAndServe(":6161", nil))
} }
@ -60,6 +61,7 @@ func computeThread() {
(float64(p.y)/Size+float64(p.tileY))/float64(uint(1<<(p.tileZoom-1))), (float64(p.y)/Size+float64(p.tileY))/float64(uint(1<<(p.tileZoom-1))),
), ),
) )
fmt.Println(val)
p.out.SetRGBA(p.x, p.y, colors[val]) p.out.SetRGBA(p.x, p.y, colors[val])
p.wg.Done() p.wg.Done()
} }
@ -176,7 +178,7 @@ func mandelbrot(c complex128) uint16 {
for i := 0; i < Iterations; i++ { for i := 0; i < Iterations; i++ {
z = z*z + c z = z*z + c
if cmplx.IsNaN(z) { if cmplx.IsNaN(z) {
return uint16(i) return uint16(i * 1024)
} }
} }
return Iterations return Iterations