1
$\begingroup$

Is there a nice way I can find all possible triangulations (or quadrangulations) of a polygon (say 10-gon)? I want to have all possible diagrams with the diagonals marked (i.e. with unique name). Please suggest me in case there already is a package for such a thing.

$\endgroup$
  • 2
    $\begingroup$ For triangulations take a look at this and this and this. $\endgroup$ – Rohit Namjoshi Sep 17 '18 at 0:56
  • 1
    $\begingroup$ @Rohit In particular, the last link would be worth an answer. $\endgroup$ – Henrik Schumacher Sep 17 '18 at 9:47
  • $\begingroup$ Thanks @RohitNamjoshi. Last link is useful. But I need something more : 1. Vertices are numbered (such that I can identify the diagonals by unique names). 2. Print all possible triangulations for a given polygon. $\endgroup$ – Physics Moron Sep 17 '18 at 11:17
2
$\begingroup$

Based on your comments, I think this is closest to your requirements. To generate labeled vertices, add the following to the triangulation function:

labels = MapIndexed[Text[Style[First[#2], 10], #1] &, vertices * 1.1];

and add it to the Graphics argument list

Show[Graphics[{poly, edges, labels}]

With size = 5 this is the output: enter image description here

I am not sure what you mean by "Print all possible triangulations", but the symbol edges is set to a list of the edges for each triangulation. For size = 5, edges is

{{{2, 5}, {2, 4}}, {{2, 5}, {3, 5}}, {{2, 4}, {4, 1}}, {{3, 1}, {3,5}}, {{3, 1}, {4, 1}}}

You can probably use that to generate the printed form you need.

$\endgroup$
  • $\begingroup$ Thanks a lot for the answer! I think this is what I want. But somehow I couldn't generate the diagrams from that package. It would be really helpful if you can modify the code and share as a link. Thanks again! $\endgroup$ – Physics Moron Sep 17 '18 at 21:28
  • $\begingroup$ It's showing some errors, even if I try to run that code unaltered. $\endgroup$ – Physics Moron Sep 17 '18 at 21:42
  • 1
    $\begingroup$ Try this, modified to work on 11.3 $\endgroup$ – Rohit Namjoshi Sep 17 '18 at 22:18
  • $\begingroup$ Works fine now. Thanks! $\endgroup$ – Physics Moron Sep 17 '18 at 22:25
  • 1
    $\begingroup$ @PhysicsMoron Maybe you can use this. $\endgroup$ – Rohit Namjoshi Jan 28 at 21:52

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.