SSブログ

TikZ/PGF 覚書(10) 手書き風描画繰返模様 [TikZ/PGF]

texshop_image.png 一週間を空けて?の投稿。 なかなか落ち着いてコード書けないな。 やっぱり今年の二月三月は特別だったなあ。 さて、TikZ/PGFの問題点が次々と明らかになります。 パスを組み合わせる事がよく判らない。 できるのだろうか。 例えば,両端が開いたパスを3つ用意して, 三角に組み合わせて閉じたパスを作りたい。 それぞれのパスは例えば (0,0)から(1,0)へ向けて定義して, そのパスをrotateしたり,逆順にしたり,shiftしたりして繋げて, 閉じたPathを作りたい。 なんかできそうになりので不細工なコードに。
\begin{tikzpicture}[scale=2,pencildraw/.style={decorate,decoration={random steps,segment length=4pt,amplitude=0.6pt}}] % Unit Tile Drawing \def\drawBox[#1](#2){ \begin{scope}[line width=2 pt]%,nearly transparent,cap=round] \pgfmathsetmacro{\sixh}{sin(60)} \draw [pencildraw,fill=#2,rotate=#1*60] (0,0) to[out=20,in=220] (1,0) to[out=135,in=315] (1/2,\sixh) to[out=280,in=110] (0,0); \fill [fill=white,rotate=#1*60] (0.7,0.2) circle (3pt); \fill [fill=white,rotate=#1*60] (0.6,0.5) circle (3pt); \draw [pencildraw,rotate=#1*60] (0.7,0.2) circle (3pt); \draw [pencildraw,rotate=#1*60] (0.6,0.5) circle (3pt); % \fill [pencildraw,fill=black] (-0.25,0.3) circle (1pt); \end{scope} } % Repeat Tiling \foreach \x in {-2,...,2}{\foreach \y in {-1,...,2}{ \pgfmathsetmacro{\xd}{3/2*\x}; \pgfmathsetmacro{\yd}{(2*\y+mod(abs(\x),2))*sin(60)}; \begin{scope}[shift={(\xd,\yd)}] \foreach \i in {0,...,5}{ \drawBox[\i](orange);} \end{scope}}} \end{tikzpicture}

nice!(0)  コメント(0)  トラックバック(0) 
共通テーマ:学問

nice! 0

コメント 0

コメントを書く

お名前:[必須]
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

Facebook コメント

トラックバック 0

Tikz/PGF 覚書(9)tikz/pgf覚書 再び ブログトップ

この広告は前回の更新から一定期間経過したブログに表示されています。更新すると自動で解除されます。