Graphics, Figures & Tables ⇒ Drawing Diagonals of regular polygon
Drawing Diagonals of regular polygon
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}
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Drawing Diagonals of regular polygon

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