Key Sub-System: Graphs
In Shape graphs are used to display functions. The functions are either analytical or set interactively by adding control points to a curve. The control points of an interactive curve can also be loaded from an external ascii file.
​
In modifiers the graphs are usually applied to set and display spatial variation of a quantity that is passed on to some quantity as a multiplier. In the modifiers the graphs may be single coordinate functions or they may depend on all three space coordinates in different types of coordinate systems (spherical by default, Cartesian or cylindrical). Generally the result is a single number, but in the case of the velocity field, for instance, the output can be a vector.
​
In the Physics Module graphs commonly are a function of wavelength.
​
The functionality and appearance of the graphs varies slightly depending on the particular context.
​
The image of the graph on the right is taken from the Squeeze Modifier, which controls the shape of a cylindrically symmetric mesh.
The function display at the top shows a line of how the function f(x) changes with the independent variable (always x). In this modifier it is the position along the axis of the object.
​
At the bottom is a list of tabs to set a variety of function properties.
​
​
Workflow:
​
Analytic:
By default the function is set to Point, but can be changed to Analytic with the Function drop-down list.
​
In the analytic mode, the graph is controlled by a mathematical expression, that by default is the constant function f(x) = 1.
​
Templates: From the Templates drop-down list a few commonly used functions can be selected that are the inserted as mathematical expressions in the editor line for the function. These templates can then be edited as needed.
In our example we have typed the function manually. In additional to several standard mathematical operators such as "exp" and "abs", it includes the variables "a" and "b". Variables can have alphanumerical names. Reserved variables include "n", "t" and "Pi", referring to density, temperature and the number p.
​
Variables: The numerical value of the variables is displayed in the Variables tab. Here the value can either be written manually or be assigned from the Math Module. If the variable was defined in the Math Module, then the flag labeled "Use global variables" needs to be set. If the flag is not set, the local manually set value is used (Local variable). Global variables are then marked by a grey background. Global variables are accessible from any function throughout Shape.
​
Constraints: Frequently used functions such as the Gaussian vary over an infinite range. In many practical situations the function is required to smoothly reach zero or some other fixed value within a finite range. This can be achieved by setting constraints in the Constraints tab. Here the function can be made to smoothly Fade in and Fade out within the ranges set there. The value form and to which the function converges is the "Default" which can be changed by the user. In the graph the region that is covert by the Fade in is shaded in blue and the Fade out in red.
​
​
Point Graph:
​
A point graph is set up using manually placed points. These point may also be loaded from a file (Load Ascii button). To obtain a continuous function the values between the points are interpolated.
​
There are two modes for interpolation. By default the interpolation is linear between the points. The second is a spline interpolation that is controlled manually with separate handle on each side of the points.
​
​
​
​
​
​
The spline interpolation is activated by clicking on the following icon:
A green color in these icons at the top of the graph indicates that they are activated. To move the points in the graph use the left-click and drag mouse functionality. To move the spline handles, use Crtl- left-click and drag.
​
Additional interactive functions to manipulate the points individually or collectively are available by activating some of the icons on the toolbar above the graph.
​
If you hover over a button or icon, a tool tip shows a short description of the functionality, which are very self-explanatory in this case.
The hand tool is active by default and allows one to move points by left-clicking on and dragging them.
The magnifying glass: zoom in and out in the graph
The next icon allows you to pan left-right and up-down in the graph.
The box with a pencil is for selecting multiple points by dragging a rectangle around them, while the cursor symbols with the arrows activates moving the selected points together.
​
Selected point are deleted by clicking on the cross icon. Note that unselected individual points can be added and removed from the right-click menu (see below).
​
The range of the graph is adjusted to the points in them by clicking on the icon with the two curvy arrows.
As mentioned above the next icon activates the spline interpolation with two handles on each point.
The wrench icon opens a pop-up windows that gives access to detailed options for the appearance of the graph. These should be largely self-explanatory.
Right-click menu:
The right-click menu give quick access to additional functionality for graphs. In particular there are four functions for point graphs at the top of the list.
​
Add Point add a point to the curve where the curser is currently located.
Remove Point removes a point over which the cursor is hovering.
Set Point opens a small pop-up window where the exact x and y values of a point can be set.
Mirror Point is a very useful function when a perfectly symmetric setting is required. When clicked while you hover over a point with coordinates (x,y) a copy of the point is added to the graph at (-x,y).
​
The second set of functions toggle on and off various functions, which are self-explanatory.
​
The Save Ascii function will open a dialog that allows you to save the point values of the graph in a file in ascii format.
The Save Image function saves an image of the graph. In the file dialog that opens, the filename has to be give a suitable file extension for the image to be correctly saved. The extension can be one of typical file formats, such as .png or .jpg, etc.
​
Finally, the Properties functions opens a dialog where the graph´s appearance may be customized in more detail by changing colors, tick-mark spacing, coordinate grids, etc.
​
​
Special variants of graphs:
​
Some contexts in Shape have specific features in addition to the basic functionality described above. These are explained in their specific contexts, such as the graph for the velocity modifier, which has a number of special functions.
​
There is one common feature of the extended graphs that depend on more than one variable, which we describe here. Most function graphs have as output a single number that controls a modifier or displays some property. An exception is the velocity modifier, which has a vector as output.
​
The basic graph that has been described above depends on a single variable. Many modifiers do, however, depend on more than one spatial dimension. Those have a separate graph that describes the spatial dependence of the output on each spatial coordinate. They are accessible through tabs at the top of the graph. The active coordinate is marked in grey.
​
Using the default Custom Mode one can select from three different types of coordinate system in the Coordinates drop-down list: Spherical (default), Cartesian and Cylindrical. The labels of the access tabs for the graphs change their labels accordingly.
​
Note that for the spherical coordinates the label convention is that of the North America, with q being longitude and f the latitude.
​
SEPARABILITY: an important property of the default behavior of these graph is that the resulting function F(u,v,w) is separable in their component functions:
F(u,v,w) = f0 * f(u) * f(v) * f(w)
​
where f0 is a constant parameter set by the user under the Coordinates drop-down list.
​
Non-separable functions: a non-separable analytic function can be set up when enabling the Analytic mode from the the Mode drop-down list. This feature requires an analytic description of the function and a point-graph can not be used.
​
As before, one chooses the type of coordinate system from the Coordinates drop-down list.
Then in the function editor a formula is types as a function of the general coordinates (u,v,w) as shown in the example on the right. The coordinates have to be in terms of the letters u,v and w, no matter which type of coordinates is chosen. Their meaning changes automatically to (x,y,z), (r,q,f) or (r,q,z) for Cartesian, spherical or cylindrical coordinates, respectively.
The image on the right shows a rendering of the density that was described by the analytic function above it. It illustrates the how the wavelength of the sinusoidal pattern can be continuously changed by mixing the coordinates appropriately.
​
​
​