CS536 - Homework Assignment 5
Superellipsoids
Programming Problem:
Write a program, named CG_hw5, that evaluates a superellipsoid
and approximates it with triangles.
Your program should be able to output both a flat-shaded and
smooth-shaded polygonal approximation.
The superellipsoid should have u_num unique samples along its
latitude lines
and will be sampled v_num times along its longitude lines.
The superlllipsoid's definition is

Normals on a superellipsoid's surface are defined by
A, B and C are scale factors of the X, Y & Z coordinates. s1 is the shape
parameter for longitude lines and s2 is the shape parameter for
latitude lines.
CG_hw5 has the following specification:
- The superellipsoid is defined by 5 parameters -r s1_val,
-t s2_val, -A Aval, -B Bval, -C Cval
Default values: r(s1) = 1; t(s2) = 1; A = 1; B = 1; C = 1
- The number of unique latitude line samples u_num is specified
by the -u u_num argument. Default value: 18
- The number of longitude line samples v_num is specified by
the -v v_num argument. Default value: 9
- The argument -F tells your program to output a flat-shaded (no
normals) triangle mesh.
- The argument -S tells your program to output a smooth-shaded (with
normals) triangle mesh.
You should compute the exact normals and not
an approximation derived from the mesh.
If neither the -F or the -S argument is given,
a flat-shaded mesh is written to the output.
- Only compute one point at the poles
- The poles should be the center of a triangle fan. IOW, the
superellipsoid should be capped by two triangle fans at each of its poles.
- In your README file, list the filename and line numbers of the
code that implements your surface normal calculations.
- Your programs will only be tested for shape values in the range 0 < r(s1), t(s2) < 2, i.e. only for smooth objects.
- Write the resulting graphics primitives in the Open Inventor format
to standard out.
- Your program will be tested with the command "./CG_hw5 > out.iv"
- Your program should not require arguments and should be able to
process a subset of them in arbitrary order.
Examples
Note: The old code that I used to generate these examples computes
multiple points at the poles, which it shouldn't. But it does produce
the proper triangle fan structure in the face definitions around the poles.
The following two files have the general structure that is most efficient.
They are generated from
./CG_hw5 > HW5_out0.iv
./CG_hw5 -S > HW5_out1.iv
A = B = C = s1 = s2 = 1
u_num = 20 v_num = 11
Link to Inventor file of a
smooth-shaded tessellation of a superellipsoid, so you can see what yours should look like
Link to Inventor file of a
flat-shaded tessellation of a superellipsoid, so you can see what yours should look like
A = B = C = 1 s1 = 0.1 s2 = 0.23
u_num = 16 v_num = 9
Link to Inventor file of a
smooth-shaded tessellation of a superellipsoid, so you can see what yours should look like
Link to Inventor file of a
flat-shaded tessellation of a superellipsoid, so you can see what yours should look like
A = 1.2 B = 1.1 C = 2.3 s1 = 0.09 s2 = 1.0
u_num = 24 v_num = 13
Link to Inventor file of a
smooth-shaded tessellation of a superellipsoid, so you can see what yours should look like
Link to Inventor file of a
flat-shaded tessellation of a superellipsoid, so you can see what yours should look like
A = 1.9 B = 2.1 C = 0.5 s1 = 1.9 s2 = 1.6
u_num = 22 v_num = 11
Link to Inventor file of a
smooth-shaded tessellation of a superellipsoid, so you can see what yours should look like
Link to Inventor file of a
flat-shaded tessellation of a superellipsoid, so you can see what yours should look like
A = 2.5 B = 1.3 C = 3.3 s1 = 0.5 s2 = 1.35
u_num = 28 v_num = 15
Link to Inventor file of a
smooth-shaded tessellation of a superellipsoid, so you can see what yours should look like
Link to Inventor file of a
flat-shaded tessellation of a superellipsoid, so you can see what yours should look like
Grading Scheme
- Incrementing parameter values correctly : 1 point
- Superellipsoid evaluation correct : 5 points
- Tesselate superellipsoid correctly : 1 point
- Correctly implementing normals and flat/smooth-shading: 3 points
4. 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_hw5 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 November 11, 2020.