Classes
MainProgram
This is the main applet class which implements a Thread interface so
that the applet can run as a thread. This class contains the "run"
method which instantiates the User Interface Panel and the Drawing
Canvas which contains the images. The event-handling method of this class
processes the user input values from the interface and passes them to
the paint method of the respective canvas.
DrawCanvas
This class sets the layout for the drawing canvas and also
instantiates the canvas for the world space, view space, screen space
and the screen projection.
InterfacePanel
This class is used to layout and process the user interface panel. The layout used is the
GridBagLayout which provides flexibilty in laying out the various
components. Some of the components that have been used are Labels,
Buttons and TextFields.
WorldModel3D
This class contains the methods that are used to draw the object in
the World Coordinate Space. The vertex list and the face list for the
object are read from a .obj file. All transformations are done on
these vertices. Using the input values from the Interface Panel passed
down by the MainProgram it calculates the inverse camera transforms and
draws the viewing frustrum in the world space. This class also
contains the methods to display the coordinate axes and to rotate the
object, frustrum and the axes when the mouse is dragged on the canvas.
ViewModel3D
This class contains the methods that are used to draw the object in
the View Coordinate Space. From the user input values it draws the
frustrum in the view space. This class also contains the methods used
to calculate the view transformation matrix (Tview) values which are
used to transform the object from the world space to the view
space.This class also contains the event-handling methods required to
rotate the object and the frustrum in view space.
PerspModel3D
This class contains the methods used to draw the object in the screen
space. From the user input values of the Near Plane, far Plane and the
Screen Height it calculates the frustrum in the screen space and
displays it. This class also contains the methods used
to calculate the perspective transformation matrix (Tper) values which are
used to transform the object from the view space to the screen
space. This class also contains the event-handling methods
required to rotate the object and the frustrum in screen space.
ProjModel3D
This class contains the methods used to draw the screen projection of
the object. It contains the methods required to clip the object before
displaying it.
Matrix3D
The Matrix3D class provides basic Matrix operations such as Scaling,
Translation and Rotation. These methods are used by other classes such
as WorldModel3D, ViewModel3D, PerspModel3D, ProjModel3D to carry out
the different transformations.
ClipPt
This class is used only during the Clipping Operation in the
PerspModel3D and ProjModel3D classes. This class contains variables used
to keep track of the intersection point between the view plane ansd
the line intersecting through it.
Click here to download the tar zipped source
files.