Index of /~drake/CurveTool

Icon  Name                    Last modified      Size  Description
[DIR] Parent Directory - [IMG] bspline-tangent.png 13-Dec-2008 00:00 126K [IMG] curve-decast.png 12-Dec-2008 23:56 125K [   ] curvetool-linux 12-Dec-2008 23:37 1.5M [   ] curvetool-mac 12-Dec-2008 23:48 514K [IMG] hermit-fan.png 13-Dec-2008 00:02 157K [IMG] line-decast.png 12-Dec-2008 23:53 118K [TXT] sha256sums.txt 13-Dec-2008 00:03 162
================================================================================
CurveTool
Drake Dowsett (drakedowsett@gmail.com)
CS 384G, Fall 2008
UT Austin
================================================================================

CONTENTS:
1. INTRODUCTION
2. HOW TO USE
  2.1 KEYBOARD SHORTCUTS
  2.2 OPTION MENU
3. PROJECT NOTES
  3.1 THE GOOD
  3.2 THE BAD
  3.3 THE TODO
4. REDISTRIBUTION
5. ACKNOWLEDGEMENTS

--------------------------------------------------------------------------------

1. INTRODUCTION

This is my final project for CS 384G: Intro to Computer Graphics. My goal was to
design a portable demonstration tool for computer graphics instructors that
would aid in conveying a better understanding of parametric curve types. To this
end I have created an FLTK application to demonstrate the following curve types:
Hermit, Bézier (both cubic and n-degree), B-Spline, and Cardinal (Catmull-Rom).

2. HOW TO USE

CurveTool is fairly straightforward. To add a point, click inside the white box.
To delete, right-click on a point. The last point created is automatically
selected, although other points can be selected by left-clicking on them. New
points are added following the selected point, so to insert a point, select the
point BEFORE where you would like to insert and then click elsewhere in the
white box (to prepend, one must reverse the points--see KEYBOARD SHORTCUTS--,
append, and reverse the points again). Right-clicking in the white box not over
a point will delete the selected point.

More control over the curve manipulation and display of the curve is available
through keyboard shortcuts and the options menu.

2.1 KEYBOARD SHORTCUTS

T - cycle through curve types
X - delete selected point
C - clear all points
F - select first point
L - select last point
R - reverse points
= - increase segment count
- - decrease segment count
space bar - show options menu
ESC - hide options window / quit

2.2 OPTIONS MENU

Curve Type - sets the curve type

[Hermit Curve Options]
Control Scale - range: [1, 40], default: 1, sets multiplier for Hermit curve
derivatives, allowing more control in smaller area

[Bézier Curve Options]
Adaptive Sampling - use de Casteljau subdivision algorithm to adaptively
sample the curve (NOT IMPLEMENTED)
Optimize n-Degree - use optimization structure on n-degree Bézier curve (HIGHLY
RECOMMENDED)
Show de Casteljau - draw de Casteljau segments for point under mouse

[B-Spline Options]
Uniform - draw uniform B-spline
Knot Vector - knots to be used to render nonuniform B-Spline (NOT IMPLEMENTED)

[Cardinal Curve Options]
Catmull-Rom - lock Tau to 1/2, thereby drawing Catmull-Rom curves
Tau Value - range: [0, 1], default: 1/2, set tau value (tension)

[General Options]
Adaptive Sampling - use a general adaptive sampling algorithm
Sampling Segments - range: [1, 200], default: 60, number of segments to sample
with when not sampling adaptively
Alternate Segments - draw every other segment in a different color, so as to
distinguish between each one
Show Control Lines - show dotted lines between control points
Show Control Points - show control points
Show Position Info - show position information in form "segment number, u value"
of point under mouse in top-left corner
Show Tangent Info - draw a tangent line at point under mouse and show slope in
top left corner

3. PROJECT NOTES

3.1 THE GOOD

I have put in considerable speed/computation optimizations at the expense of
storage. All the curve types have a store that maps a u value to quad of pre-
calculated [u^3 u^2 u 1] * [curve matrix] values. This can be multiplied by the
control points to interpolate more quickly as opposed to computing the vector-
matrix multiplications each time. For n-degree Bézier curves, though this
optimization isn't applicable. Instead, I have created a store that maps from
a tuple of <u, some control points> to the final Point on the curve. As the
algorithm to compute an n-degree Bézier curve fans out, groups of unmodified
control points are frequently recalculated: for example, moving the last
control point of the curve will force all the right-hand side computations to
recompute, but will require only a simple lookup for each left-hand side. For
redrawing the curve unaltered (as with the de Casteljau segments overlayed),
this is a huge boost over recalculating from scratch. The option has been
provided to disable this optimization for demonstration of how expensive raw
n-degree Bézier curve computation is.

I have created a unified Makefile that compiles correctly both on my personal
MacBook as well as on the Linux machines in the CS department.

3.2 THE BAD

Building the code from scratch has been exciting and fulfilling, but also very
time-consuming. As such I have not completed some of the original goals I set
out to:

- Adaptive Sampling

One of the most challenging aspects of this is not determining whether or not
to subsample, but rather to design an elegant algorithm to insert subsamples
while traversing the control points.

- Knot Vector Manipulation/Non-Uniform B-Splines

This was one of my last undertakings on the project. As such, the time I had
left for it was not sufficient. Difficulties arose in having to manipulate the
vector as one added points and by hand, and having the drawing and the text
area properly refresh. In addition, properly parsing comma-separated double
values out of a string would have taken considerable time to properly implement.

3.3 THE TODO

- adaptive sampling
- knot vector manipulation/non-uniform B-splines
- animate drawing with controllable speed or step control
- auxiliary blending curve display
- auxiliary "point = matrix * point" display where applicable
- Chaikin & DLG subdivision animation
- auxiliary averaging mask display
- custom averaging mask input

4. REDISTRIBUTION

Please do not redistribute the source without my express permission.

Please feel free to redistribute the executable, but please include this README.

5. ACKNOWLEDGEMENTS

Many thanks to the developers of Impressionist, Ray, and Animator, the class
projects that helped me quickly build an FLTK application from the ground up.

Also, to Wikipedia and Google for their seemingly endless supplies of
technical knowledge a thank you.