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.
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
.
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.
The following extensions are required:
Tension Parameter for Catmull-Rom splines
Use a slider to add a tension parameter to Catmull-Rom splines.
for first
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.
for first
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.
Adaptive Subdivision
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.
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^twhere a, b, c and d are user-supplied parameters. Add the helico-spiral primitive, and velocity or curvature scaling to generate pretty seashells.
Texture Mapping
Add the ability for users to add texture maps to their surfaces.
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.
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.
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.
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.
Curve Smoothing
Include the ability to low-pass filter the curve to remove wiggles.
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.
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.
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.