W Randolph Franklin home page
... (old version)
ComputerGraphicsFall2009/ home page Login


Answers in BLUE

Due in class Tues Sep 9, 2009.

  1. As described in Angel, what are the 4 major components of a 3D graphics API?
    1. Objects
    2. A viewer
    3. Light sources
    4. Material properties

2

  1. As described in Angel, what are the 4 stages of the graphics pipeline?
    1. Vertex processing
    2. Clipping and primitive assembly
    3. Rasterization
    4. Fragment processing
  2. Find the eigenvalues and eigenvectors of the following matrix. Suggested tools include Matlab, Maple, or doing it by hand. {$ \left(\begin{array} .8 & .6\\-.6 & .8 \end{array}\right) $}
    Characteristic polynomial: x^2 - 8.8x + 6.76=0 Real eigenvalues: {0.85035, 7.94965}
    example eigenvectors:
    Eigenvector of eigenvalue 0.85035 : (-0.08362, 0.996497)
    Eigenvector of eigenvalue 7.949647: (-0.99649, 0.083626)
    Obtained using matlab or manual mode.
  3. Consider these 3-D vectors: A=(1,2,3), B=(5,4,6), C=(7,8,9). Compute:
    1. A.BxC
    2. AxB.C
    Scalar triple product: Defines the volume of the parallelopiped
    A . BXC = [1 2 3] . [-12 -3 12] = 18
    AxB . C = [0 9 -6] . [7 8 9]= 18
  4. Suppose that we have a plane in 3-D thru the points A(2,0,2), B(2,2,0), and C(0,1,1).
    1. What is its equation, in the form ax+by+cz+d=0?
      * Solve for a,b,c in terms of d:
      -d/2.y – d/2.z +d=0 (if d=2, y+z=2)
    2. Consider the line L thru the points O(0,0,0) and P(1,1,1). Where does this line intersect the plane?
      * x/1=t , y/1=t, z/1=t
      substitute in above equation: 2t=2 => t=1
      point of intersection [1 1 1]
  5. This is a test of whether you know enough C for this course. The following code will copy string s to array t, provided that a few erroneous lines are corrected. What are the corrections and proper initializations?
    char *s="Hello!";
    char t[6];
    char p, q;
    p=s;
    q=t;
    for (;*q++ = *p++;);
    
    • char t[7] //If s is to be copied to 't' then t=7 to account for '/0'
      char *p,*q //p,q are pointers for them to be addressed
  6. If we're going to be learning complicated graphics in this course, it behooves us still to be able to do the simple things. So, this exercise is to plot the ship NCC1701 similarly to the plot shown in the right margin.

Here is a compressed file of 3,958 triangles defining the USS Enterprise. It looks like the image on the right when uncompressed with gunzip:

 
1.431000 0.505000 0.843000
1.572000 0.505000 0.801000
1.287000 0.505000 0.802000
1.431000 0.505000 0.843000


1.572000 0.505000 0.801000
1.595000 0.542000 0.794000
1.263000 0.542000 0.795000
1.572000 0.505000 0.801000


1.572000 0.505000 0.801000
1.263000 0.542000 0.795000
1.287000 0.505000 0.802000
1.572000 0.505000 0.801000


... and similarly for 23730 more lines

Each line of the file represents one vertex in the form: (x, y, z). Four lines make one triangle; the first vertex is repeated. Two blank lines separate each triangle.

You may want to cut off a piece of the file for testing. This is how to do that in Linux.

 
head -1000 /tmp/ncc > /tmp/piece

Plot the data. I used gnuplot; you may use whatever you like. It's ok to render it as polygons if you wish. You don't need to delete hidden lines, i.e., don't over-engineer the plot.

  • If Windows: Download 4.2.5 gnuplot from Sourceforge for 32-bit windows
    windows: command: splot 'path\\ncc1701.data' with lines, linux: splot 'ncc1701.data' with lines