G2dGraph.mesa
Copyright Ó 1985, 1988, 1992 by Xerox Corporation. All rights reserved.
Bloomenthal, July 1, 1992 7:09 pm PDT
Glassner, November 30, 1990 7:08 pm PST
DIRECTORY Controls, Rope;
G2dGraph: CEDAR DEFINITIONS
~ BEGIN
Types
ROPE:    TYPE ~ Rope.ROPE;
GraphData:  TYPE ~ REF GraphDataRep;
GraphDataRep: TYPE ~ RECORD [
xMin:      REAL ¬ 0.0,
xMax:      REAL ¬ 1.0,
scale:      REAL ¬ 1.0,
a:       REAL ¬ 1.0,
clientData:    REF ANY ¬ NIL];
GraphProc:  TYPE ~ PROC [x: REAL, g: GraphData] RETURNS [y: REAL];
Function:   TYPE ~ RECORD [
name:      ROPE,
proc:      GraphProc,
use:      ROPE ¬ NIL,
clientData:    REF ANY ¬ NIL];
Function Registration
RegisterFunction: PROC [function: Function];
Register the given function.
GetFunctions: PROC RETURNS [LIST OF Function];
Return the registered list of functions.
GetFunction: PROC [name: ROPE] RETURNS [Function];
Return the named function ([] returned if no such function).
Functions
Bump: GraphProc;
a second order curve.
Gauss: GraphProc;
the normal distribution curve.
Poisson: GraphProc;
the poisson curve, with a the scalar.
Power: GraphProc;
a power curve, with a the exponent.
Sin: GraphProc;
a sin curve raised to the a power.
Ln: GraphProc;
natural logarithm.
Log: GraphProc;
logarithm to the base a.
Exp: GraphProc;
an exponential function.
Perlin: GraphProc;
Ken's curve, with a the scalar.
Wyvill: GraphProc;
Wyvill's soft function.
SlowInOut: GraphProc;
slow in and out curve:.
Compress: GraphProc;
like Gauss.
Pavicic: GraphProc;
Pavicic's radial weighting filter.
PerspZ: GraphProc;
transformed perspective Z.
SquashStretch: GraphProc;
squash/stretch ala JB + BW.
Ease: GraphProc;
Andrew's easing curve. Higher values of a#0 give slower easing.
Graphing
GraphFunction: PROC [
function: Function,
xMin: REAL ¬ 0.0,
xMax: REAL ¬ 1.0,
scale: REAL ¬ 1.0,
a: REAL ¬ 1.0,
clientData: REF ANY ¬ NIL]
RETURNS [error: ROPE];
Create a tool and graph the function.
END.