Julia で千鳥格子を描く
千鳥格子は利休間道(りきゅうかんとう)ともいい,英語ではハウンズ・トゥース(猟犬のキバ)とのこと。
plotter.jl を include
https://blog.goo.ne.jp/r-de-r/e/bd71a52a09801335d56f7c47d879bfe3
include("plotter.jl")
function chidorigousi(nx, ny; a=1, width=600, height=400)
function unit(x, y)
col = :dodgerblue3
plotpolygon(x .+ [0, 0.5, 0, 0, 1, 1, 1.5, 1, 1, 0.5, 0]a,
y .+ [0, 0, -0.5, -1, 0, 0.5, 1, 1, 1.5, 1, 1]a,
col=col, fcol=col)
plotpolygon(x .+ [1, 1.5, 2, 2]a, y .+ [0, 0, 0.5, 1]a,
col=col, fcol=col)
end
nx += 1
ny += 1
x1, y1, x2, y2 = 2.5a, 2.5a, 2a*nx+0.5a, 2a*ny+0.5a
println("(width, height) = ($(x2 - x1), $(y2 - y1))")
plotbegin(w=width, h=height)
plotlimit(x1, y1, x2, y2)
for i = 1:nx
for j = 1:ny
unit(2i*a, 2j*a)
end
end
plotend()
end
chidorigousi(6, 4, a=2, width=480, height=320)
savefig("chidorigousi.png")