#rectangle.coor 4 1,-30.0,-60.0,-100.0 2,30.0,-60.0,-100.0 3,30.0,10.0,-100.0 4,-30.0,10.0,-100.0 #rectangle.poly 2 tri1 1 2 4 tri2 2 3 4
As you can see, the coor file has the number of points specified on the 1st line. This is followed by the index and the x,y,z coordinate of each point. Likewise, the poly file has the number of triangles on the first line, followed by a string identifier (does not have to be unique), and the index to the vertices of each triangle in the coor file.
Whether you specify the vertices of each triangle in a clockwise or counter clockwise (CCW) order is not important for program 1. However, it is important for subsequent programs so might as well get it correct now. Imagine that you have a closed object e.g. a sphere (as opposed to an uncapped cylinder), the convention of specifying the vertices of each triangular surface patch on the sphere is in CCW order when looking at the sphere from the outside. This allows us to distinguish between front-facing vs back-facing triangles and thereby speed up rendering of objects via a technique called backface elimination. Be sure to follow this convention consistently when specifying the triangles of your cylinders. Otherwise, your cylinder may appear dark, or have dark patches (due to backface elimination)!
Here are two examples illustrating a 3-sided and a 4-sided cylinder,
and how they are to be drawn.
You don't need to draw the XY axis.
Rubric:
You start off with 100 points. You lose credit for missing functionality, incorrect results, poorly documented or formatted code, or not following instructions. Below is a partial list: - up to 10 points off for poor features.html file - up to 10 points off for inadequate comments or hard-to-read code - up to 10 points off for not following instructions - up to 10 points off for special handling to grade your homework (usually because you did not check that it runs on the computers in the lab first). - functionality points depending on importance Make sure you: a. submit the right files you want us to grade, b. have tested your code on the browsers in the lab. c. follow the general instructions described in overview.html
Thomas Cannon: thwcanno@ucsc.edu
Put materials in a folder named prog1 and zip it up.
Last modified
Monday, 31-May-2021 08:02:48 PDT.
Read the
for instructions on how to submit your work.