CS536 - Homework Assignment 4
Superellipsoids


Programming Problem:

Write a program, named CG_hw4, 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 will be sampled u_num times 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_hw4 has the following specification:

  1. 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
  2. The number of latitude line samples u_num is specified by the -u u_num argument. Default value: 19
  3. The number of longitude line samples v_num is specified by the -v v_num argument. Default value: 9
  4. The argument -F tells your program to output a flat-shaded (no normals) triangle mesh.
  5. 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.
  6. Only compute one point at the poles
  7. 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.
  8. In your README file, list the filename and line numbers of the code that implements your surface normal calculations.
  9. Your programs will only be tested for shape values in the range 0 < r(s1), t(s2) < 2, i.e. only for smooth objects.
  10. Write the resulting graphics primitives in the Open Inventor format to standard out.
  11. Your program will be tested with the command "./CG_hw4 > out.iv"
  12. 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.

A = B = C = s1 = s2 = 1
u_num = 21   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 = 19   v_num = 9 (default values)

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 = 25   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 = 23   v_num = 12

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 = 29   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

  1. Incrementing parameter values correctly : 1 point
  2. Superellipsoid evaluation correct : 6 points
  3. Tesselate superellipsoid correctly : 1 point
  4. Correctly implementing normals and flat/smooth-shading: 2 points

4. 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 appropriate 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_hw4 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 November 8, 2016.