Sweeperis 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.
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/bin/sweeper/curves. Try loading
diamond.crv into the profile pane and
spiral.crv into the sweep path pane. Another cool one to
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
To install the project, click
here OR make a copy of the files located in
/cse/courses/cse457/sweeper. Then type
make to create the project starting point.
The only files you must modify for the required extensions are
sweeper.C (to add menu items) and computecurve.C.
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.
The following extensions are required:
for each additional:
New Spline Types
Add new spline types to the array of those available. Good choices are: C2 interpolating cubic splines, beta-splines, and Catmull-Rom splines with a tension parameter.
for each additional:
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.
Implement adaptive subdivision for the spline curves. Add a slider to control the epsilon parameter.
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. Its source code is in
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^twhere a, b, c and d are user-supplied parameters. Add the helico-spiral primitive, and velocity or curvature scaling to generate pretty seashells.
If you are daring, explore Inventor and try to improve the user interface of
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.
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.
Add the ability for users to add texture maps to their surfaces.
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.
Implement tensor-product surfaces. This will involve a fair amount of work to come up with a reasonable interface for editing these surfaces.
Include the ability to low-pass filter the curve to remove wiggles.
Add the capability to edit the curve at multiple levels of detail, as described in "Multiresolution Curves", Salesin and Finkelstein, Proceedings of Siggraph '94.
Sweepermakes 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
SbLinear.h contains the definitions for the linear
algebra types you will likely need.
sweeperto 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 3 help session.