Commands
The single command `2d' takes a function argument; the functions are:
AnimLaws
Usage: 2dAnimLaws
This draws various curves (constant, accelerating, decelerating, accelerating the decelerating); a collaboration with Andrew Glassner.
Circularize
Usage: 2dcircularize <text> <ip-out> [-option]; options include:
-radius <real>
-yScale <real>
-font <fontName>
-size <pointSize>
Wrap the given text in a circle.
radius is the radius of the circle, yScale is the height of the text.
ContoursInterpolate
Usage: 2dContoursInterpolate
Interpolate between two contours.
ContoursTest
Usage: 2dContoursTest
Test contour functions.
Ellipse
Usage: 2dEllipse
Draws ellipses.
GraphFunction
Usage: 2dGraphFunction <function> [-option]
functions are:
Bump: a second order curve
Gauss: the normal distribution curve
Poisson: the poisson curve
Power: a power curve
Sin: a sin curve
Perlin: Ken's curve
Wyvill: Wyvill's soft function
SlowInOut: Slow in and out curve
Pavicic: Pavicic's weighting function
options are:
-scale <REAL> (default = 1) change the vertical scale
-xMin <REAL> (default = 0) set the minimum abscissa
-xMax <REAL> (default = 1) set the maximum abscissa
-a <REAL> (default = 1) set a parameter for the function
This program will graph the selected function. The "a" parameter is not used by all functions. The meanings of the functions are:
Bump: a peaky, symmetric curve, y ← (1-abs(1-2x))2
Gauss: a gaussin curve with mean 0.5 and standard deviation 0.16.
Poisson: y ← axe-ax
Power: y ← xa
Sin: y ← (0.5+0.5sin(x))a
Perlin: y ← 0.5(log0.5x)(log0.5a)
Wyvill: y ← x2/a2+x4/a4+x6/a6
SlowInOut: y ← 3x2-2x3
Pavicic: y ← A(1-x)+(1-A)(1+cos(px))/2
A=(1-v2)/(v1-v2), v1=p/3, v2 = (p/2)-(2/p)
It's easy to add functions; for example, just compile and run the following:
DIRECTORY G2dGraph; IMPORTS G2dGraph ~ {
proc: G2dGraph.GraphProc ~ {RETURN[x*x]};
G2dGraph.RegisterFunction[["Square", proc, "graph the square function"]];
}.
ImplicitFunction
Usage: 2dImplicitFunction <function>
This program allows one to graph implicitly defined functions that have been registered via G2dImplicit.Register. An initial "simple" function is registered. The Curve button will draw the implicit curve.
Interpolate
Interpolate two Interpress files.
Play
Usage: 2dPlay <play-fileName>
This is an ais-display/playback-animation tool that, for performance reasons, completely ignores viewers. The tool reads the play file and plays back, onto the color (8 or 24 bpp mode) or LF display, those ais files specified in the play file. The tool permits the user to play back a single frame, or to adjust the playback speed.
The speed of playback depends upon the number of ais files and the computer's real memory. The first playback may be somewhat jerky, as the contents of real memory are rearranged. Subsequent playbacks are usually smooth.
The play file is of the following format:
Each CR-terminated line of the file is read independently; the remainder of a line following "--" is ignored. Commas separating arguments and colons separating a keyword and argument are ignored.
The following global keyword/arguments have meaning irrespective of their position within a line; they are operative unless subsequently modified:
color frames are displayed on the color display.
bw frames are displayed on the LF display.
place placement of a frame is offset by its ais origin, if it exists.
noPlace placement of a frame is not offset by its ais origin.
speed <fps> frames are played at the given speed.
x <x-offset> frames are offset by x pixels.
y <y-offset> frames are offset by y pixels.
box <xywh> frames are clipped to this region.
xOffset <x> in addition to other offsets, all frames in the file are offset by x pixels.
yOffset <y> in addition to other offsets, all frames in the file are offset by y pixels.
Source images for the playback are specified by:
image <nImage> <ais fileName>
If the ais fileName is given as "foo" then file foo, if it exists, is read; otherwise foo.ais, if it exists is read; otherwise foo is expected to be the base name for a color ais triplet of files, "foo-red.ais" (or "foo-r.ais"), "foo-grn.ais" (or "foo-green.ais"), and "foo-blu.ais" (or "foo-blue.ais"). Otherwise the message window will blink an error if this source image is later referenced.
The animation is specified by lines beginning either with the keyword "Frame" or "Frames." For example:
Frame: 0, Image: 0 -- when playing frame 0, use image 0.
Frame 1, Image: 1, 2 -- when playing frame 1, use images 1 and 2
Frames 2~4, Image: 3 -- when playing frames 2, 3, and 4, use imae 3
Frames 5~7, Image: 1, 3 -- when playing frames 5, 6, and 7, use images 1 and 3
Startup time for this program depends on the amount of ais data needed by the play file. A play file may be edited and re-read by the tool using the ``Reread Timings'' button; this re-reads the entire file, resetting the animation variables, but does not change the original image assignments
The following buttons are provided:
ABORT abort the playback.
ReRead re-read the play file, setting animation variables only.
Play play the animation.
Shuttle continuously play the animation, forwards then backwards.
Cycle continuously play the animation.
Start set the frame number for the beginning of playback (defaults to 0).
Stop set the frame number for the ending of playback (defaults to last frame).
Store replay the animation, saving each frame as an ais file;
each ais name is <play-fileName>.<frame number>.ais
(or -red.ais, -grn.ais, -blu.ais if 24 bpp animation).
A sample play file, 2dTest.play, is provided; try it:
Turn on the color display in 8 bpp mode and clear it to white
Type 2dPlay 2dTest.play to the CommandTool
Press Shuttle
PrettyCurves
Usage: 2dPrettyCurves
Andrew Glassner's program to draw a variety of parametric curves, randomly chosen, centered on successive mouse clicks in the viewer.
Spirograph
Usage: 2dSpirograph
Andrew Glassner's program to draw a spirograph.
StrokeWarp
Usage:
2dStrokeWarp (for interactive use) -- or --
2dStrokeWarp <x y text ipOut x1 y1 x2 y2 x3 y3 x4 y4> [-option]
Options:
[-color <r> [<g b>]] default is black
[-font <fontname>] default is helvetica-mrr
[-size <pointsize>] default is 14 (pixels)
x, y is in pixels (72 per inch);
fonts from ///7.0/Fonts/Xerox/Pressfonts/
A program to warp the outlines of text. In interactive mode, one draws a series of curves that controls the transformation of Tioga-selected text. The results appear in a Preview viewer, permitting arbitrary scaling, translating, and output to an Interpress master.
The transformation can be of two types: Persp or Coons, each requiring four separate curves.
Persp performs a perspective transformation on the selected text, transforming the text's rectilinear region to the arbitrary quadilateral specified by the user.
Coons transforms text according to a region bounded by four completely arbitrary curves.
The buttons in the program are:
WARP Perform the transformation; results appear in the Preview viewer.
Get Text Set the text to be the current Tioga selection.
Clear Reset the curves for the current mode.
Persp Change the current mode from Persp to Coons.
Coons Change the current mode from Coons to Persp.
Smooth If in Coons mode, smooth the Coons curves.
HELP! Open this document.
Transform
Test various 2d transformations.
Web
Usage: 2dWeb
Andrew Glassner's program to draw a web.
Zoom
Usage: 2dZoom
A tool to apply two-dimensional affine transformations to arbitrary viewers. Once a viewer is selected, its Imager context transformation may be modified in terms of scale, translation, and rotation. The transformations apply only to a top level viewer, not to any child viewers. For certain classes of viewers (Clock and Gargoyle are examples), this program is ineffective, since these programs create their own context transformations. 2dZoom appears to work well for Tioga viewers, transforming text as well as embedded artwork.
The transformation applied to the viewer is compensated within the mouse notify mechanism, so that, for example, in a Tioga viewer, text may still be selected and modified.
A transformation may be specified as a key frame, and a series of key frames may be interpolated, resulting in an animation. The initial interpolation may be slow; the resulting frames are buffered, however, and subsequent replay may be at arbitrary speeds.
The contents of an individual, transformed viewer may be written as an Interpress file. The entire animation may be written as a series of AIS files.
Tool buttons include:
Get Viewer Indicate, by selecting a viewer, which viewer is to be transformed.
Reset Reset the viewer to its native transformation.
IP Out Write the viewer, with its current transformation, to Interpress file.
AISs Out Write the animated viewers to AIS files.
HELP! Open this document.
Add Add the currently transformed viewer as a key frame.
Del Delete a key frame.
Write Write the current transformation to a file.
Read Set the current transformation from a file.
STOP Stop any interpolation or playback.
Interp Interpolate the key frames.
Replay Replay the interpolated frames.
Cycle Continuously replay.
Backforth Continuously replay forwards then backwards.
Time Interpolate the transformation to the specified time.
In addition to the interactive controls, x-translate, y-translate, scale, and rotate, there are controls to set the individual frame or the playback speed.
When at least two key frames have been specified, a time line showing key placement is drawn. Keys may be repositioned along the time line by mousing down near their position on the time line, and sliding them to a new position.
The ais frames created by the ``AISs Out'' button may be replayed with the 2dPlay program.