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


Groups > comp.soft-sys.math.mathematica > #14156 > unrolled thread

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

Started byBob Hanlon <hanlonr357@gmail.com>
First post2013-04-12 06:16 +0000
Last post2013-04-14 00:36 +0000
Articles 4 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

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

FromBob Hanlon <hanlonr357@gmail.com>
Date2013-04-12 06:16 +0000
SubjectRe: Arranging disks (or any object for that matter) be
Message-ID<kk88re$c1e$1@smc.vnet.net>
Manipulate[
 Module[{a},
  Graphics[
   Table[a = -((Pi*(-2 + n + 2*r))/n);
    {Darker[Green],
     Disk[{Cos[a], Sin[a]}, 3/Max[8, n]],
     Text[Style[r, Orange, "Label", 24],
      {Cos[a], Sin[a]}]},
    {r, 1, n}],
   ImageSize -> {350, 350}]],
 {{n, 1, "Number \nof Disks"}, 1, 20, 1,
  Appearance -> "Labeled"}]



Bob Hanlon




On Thu, Apr 11, 2013 at 4:12 AM, Clif McInnis <c_mcinnis@hotmail.com> wrote:

> I am looking for a way that I might be able to make the disks (or any
> object for that matter) be arranged in a circular or pentagonal arrangement
> as opposed to rows. I tried looking at the "Sum of Empty Skies for a Set of
> Planets" to see how the "planets" were arranged, but I could not figure out
> how the code worked. I am thinking that there might be a function that I
> have not considered, and would appreciate if someone could point me in the
> right direction.
>
> Manipulate[Pane[Row[Table[Graphics[{
>       Darker[Green],
>       Disk[{0, 0}, .5],
>       Text[Style[numerals[[ r]], Orange, "Label", 24], {0, 0}]}], {r,
>      1, n}]], {325, 300},
>   BaseStyle -> {LinebreakAdjustments -> {1., 10, 0, 0, 10}}], {{n, 1,
>    "Number \nof Disks"}, 1, 5, 1}, Initialization :> (
>    numerals = {"1", "2", "3", "4", "5"};)]
>
>

[toc] | [next] | [standalone]


#14171

FromClif McInnis <c_mcinnis@hotmail.com>
Date2013-04-13 06:02 +0000
Message-ID<kkasdc$rj0$1@smc.vnet.net>
In reply to#14156
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]}]

[toc] | [prev] | [next] | [standalone]


#14182

From"djmpark" <djmpark@comcast.net>
Date2013-04-14 00:36 +0000
Message-ID<kkctmm$7f8$1@smc.vnet.net>
In reply to#14156
Clif,

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 Disks:", 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]}]

[toc] | [prev] | [next] | [standalone]


#14183

From"djmpark" <djmpark@comcast.net>
Date2013-04-14 00:36 +0000
Message-ID<kkctmr$7fa$1@smc.vnet.net>
In reply to#14156
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]}]

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web