StageTools - Documentation (CenterStage/Tutorial) [Prev][Top][Up][Next]

Using Groups to Isolate Updates

Suppose now that we want to make the intersection curve clearer; we can do that using a special "slicing" object. Select Object/Add again, but this time, we want an object that is not one of the basic ones; use the menu at the top of the dialog box to select the Miscellaneous objects, and select the Levels type (you may need to scroll the list). When you hit OK, another dialog box will appear asking which object you want to slice. Select the Group/Surface object, which is your original surface. Once that is done, you should see your new slicing object and its definition. Set the Appearance/Line Width to 3, set Color to Solid/Red, and change the definition to

    Height z = 0
(that is, remove the -normalize). If you press Update, you should see a slice at height z=0 on your surface. Unfortunately, if you moved the slider, this slice is not at the same place as the plane. We need to tie the height to the value of h that is used in the Plane object; but since these are separate objects, they can't access each others' variables. They do, however, share any variables that belong to their parent group, so we can use a slider at the group level to give the Plane and Levels objects a common value for h.

To do this, click on the name "Group" in the object list at the right of the CenerStage window to select it. Its definition should appear in the script window. Type

    Slider h -1 1 0
and press the Enter key on the keypad (or hit the Update button). You will get a second slider named h. To get rid of the old one, select the Plane object in the object list, and delete the Slider line from it. Again, press Enter on the keypad to activate your change; you should now have only one slider again Finally, select the Levels object and change its script to read
    Height z = h
Now when you press Update, the plane and the level set should be at the same height. Moving the slider should now cause both the plane and the level set to move. Unfortunately, it also causes the axes and surface to be recomputed as well. This is because any change to the group (e.g., changing its h slider) causes all the objects in the group to be recomputed, since any of the objects might use the value of h in their definition. The group doesn't know which ones actually do. We can overcome this problem by using a nested group inside our main group. The nested group can contain just the plane and level set, together with the slider, so when the slider is changed, only those two objects will be updated.

To accomplish this, add another Group object by selecting Object/Add as usual; call this group Slice. Now select the Plane object by clicking on it in the object list, and choose Move to group in the Object menu. You will get a dialog box asking which group to move it to; select Group/Slice. Similarly, select Levels and move it to Group/Slice. The objects list should look like this:

Now select the main Group and delete the slider from it (then press Enter). Finally, select the Slice object and enter the slider there. Press Update to recompute all the objects. The slider should now update the plane and level set, but not the surface itself, when you move it.

For one last effect, we'll make the function used by the Surface be entered in a type-in area. To do this, select the Surface object, and change the script to read

    Domain {{-1 1 10} {-1 1 10}}
    Function {x y} {let z = $f}
    TypeIn f "x^2 - y^2"
Note the presence of the dollar sign in the definition of the function. This means insert the value of the variable f before evaluating the let statement. (This is part of the syntax of the TCL/TK language that underlies StageTools.) Press Update to activate these changes. If you change the value of the type-in area for f, the surface and its slice both should change. You may notice that when the Surface is selected, the slider disappears. That's because the value of h is not available to the Surface, so its slider is not shown. To be able to move the slider, select the Group object again.

[HOME] StageTools Documentation web pages
Created: 08 Sep 2001
Last modified: 08 Sep 2001 16:57:40
Comments to:
[Next] Creating a Custom Input Panel
[Up] A Short CenterStage Tutorial
[Prev] Combining Objects