G3dPlot.mesa
Copyright Ó 1985, 1992 by Xerox Corporation. All rights reserved.
Glassner, May 29, 1989 1:40:58 pm PDT
Bloomenthal, July 19, 1992 11:19 am PDT
DIRECTORY CedarProcess, Controls, G2dBasic, G3dBasic, Rope;
G3dPlot: CEDAR DEFINITIONS
~ BEGIN
Imported Types
ROPE:      TYPE ~ Rope.ROPE;
Process:     TYPE ~ CedarProcess.Process;
Viewer:     TYPE ~ Controls.Viewer;
OuterData:    TYPE ~ Controls.OuterData;
Typescript:    TYPE ~ Controls.Typescript;
RealSequence:   TYPE ~ G3dBasic.RealSequence;
Pair:      TYPE ~ G2dBasic.Pair;
PairSequence:   TYPE ~ G2dBasic.PairSequence;
PairSequenceRep:  TYPE ~ G2dBasic.PairSequenceRep;
Local Types
PrepareProc:    TYPE ~ PROC [lx, hx, ly, hy: REAL, nx, ny: INT, clientData: REF ANY];
HeightProc:    TYPE ~ PROC [x, y: REAL, clientData: REF ANY] RETURNS [REAL];
HeightField:    TYPE ~ REF HeightFieldRep;
HeightFieldRep:   TYPE ~ RECORD [
length:       CARDINAL ¬ 0,
element:       SEQUENCE maxLength: CARDINAL OF RealSequence
];
Private Types
IntRange:     TYPE ~ RECORD [ l, h: INT ];
RealRange:    TYPE ~ RECORD [ l, h: REAL ];
Line:      TYPE ~ RECORD [
left, right:      Pair
];
LineSequence:   TYPE ~ REF LineSequenceRep;
LineSequenceRep:  TYPE ~ RECORD [
length:        CARDINAL ¬ 0,
element:        SEQUENCE maxLength: CARDINAL OF Line
];
HorizonType:   TYPE ~ { upper, lower };
HorizonList:    TYPE ~ REF HorizonListRep;
HorizonListRep:   TYPE ~ RECORD [
first, last:       HorizonNode ¬ NIL,
firstSaved, lastSaved:   HorizonNode ¬ NIL,
type:        HorizonType
];
HorizonNode:   TYPE ~ REF HorizonNodeRep;
HorizonNodeRep:  TYPE ~ RECORD [
x:         REAL,
ly, ry:       REAL,
rm, rb:       REAL,     -- line coefficient of span on right
prev, next:      HorizonNode ¬ NIL
];
HeightTool:    TYPE ~ REF HeightToolRep;
HeightToolRep:   TYPE ~ RECORD [
user flags
drawX:       BOOL ¬ TRUE,
drawY:       BOOL ¬ TRUE,
hiddenLines:      BOOL ¬ TRUE,
system values
nSamples:       INT ¬ 100,     -- total # of samples in 2d grid
zScale:       REAL ¬ 1.0,     -- scale factor for sample height
xRange:       RealRange ¬ [-1.0, 1.0], -- x evaluation
yRange:       RealRange ¬ [-1.0, 1.0], -- y evaluation
nXSamples:      CARDINAL ¬ 15,    -- resolution in x
nYSamples:      CARDINAL ¬ 15,    -- resolution in y
epsilon:       REAL ¬ 0.99,     -- x resolution discriminator
yOffset:       INT ¬ 0,      -- moves plot in y
clientData:      REF ANY ¬ NIL,    -- passed to heightProc
heightProc:       HeightProc ¬ NIL,   -- callback proc to compute height
prepareProc:       PrepareProc ¬ NIL,   -- callback proc to prep new plot
heightField:       HeightField ¬ NIL,   -- heights to plot
outer:        Viewer ¬ NIL,    -- parent LF viewer
typescript:      Typescript ¬ NIL,   -- for user io
graphics:       Viewer ¬ NIL,    -- graphical LF viewer
drawProcess:      Process ¬ NIL,    -- forked drawing process
outerData:      OuterData ¬ NIL    -- Control's data record
];
Tool for Plotting Height Fields
MakeHeightToolFromProc: PUBLIC PROC [
toolName: ROPE ¬ NIL,     -- name of the tool
heightProc: HeightProc ¬ NIL,   -- callback proc to compute height
prepareProc: PrepareProc ¬ NIL,  -- callback proc to prepare for plotting
clientData: REF ANY ¬ NIL];   -- clientData passed to heightProc
Create a tool for drawing a height field with hidden lines removed.
The tool includes these buttons:
height scale
xMin, xMax
yMin, yMax
resolution
Note: heightProc must not be a nested procedure.
MakeHeightToolFromData: PUBLIC PROC [
toolName: ROPE,       -- name of the tool
heightField: HeightField];    -- heights to plot
Create a tool for drawing a height field with hidden lines removed.
The tool includes a height scale button
END.