$24
Submission timestamps will be checked and enforced strictly by the CourseWeb; late submissions will not be accepted. Check the due date of this lab on the CourseWeb. Remember that, per the course syllabus, if you are not marked by your recitation instructor as having attended a recitation, your score will be cut in half.
For this lab, you are going to create your own 3D object which will be a cone as shown below:
y=0作为底的圆圈:
(1,0,0)
(sin ,0,cos )
(1,0,0)
A solid cone consists of two parts, the bottom and the side. As you may be able to imagine that the bottom part is just a simple circle where its front side is facing down (from the above picture). Recall that a simple circle can be generated by a number of triangles. The side of a cone is simply a number of triangles as shown in the above picture. Again, do not forget about the order of vertices so that each triangle is facing outward from the cone.
What To Do?
For this lab, you are required to implement two functions. The rst function will be used to generate an array of vertices for a cone and the second function will be used to generate an array of random colors (one color per triangle). Note that when you generate a cone, it can be in any size and in any orientation. Pick the one that you are comfortable with. For example, one may decide to create a cone with height 2 unit where the base is on the plane y = 1 and the tip is at the coordinate (0; 1; 0). One may decide to create a cone with height 1 where the base is on the plane y = 0 and the top is at the coordinate (0; 1; 0). There is no restriction on this part. Make sure that you cone looks (kind of) smooth. Remember that the more triangles that you use the smoother the cone.
Note that you are not allowed to manually de ne each vertex of your cone. Your cone must be generated using some kind of formula using trigonometry theory.
Demo
For this lab, you have to show your cone to the TA at the beginning of the next recitation.
Submission
If your functions are in the same le with the main() function, simple submit that le to the CourseWeb. If your functions are in separate le(s), zip those le together with the one containing the main() function and submit it to the CourseWeb before the due date stated on the CourseWeb.
CS 1566 | Introduction to Computer Graphics Page 1