Go · gg
星座轨道
使用确定性粒子轨道绘制一组可以复现的节点网络。

使用确定性粒子轨道绘制一组可以复现的节点网络。
粒子Go
运行方式:go run constellation.go
SOURCE / 只读源码
完整代码
package main
import (
"math"
"github.com/fogleman/gg"
)
func main(){
const size=900
dc:=gg.NewContext(size,size); dc.SetHexColor("#f6f7f2"); dc.Clear()
for ring:=1;ring<=7;ring++{
radius:=float64(ring*48)
for node:=0;node<ring*7;node++{
a:=float64(node)*2*math.Pi/float64(ring*7)
x,y:=450+math.Cos(a)*radius,450+math.Sin(a)*radius
dc.SetHexColor("#087d6d"); dc.DrawCircle(x,y,4); dc.Fill()
}
}
dc.SavePNG("constellation.png")
}