Curve Editor

The curve editor permits the user to create and edit an animation curve in the MGED display window. In AnimMate, a curve is an ordered list of nodes. Each node consists of a time value and an associated point in three-dimensional space. A curve is displayed as a series of line segments between the points, and is intended to represent paths that animated objects will follow through time and space.

For a given AnimMate curve named, for example, cname, the time values associated with each node are stored in a tcl variable, "mged_sketch_time_cname". MGED's vdraw command stores the corresponding points in a vlist of the same name, and displays the curve as a pseudo-solid named "_VDRWcname". (See the vdraw help page for more information.) When using AnimMate, these details should be invisible to the user, who can consider a curve to be a single entity. However, it is important to note that curves are not part of the model geometry. Exiting an MGED session destroys a curve unless its parameters have been saved in a file.

The purpose and function of the components of the curve editor are explained below.

Current Curve

The curve editor only operates on one curve at a time. This curve is referred to as the current curve and is marked in the display with a cyan cursor. The top frame of the curve editor shows the name of the current curve. If no curves exist when the editor is created, an empty curve named vdraw is automatically created.

Clicking on the Current curve: label posts a menu with the following entries:

New Curve
Creates a new curve and makes it the current curve. The user is asked to supply the name of the new curve.

Open Curve
Makes an existing curve current. The user selects from a list of existing curves.

Rename Curve
Changes the name of the current curve as specified by the user.

Copy Curve
Creates a copy of the current curve and makes the copy current. The user supplies the name of the new curve.

Delete Curve
Deletes a curve selected by the user from a list of existing curves.
Note: Long curve names are truncated by vdraw to a maximum of 31 characters.

Current Node

The next section of the curve editor displays and controls the current node of the current curve. Whenever the current curve is non-empty, one of the nodes of the curve is designated the current node and is marked on the display with three-dimensional cyan asterisk. This is the node which will be affected by operations such as MOVE and DELETE and which controls where new nodes are added and inserted, as explained in the next section.

The curve editor contains a label of the form "Node i of n", where n is the number of nodes in the current curve, and i is the index of the current node. The index is always constrained to lie between 0 and n-1.

The left and right arrow buttons can be used to change the current node index. The small right and left arrows increment and decrement the current node index by one, while the larger arrows increment and decrement in steps of 10.

The box next to the Time label displays the time parameter of the current node. The time parameter can be keyboard-edited after clicking on the box with the left mouse button. The new time parameter is applied to the curve when the Return key is pressed.

Curve Editing

The next four buttons in the curve editor perform the principal editing operations:
ADD
This command adds a new node to the current curve, inserting it after the current node. The new node then becomes current. The spatial coordinates for the new node are taken from the current center point of the MGED display window. Before activating the button, the user should center the display (in all three dimensions) on the desired new point. If the new node is being added to the end of the current curve, the new time parameter will be the time parameter of the previous end node incremented by the global variable mged_sketch_tinc. (The value of this variable is typically 1.0, but it may be set arbitrarily by the user.) If the new node is added between two existing nodes, its time parameter will be the average of the adjacent time parameters.

INSERT
This command adds a new node to the current curve, inserting it before the current node. The new node then becomes current. The spatial coordinates for the new node are taken from the current center point of the MGED display window. If the new node is being inserted onto the beginning of the current curve, then the time parameter will be the time parameter of the previous first node decremented by the global variable mged_sketch_tinc. Otherwise, the new time parameter will be the average of the time parameters before and after the new node.

MOVE
This command changes the spatial coordinates of the current node to the current center point of the MGED display window.

DELETE
This command deletes the current node from the current curve.

Curve Color

The color of the current curve is displayed in the box next to the Color: label, in the form r g b, where r, g, and b are integers ranging between 0 and 255. The color can be keyboard-edited after clicking on the box with the left mouse button. The Return key is pressed to apply the changes.

Alternatively, clicking on the Color: label posts a menu for changing the color of any curve. The three options are as follows:

Current curve
Post a menu of pre-defined colors to apply to the current curve. If the color other is selected, then the user is asked to specify the new color.

Current spline
Post a menu of pre-defined colors to apply to the spline curve associated with the current curve (see Spline Interpolation, below). The name of this curve comes from the entry labeled into curve:. If the color other is selected, the user is asked to specify the new color.

Other
Post a menu of pre-defined colors to apply to any other curve. The user is asked to specify the name of the curve to color.

Spline Interpolation

The next section of the curve editor allows the user to fit a cubic spline curve to the current curve. If a given curve represents key points in an animation path, then the spline curve can be used to determine the animation path for the intermediate frames of the animation.

Clicking on the Spline Interpolate button creates a spline curve with open end conditions which smoothly interpolates the current curve in space and time. The name of the spline curve is specified in the box next to the into curve: label. By default, the curve editor names the spline by adding the prefix spl_ to the name of the current curve. However, the spline name can be keyboard-edited by clicking on the box with the left mouse button.

The nodes of the spline curve are distributed evenly through time. The number of spline nodes created for each second of time is determined by the value labeled Frames per second:. If the spline curve is to be used as the basis of an animation sequence, the user should set this number to the desired frame rate of the animation.

Clicking on the Cspline Interpolate button creates a circular spline curve. The circular spline smoothly interpolates the current curve, but instead of ending at the point specified by the last node, it ignores this point and ends at the point specified by the first node. The derivatives at the beginning and end of the circular spline are matched so that a periodic repetition of the curve yields a smooth animation.

Reading and Writing Curves

The Read/Write menu has the following options:
Read Curve From File
The nodes of a new or existing curve are specified by reading an ASCII file. The file should be a four-column table with columns time x y z. Any extra columns are ignored, and missing columns are zero-filled. The user is asked which file to read and which curve to read into. By default, the file is read into the current curve.

Write Curve To File
The nodes of a curve are written to a file, which is a 4-column table of ASCII text, with columns time x y z. Each row of the table represents one node of the original curve. The user specifies the name of the curve to write and the file to write to. By default, the current curve is written.

Write Spline to File
This option performs the same function as Write Curve To File, except that by default the spline curve associated with the current curve is written.

Other Buttons

The Up button raises the parent of the curve editor to the top of the stacking order, and the Cancel button closes the curve editor.
Next Section: Table Editor

Index