Question: [![enter image description here](https://i.stack.imgur.com/p8wF1.jpg)](https://i.stack.imgur.com/p8wF1.jpg)

This is what I am trying to currently draw. I however do not know how to add the purple lines or green points. I am able to draw a regular octagon with points and the outer lines by the following:

```
\begin{tikzpicture} \newdimen\R
   \R=1.3cm
   \draw (0:\R) \foreach \x in {45,90,135,180,225,270,315,360} {  -- (\x:\R) };
   \foreach \x/\l/\p in
     { 45/,
      90/,
      135/,
      180/,
      225/,
      270/,
      315/,
      360
     }
     \node[inner sep=1pt,circle,draw,fill] at (\x:\R) {}; 
\end{tikzpicture}

```

But I am unsure of how to add the rest.

Answer: 
[![regular octogon and lines](https://i.stack.imgur.com/smnKl.jpg)](https://i.stack.imgur.com/smnKl.jpg)

```
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{intersections,backgrounds}

\begin{document}
    \tikzset{
        summit/.style={inner sep=1pt,outer sep=0pt,circle,fill=black,text=white},
        innode/.style={inner sep=1pt,outer sep=0pt,circle,fill=green!50!black,text=white},
        outnode/.style={inner sep=1pt,outer sep=0pt,circle,fill=violet,text=white}
        }
    \begin{tikzpicture}
        \newdimen\R
        \R=1.3cm
        \draw (-22.5:\R) \foreach \x [count=\i] in {0,45,...,315} {  -- (\x+22.5:\R) node[summit] (\i) {} };

        \node[innode] at (intersection of  1--6 and 5--8) (A) {};
        \node[innode] at (intersection of  1--4 and 2--5) (B) {};

        \node[outnode] at (intersection of  1--2 and 5--4) (C) {};
        \node[outnode] at (intersection of  1--8 and 5--6) (D) {};

        \begin{scope}[on background layer]
            \draw[green!50!black]
                (1) -- (6)
                (5) -- (8)
                (1) -- (4)
                (2) -- (5)
                (C) -- (D);

            \draw[violet] (C) -- (1) -- (D) -- (5) -- (C);
        \end{scope}
    \end{tikzpicture}

\end{document}

```
Purely for comparison, here is a version in [Metapost](http://www.tug.org/metapost.html), showing how to draw a polygon, and how to define points at the intersection of straight lines.

[![enter image description here](https://i.stack.imgur.com/doVKR.png)](https://i.stack.imgur.com/doVKR.png)

```
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);

    path gon; gon = for i=0 upto 7: 42 dir (45i + 45/2) -- endfor cycle;

    z1 = whatever[point 0 of gon, point 1 of gon] = whatever[point 3 of gon, point 4 of gon];
    z2 = whatever[point 0 of gon, point 3 of gon] = whatever[point 1 of gon, point 4 of gon];
    z3 = whatever[point 0 of gon, point 5 of gon] = whatever[point 7 of gon, point 4 of gon];
    z4 = whatever[point 0 of gon, point 7 of gon] = whatever[point 5 of gon, point 4 of gon];

    drawoptions(withcolor 3/4);
    draw z1 -- z4;
    draw subpath (1,3) of gon -- point 0 of gon -- 
         subpath (5,7) of gon -- point 4 of gon -- cycle;

    drawoptions(withcolor 3/4[red, blue]);
    draw point 0 of gon -- z1 -- point 4 of gon -- z4 -- cycle;

    drawoptions(withpen pencircle scaled dotlabeldiam);
    for i=1 upto 4:
        draw point i of gon;
        draw point i+4 of gon;
        draw z[i] if (i=2) or (i=3): withcolor 1/2 green fi;
    endfor

    drawoptions();
endfig;
\end{mplibcode}
\end{document}

```

This is wrapped up in `luamplib`, so you need to compile it with `lualatex`.