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


Adding Sliders

Now that you have a surface, lets make it more interactive. Suppose you are interested in the family of surfaces f(x,y) = x3 - ax - y2 for various values of a. We can make a slider for the value of a so that changing the slider changes the surface. To do this, edit the function to be

    Function {x y} {
      let z = x^3 - a x - y^2
    }
and below this add the line
    Slider a -1 1 0
This declares a slider tied to the variable a whose values run from -1 to 1 and is set initially to 0. When you hit the Update button, the slider will appear in its own window. First, move this to a convenient location, then change the value of the slider by dragging it; when you let go, the surface should be updated to reflect the new value of a.1

Note that the values of sliders can be used almost anywhere. For instance, you can change the domain to

    Domain {{-1 1 n} {-1 1 n}}
    Slider n 1 20 10 -resolution 1
in order to have the number of subdivisions be controlled by a slider. Here, the resolution of the slider is set to 1 so that it will take on only integer values.


1

Geomview rescales and centers the object each time it is updated, to try to keep it in view. In our case, this will make the object appear to shrink as it gets taller. If you want the various surfaces to be the same scale in relation to each other, you can set the Normalization to Keep in the Object menu.



[HOME] StageTools Documentation web pages
Created: 08 Sep 2001
Last modified: 08 Sep 2001 23:35:30
Comments to: dpvc@union.edu
[Next] Combining Objects
[Up] A Short CenterStage Tutorial
[Prev] Creating Your First Surface