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 (1/n) during evaluation.
The curve's definition is

CG_hw1 has the following specification:
- 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
- The u increment (du, a real number between 0 and 1)
can be computed from the number of segments specified by the
-n n argument. du = 1/n. Default value: 20
- The locations of the control points should be displayed with
small spheres.
- The radius of the spheres is specified by
the -r radius argument. Default value: 0.1
- Each Bezier curve is parameterized from 0 to 1, and will have
degree N - 1.
- Be sure to evaluate the curve only in the range 0 ≤ u ≤ 1, and to
include both endpoints, i.e. the spline should start at one endpoint and end at the other.
- Write the resulting graphics primitives in the Open Inventor format
to standard out.
- Your program will be tested with the command like "./CG_hw1 -f filename -n n -r radius > out.iv"
- 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
with n = 40 (du = 0.025), radius = 0.05
should produce this cubic curve with
this input file.
The following control points
0 0 0
1.33333 1.66667 0.33333
4.0 -0.33333 -0.66667
5 0 0
with n = 20 (du = 0.05), radius = 0.05
should produce this cubic curve with
this input file.
The following control points
-3.5 5.1 1.2
1.1 3.2 -2.8
0.5 7.3 3.5
4.7 6.9 -1.5
6.5 1.0 -3.8
5.5 5.4 -0.2
6.9 -0.4 4.6
with n = 100 (du = 0.01), radius = 0.13
should produce this sextic curve with
this input file.
Grading Scheme
- Parsing input file correct : 1 point
- Display control points with spheres : 1 point
- Controlling sphere radius : 0.5 point
- Incrementing curve segments correctly : 1 point
- Bezier curve evaluation correct : 6 points
- Include curve's endpoints : 0.5 points
Submission Guidelines:
- Assignments must be submitted via Bb Learn.
- Makefile whose default action is to create the executable, or
include a script with the appropriate name.
- 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.
- All source code. Your code must compile and run on tux (Linux).
- You may program in any language you like as long it can produce
a usable executable on tux.
- Your program will be run by the grader. 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.
- 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.
- 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 25, 2019.