TransWikia.com

Drawing diagonals of a hexagon with asymptote

TeX - LaTeX Asked on December 1, 2021

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! 😀

One Answer

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

Answered by g.kov on December 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP