Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: Arranging disks (or any object for that matter) be
Replies: 6   Last Post: Apr 13, 2013 8:36 PM

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 David Park Posts: 1,560 Registered: 5/19/07
Re: Arranging disks (or any object for that matter) be
Posted: Apr 13, 2013 8:36 PM
 Plain Text Reply

Clif,

(This should replace my earlier posting so as to use Turtles instead of
Disks in the SetterBar heading.)

The previous Presentations solution can be easily modified for this.

<< Presentations`

I scale the turtle down so it can walk basically on a unit circle.

turtleShape = {Darker[Green], Thickness[1/32],
Circle[{-1, .7}, .5, {8 Pi/6, 3 Pi/2}],
EdgeForm[Directive[Thick, White]], Disk[{1, 0}, .5, {0, Pi}],
Disk[{0, 0}, 1, {0, Pi}], Disk[{-.5, 0}, .25, {Pi, 2 Pi}],
Disk[{.5, 0}, .25, {Pi, 2 Pi}], White, Disk[{1.2, .3}, .04]} //
ScaleOp[1/5, {0, 0}];

This provides the dynamic, again with a completely fixed background. Each
turtle is rotated and then translated into position. I added a circle as a
base for the turtles, who are arrayed clockwise about the circle.

DynamicModule[{numDisks = 0, angle = 0},
pagelet[
phrase["Number of Turtles:", Spacer[10],
SetterBar[
Dynamic[numDisks, (numDisks = #;
angle = -2 \[Pi]/Max[1, numDisks]) &], Range[0, 9]]],
Draw2D[
{{GrayLevel[0.5], ComplexCircle[0, 0.96]},
Dynamic@
Table[
turtleShape // RotateOp[(nn - 1) angle - \[Pi]/2, {0, 0}] //
TranslateOp[ToCoordinates[Exp[I (nn - 1) angle]]], {nn, 1,
numDisks}]},
PlotRange -> 1.5,
Background -> LightBrown,
ImageSize -> 500]
]
]

David Park
djmpark@comcast.net
http://home.comcast.net/~djmpark/index.html

From: Clif McInnis [mailto:c_mcinnis@hotmail.com]

Bob,

Thank you, that works very well. I am wondering if it is possible to put an
object in the place of the disk. I have a little turtle shape (the code
below)that I had tried to substitute for the line " Disk[{Cos[a], Sin[a]},
3/Max[8, n]]" which did not work out too well. My guess is that it would
work if I would assign the {x,y} values of the semi disk that makes the
shell to Cos[a],Sin[a] and then related the other parts of the shape to
those coordinates, however before I undertook that endeavor I thought that I
would just ask you to give me a yes/no answer as to whether it would even be
a possibility. Again Thank You for your help.

Sincerely -- Clifton McInnis

Graphics[{
Darker[Green], Thickness[1/32],
Circle[{-1, .7}, .5, {8 Pi/6, 3 Pi/2}],
EdgeForm[Directive[Thick, White]], Disk[{1, 0}, .5, {0, Pi}],
Disk[{0, 0}, 1, {0, Pi}], Disk[{-.5, 0}, .25, {Pi, 2 Pi}],
Disk[{.5, 0}, .25, {Pi, 2 Pi}], White, Disk[{1.2, .3}, .04]}]

Date Subject Author
4/12/13 Bob Hanlon
4/13/13 Clif McInnis
4/13/13 David Park
4/13/13 David Park
4/13/13 Bob Hanlon

© The Math Forum at NCTM 1994-2016. All Rights Reserved.