# How to draw all diagonals in the n-gon from a particular vertex?

What I'm trying to do is this

I can draw them one by one, but what if I have not a 15-gon but a 1002-gon, how do I "automate" that? What tool should I use?

I've tried to use "Interpolate" tool, but diagonals aligned with the straight line, rather than the сircumscribed circle

By the way, I'm using Inkscape 0.92.2

• Perhaps you can look into TikZ? If you have specific questions the people at tex.stackexchange.com can probably help you. – Saaru Lindestøkke Dec 9 '18 at 17:30
• Then you should be writing the svg using some programming interface. Wether its TeX, mathematica, javascript in the browser, svg by hand or eps doe snot really matter – joojaa Dec 9 '18 at 17:30
• Note that a 1002 gon does not look very interesting in normal screen scales see image I made the lines thin so you can see them yet even at this cale they flow into each other and make a moire pattern – joojaa Dec 9 '18 at 17:44
• Thank you @SaaruLindestøkke! Didn't know about TikZ. Now i'm studying Tkinz to workout the asnwer. – InkUsya Dec 9 '18 at 18:00
• @joojaa would you mind sharing the method that you used to create that image? I suppose it might be helpful to InkUsya. – Saaru Lindestøkke Dec 9 '18 at 18:03

User joojaa posted an answer in the comments but is for some reason reluctant to post it as an actual answer. To keep in line with the SE format I've therefore posted his answer below, I hope that's ok.

As the EPS format is merely a set of instructions you can use that to code your n-gon with an arbitrary number N as follows:

1. Open a text editor (e.g. notepad++, sublime text, textedit)
2. Paste in the code below.
3. Adjust the number `10` in the line `/num 10 def` (line 6, the first line after the comments) to adjust the number of corners in your n-gon.
4. Save it as a file with and `.eps` extension.
5. View it with any eps-capable viewer.

## Code

``````%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: -40 -40 40 40
%%Creator: https://graphicdesign.stackexchange.com/users/18306/joojaa

/num 10 def
/li {dup sin 30 mul exch cos 30 mul lineto} def
/lin {0 30 moveto li} def

1 1 num {
360 mul num div lin
} for
stroke

0 30 moveto
1 1 num {
360 mul num div li
} for
stroke

%%EOF
``````

## Output

This is the output for N = 40 and N = 6 (`/num 40 def` and `/num 6 def` respectively)

## Documentation

Someone at the University of Cambridge posted this nice documentation of the EPS language. That might help interpreting what all the commands do.

## Automation

If you would like to create a set of n-gons for a series of `N`, you could create script (with any scripting language of your choosing) to change the number on line 6 and save a different eps file each time. How to do that is not in the scope of this SE.