Search All of the Math Forum:

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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

 Messages: [ Previous | Next ]
 Bob Hanlon Posts: 906 Registered: 10/29/11
Re: Arranging disks (or any object for that matter) be
Posted: Apr 13, 2013 8:36 PM

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

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