Sidney's 6.837 Project 3 Applet
Project 3 is a three-dimensional transformation matrix class. The class
Matrix3D performs viewing and modelling transformations on
three-dimensional points. It includes perspective and orthographic
viewing transformations given vectors for the camera position, the
position we are looking at, and an up direction vector. It also includes
modelling transformations such as translation, rotation, scaling, and skew.
Directions:
- Please use Internet Explorer 4.0 or higher or
appletviewer using JDK 1.1 or higher.
- Mouse Controls
- Left Click - rotates the object
- Right Click - loads the identity matrix into the modelling matrix
- GUI Controls
- Choice Menu - The menu is divided into viewing and modelling
transformtions (separated by the line). Choose the transformation you
wish to apply to the model.
- Perspective and Orthographic are viewing transformations. They will
reset both the viewing and modelling matrices.
- Translate, Scale, and Skew are modelling transformations. They will
add to the current modelling matrix.
- Input Fields - These fields will only be active for the modelling
transformations. Input the desired translation, scaling, or skew factors
in the x, y, and z directions.
- Go Button - Press this button to apply the transformation specified
in the transformation Choice Menu and when appropriate, using the values
specified in the Input Fields.
Source Code
- Applet Code (classes are located in the same file)
-
TestMatrix.java
- This class is based on Professor McMillan's
TestMatrix class which performed functions such as reading in .obj files
that specify eye, look, up vectors and the field of view and also
handling mouse events. I added a user interface for applying different
viewing and modelling transformations. I also added methods for handling
events dealing with the user interface
-
TestMatrixListener.java
- This class implements the ActionListener
interface and handles action events such as the clicking of the "Go"
button.
-
ChoiceListener.java
- This class implements the ItemListener
interface and handles events with the choices menu such as enabling or
disabling the input fields or the "Go" button based on the menu
choice.
- Matrix and Point Code
-
Matrix3D.java
- This class is the main part of the project. It
manages the functionality of the transformations and stores the
transformation matrices. Note that the matrix is represented as a 4x4
matrix in the Matrix3D.java since we must accomodate a mixture of matrix
multiplications and vector additions.
-
Point3D.java
- This is a utility class for describing
three-dimensional points/vectors.