The title, the key is not a picture of how, but said, go can be used to implement dynamic map verification code, coupled to the go support CGI, fcgi, can make an EXE to update the existing server.
Ball.go
Package main import ("Github.com/hydra13142/cube" "Github.com/hydra13142/geom" "Github.com/hydra13142/paint" "Im Age "" Image/color/palette "" Image/gif "" Math "" OS ") Var (PLN *cube. Plain Unx Cube. Vector Uny Cube. Vector) const (H = W = +) func init () {PLN, _ = cube. Newplain (Cube. point{}, Cube. Vector{4, 4, 3}) Uny = cube. FromTo (Cube. point{}, PLN. Verticalpoint (Cube. point{0, 0, 10})). Unit () Unx = cube. Outerproduct (Uny, Cube. Vector{4, 4, 3}). Unit ()} func main () {var x [H + 1][w]cube. Point Var y [H + 1][w]geom. Point dz: = Math. pi/h DXY: = Math. Pi * 2/w for I: = 0; I <= H; i++ {az: = float64 (i) *dz-math. PI/2 r: = 140 * Math. Cos (AZ) Z: = 140 * Math. Sin (AZ) for J: = 0; J < W; J + + {axy: = Float64 (j) * DXY x[i][j] = cube. Point{math. Cos (axy) * R, Math. Sin (axy) * R, Z}} PICS: = Make ([]*image. paletted, 0) img: = Paint. image{Fr:paint. Green, Bg:paint.
White,} STP: = DXY/20 Delay: = Make ([]int, 0] for t: = 0; T < 20; t++ {img. Image = Image. newpaletted (image. Rect (0, 0,,,), palette. PLAN9) for I: = 0; I <= H; i++ {for J: = 0 J < W; J + + {ox: = cube. FromTo (Cube. point{}, X[i][j]) y[i][j] = Geom. Point{cube. Innerproduct (Ox, Unx), Cube. Innerproduct (Ox, Uny)} A, B: = X[i][j]. X, X[i][j]. Y X[i][j]. X = A*math. Cos (STP)-B*math. Sin (STP) x[i][j]. Y = B*math. Cos (STP) + A*math. Sin (STP)}} for I: = 0; i < H; i++ {for J: = 0; J < W; J + + {img. Line (150+int (Y[I][J). X), 150-int (Y[i][j]. Y), 150+int (y[i][(j+1)%w]. X), 150-int (y[i][(j+1)%w]. Y),) img. Line (150+int (Y[I][J). X), 150-int (Y[i][j]. Y), 150+int (Y[i+1][j]. X), 150-int (Y[i+1][j]. Y),)} pics = append (Pics, img. Image. (*image. paletted) delay = append (delay, 5)} file, _: = OS. Create ("bAll.gif ") defer file. Close () gif. Encodeall (file, &gif.
gif{image:pics, Delay:delay, Loopcount:5 * Len (Delay),})}
Woniu.go
Package main import ("Github.com/hydra13142/cube" "Github.com/hydra13142/geom" "Github.com/hydra13142/paint" "Im Age "" Image/color/palette "" Image/gif "" Math "" OS ") Var (PLN *cube. Plain unx, Uny Cube. Vector) const (H = W =%) func init () {PLN, _ = cube. Newplain (Cube. point{}, Cube. Vector{2, 2, 1}) Uny = cube. FromTo (Cube. point{}, PLN. Verticalpoint (Cube. point{0, 0, 10})). Unit () Unx = cube. Outerproduct (Uny, Cube. Vector{2, 2, 1}). Unit ()} func main () {var x [H + 1][w]cube. Point Var y [H + 1][w]geom. Point dz: = Math. pi/h DXY: = Math. Pi * 4/w for I: = 0; I <= H; i++ {az: = float64 (i) *dz-math. PI/2 r: = Math. Cos (AZ) Z: = Math. Sin (AZ) for J: = 0; J < W; J + + {axy: = Float64 (j) * DXY R: = Float64 (j) * r/w x[i][j] = cube. Point{math. Cos (axy) * R, Math. Sin (axy) * R, z}} PICS: = Make ([]*image. paletted, 0) img: = Paint. image{Fr:paint. Green, Bg:paint.
White,} STP: = Math. pi/w delay: = Make ([]int, 0, 2*w) for t: = 0; T < 2*w; t++ {img. Image = Image. newpaletted (image. Rect (0, 0,,), palette. PLAN9) for I: = 0; I <= H; i++ {for J: = 0 J < W; J + + {ox: = cube. FromTo (Cube. point{}, X[i][j]) y[i][j] = Geom. Point{cube. Innerproduct (Ox, Unx), Cube. Innerproduct (Ox, Uny)} A, B: = X[i][j]. X, X[i][j]. Y X[i][j]. X = A*math. Cos (STP)-B*math. Sin (STP) x[i][j]. Y = B*math. Cos (STP) + A*math. Sin (STP)}} img. Line (300+int (y[0][0). X), 150-int (Y[0][0]. Y), 300+int (Y[h][0]. X), 150-int (Y[h][0]. Y),) for I: = 0; i < H; i++ {for J: = 1; j < W; J + + {img. Line (300+int (Y[I][J). X), 150-int (Y[i][j]. Y), 300+int (Y[i][j-1]. X), 150-int (Y[i][j-1]. Y),) img. Line (300+int (Y[I][J). X), 150-int (Y[i][j]. Y), 300+int (Y[i+1][j]. X), 150-int (Y[i+1][j]. Y),)} pics = append (Pics, img. Image. (*image. paletted) delay = append (delay, 5)} file, _: = OS. Create ("Woniu.gif") defer file. Close () gif. Encodeall (file, &gif.
gif{image:pics, Delay:delay, Loopcount:5 * Len (Delay),})}
Rotate.go
Package main import ("Github.com/hydra13142/cube" "Github.com/hydra13142/geom" "Github.com/hydra13142/paint" "Im Age "" Image/color/palette "" Image/gif "" Math "" OS ") Var (PLN *cube. Plain unx, Uny Cube. Vector) const (H = 9 W = +) func init () {PLN, _ = cube. Newplain (Cube. point{}, Cube. Vector{4, 4, 3}) Uny = cube. FromTo (Cube. point{}, PLN. Verticalpoint (Cube. point{0, 0, 10})). Unit () Unx = cube. Outerproduct (Uny, Cube. Vector{4, 4, 3}). Unit ()} func main () {var x [h*w + 1]cube. Point Var y [h*w + 1]geom. Point DXY: = (Math. Pi * 2)/W dz: = Math. pi/h for I: = 0; I <= h*w; i++ {az: = float64 (i) *dz/w-math. PI/2 r: = 140 * Math. Cos (AZ) Z: = 140 * Math. Sin (AZ) Axy: = Float64 (i) * DXY x[i] = cube. Point{math. Cos (axy) * R, Math. Sin (axy) * R, Z}} PICS: = Make ([]*image. paletted, 0) img: = Paint. image{Fr:paint. Green, Bg:paint. White,} STP: = Math. Pi * 2/(W * 3) Delay: = Make ([]int, 0, 3*w) for T:= 0; T < 3*w; t++ {img. Image = Image. newpaletted (image. Rect (0, 0,,,), palette. PLAN9) for I: = 0; I <= h*w; i++ {ox: = cube. FromTo (Cube. point{}, X[i]) y[i] = Geom. Point{cube. Innerproduct (Ox, Unx), Cube. Innerproduct (Ox, Uny)} A, B: = X[i]. X, X[i]. Z X[i]. X = A*math. Cos (STP)-B*math. Sin (STP) x[i]. Z = B*math. Cos (STP) + A*math. Sin (STP)} img. Line (150+int (y[0). X), 150-int (Y[0]. Y), 150+int (Y[h*w]. X), 150-int (Y[h*w]. Y),) for I: = 0; i < h*w; i++ {img. Line (150+int (y[i). X), 150-int (Y[i]. Y), 150+int (Y[i+1]. X), 150-int (Y[i+1]. Y),)} pics = append (Pics, img. Image. (*image. paletted) delay = append (delay, 8)} file, _: = OS. Create ("Rotate.gif") defer file. Close () gif. Encodeall (file, &gif.
gif{image:pics, Delay:delay, Loopcount:5 * Len (Delay),})}
The above is the entire content of this article, I hope you can enjoy.