Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14183

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

From "djmpark" <djmpark@comcast.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Arranging disks (or any object for that matter) be
Date 2013-04-14 00:36 +0000
Message-ID <kkctmr$7fa$1@smc.vnet.net> (permalink)
References <20130411081228.CDAF66B1E@smc.vnet.net> <kk88re$c1e$1@smc.vnet.net> <10278596.52387.1365833271782.JavaMail.root@m06>
Organization Time-Warner Telecom

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: Arranging disks (or any object for that matter) be Bob Hanlon <hanlonr357@gmail.com> - 2013-04-12 06:16 +0000
  Re: Arranging disks (or any object for that matter) be Clif McInnis <c_mcinnis@hotmail.com> - 2013-04-13 06:02 +0000
  Re: Arranging disks (or any object for that matter) be "djmpark" <djmpark@comcast.net> - 2013-04-14 00:36 +0000
  Re: Arranging disks (or any object for that matter) be "djmpark" <djmpark@comcast.net> - 2013-04-14 00:36 +0000

csiph-web