CSE 557: Introduction to Computer Graphics


Project 2: Sweeper

Date Assigned: Monday, January 27
Date Due: Monday, February 10

Program description

Sweeper is an interactive program that lets the user generate interesting surfaces by specifying a profile curve and a sweep curve (trajectory). The profile curve is swept along the path of the sweep curve to produce a surface.

Project objectives

The purpose of this assignment is to give you some experience in working with and writing an interactive 3D modeling program. Specifically, you will be adding spline and Frenet frame support to a surface modeling program.

The finished program

First, you should check out an example solution by clicking here or running the program in /cse/courses/cse457/bin/sweeper. The program has three panes: the top pane is for the surface, the lower left pane is for the profile curve, and the lower right pane is for the sweep path. Click four points in the profile pane to start with. Then click four points in the sweep pane. You should now see some sort of surface appearing in the surface pane on top.

You can move around in the 3D windows when in viewing mode by using the left and middle mouse buttons in different combinations, as described below. The menu brought up by the right mouse button has a few other useful features. Selecting "home" under the "Functions" menu will reset the 3D view. Selecting "hidden line" under the "Draw Style" menu will show you the wireframe representation of the model. Select "as is" to go back to the shaded model.

Here is a summary of the controls for the windows:

The control points you enter can be edited when not in viewing mode by clicking with the left mouse button and dragging. Clicking on a control point with the middle mouse button will delete a control point. Currently, there is no way to insert control points except at the end of the sequence.

The file menus above the lower two panes let you load and save control polygons. There are some sample control polygons in /cse/courses/cse457/projects/sweeper/curves. Try loading diamond.crv into the profile pane and spiral.crv into the sweep path pane. Another cool one to try is james.crv for the path and jamesprofile.crv for the profile. The Curve Type menus let you select the kind of curve generated in each window. The Transport Type menu at the top of the surface pane selects how the profile curve will be swept along the sweep path. Finally, the Copy button copies the 3D surface onto the clipboard. You can paste it into another application such as showcase or SceneViewer.

Installing the project starting point

To install the project, click here OR make a copy of the files located in /cse/courses/cse457/projects/sweeper. Then type make to create the project starting point. The only files you must modify for the required extensions are computecurve.C, sweeper.C (to add menu items), surface.h and curve.h (to add names of new spline and transport types to the enum list).

The project starting point has all the same features as the finished program except that the only curve type is piecewise-linear, and the only transport type is the static frame.

Required extensions

The following extensions are required:

  1. Add B-splines and Catmull-Rom splines to the curve types allowed in both the profile and sweep path windows, using floating end conditions.

  2. Add Frenet frame support to the transport type menu. You will encounter the flipping problem discussed in class when the sweep curve hits an inflection point. Come up with a solution so that the frame does not flip when it hits an inflection point.

Bells and whistles

[Bell&Whistle] Tension Parameter for Catmull-Rom splines
Use a slider to add a tension parameter to Catmull-Rom splines.

[Bell&Whistle] for first [Whistle] for each additional:
New Spline Types
Add new spline types to the array of those available. Good choices are: C2 interpolating cubic splines and beta-splines.

[Bell] for first [Whistle] for each additional:
End Conditions
Four control points are needed to generate a B-spline or Catmull-Rom spline. This means that the user will not see a curve until they have clicked four control points on the screen. There are several ways to avoid this. One way is to duplicate the first and last control points of the spline. Using this doubly-anchored end condition, the user will see a spline as soon as they enter two control points. Another useful option is the periodic end condition where the curve closes itself automatically. A third option is to use phantom vertices, where the second control point is reflected through the first. Implement doubly-anchored, phantom and periodic versions of B-splines and Catmull-Rom splines as new curve types.

[Bell&Whistle] Adaptive Subdivision
Implement adaptive subdivision for the spline curves. Add a slider to control the epsilon parameter.

[Bell&Whistle] Surfaces of revolution
Surfaces of revolution are swept surfaces where the sweep path is a perfect circle and the Frenet frame is used to orient the profile curve. Perfect circles cannot be modeled using either B-splines or Catmull-Rom curves, so add a new circle curve type to allow you to make really spiffy surfaces of revolution. Check out revo in the directory /cse/courses/cse457/bin. It is an Inventor sample program for making surfaces of revolution.

[Bell&Whistle] Seashells
It is possible to generate surfaces that look like seashells by scaling the profile curve as you move along the sweep path (the helico-spiral primitive below is especially good for this). One way to determine the scaling is to use the "velocity" of the sweep path -- that is, length of its first derivative vector. Another possibility is to compute the scaling from the curvature of the sweep path.
The helico-spiral primitive is defined by the formulae:

theta = t
r     = a * b^t
z     = c * d^t
where a, b, c and d are user-supplied parameters. Add the helico-spiral primitive, and velocity or curvature scaling to generate pretty seashells.

[Bell] [Bell] Texture Mapping
Add the ability for users to add texture maps to their surfaces.

[Bell&Whistle] [Bell&Whistle] User Interface
If you are daring, explore Inventor and try to improve the user interface of sweeper. For example, there is currently no way to insert a control point in the middle of a control polygon. Add code to allow the user to do this. You may want to check out revo for user interface ideas.

[Bell&Whistle] [Bell&Whistle] Control Polygon
With complicated curves, it is often hard to tell which segment of curve corresponds to which control point. It would be helpful to faintly draw the control polygon along with the refined curve. Add an option to turn on this feature.

[Bell&Whistle] [Bell&Whistle] Direct Manipulation
Often, it is unintuitive to manipulate a curve by dragging control points. It would be nicer to be able to grab ahold of the curve and directly alter its shape. Add the capability for direct manipulation, as described in the help session, to the program.

[Bell&Whistle] [Bell&Whistle] [Bell&Whistle] Tensor-Product Surfaces
Implement tensor-product surfaces. This will involve a fair amount of work to come up with a reasonable interface for editing these surfaces.

[Bell&Whistle] [Bell&Whistle] Curve Smoothing
Include the ability to low-pass filter the curve to remove wiggles.

[Bell&Whistle] [Bell&Whistle] [Bell&Whistle] [Bell&Whistle] [Bell&Whistle] Multiresolution Curves
Add the capability to edit the curve at multiple levels of detail, as described in "Multiresolution Curves", Salesin and Finkelstein, Proceedings of Siggraph '94.

Inventor

Sweeper makes use of the Inventor library. Inventor is an object-oriented application development library that lets you create interactive 3D applications with much less effort than using raw OpenGL. Although you will not need to learn Inventor for this assignment, you will probably want to make use of its extensive linear algebra library. Open the man pages under the help menu in the desktop window, and under "Sections", find the entry "(3) Subroutines (Inventor)". Of particular use will be the SbVec3f (3D vector) type, and possibly the SbRotation (3D rotation), and SbMatrix (3D transformation matrix) types.

Also available on-line is The Inventor Mentor under Help, On-Line Books in the desktop window. This book is a fairly good tutorial on Inventor but is very poor as a reference manual. Finally, the Inventor header files are in /usr/include/Inventor. SbLinear.h contains the definitions for the linear algebra types you will likely need.

Artifacts

Your artifact for this project will be a 3-dimensional scene that you create. You'll use sweeper to generate models, and showcase (an SGI program) to combine these models into an interesting scene. For a more in-depth explanation of this process, see the project 2 help session.

And finally...

When you are finished with this assignment, type "make clean" to clean up unnecessary disk space.