Central Connecticut State University, Fall 1999
CS 423 -- Computer Graphics -- Demos Page
For Java programming background information, you may also want to consult the demos listed on the Java Resources page. You can also find instructions for downloading the SUN Java Development Kit (Free Java!) there.
These demonstration programs are written in Java, version 1.1.7 or higher. Because the emphasis is on the first principles of computer graphics, these demos use a minimal amount from the Java AWT, and nothing from Java2D. They illustrate from the ground up how to create a 3-dimensional cube which can be rotated around any of the three world coordinate axes. The programs are written for logical clarity rather than efficiency, and they leave some things out so you can have the fun of implementing them.
- Point.java, a 3-dimensional Point object which implements a geometrical vector, and can be scaled, translated or rotated. Rotations around the x and y world coordinate axes are left to you, but rotations around the z world coordinate axis are included.
- Edge.java, a 3-dimensional Edge object which represents an edge of a 3-dimensional polyhedron. Edge objects can be scaled, translated or rotated. Again, rotations around the x and y world coordinate axes are left to you, but rotations around the z world coordinate axis are included.
- Face.java, a 3-dimensional Face object which represents a face of a 3-dimensional polyhedron. Face objects can be scaled, translated or rotated as Point and Edge objects can be.
- Cube.java, a 3-dimensional Cube object. Rather than write a general polyhedron object, it seemed clearer and logically simpler to deal with the illuminating special case of a cube. Cube objects can be scaled, translated and rotated as Point, Edge and Face objects can be.
- CubeViewer.java, a Java Applet for viewing and rotating a Cube object. The cube appears in the upper-left corner of the Applet Panel. It is left to you to make the appropriate transformation to viewing coordinates so the cube appears in the middle of the Applet Panel. Rotations around the x and y world coordinate axes are also left to you, but rotations around the z world coordinate axis are included. You can't see the 3-dimensional effect until you implement x and y world coordinate rotations, and then rotate the cube around two separate world coordinate axes. But once you do this, it is interesting, say, to first rotate the cube around the x axis, then around the z axis, then close and rerun the Applet, and rotate the cube first around the z axis, and then around the x axis. Even if the angles are the same, you won't get the same results, because multiplication of rotation matrices is NOT COMMUTATIVE!.
- CubeScroller.java, a Java Applet like CubeViewer.java, but with Scrollbars instead of TextFields and Buttons for doing the rotations. Programs using Scrollbars for user input always seem more complicated than similar programs using TextFields and Buttons, so it seemed a good idea to present the TextField and Button version first, and then the Scrollbar version.
This page is best viewed with Netscape Navigator.
Return to CS 423 -- Computer Graphics Home Page.