こちらはこの章のコード例です。これらのページは現在、時間をかけて更新されています(画像、キャプションの追加、おそらくさらなる例の追加)。更新のためにもう一度訪れてください。もちろん、このページを説明が得られる本と一緒に使用するのが最善の方法です。
図10.1 – 軸ラベル付きグリッド
\documentclass[tikz,border=10pt]{standalone} \begin{document} \begin{tikzpicture} \draw[thin,dotted] (-3,-3) grid (3,3); \draw[->] (-3,0) -- (3,0); \draw[->] (0,-3) -- (0,3); \foreach \i in {-3,-2,-1,1,2,3} { \node at (\i,-0.2) {\i}; \node at (-0.2,\i) {\i}; } \end{tikzpicture} \end{document}
図10.2 – 回転した円
\documentclass[tikz,border=10pt]{standalone} \begin{document} \begin{tikzpicture} \draw \foreach \i in {10,20,...,360} {(\i:1) circle (1)}; \end{tikzpicture} \end{document}
図10.3 – 塗りつぶされた交差する円
\documentclass[tikz,border=10pt]{standalone} \begin{document} \begin{tikzpicture} \filldraw[even odd rule] \foreach \i in {10,20,...,360} {(\i:1) circle (1)}; \end{tikzpicture} \end{document}
図10.4 – 英数字ラベル
\documentclass[tikz,border=10pt]{standalone} \begin{document} \begin{tikzpicture} \draw[thin,dotted] (-3,-3) grid (3,3); \draw[->] (-3,0) -- (3,0); \draw[->] (0,-3) -- (0,3); \foreach \i/\j in {A/1,B/2,C/3} \node at (\j,-0.2) {\i}; \end{tikzpicture} \end{document}
図10.5 – 内接する円を持つ三角形
\documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \coordinate (A) at (1,2); \coordinate (B) at ($(A)+(1,0)$); \coordinate (C) at ($(A)+(60:1)$); \draw (A) -- (B) -- (C) --cycle; \draw ($(A)!0.5!(B)+(0,{sqrt(3)/6})$) circle({sqrt(3)/6}); \end{tikzpicture} \end{document}
図10.6 – 線上の射影
\documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \coordinate (A) at (1,2); \coordinate (B) at ($(A)+(1,0)$); \coordinate (C) at ($(A)+(60:1)$); \draw (A) -- (B) -- (C) --cycle; \draw ($(A)!0.5!(B)+(0,{sqrt(3)/6})$) circle({sqrt(3)/6}); \draw[densely dotted] (C) -- ($(A)!(C)!(B)$); \end{tikzpicture} \end{document}
図10.7 – 角度を持つ部分的修飾子を使用する
\documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \coordinate (A) at (1,2); \coordinate (B) at ($(A)+(1,0)$); \coordinate (C) at ($(A)+(60:1)$); \draw (A) -- (B) -- (C) --cycle; \draw ($(A)!0.5!(B)+(0,{sqrt(3)/6})$) circle({sqrt(3)/6}); \draw[densely dotted] (C) -- ($(A)!(C)!(B)$); \filldraw ($(A)!0.5!60:(B)$) circle (0.03); \end{tikzpicture} \end{document}
図10.8 – 円の螺旋
\documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \foreach \i in {0,0.025,...,1} \draw ($(0,0)!\i!\i*360:(1,0)$) circle(0.08*\i); \end{tikzpicture} \end{document}
図10.9 – ボールの螺旋
\documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \foreach \i in {0,0.025,...,6} \draw[shading=ball] ($(0,0)!\i!\i*360:(1,0)$) circle(0.08*\i); \end{tikzpicture} \end{document}
\documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \foreach \i [evaluate=\i as \j using 40*\i] in {0,0.05,...,2} \fill[fill=black!60!blue!\j!white] ($(0,0)!\i!\i*180:(1,0)$) -- ($(0,0)!\i+0.05!\i*180+9:(1,0)$) -- (0,0); \end{tikzpicture} \end{document}
図10.10 – セグメントのある色の螺旋
\documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \foreach \i [remember=\i as \j (initially 6), evaluate=\i as \c using 20*\i] in {5.95,5.9,...,0} \fill[fill=black!60!blue!\c!white] ($(0,0)!\i!\i*180:(1,0)$) -- ($(0,0)!\j!\j*180:(1,0)$) -- (0,0); \end{tikzpicture} \end{document}
図10.11 – 二つの線の交点上の点
\documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture} \draw[thin,dotted] (-3,-3) grid (3,3); \draw[->] (-3,0) -- (3,0); \draw[->] (0,-3) -- (0,3); \draw[name path = l1] (-2,-2) -- (3,3); \draw[name path = l2] (-1,3) -- (3,-3); \fill[name intersections = {of = l1 and l2}] (intersection-1) circle(1mm) node[right] {here}; \end{tikzpicture} \end{document}
図10.12 – 交差する円と三角形で塗りつぶされたパス
\documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture} \fill[name path=triangle, orange] (90:2) -- (210:2) -- (330:2) -- cycle (90:1) -- (330:1) -- (210:1) -- cycle; \draw[name path=circle, dashed, gray] circle(1.5) circle(0.65); \end{tikzpicture} \end{document}
図10.13 – 円と三角形の交点
\documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture} \fill[name path=triangle, orange] (90:2) -- (210:2) -- (330:2) -- cycle (90:1) -- (330:1) -- (210:1) -- cycle; \draw[name path=circle, dashed, gray] circle(1.5) circle(0.65); \fill[blue, name intersections = {of = triangle and circle, total=\max, name=c, sort by = circle}] \foreach \i in {1,...,\max} { (c-\i) circle(0.5mm) node[above left=0.5mm,font=\tiny, inner sep=0]{\i}}; \end{tikzpicture} \end{document}
次の章 へ進む.