Mathematica 9 is now available
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: [mg130479] Re: Arranging disks (or any object for that matter) be
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sat, 13 Apr 2013 20:39: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>

turtle[pos_: {0, 0}, scale_: 1] :=
 Module[
  {x = pos[[1]], y = pos[[2]]},
  {Thickness[scale/16],
   Circle[{x - scale, y + .7 scale}, .5 scale, {8 Pi/6, 3 Pi/2}],
   EdgeForm[Directive[Thick, White]],
   Disk[{x + scale, y}, .5 scale, {0, Pi}],
   Disk[{x, y}, scale, {0, Pi}],
   Disk[{x - .5 scale, y}, .25 scale, {Pi, 2 Pi}],
   Disk[{x + .5 scale, y}, .25 scale, {Pi, 2 Pi}],
   White,
   Disk[{x + 1.2 scale, y + .3 scale}, .04 scale]}]
Manipulate[Module[{a, pos, scale},
  Graphics[
   Table[
    a = -((Pi*(-2 + n + 2*r))/n);
    pos = {Cos[a], Sin[a]};
    scale = 2.5/Max[8, n];
    {Darker[Green],
     shape[pos, scale],
     Text[Style[r, Orange, "Label",
       Floor[2 (313 - 9*n)/19]],
      pos + If[shape == turtle, {0, .5 scale}, 0]]},
    {r, 1, n}],
   ImageSize -> {350, 350}]],
 {{shape, turtle, "Shape"},
  {Disk -> "Disk", turtle -> "Turtle"},
  ControlType -> SetterBar},
 {{n, 1, "Number \nof Disks"}, 1, 20, 1,
  Appearance -> "Labeled"}]



Bob Hanlon




On Sat, Apr 13, 2013 at 2:02 AM, Clif McInnis <c_mcinnis at hotmail.com> wrote:

> 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: Can I join please?
  • Next by Date: Re: rayshade POV Export help asked
  • 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 arranged in a