3

I would like to create the projective plane PG(2,3) using tikz, as shown in this picture:

enter image description here

My tikz abilities right now go as far as creating the dots in a 3x3 grid, so providing what I have tried so far won't be of much help; if somebody could just provide the actual code, I would be more than grateful.

5

The tricky bit is getting the paths to pass over or under each other as in your diagram. The rest is just basic TikZ paths, though a fair amount could be automated.

For the tricky part, fortunately there's a TikZ knots package which does all the under-over stuff for you.

\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}

Projective Plane

  • I have no words to thank you, that was such a headache for me. – geo909 Oct 31 '16 at 22:07
4

Here is a solution using double lines to draw the crossings.

\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.