# Homework 1, due Thurs Sep 6

Hand in your solution on RPILMS. Each team should submit their solution under only 1 student's name. The other student's submission should just name the lead student. (This makes it easier for us to avoid grading it twice.)

1. (4 pts) One of the graphics pioneers was Ivan Sutherland. Name an influential program that he wrote when he was young and a company he helped found when he was older.
Sketchpad. Evans and Sutherland (and possibly others).
2. (4) Consider these 3-D vectors: A=(2,3,1), B=(5,4,6), C=(8,7,9). Compute:
1. A.BxC
I used Matlab. (5,4,6)x(8,7,9)=(-6,3,3). (2,3,1).(-6,3,3)=0
2. AxB.C
(2,3,1)x(5,4,6)=(14,-7,-7). (14,-7,-7).(8,7,9)=0
3. (4) (This is another a test of your linear algebra knowledge. Feel free to refer to books to find the correct formulae.)
Suppose that we have a plane in 3-D thru the points A(0,0,2), B(2,2,0), and C(0,1,1).
1. What is its equation, in the form ax+by+cz+d=0?
1. There are various ways' here's one. AB=(2,\mathbf{+}2,-2). AC=(0,1,-1). ABxAC=(0,2,2). That's the normal to the plane. Optionally simplify it to (0,1,1), or normalize it to {$\left(0, \frac{1}{\sqrt{2}}, \frac{1}{\sqrt{2}} \right)$}. Plug in (0,0,2) to get 2.
2. y+z-2=0, or any multiple.
3. Test by plugging in the 3 points.
2. Consider the line L thru the points O(0,0,0) and P(1,1,1). Where does this line intersect the plane?
1. The equation of a point A on the line is A=(a,a,a) for any a.
2. Solve to get a=1, and the point is (1,1,1).
4. (6) 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++;);


Below:
char *s="Hello!";
char t[7];
char *p, *q;
p=s;
q=t;
for (;*q++ = *p++;);


5. (10) 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.



plot "ncc1701.data" with lines