Re: drawing polygon diagonals
- To: mathgroup at smc.vnet.net
- Subject: [mg112371] Re: drawing polygon diagonals
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Sat, 11 Sep 2010 05:44:32 -0400 (EDT)
- References: <i6755n$873$1@smc.vnet.net> <i6a5f5$kjv$1@smc.vnet.net> <i6creo$s8p$1@smc.vnet.net>
Something like this? DynamicModule[{maxpts = 12}, Manipulate[ pts = Table[{Cos[2 Pi*k/maxpts], Sin[2 Pi*k/maxpts]}, {k, 1, n}]; Graphics[ { Black, Thickness[0.0005], GraphicsComplex[pts, Line[Subsets[Range[n - 1], {2}]]], Blue, GraphicsComplex[pts, Line[{n, #} & /@ Range[n - 1]]], Red, PointSize[0.035], GraphicsComplex[pts, Point[Range[n]]] }, PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}} ], {n, 2, maxpts, 1} ] ] Cheers -- Sjoerd On Sep 10, 10:49 am, MH <matthewh... at gmail.com> wrote: > Thanks for your help, Dan & Sjoerd! I have one more question because > as I was working with this, I thought of a small improvement. For > now, I'll assume my biggest n-value is 12, so the current Manipulate > statement finishes with a dodecagon. The current code generates a > triangle, then a square with its diagonals, then a pentagon with its > diagonals, then a hexagon, and so on, up to a dodecagon with all its > diagonals. Each step shows a regular polygon with all its > diagonals. > > It'd be nice, though, if as n increased (with the slider) the vertices > of the dodecagon appeared one at a time in the correct place, and the > lines between them also appeared. For example, when n is 5 (and not > yet all the way to 12), there'd be five red circles but they would NOT > form a regular pentagon. Instead, they'd be in the correct position > to be vertices of a regular dodecagon. This would be cool because a > large collection of lines would not change from one n-value to the > next. Your eye would be drawn only to the new lines when you add each > circle. And if the new lines could appear in a separate color -- oh > wow, that'd be great. (For my purposes, those are the new handshakes > when you add each person.) > > I hope this makes sense. I'll do some more looking in the DocCenter. > Thanks! I appreciate your help and guidance. > > MH