Hi,
This seems basic but it has me stumped. I'm trying to illustrate the
idea of the "handshake problem", where small circles represent people
and the lines between the circles represent handshakes. With the code
below, I'm able to show (and manipulate) any number of circles, and
I'm also able to show the lines between adjacent circles. This just
generates a polygon whose vertices are all connected, as it should.
But how can I update my code to show the diagonals, too, and not just
the sides of the polygon? I'm not sure what to add.
Thanks!
MH
=================
Manipulate[
Graphics[{
{
Table[{Black, Thickness[0.005],
Line[{{Cos[2 Pi*k/n], Sin[2 Pi*k/n]},
{Cos[2 Pi*(k + 1)/n], Sin[2 Pi*(k + 1)/n]}}]},
{k, 0, n - 1, 1}
]
},
{
Table[
{Red, PointSize[0.035], Point[{Cos[2 Pi*k/n], Sin[2 Pi*k/n]}]},
{k, 0, n - 1, 1}
]
}
},
PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}}
]
, {n, 2, 12, 1}]