我如何使用 tikz 设计这个图表?
\documentclass[a4paper]{book}
\usepackage{tikz}
\usepackage{tkz-berge}
\usetikzlibrary{matrix,positioning,arrows,calc,patterns,automata}
\begin{document}
\begin{tikzpicture}[font=\footnotesize]
\filldraw (0,0) circle (3pt) coordinate (a1);
\filldraw (-.75,-.5) circle (3pt) coordinate (a2);
\filldraw (0,-1) circle (3pt) coordinate (a3);
\filldraw (.75,-.5) circle (3pt) coordinate (a4);
\draw (a1) -- (a2) -- (a3) -- (a4) -- (a1);
\draw (a1) -- (a3);
\end{tikzpicture}
\end{document}
答案1
这是一个尝试。
\documentclass[a4paper]{book}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand\pgfmathsinandcos[3]{%
\pgfmathsetmacro#1{sin(#3)}%
\pgfmathsetmacro#2{cos(#3)}%
} % from https://tex.stackexchange.com/a/49589/121799
\newcommand\Kite[2][rotate=0]{\begin{scope}[#1]
\node[circle,fill=black,scale=0.7] (a1-#2) at (0,0) {};
\node[circle,fill=black,scale=0.7] (a2-#2) at (-.75,-0.5) {};
\node[circle,fill=black,scale=0.7] (a3-#2) at (0,-1) {};
\node[circle,fill=black,scale=0.7] (a4-#2) at (0.75,-0.5) {};
\draw (a1-#2) -- (a2-#2) -- (a3-#2) -- (a4-#2) -- (a1-#2);
\draw (a1-#2) -- (a3-#2);
\end{scope}
}
\begin{document}
\def\myrad{90}
\begin{tikzpicture}[font=\footnotesize]
\foreach \angle in {0,60,...,300} {
\pgfmathsinandcos{\myx}{\myy}{\angle}
\Kite[xshift=\myrad*\myx,yshift=\myrad*\myy,rotate=-\angle]{\angle}
}
\draw[-] (a4-300.center) -- (a2-0.center);
\draw[-] (a4-0.center) -- (a2-60.center);
\draw[-] (a4-60.center) -- (a2-120.center);
\draw[-] (a4-120.center) -- (a2-180.center);
\draw[-] (a4-180.center) -- (a2-240.center);
\draw[-] (a4-240.center) -- (a2-300.center);
\end{tikzpicture}
\end{document}
遗憾的是,我无法画出风筝之间的连接线。