Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

drawing polygon diagonals

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112295] drawing polygon diagonals
  • From: MH <matthewhoek at gmail.com>
  • Date: Wed, 8 Sep 2010 00:58:30 -0400 (EDT)

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}]


  • Prev by Date: Re: FindRoots?
  • Next by Date: Re: Please help
  • Previous by thread: Re: Collecting Positive and Negative Terms
  • Next by thread: Re: drawing polygon diagonals