Пример #1
0
Файл: win.go Проект: s2607/mbrot
func drawGradient(m *image.RGBA) {
	b := m.Bounds()
	var scale = (b.Min.X - b.Max.X) / 2
	for y := b.Min.Y; y < b.Max.Y; y++ {
		for x := b.Min.X; x < b.Max.X; x++ {
			if mandelbrot.Mbi(float64(-x-scale), float64(y+scale), float64(scale)) {
				m.SetRGBA(x, y, color.RGBA{0xff, 0xff, 0xff, 0xff})
			} else {
				m.SetRGBA(x, y, color.RGBA{0x00, 0x00, 0xff, 0xff})
			}
		}
	}
}
Пример #2
0
func main() {
	//1181
	//559
	//274
	var scale int = 284
	//var scale int = 18
	//var scale int = 30
	//	for i := -scale * 2; i < scale*2; i++ {
	for x := -scale * 2; x < scale*2; x = x + 2 {
		if scale < 50 {
			fmt.Print(x / 10)
		} else {
			fmt.Print(x / 100)
		}
		if x > -10 {
			fmt.Print(" ")
		}
	}
	fmt.Print("\n")
	for x := -scale * 2; x < scale*2; x = x + 1 {
		if scale < 50 {
			fmt.Print(int(math.Abs(float64(x))) % 10)
		} else {
			fmt.Print(int(math.Abs(float64(x))) % 100)
		}
	}
	fmt.Print("\n")
	for i := -scale * 2; i < scale*2; i = i + 2 {
		for rel := -scale * 2; rel < scale*2; rel++ {
			if mandelbrot.Mbi(float64(rel), float64(i), float64(scale)) {
				fmt.Print("#")
			} else {
				fmt.Print(".")
			}
		}
		fmt.Printf("|%d\n", i)
	}
	fmt.Println("done")
}