Julia で花菱をモチーフとした模様を描く(2)
include("plotter.jl")
function hanabisi2(nx=6, ny=6; r=1, fcol=:brown,
backcol=:cornsilk, width=600, height=400)
plotbegin(w=width, h=height)
nx += 1
ny += 2
x1, y1, x2, y2 = 2r, r*sqrt(3), (2nx+1)r, ny*r*sqrt(3)
println("(width, height) = ($(x2 - x1), $(y2 - y1))")
plotbegin(w=width, h=height)
plotlimit(x1, y1, x2, y2)
plotbox(x1, y1, x2, y2, lwd=0, fcol=backcol)
for i = 1:ny
y = sqrt(3)i*r
for j = 1:nx
x = (2j + i % 2)r
plotpolygon2(x, y, 1.08r, 6, φ=30, lwd=0, fcol=fcol)
plotpolygon2(x, y, 0.85r, 6, φ=30, lwd=0, fcol=backcol)
plotpolygon2(x, y, 0.80r, 6, φ=30, lwd=1, col=fcol)
hanabisi(x, y, r=0.6r, lwd=1, fcol=fcol,
backcol=backcol)
end
end
plotend()
end
hanabisi2(4, 3, width=630, height=485)