CS536 - Homework Assignment 1
Arbitrary-degree Bezier Curves


Programming Problem:

Write a program, named CG_hw1, that evaluates a 3D arbitrary-degree Bezier curve and approximates it with a polyline.
Your program will read in an arbitrary number of 3D points and will fit an arbitrary-degree Bezier curve to them.
The curve's u parameter will be incremented by du during evaluation.
The curve's definition is

CG_hw1 has the following specification:

  1. The program reads in the curve's 3D control points from a file specified by the -f filename argument. The file will contain N 3D points, one per line, for example:
    x1 y1 z1
    x2 y2 z2
    x3 y3 z3
    x4 y4 z4
    ...
    Default value: cpts_in.txt
  2. The u increment (a real number between 0 and 1) is specified by the -u du argument. Default value: 0.09
  3. The locations of the control points should be displayed with small spheres.
  4. The radius of the spheres is specified by the -r radius argument. Default value: 0.1
  5. Each Bezier curve is parameterized from 0 to 1, and will have degree N - 1.
  6. Be sure to evaluate the curve only in the range 0 ≤ u ≤ 1, and to include both endpoints.
  7. Write the resulting graphics primitives in the Open Inventor format to standard out.
  8. Your program will be tested with the command "./CG_hw1 -f filename -u du -r radius > out.iv"
  9. Your program should not require arguments and should be able to process a subset of them in arbitrary order.

Example Output

The following control points

   0 0 0
   1.33333 0 1.33333
   3.66667 0 1.33333
   5 0 0

should produce this cubic curve.
du = 0.025 (1/40), radius = 0.05

The following control points

   0 0 0
   1.33333 1.66667 0.33333
   4.0 -0.33333 -0.66667
   5 0 0

should produce this cubic curve.
du = 0.025 (1/40), radius = 0.05

Grading Scheme

  1. Parsing input file correct : 1 point
  2. Display control points with spheres : 1 point
  3. Controlling sphere radius : 0.5 point
  4. Incrementing curve segments correctly : 1 point
  5. Bezier curve evaluation correct : 6 points
  6. Include curve's endpoints : 0.5 points

Submission Guidelines:

  1. Assignments must be submitted via Bb Learn.
  2. Makefile whose default action is to create the executable, or include a script with the approriate name.
  3. README file: explain the features of your program, language and OS used, compiler or interpreter used, name of file containing main(). Text files only. Word and PDF documents will NOT be accepted.
  4. All source code. Your code must compile and run on tux (Linux).
  5. You may program in any language you like as long it can produce a usable executable on tux.
  6. Your program will be run by the TA. Please do NOT submit any image files, Visual C++ project files, or anything not requested in this section. Your program must run on tux without the installation of "special" libraries.
  7. If you are using a language that doesn't produce an executable file, e.g. python, then be sure to include a script called CG_hw1 that accepts arguments and prints Inventor to standard out.
  8. Points will be deducted if submission guidelines are not followed.

NOTE: Your source code for all programming assignments will be run through a plagiarism detection system. This program uses compiler techniques which are invariant of syntax and style. If you are sharing code with other classmates, you will get caught. Please refer to the student handbook for actions that will be taken.


Last modified on September 28, 2016.