The purpose of this assignment is to evaluate Bezier surfaces and
to draw smooth objects using OpenGL.
The Bezier surfaces in this assignment are bicubic polynomials of
order 3 in each parameter, thus each patch is defined by a 4 by 4
grid of control points. Unlike a triangle mesh, a Bezier surface
patch is smooth, differentiable, and its shape is entirely specified
by its 16 control points. However, to draw such a smooth surface in
OpenGL we must approximate the smooth surface with small primitives
(e.g., triangles or quads). You will do this by evaluating the
surface at regular intervals along the s and t directions, and
drawing triangles or quads.
Note that OpenGL can draw polynomial surfaces through the use of
evaluators. In the assignment, we ask you not to use OpenGL
evaluators, but rather to implement your own code to evaluate the
surface and its derivatives given values of the parameters s and
The sample code runs, but does nothing but
draw a world axis and calls a collection of methods in the
BezierPatchWork class that you need to complete. The sample code
zip file has the following contents.
- A2App and BezierPatchwork java files, which need to be placed in
a package called comp557a2, and you will need to add the jogl and
vecmath jars to your project as per the previous assignment.
- mintools.jar, which also needs to added to your classpath as it
provides a small framework used by the sample code.
- Three data files. The file testPatch.txt contains one single
flat Bezier patch. The file testPatches.txt contains two Bezier
patches. The third contains Bezier patches defining the Utah
teapot. Change the constructor of A2App to run your application
with different data files.
The code (BezierPatchWork.java) contains TODO comments in the
places where you will need to add code to complete the assignment
objectives specified below. The A2App code sets up the interface
and adds a number of swing controls to a control window. You will
use these controls to turn on or off or adjust the display different
things as specified in the objectives.
mintools Framework Jar
While it is easy enough to start writing code from scratch when
building a new application, many small parts of code are always the
same. The mintools.jar provides classes that help set up an
interactive application. It takes care of clearing the screen,
setting up lights, and provides a simple interface. In particular,
you can use the mouse to rotate and zoom the object: Left click and
drag to rotate, middle click and drag to translate, right click and
drag to zoom.
Bezier Patch Data
The teapot is composed of 32 Bezier patches, each with a 4 by 4
grid of control points for a total of 16 control points each. You
will notice that the BezierPatchWork class already contains code for
loading all this data into an array of Matrix4d objects. Each
matrix contains the 16 control points of a given patch for a
given axis (x, y, or z). For instance, Gx, the 4 by 4 matrix of x
coordinates of control points of the first patch will be found in
coordinatePatch, while the y coordinates are in
coordinatePatch, and z in coordinatePatch. This code is
provided as a convenience to help you get started faster. But if
you feel strongly about storing your control points in some other
manner then feel free to change it!
Great! Be sure your name and student number is in the window
title, and in the comments of the code. Submit your source code
as a zip file via webCT.
Include a readme.txt file with your comments. Note that your
written questions need to be submitted to a different assignment
box! DOUBLE CHECK BOTH of your submitted files by downloading
them from WebCT. You can not recieve any marks for assignments
with missing or corrupt files!
Note that you are encouraged to discuss assignments with your
classmates, but not to the point of sharing code and answers.
All code and written answers must be your own.