All Packages Class Hierarchy This Package Previous Next Index
Class sim.display.Graph3D
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----GWin
|
+----Display
|
+----sim.display.Graph3D
- public class Graph3D
- extends Display
Display a scalar function of 2 variables as a 3D plot
of the cube appear at desired locations on the screen.
This code is (c) 1996 Ansgar Laubsch and Leemon Baird
<leemon@cs.cmu.edu>,
http://www.cs.cmu.edu/~baird
The source and object code may be redistributed freely.
If the code is modified, please state so in the comments.
- Version:
- 1.5 15 Apr 97
- Author:
- Ansgar Laubsch, Leemon Baird
-
bottomC
-
-
bottomColor
-
-
bottomColorM
-
-
cx
- Position of center of screen
-
cy
- Position of center of screen
-
data
- Array of heights of points
-
floorC
-
-
floorColor
-
-
floorColorM
-
-
function
- Function approximator to plot (a duplicate of the original)
-
initXAngle
- Initial rotation of the cube about x axis (degrees)
-
initYAngle
- Initial rotation of the cube about y axis (degrees)
-
initZAngle
- Initial rotation of the cube about z axis (degrees)
-
inputM
- Input vector
-
inputs
- Vector of inputs, only 2 of which are overridden
-
maxHeight
- highest & lowest height Dataset in Array
-
minHeight
- highest & lowest height Dataset in Array
-
origFunction
- The origianl function approximator whose duplicate will be plotted
-
outputM
- Output vector
-
plot
-
-
plotFloor
-
-
plotTop
-
-
topC
-
-
topColor
-
-
topColorM
-
-
trigger
- Variable whose changes trigger updates of the graph
-
triggerFreq
- How many times the trigger variable must change to cause an update
-
viewScreen
- Rectangle to fit cube for rescaling after rotation
[0][0..1] = upper-left corner x/y
[1][0..1] = lower-right corner x/y
-
weightM
- snapshot of the weights used by the learning system
-
weightP
- pointer to the weights used by the learning system
-
xElement
- Which element of the input vector is plotted as x
-
xMax
- Max value of x to plot
-
xMin
- Min value of x to plot
-
xMouseDown
- Position of mouseCursor on mouseDown-Event
-
xs
-
-
xSamples
- How many samples to take in the x dimension
-
yElement
- Which element of the input vector is plotted as y
-
yMax
- Max value of y to plot
-
yMin
- Min value of y to plot
-
yMouseDown
- Position of mouseCursor on mouseDown-Event
-
ys
-
-
ySamples
- How many samples to take in the y dimension
-
zElement
- Which element of the output vector is plotted as z
-
zMax
- Max value of z to plot (min>max for autoscaling)
-
zMin
- Min value of z to plot (min>max for autoscaling)
-
Graph3D()
-
-
action(Event, Object)
- respond to the menu choices
-
addMenus(MenuBar)
- add menu items to the window containing this GWin canvas.
-
destroy()
- ensure the function approximator has its destroy() called too
-
drawAll(Graphics)
- function drawAll
Show a 3D surface plot of the heights in data[][],
with the origin at (ax,ay), the X axis corner at (bx,by),
the Z axis corner at (cx,cy), and the Y axis corner at (dx,dy).
-
drawCubeOutlines(Graphics, int, int, boolean, double[][][][])
- function drawCubeOutlines
Draw outlines of Cube
part = 1 draws backpart
part = 2 draws frontpart
mode = 1 draws outlines normally
mode = 2 erases outlines
numbers = true prints numbers & names of axis
numbers = false does not print any numbers and names of axis
-
getParameters(int)
- Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
-
initialize(int)
- Initialize, either partially or completely.
-
mark(Graphics, double, double, double, double, double, double, double)
- function mark
Draws one mark onto the screen
-
mouseDown(Event, int, int)
- function mouseDown
Event Handling for pressing mouseButton
-
mouseDrag(Event, int, int)
- function mouseDrag
Event Handling for dragging Mouse
-
mouseUp(Event, int, int)
- funtion mouseUp
Event Handling for releasing mouseButton
-
rescale(double[][][][])
- function rescale
Rescales given cube in 'array' to fit in viewScreen rect
-
setWatchManager(WatchManager, String)
- Remember the WatchManager for this object and create the window.
-
unregister(String)
- One of the watched variables has been unregistered.
-
update(String, Pointer, Watchable)
- The variable changed, so redraw
-
xs(double, double, double, double[][][][])
- fucntion xs
calculates screen-x-coordinate from space coordinates of a point
-
ys(double, double, double, double[][][][])
- function ys
calculates screen-y-coordinate from space coordinates of a point
floorC
protected double floorC[]
topC
protected double topC[]
bottomC
protected double bottomC[]
floorColorM
protected PMatrixD floorColorM
topColorM
protected PMatrixD topColorM
bottomColorM
protected PMatrixD bottomColorM
floorColor
protected Color floorColor
topColor
protected Color topColor
bottomColor
protected Color bottomColor
plotFloor
protected PBoolean plotFloor
plotTop
protected PBoolean plotTop
plot
protected Parsable plot[][]
xs
protected int xs[]
ys
protected int ys[]
function
protected FunApp function
- Function approximator to plot (a duplicate of the original)
origFunction
protected FunApp origFunction[]
- The origianl function approximator whose duplicate will be plotted
inputs
protected PMatrixD inputs
- Vector of inputs, only 2 of which are overridden
xSamples
protected IntExp xSamples
- How many samples to take in the x dimension
xElement
protected IntExp xElement
- Which element of the input vector is plotted as x
xMin
protected NumExp xMin
- Min value of x to plot
xMax
protected NumExp xMax
- Max value of x to plot
inputM
protected MatrixD inputM
- Input vector
outputM
protected MatrixD outputM
- Output vector
weightM
protected MatrixD weightM
- snapshot of the weights used by the learning system
weightP
protected PMatrixD weightP
- pointer to the weights used by the learning system
ySamples
protected IntExp ySamples
- How many samples to take in the y dimension
yElement
protected IntExp yElement
- Which element of the input vector is plotted as y
yMin
protected NumExp yMin
- Min value of y to plot
yMax
protected NumExp yMax
- Max value of y to plot
zElement
protected IntExp zElement
- Which element of the output vector is plotted as z
zMin
protected NumExp zMin
- Min value of z to plot (min>max for autoscaling)
zMax
protected NumExp zMax
- Max value of z to plot (min>max for autoscaling)
trigger
protected PString trigger
- Variable whose changes trigger updates of the graph
triggerFreq
protected IntExp triggerFreq
- How many times the trigger variable must change to cause an update
data
public double data[][]
- Array of heights of points
xMouseDown
public int xMouseDown
- Position of mouseCursor on mouseDown-Event
yMouseDown
public int yMouseDown
- Position of mouseCursor on mouseDown-Event
cx
public int cx
- Position of center of screen
cy
public int cy
- Position of center of screen
initXAngle
public NumExp initXAngle
- Initial rotation of the cube about x axis (degrees)
initYAngle
public NumExp initYAngle
- Initial rotation of the cube about y axis (degrees)
initZAngle
public NumExp initZAngle
- Initial rotation of the cube about z axis (degrees)
maxHeight
public double maxHeight
- highest & lowest height Dataset in Array
minHeight
public double minHeight
- highest & lowest height Dataset in Array
viewScreen
public int viewScreen[][]
- Rectangle to fit cube for rescaling after rotation
[0][0..1] = upper-left corner x/y
[1][0..1] = lower-right corner x/y
Graph3D
public Graph3D()
getParameters
public Object[][] getParameters(int lang)
- Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
- Overrides:
- getParameters in class Display
- See Also:
- getParameters
addMenus
public void addMenus(MenuBar mb)
- add menu items to the window containing this GWin canvas.
- Overrides:
- addMenus in class GWin
action
public boolean action(Event e,
Object w)
- respond to the menu choices
- Overrides:
- action in class Component
setWatchManager
public void setWatchManager(WatchManager wm,
String name)
- Remember the WatchManager for this object and create the window.
After everything is parsed and windows are created, all experiments
are given a watchManager by Simulator, then it starts giving each
Display a watchManager. This is where
the Display should register each variable it wants to watch.
- Overrides:
- setWatchManager in class Display
unregister
public void unregister(String watchedVar)
- One of the watched variables has been unregistered.
- Overrides:
- unregister in class Display
update
public void update(String changedName,
Pointer changedVar,
Watchable obj)
- The variable changed, so redraw
- Overrides:
- update in class Display
drawAll
public void drawAll(Graphics g)
- function drawAll
Show a 3D surface plot of the heights in data[][],
with the origin at (ax,ay), the X axis corner at (bx,by),
the Z axis corner at (cx,cy), and the Y axis corner at (dx,dy).
- Overrides:
- drawAll in class Display
xs
public int xs(double x,
double y,
double height,
double corner[][][][])
- fucntion xs
calculates screen-x-coordinate from space coordinates of a point
ys
public int ys(double x,
double y,
double height,
double corner[][][][])
- function ys
calculates screen-y-coordinate from space coordinates of a point
mouseDown
public boolean mouseDown(Event e,
int x,
int y)
- function mouseDown
Event Handling for pressing mouseButton
- Overrides:
- mouseDown in class Component
mouseDrag
public boolean mouseDrag(Event e,
int x,
int y)
- function mouseDrag
Event Handling for dragging Mouse
- Overrides:
- mouseDrag in class Component
mouseUp
public boolean mouseUp(Event e,
int x,
int y)
- funtion mouseUp
Event Handling for releasing mouseButton
- Overrides:
- mouseUp in class Component
drawCubeOutlines
public void drawCubeOutlines(Graphics g,
int part,
int mode,
boolean numbers,
double corner[][][][])
- function drawCubeOutlines
Draw outlines of Cube
part = 1 draws backpart
part = 2 draws frontpart
mode = 1 draws outlines normally
mode = 2 erases outlines
numbers = true prints numbers & names of axis
numbers = false does not print any numbers and names of axis
mark
public void mark(Graphics g,
double x0,
double y0,
double xa,
double ya,
double xb,
double yb,
double ln)
- function mark
Draws one mark onto the screen
rescale
public void rescale(double array[][][][])
- function rescale
Rescales given cube in 'array' to fit in viewScreen rect
destroy
public void destroy()
- ensure the function approximator has its destroy() called too
- Overrides:
- destroy in class Display
initialize
public void initialize(int level)
- Initialize, either partially or completely.
- Overrides:
- initialize in class Display
- See Also:
- initialize
All Packages Class Hierarchy This Package Previous Next Index