KnotPlot Commands

This is a description of some of the commands available in KnotPlot. Commands may be abbreviated to any length. However it is safer to never abbreviate a command to less than four characters. Commands are guaranteed to be unambiguous if this general rule is followed. Command arguments that take on numerical values may be set in the same way as parameters (except without an equal sign). See the explanation at the beginning of that page.

Click on one of the following subsection names to go to that subsection. To return to the top of the page, click on one of the arrows pointing upwards.

[General purpose commands] [Loading and saving knots and links] [Creating new knots and links] [Transformation tools] [Relaxing knots and links] [Graphics display] [Geometry commands] [Producing pictures] [Exporting surface models] [Topology commands] [4D commands] [Other commands]

General purpose commands

< filename
Reads the file filename and executes the commands found there. Same as the read command.

! shell-command
Sends the string shell-command to the shell to be executed there.

alert message text1 [text2]
Pops up an alert box with message written in it, and two buttons text1 and text2.

animate parameter start stop steps [linear | log]
Animates parameter from start to stop in steps increments. Defaults to linear. The demos directory has several examples of the use of animate .
tref-relax, a trefoil relaxing. fig8-relax, a figure-8 knot relaxing. 6.3-relax, the knot 6.3 relaxing. 7.1-relax, the knot 7.1 relaxing. 8sep94a, made on Sep 8, 1994. 7oct94a, made on Oct 7, 1994. 7oct94d, made on Oct 7, 1994. mangle-demo, something mangling (see mangle below). spun-trefoil An example of a 4D knot.

cursor what
Sets the mouse cursor used in the view window. The argument what can be either an integer or a string. The following values are permitted for integer settings: If what is a non-integer, a 2-bit (four colour) cursor is read from the file what.cur. A program, ppm2cur is included in the resource directory for converting raw PPM files to the '.cur' format. Check here to find out more details.

Same as the quit command.

function number action
With no arguments, prints the current binding of the function keys. With one argument, prints the binding for that key. Otherwise the function key number is bound to action. See the demo files and the knotplotrc file for examples of use.

Prints out some useful information about the current knot, such as the number of beads and components, and the extent in the three orthogonal directions.

nap number
Same as pause except on SGIs, where there is a difference but not a very interesting one.

This command does nothing at all.

panel psout [filename]
Outputs a Postscript representation of the current control panel to the file filename.eps. If filename is omitted, the output is written to the file cpanel.eps.

panel set which
Sets the control panel to which. The same effect can be achieved using the pop-up menus. See the list to find out how the control panels are numbered.

Prints the current settings of all parameters.

parameters name
Prints the value of any parameters starting with the string name.

path [directory]
If directory is omitted, this command prints the current read and write paths. See the example for more information.

pause number
Pauses execution for number seconds. This is only useful for sessions run from a script.

Same as the stop command.

read filename
Reads the file filename and executes the commands found there. Same as the < command. It is useful because there are certain contexts where read will work but < will not.

Similar to the function command except uses shifted function keys (using the right shift key).

seed value
Sets the random number seed to value.

Similar to the function command except uses shifted function keys (using the left shift key).

special what
Without an argument, turns off drawing of all specials. Otherwise, what may be one of the following:

If you want to draw more than one special at a time, append the keywords with a '+' sign. Appending a '-' sign will turn off that special without affecting the drawing of other specials. Appending a ' ' sign will toggle the special without affecting other specials. Look here for examples of usage. The spin plane, labels, and axes may also be turned on and off with the radio button in the main control panel and the utility sphere via the pop-up menu.

Prints out some execution info.

Same as the exit command.

Prints out some useful information, including how to find the KnotPlot home directory (the root of the KnotPlot distribution ) and the resource directory.

Loading and saving knots and links

allocate nbeads
Allocates enough memory for nbeads number of beads.

Prints out the coordinates of every bead in the current knot.

coords filename
Same as the above command except this outputs to the file filename. These files are made for easy reading by other software. A knot file written with this command may be read by using the load command.

Loads a knot or link from the catalogue, selected at random. Very useful for demos.

knot n
Same as above, but loads a knot with n components.

knot number n
Loads the nth knot or link from the tables. The valid range for n is from 1 to 384.

knot special
Loads a knot at random from the ``special collection'' The special collection contains several oddities as well as a few composite knots.

load filename
Loads a knot from the file filename.

load combine filename
Same as above except a new link is created by combining the current knot and the knot in the file filename (i.e. creates the union of the two knots or links).

load sum filename
Same as above except a new knot is formed by creating the direct sum of the current knot and the knot in file filename. This command uses the shift , revbeads , and translate to commands to move everything into the correct position. If you find you don't like the results it gives, you may have to do these operations as well as cut and join yourself. One limitation is that KnotPlot expects both summands to be proper knot s.

save filename [format]
Saves the current knot or link to the file filename. If format is omitted, the file is saved in the format given by the current value of sformat . If format is an integer, then that value is used as the save format and sformat is ignored. Otherwise, if format is float (or LOCF), short (or LOCS), char (or LOCC), ascii (or raw), ked, or ming then the file is saved with that format instead of the format specified by sformat (see the description of sformat). Including the second parameter is useful for temporarily overriding the default save format.

zoo start size
Generates a ``knot zoo'' of size sizeXsize starting with the knot number start in the standard catalogue. If size is omitted, it will default to 5. If start is 0, a random selection of knots is loaded. This command uses singlebuffer mode so that the knots can be seen while they are being loaded. Clicking with the left mouse on an image in the zoo will load that knot or link.

Creating new knots and links

These commands will create something from scratch. In addition you could load a knot or link from the catalogues with the load command or sketch one yourself. See also the construct command below, which can be used to construct user-defined things. The commands chain, lissajous, 2lissajous, torus, and unknot are affected by the new parameter.

chain ncomp [nbeads]
Creates a linked chain with ncomp components (this number should be even) of nbeads each. If nbeads is omitted, it defaults to 9. The parameters D-chain and d-chain control the geometry of the chain.

conway n
Constructs the knot with Conway number n. Currently, only rational knots as defined by Conway [? ] can be constructed. Non-rational knots may be constructed with the tangle command.

lissajous nx ny nz [phix phiy nbeads]
Constructs a Lissajous knot [? ] of type (nx, ny, nz) and phase (phix, phiy) with nbeads number of beads. If nbeads is omitted, the number of beads defaults to N-torus . phix and phiy both default to 0 if omitted, and that's not too interesting. For best results they should have different values. The parameterization of the curve is

except that phiz is zero. Check out this location to see some examples and here to see some good values to try.

2lissajous nx ny nz nk [phix phiy phiz nbeads]
Similar to the lissajous command except constructs a 2-mode Lissajous knot.

random tangle
Creates a random tangle using the tangle calculator. This is one of several methods of creating random knots and links that will be implemented in KnotPlot in the near future.

tangle tangle-string
Uses the tangle calculator to execute the commands in tangle-string. Click here for some examples. An interactive version of the tangle calculator can be accessed using the pop-up menus.

torus n m [beads]
Produces the torus knot K(n, m). If beads is omitted, the number of beads defaults to N-torus . Other parameters controlling how the knot is constructed are R-torus and d-torus . If two few beads are used, the results can be bizarre. If n and m are not relatively prime, then a torus link with gcd (n, m) components is created. You can also omit n and/or m to have values chosen randomly. A page of examples is at the KnotPlot Site.

unknot [B [R]]
Creates an unknot with B beads of radius R. in the xy-plane. If B is omitted, the number of beads defaults to N-torus . If R is omitted, the radius defaults to R-torus .

Transformation tools

Knots or links can be transformed into new knots or links using the commands in this section. Other commands that could belong in this section are the jitter , mangle , and split commands as some of these may change the knot type.

Takes the current knot and cables it.

close compA [to compB]
With one argument, closes component compA if it is open, otherwise closes all components in the range compA to compB. Without any arguments, prints out information on all components. See the open command.

close all
Closes all components.

Transforms the current knot (one component only) into its ``companion'' knot.

cut bead
Cuts a component at location bead. If the component is closed, it becomes open. Otherwise two open components result. Small components (less than four beads) are automatically reaped. See the join command.

delete n
Deletes component n of the current link. Components are numbered starting at 0. See the keep command.

delete all
Deletes the current knot or link.

Takes the current knot and doubles it.

join a b
Joins together beads a and b. Both a and b must be the endpoints of an open component. See the cut command.

identify a b
Identifies bead a and bead b. This is how knotted graphs are implemented.

identify init
Initializes (unidentifies) all bead identifications. Use this whenever specifying new identifications.

keep component
Deletes all knot components except component. Components are numbered starting at 0. Only makes sense for links. See the delete command.

nbeads value
If value begins with a '+' or a '-' sign then the number of beads is incremented or decremented by value, otherwise the number of beads is changed to value. See here for examples.

nbeads mult fraction
The number of beads is multiplied by fraction.

open compA [to compB]
With one argument, opens component compA if it is closed, otherwise opens all components in the range compA to compB. Without any arguments, prints out information on all components. See the close command.

open all
Opens all components.

revbeads [comp]
Reverses the beads in component comp. If comp is omitted all beads in each component are reversed. Useful in combination with the shift command.

shift distance [comp]
Shifts the bead numbering in component comp by distance, which may be positive or negative. If comp is omitted, all components are affected. Use the special command to turn on bead labels.

swap compa compb
Swaps components compa and compb.

Relaxing knots and links

If you're running in an interactive mode, you should almost never need to enter any of these commands, since everything can be controlled using the main control panel.

charge value
Sets the charge to value.

collision [allow |none |fast]
If the argument is omitted, prints the current collision constraint. If set to allow collision checking is disabled. Mode none is obsolete and should not be used. Defaults to fast.

go niter
Performs niter iterations of the knot relaxation.

hooke value
Sets the spring constant to value.

power value
Sets the exponent in the dynamical simulation to value.

timeincr value
Sets the time increment to value.

Graphics display

These commands affect the display of the knot or link. It is possible that they will also affect any output geometry in the cases where the type of surface (broken, smooth) or quality is changed.

alpha value
Sets the transparency to value. Should be avoided because transparency isn't correct unless things are drawn back to front. A form of pseudo-transparency can be obtained by using blendfunction one one and zbuffer false.

backface [true | false]
Enables or disables removal of backfacing polygons (see the GL manual).

blendfunction sfactr dfactr
Sets the blendfunction (see the GL manual). The parameters must be one of zero one dc mdc sa msa da mda min-sa-mda sc msc. This command is an exception to most commands in that abbreviations are not allowed for the parameters. The default is blendfunction sa msa. This command may not work on all machines. Look here for some examples of usage.

Sets nsegments to chnseg and ncurve to chncurve . This is useful if a cheaper quality rendering is desired in exchange for a faster drawing time. See luxo command.

clrfun [what]
Sets the clear functions used each time something is drawn. The value supplied for what should be one of the following: This function is useful for several neat tricks, include painting and getting beads to leave traces during relaxation. Enter the command without an argument to see the buffers which are currently being cleared.

Forces display to be updated, even if nothing has changed.

display true
Forces the display to be updated, even if the parameter Drawing is set to off.

Draws the knot as a NURBS (Non-Uniform Rational B-Spline. The surfaces output are actually uniform and non-rational, but that would make them BS surfaces.) surface. Pretty slow, but shows the same surface that would result from outputting a NURBS description to a ray-tracing program. Not recommended.

Switches to doublebuffer mode. In this mode, all drawing takes place in an off-screen buffer.

draw what
Changes the way the knot is drawn. Currently only five settings are of interest:

Similar to cheapo above except produces high quality rendering. Sets nsegments to lxnseg and ncurve to lxncurve . May be very slow on some machines.

Makes the current knot loaded into a graphical object. Can greatly speed up the rendering time on some machines. Must be used in conjunction with mode o (see below). This command is not needed if a knot is loaded when mode o is already in effect.

mathsv material hue saturation value
Sets the colour of the indicated material. material must be one of the following:
The knot material.
The bead material.
The arrow material.
The 4D knot material.
hue, saturation, and value must be in the range from 0 to 1.

matrgb material red green blue
Similar to mat-hsv but uses RGB space instead of HSV space.

mode mode
Sets the drawing mode. mode may be one of the following:
Draws the knot as a smooth tube, interpolating between beads depending on the setting of ncurve .
Draws cylinders between beads.
Draws the beads.
Draws the force vectors.
Draws the anchors.
Draws identification clusters (for knotted graphs).
Draws the knot as a graphical object. This setting is mutually exclusive of the others.
These settings may be OR'd together, for example mode cfb will draw cylinders, beads, and force vectors. Use mode sc in conjunction with draw spectrum for bizarre effects.

nonprop xs ys zs
Modifies the current view matrix by a non-proportional scaling factor. Useful for special effects.

ortho xs ys zs
Sets the view to an orthographic projection with clipping volume x in (-xs, xs), y in (-ys, ys), and z in (-zs, zs).

rotate [x | y | z] angle
Rotates the current view about the indicated axis by an amount of angle degrees. Note this is not the same as the about command.

rotate fix
Uses the current rotation matrix to modify the embedding of the knot and then resets the view matrix to the unit matrix.

rotate unit
Resets the rotation matrix to the unit matrix. This is equivalent to the unrot button on the control panel.

Switches to singlebuffer mode. In this mode, all drawing takes place in the on-screen buffer. This way the knot may be viewed as it is drawn. The command zoo uses singlebuffer mode.

A command that will automatically adjust twist to eliminate the deficit angle seen when nsegments is too small. A demo script is available in the demos directory that illustrates the use of this command.

zbuffer [true |false]
Enables or disables z-buffering.

Geometry commands

These commands affect the embedding of the knot or link in space. They have no effect on the viewing transform but will affect any surface models exported or anything saved with the save command.

about [x | y | z] angle [comp]
Rotates component comp of the current link about the indicated axis by angle degrees. This may appear to be identical to the rotate command, but there is a difference. This command modifies the coordinate values of the link, thus affecting any geometric data that might be written out in a file. The rotate command simply modifies the viewing transformation. If comp is omitted, all components in the link are modified. If comp is the keyword last then only the last component is rotated.


Translates the knot or link so its bounding is centered at the origin. (minor note)

centre mass
Translates the knot or link so its centre of mass is at the origin.

fitto size
Fits the knot to a radius of size.

jitter distance
Displaces each bead by a random distance.

mangle niters alpha redraw centre
Mangles the knot (single component) niters times. Each time the knot is mangled two beads are chosen at random and one of the two arcs connecting the beads is rotated about the line through the beads by a random angle (This function was inspired by a talk given by K. C. Millett at the 1993 meeting of the American Mathematical Society in Vancouver.). The angle rotated is chosen uniformly between -alpha and +alpha If redraw or centre are omitted then all mangling is done and then the mangled knot is displayed. Otherwise if redraw is non-zero the knot is redrawn every redraw manglings. The centre parameter is used in a similar fashion. Look here for a demo script using this command.

reflect axis [comp]
Reflects component comp of the current link about axis axis which must be one of x, y, or z. Reflections can be concatenated, for example refl xyz will perform an inversion through the origin. If comp is omitted, all components are reflected. If comp is the keyword last then only the last component is reflected.

scale xs ys zs [comp]
Scales component comp of the current link by the factors xs, ys, and zs in the obvious directions. Not to be confused with the scale parameter. If comp is omitted, all components are scaled. If comp is the keyword last then only the last component is scaled.

Splits every cylinder in two. Doubles the number of beads.

split cylinder n
Splits the nth cylinder in two.

split value
Splits any cylinder with a length greater than value.

swirl angle [x | y | z | r]
``Swirls'' the knot by the angle degrees about the indictated axis. If the second parameter is omitted, it defaults to y. Use r to have a axis chosen at random. The best way to see how this command works is to try it. This is one of a (eventually) large number of homeomorphisms on three-space that will be available.

translate x y z [comp]
Translates component comp of the current link by the vector (x, y, z). This is a translation relative to the current location. If comp is omitted, all components are translated. If comp is the keyword last then only the last component is translated.

translate to x y z [comp]
Translates component comp of the current link so that its initial bead is located at the postion (x, y, z). Unlike the above command, this is an absolute translation. If comp is omitted, all components are translated so that bead 0 is at the indicated location.

Producing pictures

These commands produce pictures of one form or another.

ascii [xsize [ysize]]
Makes a cheapo ascii picture of the knot or link. Most useful when running without the command window or without graphics at all (for example over a modem on a VT100 terminal). Assumes that the knot fits into a bounding box of (-10, 10). You can use the fitto command to ensure this. If ysize is omitted, it defaults to 11/25 of xsize. If xsize is omitted, it defaults to 50. Look here for some examples.

ppmout name [squish]
Outputs what is currently seen in the view window as a PPM ( Portable Pix Map.) file. The output is written to the file name.ppm. Normally the frame buffer is squished by the factor squish in both directions. If squish is omitted, it defaults to the current value of ppm-reduce . Use a squish of 1 to output the frame buffer at full resolution. PPM files (the raw version) are a good, simple, and useful file format for colour images. There are many tools installed on most platforms that can manipulate PPM images.

psoption keyword setting
Sets several options for Postscript output via the psout command. Currently, keyword can be one of the following: Enter the command without any arguments to see the current settings.

psout name
Outputs the current knot as a Encapsulated Postscript file (EPSF). This command may be used to produce pictures of the of the type seen here. For this command to work properly, the program should be set to mode s and cyl-rad should be around 1.0. Also, nsegments and ncurve should not be too high or enormous output files will be produced. Different effects may be achieved by changing the value of psmode . The command twfix should be used first to eliminate any deficit angle.

rgbout name
Outputs the contents of the current view window as a Silicon Graphics RGB image with filename name.rgb.

rleout name
Outputs the contents of the current view window as a Imager RLE image with filename name.rle.

Exporting surface models

KnotPlot can export surface descriptions to several other software platforms. Note that all these commands assume that drawing mode 's' is currently in effect (see the mode command). Bizarre effects will occur if this is not the case. Also they work only for one component knots. This is a minor limitation because separate models can be can be exported for each component of a multi-component link (just use the save , load , and keep commands in the right order).

If you're unsure which command to use, check this table.

dragon filename
Outputs a NURBS description to the file filename.hs in the format suitable for input into David Forsey's Dragon program.

dxf filename
Outputs a DXF NURBS description to the file filename.dxf suitable for input into the ALIAS modeller.

optik filename
Outputs the current knot as a collection of bézier patches in a format suitable for input into the raytracing program Optik.

pfdxf filename [option]
Outputs a DXF polygonal face description of the current knot to the file filename.dxf. If option is present and equal to broken or if the current drawing function (see the draw command) is broken the knot is output as a broken surface.

poptik filename
Outputs the current knot as a collection of polygons in a format suitable for input into the raytracing program Optik.

Outputs a SDL polygonal face description and model of the current knot to the files knotD.sdl and knotM.sdl.

rawout name
Outputs the current knot as a BPF ( Basic Polygon Format.) file. BPF files may be passed through a number of filters to input knots into other software packages, such as animation and raytracing programs.

sdl filename patchname shadername
Outputs a NURBS representation of the knot in a format suitable for input into the Alias renderer or raytracer. The NURBS patch is given the name patchname and is assigned to the shader shadername (defaults are Knot and KnotShader respectively). The output is written to the file filename.sdl. The parameter atw should be set to on before this command is used.

objout filename
Outputs an Alias|Wavefront polygon description of the current knot to the file filename.obj.

Topology commands

Most of the commands in this section will be of interest to mathematicians. They may or may not be interesting to other people.

Computes the Alexander polynomial for the knot (single component only). Needs Mathematica somewhere on the system. Sometimes fails to give any answer, but if it does give one it is correct (I think!).

alexander split ntries
Same as above except attempts up to ntries times to split problem cylinders. If ntries is omitted, it defaults to 10.

Computes the Dowker code of the current knot (single component only).

Computes Simon's minimum distance energy [? ] of the current knot or link.

4D commands

These commands all deal with four-dimensional knots.

If you're unsure which command to use for exporting a surface model, check this table.

smovie frames i1 i2 i3
Spin the knot in 4D.

spactivate Lb Le [on |off]
Enables or disables the drawing of a spun knot in the latitude range Lb to Le. The default is to enable. Look here for an example of usage.

spdxf filename
Outputs a DXF NURBS description of the currently spun knot to the file filename.dxf.

spface filename
Outputs a polygonal DXF description of the currently spun knot to the file filename.dxf.

spsdl filename
Outputs a Alias SDL description of the currently spun knot to the file filename.sdl.

spin theta phi chi
First spins the knot about the spin plane. Then performs three rotations in 4-space by the given angles about the planes specified by the saxes command. Final result is a knotted 2-sphere in 4-space (see spun knot and twist spun knot examples).

splane [bead1 bead2 [angle]]
Without any arguments, prints out the current settings for the spin plane. Otherwise draws the spin plane between beads bead1 and bead2 and sets the spin plane angle to angle degrees. This command will turn on the drawing of the spin plane. You can also turn the spin plane on and off with the special command or by using the radio button in the main control panel.

4dplane plane axis1 axis2
Sets a plane in which four dimensional rotations are performed. With no arguments prints the current settings of the rotation planes. Check here for some examples.

4dto3d projection
Sets the method of projection from 4D to 3D for the higher dimensional surfaces. Currently projection must be one of the following:
uses an orthographic projection.
uses a perspective projection. The distance of the 4D-eye from the origin is set via the parameter 4deye .
this uses the Hopf mapping from 4D to 3D. Can be expected to produce weird results.

Other commands

construct name [par1 [par2 [par2 ... [parN]]]]
Invokes the constructor KP-cons-name with the given paramters. Examples of constructors, KP-cons-cable, KP-cons-symm, and others are in the demos directory.

This command is not documented and never will be.

Knots and (soon?) links can be exported as Metafont programs. This feature is under development, but is available for test purposes and examples can be found.

This HTML file was produced at 5:42 p.m. on February 7, 1997 directly from the LaTeX source.

[ KnotPlot Manual ], [ View Window ], [ Control Panel ], [ Command Window ], [ Overview ]
[ Rob Scharein's main WWW site ], [ KnotPlot Site ]