![使用 tikz 创建射影平面 PG(2,3)(含图片)](https://linux22.com/image/343494/%E4%BD%BF%E7%94%A8%20tikz%20%E5%88%9B%E5%BB%BA%E5%B0%84%E5%BD%B1%E5%B9%B3%E9%9D%A2%20PG(2%2C3)%EF%BC%88%E5%90%AB%E5%9B%BE%E7%89%87%EF%BC%89.png)
答案1
棘手的部分是让路径像图中那样从上到下穿过。其余的只是基本的 TikZ 路径,尽管相当一部分可以自动化。
对于棘手的部分,幸运的是,有一个 TikZknots
包可以为您完成所有的底层工作。
\documentclass{article}
%\url{http://tex.stackexchange.com/q/336897/86}
\usepackage{tikz}
\usetikzlibrary{knots,calc,shapes.geometric}
\begin{document}
\begin{tikzpicture}
\foreach \x in {0,...,2}
\foreach \y in {0,...,2} {
\pgfmathtruncatemacro\nk{\y*3+\x+1}
\coordinate (\nk) at (\x,2-\y);
}
\coordinate (11) at ({3+sqrt(2)},1);
\coordinate (13) at (1,{-1-sqrt(2)});
\coordinate (10) at ($(2,2)+(45:2)$);
\coordinate (12) at ($(2,0)+(-45:2)$);
\begin{knot}
\strand (10) arc[radius={2+sqrt(2)},start angle=45,end angle=-90];
\strand (1) -- (2) -- (3) to[out=0,in=135] (11);
\strand (4) -- (5) -- (6) -- (11);
\strand (7) -- (8) -- (9) to[out=0,in=-135] (11);
\strand (1) -- (4) -- (7) to[out=-90,in=135] (13);
\strand (2) -- (5) -- (8) -- (13);
\strand (3) -- (6) -- (9) to[out=-90,in=45] (13);
\strand (7) -- (5) -- (3) -- (10);
\strand (9) .. controls +(-2.5,-2.5) and +(-2.5,-2.5) .. (4) -- (2) to[out=45,in=-180] (10);
\strand (1) .. controls +(-2.5,-2.5) and +(-2.5,-2.5) .. (8) -- (6) to[out=45,in=-90] (10);
\strand (1) -- (5) -- (9) -- (12);
\strand (7) .. controls +(-2.5,2.5) and +(-2.5,2.5) .. (2) -- (6) to[out=-45,in=90] (12);
\strand (3) .. controls +(-2.5,2.5) and +(-2.5,2.5) .. (4) -- (8) to[out=-45,in=180] (12);
\end{knot}
\foreach \k in {1,...,13} {
\node[ellipse,fill,red,label=north east:$\k$] at (\k) {};
}
\end{tikzpicture}
\end{document}
答案2
这是一个使用双线绘制交叉口的解决方案。
\documentclass[tikz,border=7pt]{standalone}
\begin{document}
\begin{tikzpicture}[
every node/.style={fill=red,circle, text=white, inner sep=0, minimum size=14},
every path/.style={draw=white,double=black, very thick}
]
\foreach \i in {-1,0,1}
\foreach[evaluate={\k=int(5-3*\j+\i)}] \j in {-1,0,1}
\path (\i,\j) node (\k) {\k};
\foreach[count=\i, evaluate={\k=int(9+\i)}] \a in {45,0,-45,-90}
\path (\a:3) node (\k) {\k};
\draw (1) to (2) to (3) to[out=0,in=135] (11);
\draw (4) to (5) to (6) to (11);
\draw (7) to (8) to (9) to[out=0,in=-135] (11);
\draw (1) to (4) to (7) to[out=-90,in=135] (13);
\draw (2) to (5) to (8) to (13);
\draw (3) to (6) to (9) to[out=-90,in=45] (13);
\draw (7) to[out=135,in=135, distance=100] (2) (2) to (6) (6) to[out=-45,in=90] (12);
\draw (1) to (5) to (9) to (12);
\draw (3) to[out=135,in=135, distance=100] (4) (4) to (8) (8) to[out=-45,in=180] (12);
\draw (1) to[out=-135,in=-135, distance=100] (8) (8) to (6) (6) to[out=45,in=-90] (10);
\draw (7) to (5) to (3) to (10);
\draw (9) to[out=-135,in=-135, distance=100] (4) (4) to (2) (2) to[out=45,in=180] (10);
\draw[bend left=17] (10) to (11) (11) to (12) (12) to (13);
\end{tikzpicture}
\end{document}