Is there a way to use the notation \draw (p.corner /n) -- (p.corner /k) ; in tkiz instead of actually knowing the points?
This is my code. Any help would be appreciated! More specifically im trying to draw diagonals from A_1 to A_8 etc.
\begin{tikzpicture}
\node (p) [draw,rotate=90,minimum size=10cm,regular polygon, regular polygon sides=9] at (0,0) {};
\draw (0,0) circle (5 cm);
\foreach \n [count=\nu from 1, remember=\n as \lastn, evaluate={\nu+\lastn}] in {1,2,...,9}
\node[anchor=\n*(360/9)]at(p.corner \n){$A_{\nu}$};
\foreach \x in {1,2,...,9}
\fill (p.corner \x) circle[radius=1.5 pt];
\end{tikzpicture}
Graphics, Figures & Tables ⇒ Drawing Diagonals of regular polygon
NEW: TikZ book now 40% off at Amazon.com for a short time.
Drawing Diagonals of regular polygon
Please create a
minimal working example and mark its code so that it can be tested immediately.
If the diagonals are allowed to look the same as the sides of the polygon, then a possible solution can be kept quite simple. My suggestion uses percusse's answer:

If the diagonals are allowed to look the same as the sides of the polygon, then a possible solution can be kept quite simple. My suggestion uses percusse's answer:
Code: Select all
\documentclass[tikz]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\newcommand{\pSides}{9}
\draw
node (p) [
rotate=90,
minimum size=10cm,
regular polygon,
regular polygon sides=\pSides
] {}
circle [radius=5cm]
;
\foreach \n in {1,2,...,\pSides}{
\node[anchor=\n*(360/\pSides)] at (p.corner \n) {$A_{\n}$};
\fill (p.corner \n) circle [radius=1.5pt];
\ifnum\n<\pSides
\foreach\k in {\n,...,\pSides}
\draw (p.corner \n) -- (p.corner \k);
\fi
}
\end{tikzpicture}
\end{document}