【发布时间】:2015-02-17 08:30:52
【问题描述】:
我正在尝试制作 19x19 六边形格子,每个格子都包含一个圆柱体,其颜色不同,称为“hexagon.dat”。
2-> 红色圆柱体
1-> 用绿色着色的圆柱体
六边形.dat
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 2
2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2
2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 2
2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 2
2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2
2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2
2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2
2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2
2 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
2 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2
2 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2
2 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
但是目前,由于我不知道如何存储和访问hexagon.dat的矩阵数据,所以只有绿色圆柱体 这是我的 gnuplot 脚本
脚本
set term X11 persist title "test" size 1000, 1000
P = 0.78
pin_id = 0
do for [pin_ix=-9:9]{
do for [pin_iy=-9:9]{
cx = pin_ix*P + pin_iy*(-P/2)
cy = pin_iy*sqrt(3)/2*P
pin_id = pin_id + 1
set object pin_id poly from cx-P/2, cy+P/2/sqrt(3) \
to cx, cy+P/sqrt(3) \
to cx+P/2, cy+P/2/sqrt(3) \
to cx+P/2, cy-P/2/sqrt(3) \
to cx, cy-P/sqrt(3) \
to cx-P/2, cy-P/2/sqrt(3) \
to cx-P/2, cy+P/2/sqrt(3) \
fs solid fc rgb "red"
pin_id = pin_id + 1
set object pin_id circle at cx, cy size 0.3275 \
fs solid fc rgb "green"
}
}
set size ratio 1.0
set xr [-11:11]
set yr [-11:11]
plot 1/0
我在等待你的帮助。
【问题讨论】: