Introduction to Computer Graphics
Spring 1996
Due before class on Tuesday April 9
c(w,m) = SGN(cos(w))*pow(fabs(cos(w)),m)
s(w,m) = SGN(sin(w))*pow(fabs(sin(w)),m)
where SGN(x) = -1, 0, or 1, depending on whether x is less than, equal, or greater than 0. Suggestion: SGN(x) can be implemented as a C macro.
Points on the surface of a superquadric toroid can be computed with the following parametric equations:
x(u,v) = rx*(r + c(u,e1))*c(v,e2)
y(u,v) = ry*(r + c(u,e1))*s(v,e2)
z(u,v) = rz*s(u,e1)
where:
rx, ry, rz are the radii,
r is the hole's radius,
e1, e2 are the superquadric exponents,
u, v are the surface parameters, both in the range -PI to PI.
Normals on the surface of a superquadric toroid can be computed with the following equations:
nx(u,v) = (1.0/rx)*c(u,2-e1)*c(v,2-e2)
ny(u,v) = (1.0/ry)*c(u,2-e1)*s(v,2-e2)
nz(u,v) = (1.0/rz)*s(u,2-e1)
This example program was adapted from "The OpenGL Programming Guide." This program is only provided as an example and you are not required to use it as basis for your own program.
Your program's source files are to be electronically submitted by using the submit program on cgl. The code you submit should conform with the program assignment guidelines.
Part of your grade for this programming assignment will be based on your giving a short demo (2-3 minutes) in the CGL cluster. You will be expected to talk about how your program works, and we will see how well your program performs on some test examples. Demos will be scheduled for the Friday afternoon following the assignment due date.
Page Created: Feb 23, 1996 Last Modified: Feb 23, 1996 Maintained by: Stan Sclaroff