Class Scene

java.lang.Object
  |
  +--Scene

public class Scene
extends java.lang.Object

A class to provide methods to draw objects in 3D world onto a Graphics object
version :
01/10/1997 original program in C written by Eleanor Yu and Ho Ng
09/08/1998 translated into Java by Ho Ng
12/08/1998 modified by Ho Ng
01/09/1998 modified by Ho Ng to support classes Polygon3D and Object3D


Constructor Summary
Scene()
          Default constructor purpose : initialize the Scene object and set the output screen size to 512x512
Scene(int usize, int vsize)
          Constructor purpose : initialize the Scene object
 
Method Summary
 void drawObject3D(Object3D obj, java.awt.Graphics g)
          purpose : project and draw the Object3D onto the Graphics
 void drawPolygon3D(Polygon3D poly, java.awt.Graphics g)
          purpose : project and draw the Polygon3D onto the Graphics
 boolean setCamera(Vector3D lookFrom, Vector3D lookAt, Vector3D lookUp)
          purpose : set the position and orientation of the carmera
 void setCTM(Matrix m)
          purpose : change the current transformational matrix
 void setScreen(int maxU, int maxV)
          purpose : set the output screen
 void setViewport(double llx, double lly, double urx, double ury)
          purpose : set the viewport of the output
 void setViewVolume(double width, double height, double distance, double near, double far)
          purpose : set the view volume of the camera
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scene

public Scene()
Default constructor purpose : initialize the Scene object and set the output screen size to 512x512

Scene

public Scene(int usize,
             int vsize)
Constructor purpose : initialize the Scene object
Parameters:
usize - total number of pixels horizontally
vsize - total number of pixels vertically
Method Detail

setCTM

public void setCTM(Matrix m)
purpose : change the current transformational matrix
Parameters:
m - new current transformational matrix

setCamera

public boolean setCamera(Vector3D lookFrom,
                         Vector3D lookAt,
                         Vector3D lookUp)
purpose : set the position and orientation of the carmera
Parameters:
lookFrom - position of the camera
lookAt - target's position of the camera
lookUp - orientation of the camera

setViewVolume

public void setViewVolume(double width,
                          double height,
                          double distance,
                          double near,
                          double far)
purpose : set the view volume of the camera
Parameters:
width - width
height - height
distance - distance
near - near
far - far

setViewport

public void setViewport(double llx,
                        double lly,
                        double urx,
                        double ury)
purpose : set the viewport of the output

setScreen

public void setScreen(int maxU,
                      int maxV)
purpose : set the output screen
Parameters:
maxU - total number of pixels of the screen horizontally
maxV - total number of pixels of the screen vertically

drawPolygon3D

public void drawPolygon3D(Polygon3D poly,
                          java.awt.Graphics g)
purpose : project and draw the Polygon3D onto the Graphics
Parameters:
poly - Polygon3D
g - Graphics

drawObject3D

public void drawObject3D(Object3D obj,
                         java.awt.Graphics g)
purpose : project and draw the Object3D onto the Graphics
Parameters:
obj - Object3D
g - Graphics