HF-Lab Documentation (Leveller-specific)


The following text is directly based on the original HF-Lab help file. However, some edits were made to take into account the differences between HF-Lab (the program) and the Leveller HF-Lab plug-in, and to increase grammatical consistency.

To make things happen, one types in commands (operators) and their arguments, just like working in a command-line environment. If someone has given you an HF-Lab script, you can execute it by keying in "run scriptname". The table below summarizes the available operators; just click on one for detailed information. The operators are fully described further below in alphabetical order.

HF creation const gforge plasma random zero
Single-HF operators + - * / ^ abs asin atan ceil clip crater dif2 diff disc double equalize fillbasin floor flow gauss half hshift invert negate normalize lcurve log lslope mod nsmooth peak pow ring rotate rescale sin smooth tan yslope zedge
Dual-HF operators add bloom comneg compos div exp joinx joiny mul sub rmag twist
Complex* cdiff cint cjoin cmag cpolar crect csplit cswap cwarp
Filters bpfilter brfilter hpfilter lpfilter
FFT cfillarray ffbp ffbr ffhp fflp fft ifft
Stack clear dup list name pop rot rot3 swap
Files cd del dir gdir load ls rm run save startlog stoplog
Information author hist last list help sample tile? tshow version warranty
Temporal tic toc wait
Settings seed set
HF-Lab works by creating and manipulating up to four heightfields which are stored on a stack. The stack is a shared resource that makes it unnecessary for operators to need heightfield arguments. When combining two heightfields, for example, one just uses the 'add' operator and the two heightfields on the top of the stack are added. They are removed and the result becomes the new topmost stack element. Think of operators as "consuming" heightfields off the stack and "depositing" their results onto it. The heightfields on the stack do not need to have the same dimensions but they usually do.

HF-Lab uses two-dimensional arrays to store both heightfields and matrices. Each can be interpreted as the other. For example, you could create a terrain formation into a heightfield, and then interpret it as a matrix in a math operation.

HF-Lab also assumes the existence of several environmental variables. These control various operator behaviors which are more efficient to set by themselves instead of repeatedly specifying as operator arguments.

*Matrices can be complex (i.e., their values lie on the complex number plane) and are used with operations that require complex matrices.


HF-Lab Operators

 +, -, *, /, ^

These math operators (respectively) add, subtract, multiply, divide, or raise to a power each element of the current heightfield. For instance, '* 3.14' would multiply each element in the current matrix by the value 3.14. POW may be used a synonym for ^.

See also: pow

 
 abs

Replace each element of the topmost matrix with its absolute value.
 
 add

ADD [ xo yo ]

Replaces the top two heightfields with one that is the combined sum of their elevations.

Dimensions of the X HF must be equal to or smaller than those of the Y HF. The optional xo yo arguments specify the offset of the X HF relative to the Y; the default is 0 0 (no offset).

See also: sub, mul, div

 
 asin

Performs the arcsine trigonometric function on the current matrix. Input is clamped to the range -1 to +1.

See also: sin, tan, atan

 
 atan

Performs the arctangent trigonometric function on the current matrix.

See also: sin, asin, tan

 
 author

Displays the authorship information for HF-Lab. The text is:

	HF-Lab was written by John Beale in January 1996. I wrote it to
	enable me to explore ways to generate interesting-appearing
	surfaces, for eventual viewing in a raytracer (eg, the wonderful
	freeware POV-Ray program). You may find it useful for generating
	mountains or other landscapes.
	
	This program is available free of charge under the GNU Public
	License. You may distribute it freely. Type 'HELP WARRANTY' for more
	details. If you come up with any additions to HF-Lab you like,
	please let me know. Thanks!

	John Beale (beale@best.com)
	http://beale.best.vwh.net
	

	The Daylon Leveller HF-Lab plug-in was written by 
	Ray Gardener of Daylon Graphics Ltd.
	The added 'plasma' routine was written by Dave Sharpe.

See also: warranty
 
 bloom

BLOOM scale
BLOOM scale xcent ycent

Radially expands (or contracts) the Y matrix to a degree based on the value of each point in the X matrix. Positive = radial expansion, negative = radial contraction. If the control matrix is nonzero at xcent, ycent there will be a discontinuity there. If not specified, xcent=ycent=0.5 (center of the matrix). The control value is premultiplied by scale (default = 1.0)

 
 bpfilter

BPFILTER frequency quality

Bandpass filter; modifies the current (real) array in the Fourier (frequency) domain. The real data is transformed with a FFT, (becoming complex), filtered, and then transformed back with an IFFT. The effect on the heightfield is to magnify bumps (wavelengths) of a given size.

frequency is in the range of [0..1] and quality is 1=moderate, 10=strong, 100=brickwall.

Defaults: frequency = 0.1, quality = 4

See also: hpfilter, lpfilter, brfilter

 
 brfilter

BRFILTER frequency quality

Band rejection filter; modifies the current (real) array in the Fourier (frequency) domain. The real data is transformed with a FFT, (becoming complex), filtered, and then transformed back with an IFFT. The effect on the heightfield is to remove bumps (wavelengths) of a given size.

frequency is in the range of [0..1] and quality is 1=moderate, 10=strong, 100=brickwall.

Defaults: frequency = 0.0, quality = 50

See also: hpfilter, lpfilter, bpfilter

 
 cd

CD pathspec

Changes the current working directory to pathspec. Subsequent file operations that do not include directory information will occur in the current directory.

 
 cdiff

Takes the x and y slope (differential) of a real matrix and stores the result as a complex matrix: real = Diff(x), imag = Diff(y).
 
 ceil

CEIL val

Clips all values greater than val to equal val.

See also: floor

 
 cfillarray

CFILLARRAY width breadth [ dim ]

Generates a complex frequency-domain array of 1/f noise with specified size such that the inverse FFT will yield a landscape. dim controls the (1/f) exponent, where 1.5 is very smooth and 2.5 is very rough. Default dim is 2.1

 
 cint

Takes a complex matrix with x slope (real) and y slope (imag) parts, and generate a real matrix by integration. CDIFF followed by CINT should return the same matrix (apart from roundoff error).

See also: cdiff

 
 cjoin

Combines X (real) and Y (imaginary) matrices into a single complex matrix. Dimensions must be equal.
 
 clear

Erases all heightfields from the stack. All data not saved is lost.
 
 clip

CLIP width breadth
CLIP width breadth xo yo

Cuts out a sub-matrix of the specified dimension from the current HF. xo and yo are the x,y offset from (0,0) (top left corner).

CLIP 60 40 cuts out a 60x40 matrix starting from (0,0)
CLIP 60 40 15 12 cuts out a 60x40 matrix starting from (15,12)

 
 cmag

Takes the magnitude of a complex matrix computed as the square root of the sum of the squares of each element: sqrt(Re*Re + Im*Im). Result is a real matrix.
 
 comneg

COMNEG [ xo yo ]

Combine two matrices by choosing each element to be the lower of the corresponding element from the two matrices.

Dimensions of the X heightfield must be equal to or smaller than those of the Y heightfield. The optional arguments specify the offset of the X heightfield relative to the Y; the default is '0 0' (no offset).

See also: compos

 
 compos

COMPOS [ xo yo ]

Combine two matrices by choosing each element to be the higher of the corresponding element from the two matrices.

Dimensions of the X heightfield must be equal to or smaller than those of the Y heightfield. The optional arguments specify the offset of the X heightfield relative to the Y; the default is '0 0' (no offset).

See also: comneg

 
 const

CONST val
CONST val meshsize
CONST val width breadth

Creates a constant matrix with each element equal to val. Useful prior to the YSLOPE, GAUSS or RING commands, for example. If no size is given, a constant matrix is created with the same size as the matrix currently on the top of the stack.

 
 cpolar

Converts a complex matrix in rectangular form to a complex matrix in polar form: Re = sqrt(Re*Re + Im*Im); Im = atan2(Im,Re)

CRECT performs the inverse operation.

See also: crect

 
 crater

CRATER [craters] [depth_scale] [radius_scale] [dist]

Adds craters to a heightfield.

You can specify the number of craters to add, their depth and maximum radius relative to "normal" values, and a size distribution factor (controls relative number of larger craters to smaller ones). The minimum crater size is three pixel elements across. dist=1.0 means equal numbers of all size craters; dist=5.0 gives many more small than large craters (more realistic).

Defaults: craters = 100, depth_scale = 1.0, radius_scale = 1.0, dist = 10.0

 
 crect

Converts a complex matrix in polar form to a complex matrix in rectangular form: Re = Re * cos(Im); Im = Re * sin(Im). (Im units are radians)

CPOLAR performs the inverse operation.

See also: cpolar

 
 csplit

Replaces a complex matrix with two real matrices containing the real and imaginary parts of the original.
 
 cswap

Exchanges real and imaginary portions of the current matrix, which must be complex.
 
 cwarp

CWARP scale

Maps the Y matrix into a new matrix using complex control matrix X. Real portion specifies x shift, imaginary = y shift. Matrix is premultiplied by scale, 1 unit = full width of matrix Y.

 
 del

DEL filename

Delete the specified file from the disk. RM is a synonym for DEL.

See also: rm, cd

 
 dif2

Takes the second differential (local curvature) of the matrix. The same result is achieved by taking the differential twice.
 
 diff

Takes the differential (local slope) of the matrix. This is called "emboss" in image-processing programs.
 
 dir

List all the files in the current directory. LS is a synonym for DIR.

See also: ls, gdir, cd

 
 disc

DISC steps

Discretize the heightfield to have only steps different levels. Saving your file as a GIF and then loading it is equivalent to DISC 256, because the GIF file has only 256 different colors available.

 
 div

DIV [ xo yo ]

Makes a new heightfield whose elements are the division of each corresponding element from the two topmost matrices. The new heightfield then replaces those matrices. Essentially, hX = hY / hX. Pixels resulting from a divide-by-zero operation are set to zero.

Dimensions of the X heightfield must be equal to or smaller than those of the Y heightfield. The optional xo yo arguments specify the offset of the X heightfield relative to the Y; the default is 0 0 (no offset).

See also: add, sub, mul

 
 double

DOUBLE [ local_frac global_frac ]

Doubles the size of the matrix using a modified-midpoint-displacement algorithm (aka Fractint 'plasma') to do fractal interpolation between points. Behavior depends on tiling mode; if tiling is turned off, the new size will be one less than exactly double. Resolution may be re-doubled as many times as you like.

local_frac specifies the interpolation roughness scale normalized to each local pixel; the default is DOUBLE 0.5 0.0 which will leave the flat areas flat.

global_frac specifies roughness everywhere: try DOUBLE 0.0 1.0 for added texture even in flat areas.

DOUBLE 0 0 is equivalent to RESCALE 2x 2y followed by SMOOTH.

 
 dup

Makes a copy of (duplicates) the top matrix on the stack.
 
 equalize

EQUALIZE [frac]

Makes a histogram equalized version of the current matrix, such that there is an equal number of matrix values in each bin. The number of bins used is specified in the variable HISTBINS, default is 1000. frac is an optional real number where 1.0 is complete equalization and 0.0 is no change. Frac can also be less than zero or greater than one, although the results in that case can be hard to predict (the default is 1.0).

 
 exp

EXP [ xo yo ]

Raise each element in the current matrix to the power of the corresponding element of the second matrix on the stack.

Dimensions of the X HF must be equal to or smaller than those of the Y HF. The optional xo yo arguments specify the offset of the X HF relative to the Y; the default is 0 0 (no offset).

 
 ffbp

FFBP frequency quality

Bandpass filter; operates on complex matrices only. Use LPFF, HPFF etc. for real data. The data is assumed to be in the frequency domain, and must be subsequently transformed with IFFT.

frequency ranges from zero to one (ie, normalized frequency). quality is the 'quality factor', where 1.0 is a gentle filter and 100 or larger is an extremely sharp peak or notch filter.

See also: ffhp, fflp, ffbr

 
 ffbr

FFBR frequency quality

Band rejection filter; operates on complex matrices only. Use LPFF, HPFF etc. for real data. The data is assumed to be in the frequency domain, and must be subsequently transformed with IFFT.

frequency ranges from zero to one (ie, normalized frequency). quality is the 'quality factor', where 1.0 is a gentle filter and 100 or larger is an extremely sharp peak or notch filter.

See also: ffhp, ffbp, fflp

 
 ffhp

FFHP frequency order

Highpass filter; operates on complex matrices only. Use LPF, HPF etc. for real data. The data is assumed to be in the frequency domain, and must be subsequently transformed with IFFT.

frequency ranges from zero to one (ie, normalized frequency). order specifies the strength of the filter, where 1.0 is a weak filter and 100 or larger approaches a brick-wall filter.

See also: fflp, ffbp, ffbr

 
 fflp

FFLP frequency order

Lowpass filter; operates on complex matrices only. Use LPF, HPF etc. for real data. The data is assumed to be in the frequency domain, and must be subsequently transformed with IFFT.

frequency ranges from zero to one (ie, normalized frequency). order specifies the strength of the filter, where 1.0 is a weak filter and 100 or larger approaches a brick-wall filter.

See also: ffhp, ffbp, ffbr

 
 fft

Performs forward fast Fourier transform.

Requires a complex matrix. The data is transformed in place, leaving the complex result on the stack.

See also: ifft

 
 fillbasin

FILLBASIN iterations

Fills in basins by replacing each local minimum with the average of the surrounding points. Repeat this procedure iterations times. This is VERY slow on large HFs, and will not fill large basins in any reasonable amount of time (try FILLB at lower resolution and then DOUBLE).

 
 floor

FLOOR val

Clips all values less than val to equal val.

See also: ceil

 
 flow

Calculates flowlines according to slope. Unlike other HF-Lab operators, the output is an imagemap rather than a heightfield. Pixel values are proportional to total uphill area (eg, water in a river). Flow lines end at a local minimum (which a typical gforge surface is full of, unless 'fillbasin' has been run for many cycles first).
 
 formats

Lists the known file formats HF-Lab reads and writes:

    PNG    Portable Network Graphics 16-bit greyscale (compressed)
    GIF    Compuserve GIF87a 8-bit greyscale format (compressed)
    POT    Fractint/POV 16-bit greyscale format (compressed)
    TGA    Targa 24-bit color, but only uses 16 bits (POV format)
    PGM    PPM greyscale format: 8-bit binary or 16-bit-equiv. ASCII
    MAT    Matlab 1.0 format: 32-bit binary floating point
    OCT    Octave ASCII format: 7 digit floating point
    RAW    Raw triangle vertices in ASCII format (output only)      
Note: Avoid using RAW format if possible. Raw files are 41x bigger (!) Use only MAT (or OCT or RAW) formats for floating-point. HF-Lab can only store values in the range [0..1] in the other formats.

See also: gdir, load, save

 
 gauss

GAUSS xc yc width max

Add a rounded hill (gaussian bell curve) to the current HF. xc and yc specify the center in fractions of the x and y dimensions; GAUSS 0.5 0.5 puts the peak in the center of the matrix. width sets the radius of the peak; 0.3 is a good trial value. The function added goes from (near) zero at an edge to max at the peak.

Default: GAUSS 0.5 0.5 0.3 0.5

 
 gdir

Lists only those files with known format extensions. (*.tga *.gif *.pot *.mat *.pgm *.oct)

See also: dir, formats

 
 gforge

GFORGE [mesh dim]

Creates a fractal landscape in a square array having mesh elements on each side. The surface roughness is controlled by the dim parameter where 1.5 is fairly smooth and 2.3 is rather rough. The resulting heightfield is left on top of the stack for subsequent operations, display, or saving to a file. dim may be any number greater than zero. mesh is limited only by memory. Note that a meshsize of 1000 uses just over 8 megabytes.

Defaults: mesh = width of top matrix, dim = 2.1

 
 half

Cuts x and y dimensions in half, averaging each block of 4 pixels. RESCALE is more general, but that is a simple (sub)sampling operation which is not optimal when decreasing resolution.

See also: rescale

 
 help

HELP command
? command

Explain the usage of a given command. 'help' or '?' with no arguments lists the available commands.

 
 hist

Prints a text-mode histogram of the elements in the current matrix.
 
 hpfilter

HPFILTER frequency order

Highpass filter; modifies the current (real) array in the Fourier (frequency) domain. The real data is transformed with a FFT, (becoming complex), filtered, and then transformed back with an IFFT. The effect tends to sharpen the heightfield.

frequency is in the range of [0..1] and order is 1=moderate, 10=strong, 100=brickwall.

Defaults: frequency = .05, order = 1.0

See also: lpfilter, bpfilter, brfilter

 
 hshift

HSHIFT [value]

Adds a constant to the matrix such that the most-represented elevation value (usually near 0.5 in a default "gforge" matrix) is shifted to value (default = 0.0). This function involves a histogram, using HISTBINS bins for the calculation.

 
 ifft

Performs inverse fast Fourier transform.

Requires a complex matrix. The data is transformed in place, leaving the complex result on the stack.

See also: fft

 
 int

Integrates HF; inverse of DIFF. Needs work to make any useful sense.
 
 invert

For each element of the matrix A, forms the result 1/A. (If x is zero, the result is arbitrarily defined as zero.)
 
 joinx

Combine the top two HFs X and Y into a single HF by stacking them widthwise.

See also: joiny

 
 joiny

Combine the top two HFs X and Y into a single HF by stacking them breadthwise.

See also: joinx

 
 last

LAST n

Prints out the last n commands entered.

 
 lcurve

LCURVE max_curve reps

Averages each pixel which has a local curvature greater than max_curve. Make reps passes through the HF in all. This is the second-order version of LSLOPE, and converges more quickly. The effect is to smooth out the rough parts of the HF. To find the current maximum HF curvature try: dup;dif2;l;pop and look at the maximum value of the 'dif2' HF on the stack.

 
 list

LIST [stack | var | formats]

Lists a number of different things:

STACK list the name, size, and range of matrices on the stack.
VAR list the names of internal variables ('SET' shows values)
FORMATS list the available image storage formats

'list' or 'l' with no arguments lists the matrices on the stack.

 
 load

LOAD filename

Read in a heightfield file. Type "help formats" for a list of the graphics formats understood.

 
 log

Takes the natural logarithm of the input matrix. The log of zero or negative values is set to zero.
 
 lpfilter

LPFILTER frequency order

Lowpass filter; modifies the current (real) array in the Fourier (frequency) domain. The real data is transformed with a FFT, (becoming complex), filtered, and then transformed back with an IFFT. The effect tends to smooth out sharp edges. The SMOOTH operation is faster for very slight smoothing, but LPFILTER can smooth to any degree desired in a single pass. LPF 0.3 1 is a weak filter, LPF 0.05 100 is strong.

frequency is in the range of [0..1] and order is 1=moderate, 10=strong, 100=brickwall.

Defaults: frequency = .1, order = 1.0 See also: hpfilter, bpfilter, brfilter, smooth

 
 ls

List all the files in the current directory. DIR is a synonym for LS.

See also: dir, cd

 
 lslope

LSLOPE max_slope reps

Averages each pixel which has a local slope greater than max_slope with its 4 neighbors. Make reps passes through the HF in all. This will take a very long time on large HFs. Produces cone-shaped features. To find current maximum HF slope, try: dup;diff;l;pop and look at the maximum value of the 'diff' HF on the stack.

 
 mod

MOD value

Takes the HF modulus value, ie, wrap around at +value and -value. For a smoother but similar effect, prescale the HF and use SIN.

See also: sin

 
 mul

MUL [ xo yo ]

Makes a new heightfield whose elements are the multiplication of each corresponding element in the two topmost matrices. The new heightfield then replaces those matrices.

Dimensions of the X HF must be equal to or smaller than those of the Y HF. The optional xo yo arguments specify the offset of the X HF relative to the Y; the default is 0 0 (no offset).

See also: add, sub, div

 
 name

NAME name

Give the specified name to the top matrix on the stack. Names may be no longer than 14 characters.

 
 negate

Inverts the polarity of a matrix without changing the maximum or minimum values. Peaks become valleys and vice-versa.
 
 normalize

NORMALIZE [min max]

Linearly scales the values in the current matrix so that they lie in the range min to max. The default range is [0..1]. If min is greater than max then the surface will be inverted. Operates on the current matrix in place, without pushing the stack.

 
 nsmooth

NSMOOTH reps [ hmin hmax ]

Smooths the HF reps times in sucession, while leaving those values less than hmin and greater than hmax unchanged. Good for changing sharp-edged features (e.g., imported B/W letters) into smooth slopes.

See also: smooth

 
 peak

PEAK xfrac yfrac

Adjust the image such that that highest point is in the place specified by the arguments (which are fractional horizontal and vertical distances, ranging from 0..1). This only works with tilable images (such as are produced by gforge).

See also: gforge

 
 plasma

PLASMA
PLASMA size
PLASMA size vscale
PLASMA width breadth vscale

Generate a fractal subdivision plasma matrix. vscale is 2.0 by default.

Note: this routine is not part of canonical HF-Lab 0.90 and was added separately for the Leveller HF-Lab plug-in.

 
 pop

Removes the top matrix from the stack.
 
 pow

The POW operator (or its synonym ^)raises to a power each element of the current heightfield. Example: POW 3.0 converts rolling hills into sharp mountains.

See also: math operators

 
 random

RANDOM n
RANDOM width breadth

Generate a matrix of the specified dimensions filled with random values distributed between 0 and 1. If only one argument is given, the matrix is square with n x n elements. Select uniform or normal distribution with the variable 'randgauss' (see also).

 
 rescale

RESCALE width breadth

Resizes the matrix to the specified dimensions. The scaling operation uses bilinear interpolation. The SMOOTH operation should be performed afterwards to remove the interpolation edges.

See also: half, smooth

 
 ring

RING [ xc yc radius width max ]

Add a smooth ring shape (gaussian cross section) to the current HF. xc and yc specify the center in fractions of the x and y dimensions; RING 0.5 0.5 centers the ring in the matrix. radius is the radius of the ring and width sets how thick it is. The ring function added goes from (near) zero at an edge to max at the peak. Default: RING 0.5 0.5 0.25 0.2 0.5

 
 rm

RM filename

Remove the specified file from the disk. DEL is a synonym for RM.

See also: del

 
 rmag

RMAG [ xo yo ]

Take the square root of the sum of the squares of the top two matrices, i.e., the geometric mean or complex magnitude (sqrt(X*X + Y*Y)).

Dimensions of the X HF must be equal to or smaller than those of the Y HF. The xo yo arguments specify the offset of the X HF relative to the Y; the default is 0 0 (no offset).

 
 rot

Rotates the entire stack, i.e., moves each matrix down by one stack level and moves the bottom matrix to the top.

See also: rot3

 
 rot3

Moves the third-from-top matrix in Z to X, and pushes contents of X and Y down by one level.

See also: rot

 
 rotate

ROTATE [90 | 180 | 270]

Rotates the matrix the specified number of degrees clockwise. Hint: you can get fractional rotation (eg 37.5 degrees) with the "twist" operation; just make the control matrix a constant.

See also: twist

 
 run

RUN filename

Reads in a text file of HF-Lab commands and execute them. You can generate such a file while in HF-Lab with the STARTLOG option.

The Leveller HF-Lab plug-in allows scripts to run other scripts as subroutines, although care must be taken to avoid circular dependencies.

 
 sample

SAMPLE x [ y ]

Prints the elevation of the HF at the point (x, y). If the value specified is less than 1.0, it is taken as a fraction of the total width, else it is taken as the coordinate directly, e.g., SAMPLE 0.5 0.5 reports the elevation at the center of the matrix. If y is not specified it is set to equal x.

 
 save

SAVE filename

Write the current heightfield to a file. The format is specified by the extension used, ie "save hill.tga" would generate a file in the Targa "TGA" format. Type "help formats" for a list of options.

 
 seed

SEED value

Sets the random number seed to be used for the next 'gforge', 'crater', 'random', or 'fillarray' command. If not set, the seed is regenerated based on the system clock. Type 'set' to see the values of the internal variables including 'seed'. If an asterisk '*' is present, you have set that seed value for next use. If not, that was the seed value used previously.

 
 set

SET varname value

Sets the system variable whose name is varname to the specified value. Type 'list variables' to see variable names. 'set' by itself lists all variable values. Refer to the System Variables section for a description of available variables.

 
 sin

Performs the sine trigonometric function on the current matrix. Input to ASIN is clamped to [-1..1].

See also: asin, tan, atan

 
 smooth

SMOOTH frac

Smooths the matrix by averaging each element with nearest neighbors. frac specifies the amount: 0.0 = no smoothing, 1.0 = element is replaced by average of neighbors. frac may also be less than zero or greater than one; note that this makes surfaces rougher (often the smoothest effect is achieved by frac = 0.5).

SMOOTH will behave differently at the edges depending on the setting of the "tile_mode" variable. With ON or AUTO, smoothed heightfields which were tilable will remain so, and in fact edge discontinuities will be reduced. If edge artifacts show up in this mode, your heightfield has a discontinuity across the edge; set tile_mode to OFF.

See also: nsmooth

 
 startlog

STARTLOG filename

Turns on command logging to the specified text file. If filename is omitted, it defaults to 'log-hf.txt'. If the specified file already exists, commands are appended.

See also: stoplog

 
 stoplog

Turns off command logging started with STARTLOG.

See also: startlog

 
 sub

SUB [ xo yo ]

Subtracts from the Y matrix the elevations of the X matrix, and replaces those matrices with the resulting matrix.

Dimensions of the X HF must be equal to or smaller than those of the Y HF. The optional xo yo arguments specify the offset of the X HF relative to the Y; the default is 0 0 (no offset).

See also: add, mul, div

 
 swap

Exchanges the top two matrices on the stack.

 
 tan

Performs the tangent trigonometric function on the current matrix.

See also: sin, asin, atan

 
 tic

TIC starts an internal timer running. A later use of TOC will print out the elapsed time. This may be useful for comparing speeds of computer systems. For example, the command TIC; GFORGE 600; TOC will print out how long your computer takes to fill a 600x600 matrix with random number pairs and compute a complex 2D-FFT.

See also: toc

 
 tile?

Reports if the current heightfield appears to tile smoothly.
 
 toc

TOC prints out the time elapsed since the most recent use of TIC. This may be useful for comparing speeds of computer systems. For example, the command TIC; GFORGE 600; TOC will print out how long your computer takes to fill a 600x600 matrix with random number pairs and compute a complex 2D-FFT.

See also: tic

 
 tshow

TSHOW [ width height ]

Show a 2D view of matrix in text mode using characters for shading. Very crude; but may be useful in some situations. The default display dimensions are 78 columns x 20 lines. No attempt is made to have the text display match the aspect ratio of the heightfield.

'TSHOW 35 15' gives good results in the HF-Lab plug-in's text output window for square heightfields. Larger widths and heights also work but require scrolling the window to see the result.

 
 twist

TWIST scale
TWIST scale xc yc

Rotate each point in the Y matrix about (xc, yc) by an angle specified by the value (radians) of each corresponding point in the X matrix. Positive = counterclockwise. The rotation angle increment is multiplied by scale (default = 1.0). If not specified, xc = yc = 0.5 (center of the matrix).

See also: rotate

 
 version

Prints the current version identifier of the software.
 
 wait

WAIT seconds

Pauses execution for the specified number of seconds. Useful in scripts.

See also: tic, toc

 
 warranty

Displays the warranty notice for HF-Lab. The text is:

    HeightField-Lab  --  Generation and manipulation of heightfields
    Copyright (C) 1996  John P. Beale  (beale@best.com)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    Type 'HELP AUTHOR' for more information about the author of HF-Lab.

See also: author
 
 yslope

YSLOPE [ frac scale pow ]

Adds a one-dimensional polynomial slope to the current matrix starting a fraction frac from the edge. frac ranges from 0 (none of matrix has added slope) to 1.0 (all of it).

pow specifies the degree of the polynomial: 1 is a plane, 2 is a parabolic sheet.

scale is the value of the function reached at the edge: a positive scale adds positive slope to the matrix.

Defaults: frac=1.0, scale=1.0, pow=1.0

 
 zedge

ZEDGE [ frac pow ]

Set the edges of the HF to zero.

frac specifies the fractional distance from the center to the edge to start reducing amplitude. frac can be from 0.0 to 1.0.

pow sets the smoothing function exponent. Range is anything greater than 0.0; 1.0 is normally adequate.

Defaults: frac=0.5, pow=1.0

 
 zero

ZERO
ZERO meshsize
ZERO width breadth

Generate a matrix of all zero values with the specified dimensions. Useful prior to YSLOPE, GAUSS, or RING commands, for example. If no argument is given, a zero matrix is created with the same dimensions as the matrix currently on the top of the stack.

 

System Variables

 histbins

Number of bins used in histogram equalization.

This can be any positive integer greater than one. The default is 1000. See also EQUALIZE.

 
 randgauss

TRUE=gaussian (normal) distrib. FALSE=even (uniform)

This relates to the RANDOM matrix generator (see).

 
 stacksize

Number of matrices to store on stack.

This can be any positive integer greater than one. NOTE!! changing the stack size erases all current contents of the stack. Save anything important first.

 
 tile_mode

Treatment of matrix edge-wraparound.

ON consider matrix to be seamlessly tilable OFF consider matrix to have unique edges AUTO attempt to auto-determine tilability of any given matrix by using algorithm.

The functions DOUBLE, RESCALE, SMOOTH, CRATER, GAUSS, and RING have two modes of behavior, and which one should be used depends on whether the matrix is seamlessly tilable (e.g. any output of GFORGE) or not (e.g. almost anything else). The auto-detect mode isn't as sensitive as your eye, so if you know the tilability of your matrix, it's better to set tile_mode to ON or OFF rather than the default AUTO.

 
 tolerance

Value used to distinguish a matrix which can be seamlessly tiled, from one that can't. 0.01 seems to work ok. This has meaning only when variable 'tile_mode' is set to AUTO. (see also)
 
 

 

 

 

 

 

 

 

 

 

 


Last updated: January 14, 2004
Transcription by: Ray Gardener

 


Copyright 2004 Daylon Graphics Ltd. All Rights Reserved.
Daylon Leveller is an unregistered trademark of Daylon Graphics Ltd.