1

So I wanted to make a hexagon with the diagonals marked in Asymptote but I couldn't figure out how to do it, so can someone please help write the Asymptote code for me? I'm very new to Asymptote so I have no idea how to do it.

I attached an image of what I'm trying to make. enter image description here Thank you! :D

6
  • 3
    Why are you even doing this in asymptote when you can draw it directly in tikz
    – daleif
    Jul 16, 2020 at 1:23
  • 2
  • 1
    @daleif: In some cases TikZ has a clear advantage over Asymptote. This is not one of those cases. So we should not assume that preferring Asymptote here requires justification. (That having been said, anyone who wants to give a TikZ answer is welcome to do so, in accordance with TeX.SX practices.) Jul 16, 2020 at 15:39
  • 1
    Hi and welcome. Please modify the title of your question with a clear title that allows you to understand what it is about and allows it to be indexed by search engines. such as Drawing diagonals of a hexagon with asymptote.
    – AndréC
    Jul 17, 2020 at 10:06
  • 5
    @daleif I'm sorry I was not clear. Neither tool has a clear advantage over the other for this particular problem. The way I understand your comment, you see TikZ as the default solution for creating diagrams and Asymptote as something only to be used in special cases. That policy may well be optimal for your usage pattern. But you should not treat it as universal. There are any number of valid reasons the OP might prefer to invest in learning Asymptote rather than TikZ, and they are not obligated to share them with us. Jul 17, 2020 at 15:12

1 Answer 1

5

There are many ways to code it in Asymptote. here is one, file hexa.asy:

// run 
//   asy hexa.asy
// to get hexa.pdf
// 
settings.outformat="pdf";
size(4cm);
int n=6;
pair[] V= sequence(new pair(int i){return dir(360*i/n);}, n);
V.cyclic=true;
for(int i=0;i<n;++i){
  draw(V[i]--V[i+1]--V[i-1]--cycle,darkblue+0.7bp);
}
dot(V,UnFill);

enter image description here

You must log in to answer this question.