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

Variable Index

 o bottomC
 o bottomColor
 o bottomColorM
 o cx
Position of center of screen
 o cy
Position of center of screen
 o data
Array of heights of points
 o floorC
 o floorColor
 o floorColorM
 o function
Function approximator to plot (a duplicate of the original)
 o initXAngle
Initial rotation of the cube about x axis (degrees)
 o initYAngle
Initial rotation of the cube about y axis (degrees)
 o initZAngle
Initial rotation of the cube about z axis (degrees)
 o inputM
Input vector
 o inputs
Vector of inputs, only 2 of which are overridden
 o maxHeight
highest & lowest height Dataset in Array
 o minHeight
highest & lowest height Dataset in Array
 o origFunction
The origianl function approximator whose duplicate will be plotted
 o outputM
Output vector
 o plot
 o plotFloor
 o plotTop
 o topC
 o topColor
 o topColorM
 o trigger
Variable whose changes trigger updates of the graph
 o triggerFreq
How many times the trigger variable must change to cause an update
 o 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
 o weightM
snapshot of the weights used by the learning system
 o weightP
pointer to the weights used by the learning system
 o xElement
Which element of the input vector is plotted as x
 o xMax
Max value of x to plot
 o xMin
Min value of x to plot
 o xMouseDown
Position of mouseCursor on mouseDown-Event
 o xs
 o xSamples
How many samples to take in the x dimension
 o yElement
Which element of the input vector is plotted as y
 o yMax
Max value of y to plot
 o yMin
Min value of y to plot
 o yMouseDown
Position of mouseCursor on mouseDown-Event
 o ys
 o ySamples
How many samples to take in the y dimension
 o zElement
Which element of the output vector is plotted as z
 o zMax
Max value of z to plot (min>max for autoscaling)
 o zMin
Min value of z to plot (min>max for autoscaling)

Constructor Index

 o Graph3D()

Method Index

 o action(Event, Object)
respond to the menu choices
 o addMenus(MenuBar)
add menu items to the window containing this GWin canvas.
 o destroy()
ensure the function approximator has its destroy() called too
 o 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).
 o 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
 o getParameters(int)
Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
 o initialize(int)
Initialize, either partially or completely.
 o mark(Graphics, double, double, double, double, double, double, double)
function mark Draws one mark onto the screen
 o mouseDown(Event, int, int)
function mouseDown Event Handling for pressing mouseButton
 o mouseDrag(Event, int, int)
function mouseDrag Event Handling for dragging Mouse
 o mouseUp(Event, int, int)
funtion mouseUp Event Handling for releasing mouseButton
 o rescale(double[][][][])
function rescale Rescales given cube in 'array' to fit in viewScreen rect
 o setWatchManager(WatchManager, String)
Remember the WatchManager for this object and create the window.
 o unregister(String)
One of the watched variables has been unregistered.
 o update(String, Pointer, Watchable)
The variable changed, so redraw
 o xs(double, double, double, double[][][][])
fucntion xs calculates screen-x-coordinate from space coordinates of a point
 o ys(double, double, double, double[][][][])
function ys calculates screen-y-coordinate from space coordinates of a point

Variables

 o floorC
 protected double floorC[]
 o topC
 protected double topC[]
 o bottomC
 protected double bottomC[]
 o floorColorM
 protected PMatrixD floorColorM
 o topColorM
 protected PMatrixD topColorM
 o bottomColorM
 protected PMatrixD bottomColorM
 o floorColor
 protected Color floorColor
 o topColor
 protected Color topColor
 o bottomColor
 protected Color bottomColor
 o plotFloor
 protected PBoolean plotFloor
 o plotTop
 protected PBoolean plotTop
 o plot
 protected Parsable plot[][]
 o xs
 protected int xs[]
 o ys
 protected int ys[]
 o function
 protected FunApp function
Function approximator to plot (a duplicate of the original)

 o origFunction
 protected FunApp origFunction[]
The origianl function approximator whose duplicate will be plotted

 o inputs
 protected PMatrixD inputs
Vector of inputs, only 2 of which are overridden

 o xSamples
 protected IntExp xSamples
How many samples to take in the x dimension

 o xElement
 protected IntExp xElement
Which element of the input vector is plotted as x

 o xMin
 protected NumExp xMin
Min value of x to plot

 o xMax
 protected NumExp xMax
Max value of x to plot

 o inputM
 protected MatrixD inputM
Input vector

 o outputM
 protected MatrixD outputM
Output vector

 o weightM
 protected MatrixD weightM
snapshot of the weights used by the learning system

 o weightP
 protected PMatrixD weightP
pointer to the weights used by the learning system

 o ySamples
 protected IntExp ySamples
How many samples to take in the y dimension

 o yElement
 protected IntExp yElement
Which element of the input vector is plotted as y

 o yMin
 protected NumExp yMin
Min value of y to plot

 o yMax
 protected NumExp yMax
Max value of y to plot

 o zElement
 protected IntExp zElement
Which element of the output vector is plotted as z

 o zMin
 protected NumExp zMin
Min value of z to plot (min>max for autoscaling)

 o zMax
 protected NumExp zMax
Max value of z to plot (min>max for autoscaling)

 o trigger
 protected PString trigger
Variable whose changes trigger updates of the graph

 o triggerFreq
 protected IntExp triggerFreq
How many times the trigger variable must change to cause an update

 o data
 public double data[][]
Array of heights of points

 o xMouseDown
 public int xMouseDown
Position of mouseCursor on mouseDown-Event

 o yMouseDown
 public int yMouseDown
Position of mouseCursor on mouseDown-Event

 o cx
 public int cx
Position of center of screen

 o cy
 public int cy
Position of center of screen

 o initXAngle
 public NumExp initXAngle
Initial rotation of the cube about x axis (degrees)

 o initYAngle
 public NumExp initYAngle
Initial rotation of the cube about y axis (degrees)

 o initZAngle
 public NumExp initZAngle
Initial rotation of the cube about z axis (degrees)

 o maxHeight
 public double maxHeight
highest & lowest height Dataset in Array

 o minHeight
 public double minHeight
highest & lowest height Dataset in Array

 o 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

Constructors

 o Graph3D
 public Graph3D()

Methods

 o 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
 o addMenus
 public void addMenus(MenuBar mb)
add menu items to the window containing this GWin canvas.

Overrides:
addMenus in class GWin
 o action
 public boolean action(Event e,
                       Object w)
respond to the menu choices

Overrides:
action in class Component
 o 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
 o unregister
 public void unregister(String watchedVar)
One of the watched variables has been unregistered.

Overrides:
unregister in class Display
 o update
 public void update(String changedName,
                    Pointer changedVar,
                    Watchable obj)
The variable changed, so redraw

Overrides:
update in class Display
 o 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
 o xs
 public int xs(double x,
               double y,
               double height,
               double corner[][][][])
fucntion xs calculates screen-x-coordinate from space coordinates of a point

 o ys
 public int ys(double x,
               double y,
               double height,
               double corner[][][][])
function ys calculates screen-y-coordinate from space coordinates of a point

 o mouseDown
 public boolean mouseDown(Event e,
                          int x,
                          int y)
function mouseDown Event Handling for pressing mouseButton

Overrides:
mouseDown in class Component
 o mouseDrag
 public boolean mouseDrag(Event e,
                          int x,
                          int y)
function mouseDrag Event Handling for dragging Mouse

Overrides:
mouseDrag in class Component
 o mouseUp
 public boolean mouseUp(Event e,
                        int x,
                        int y)
funtion mouseUp Event Handling for releasing mouseButton

Overrides:
mouseUp in class Component
 o 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

 o 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

 o rescale
 public void rescale(double array[][][][])
function rescale Rescales given cube in 'array' to fit in viewScreen rect

 o destroy
 public void destroy()
ensure the function approximator has its destroy() called too

Overrides:
destroy in class Display
 o 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