裏 RjpWiki

Julia ときどき R, Python によるコンピュータプログラム,コンピュータ・サイエンス,統計学

家紋シリーズ 輪違い(1) 丸に三輪違い

2021年09月08日 | ブログラミング

# 家紋シリーズ 輪違い(1) 丸に三輪違い

plotter.jl を include
https://blog.goo.ne.jp/r-de-r/e/bd71a52a09801335d56f7c47d879bfe3

include("plotter.jl")

# 塗りつぶしリングを描く
function plotring(x, y, r1=1.0, r2=0.9; startangle=0, endangle=360, fcol=:black)
    r1, r2 = max(r1, r2), min(r1, r2)
    θ = startangle:endangle;
    coordx = cosd.(θ);
    coordy = sind.(θ);
    plotpolygon(x .+ vcat(r1 .* coordx, r2 .* reverse(coordx)), y .+ vcat(r1 .* coordy, r2 .* reverse(coordy)), col=fcol, lwd=0, fcol=fcol)
end

function marunimituwawatigai(; r=1,  r1=1.5r, r2 = 1.15r, width=400, height=400)
    plotbegin(w=width, h=height)
    plotring(0, 0, 102//35*r, 90/35*r, fcol=:black)
    for θ in -30:120:210
        centerx = r*cosd(θ)
        centery = r*sind(θ)
        plotring(centerx, centery, r1, r2, fcol=:black)
    end
    for θ in -30:120:210
        centerx = r*cosd(θ)
        centery = r*sind(θ)
        plotring(centerx, centery, r1+0.05r, r1, startangle= 80+θ, endangle=140+θ, fcol=:white)
        plotring(centerx, centery, r2, r2-0.05r, startangle= 80+θ, endangle=140+θ, fcol=:white)
        plotring(centerx, centery, r1+0.05r, r1, startangle=180+θ, endangle=240+θ, fcol=:white)
        plotring(centerx, centery, r2, r2-0.05r, startangle=180+θ, endangle=240+θ, fcol=:white)
    end
    plotend()
end

marunimituwawatigai()

コメント    この記事についてブログを書く
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする
« 家紋シリーズ 稲妻(2) 角立... | トップ | 家紋シリーズ 輪違い(2) 丸... »
最新の画像もっと見る

コメントを投稿

ブログラミング」カテゴリの最新記事