---- Why Groups are useful ----

In the last script(curve2), we made a flower from individual petals
and moved them all individually as part of the default group 1. This
method has some problems:
-----it is slow to respond to keystrokes when in rapid rotation
-----it's maximum rotation speed is slow
-----we have to manually keep track of the axis of rotation point

So, lets take the next step and make our flower in a group of it's own
and see it's benefits and problems.
So here is a screenshot of the group0 script:
[group0.jpg] Htmlified script group0
group0 text

Now lets explain the things going on in this script.
At line 0036, I make a group called $flower. Then at line 0055, I make
the petals by cloning and rotating around the center point of the
$zinc canvas. In a later script, I'll show a better method, but for now,
let's take it one step at a time to see the problems.

When you run this script, you will notice how much faster it spins,
because we are rotating the whole $flower group, instead of individual petals.

We now can just do:
At line 0099::

instead of:
   foreach $petal(@petals){
The speed of rotation is much faster in this script, and it does lend itself
to some "weird illusions" at high rotation speeds.
There is still one problem though....scaling. I put a scaling function in
with keys 'a' and 'z'. Notice that when you scale, it goes to zero at the left
upper corner(point(0,0)); and zooms out at the right bottom corner. Why? Because
we made our $flower a member of group 1, the default $zinc group, which always has
it's origin at (0,0).
This is a useful trick to remember for making some
"animated display".

---- A technique for centering with groups ----

Alright, now we see that putting things in group 1 makes it somewhat more
difficult to manipulate items. In the previous script, we made a separate
group for $flower, but we're still forced to deal with the origin being at
(0,0), since we were in group 1. The most obvious way to fix that, would be to
translate the $flower group to the center point:

but I'm going to use a more "useful" method of creating a "$centergroup".
So here is a screenshot of the group1 script:
[group1.jpg] Htmlified script group1
group1 text

It is a good habit to get into of making alot of groups for different purposes.

So instead of translating the $flower group to the center, I make a $centergroup, which I add the $flower group to. See lines 0037-0042. Now this will make things
alot easier for our $flower. Notice when we create $petals at line 0045, we can
make a coordinate system which is centered at (0,0). Being a member of the
$centergroup takes care of the centering for us. It also allows us to add other
items which can move with the $flower, by being assigned to the same $centergroup.
Just for fun uncomment line 0105, and watch what happens when both the $flower group
is rotating, and the $centergroup is rotating.

---- Rotating groups ----

Here is another script which shows the advantage of assigning a center group.
In this script, we create a ring around the $flower and place it in the same
group. So we can now move the entire $centergroup in unison, with very little
programming effort. As you can see, we once again face the scaling problem, if
we try to scale $centergroup. What to do? Make another $centergroup1, and make
$centergroup a member of that. :-) Don't hesitate to make alot of groups.

So here is a screenshot of the group2 script:
[group2.jpg] Htmlified script group2
group2 text

More later.