Interactive Spline Editor


ISE is a simple program by which users can interactively input, edit, and sample spline curves. The spline curves handled by the program is uniform Catmull-Rom cubic splines. The source code and executable are located at

     /usr/class/cs368/assignments/assignment2/spline.

You are expected to use this program to generate sample points as input to your curve reconstruction program.

Frequently Asked Questions

  1. What is ISE?
  2. Why do I care?
  3. Which kind of splines are handled by ISE?
  4. How to run ISE?
  5. What are the available commands?
  6. How to input spline curves?
  7. How to edit spline curves?
  8. How to sample curves?
  9. How to save sampled points?
  10. What is the data file format of splines?
  11. Why does the interface looks so ugly?
  12. What if the program crashes?

1. What is ISE?

ISE (Interactive Spline Editor) is a simple program for user to interactively input, edit, and sample cubic splines. It is written by using the LEDA library.

2. Why do I care?

ISE is used to generate sample points to test your crust constrution program (aka the assignment 2 of CS368). You may choose to program your own user interface and read point sets generated by ISE or to integrate it with ISE.

3. Which kind of splines are handled by ISE?

The types of splines handled by the program are uniform cubic Catmull-Rom splines. More concretely, the spline passes all the control points. For each control point m(i), the tangent vector at m(i) is (m(i+1)-m(i-1))/2. For open curves, the tangent vectors at endpoints are defined by:

    for m(0) 2*(m(1)-m(0)) - (m(2)-m(0))/2
    for m(n-1) 2*(m(n-1)-m(n-2)) - (m(n-1)-m(n-3))/2.

You may look the files Spline.h C for the implementation. You may call member functions of class BezierArc to obtain the parametric description which is a degree 3 polynomial.

4. How to run ISE?

Currently, ISE is only available on Sun Sparc platform. To run it, simply type "ISE". Usually, you first draw some spline curves, edit, sample, and then save them. You can save both curves and sample-points to data files. But you can only load curves.

5. What are the available commands?

Press right button and you will see a pop-up menu that contains all the available commands. Bascially, there are three groups of commands: curve input/edit, sample generate/edit, and IO commands.

6. How to input spline curves?

To draw a curve, you need to select "Draw closed Curves" or "Draw Open Curves" in the pop-up menu. Then, you can click left button to input control points and click right button once you are done.

7. How to edit spline curves?

To edit a curve, you first need to select "Edit Curves". To choose a curve, you need to click right on the curve. Then, a green bounding box will appear around the chosen curve. You can then move spline by press the left button anywhere inside the bounding box and drag it to any other place. However, if you click right on the curve, a new control point will be inserted. If the point happens to be a control point, you will move that control point to the place where you release the mouse button (you would not be able to see the effect unless you release the button). To delete a spline curve, you need to press left button inside the bounding box and hold the shift key while you release the button. To delete a control point, you can press left button on the point and hold the control key while releasing the button.

8. How to sample curves?

You can generate uniform sample points by choosing "Sample Curve". It will ask you input a sample rate. The sample rate is the distance between two adjacent sampling points in parametric space. Therefore, if you input 0.1, it will generate 10 points per arc. Notice that the "uniformity" means the "uniformity" in parametric space. Therefore, the sample points may look highly un-uniformly in Euclidean space. Again, you can insert, delete, and move sample points as editing control points of splines. When you move an exsiting sample point, the parameters of the sample points on the same Bezier arc will be scaled according to where you move it.

Be careful when you edit a curve which you have sampled --- all the sample points will be deleted if you insert or delete a control point.

9. How to save sampled points?

You may choose to save the sample points. It will ask whether you want to scramble or purturb the points. Scrambling means saving the sample points in a random order. Purturbing means purturbing all the points by a rate (which is specified by users). The data file format is quite straight forward --- the number of points following by the coordinates of each point.

10. What is the data file format of splines?

The data format is as follows:

n         --- number of splines

spline 1
spline 2
...
spline n
For each spline, it is:
closed (or open) --- whether it is a closed or open curve.
(x, y)           --- (x,y) is the offset of the spline
m                --- the number of control points
p1               --- control points
p2
...
pm

11. Why does the interface look so ugly?

To make you focus on the key part (or to reduce my work load :), we use the window class provided by LEDA. Since LEDA is not specialized as a user interface design or graphics library, it only provides some basic widgets.

12. What if the program crashes?

Send an email to lizhang@cs.stanford.edu.


Return to index