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

MathGroup Archive 2013

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

Search the Archive

Re: Arranging disks (or any object for that matter) be

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130476] Re: Arranging disks (or any object for that matter) be
  • From: "djmpark" <djmpark at comcast.net>
  • Date: Sat, 13 Apr 2013 20:38:15 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20130411081228.CDAF66B1E@smc.vnet.net> <kk88re$c1e$1@smc.vnet.net> <10278596.52387.1365833271782.JavaMail.root@m06>

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 at comcast.net 
http://home.comcast.net/~djmpark/index.html 




From: Clif McInnis [mailto:c_mcinnis at 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]}]




  • Prev by Date: Re: Arranging disks (or any object for that matter) be
  • Next by Date: Distribute one list element over another
  • Previous by thread: Re: Arranging disks (or any object for that matter) be
  • Next by thread: Re: Arranging disks (or any object for that matter) be