In this lab you are to write a C program that renders triangles. The program should read a PLY object filename and 3 rotation angles (degrees) as command line arguments. It should then set a camera position using the 3 rotation angles and render a 256 x 2

computer science

Description

In this lab you are to write a C program that renders triangles. The program should read a PLY object filename and 3 rotation angles (degrees) as command line arguments. It should then set a camera position using the 3 rotation angles and render a 256 x 256 pixel image saving it in PPM format.


At the course website are several PLY object files that can be used. The program may be written under linux using gcc or under Windows using Visual C++. The specific rendering steps include:


1. Parse the PLY file header to determine the number of vertices and faces. All other header info is irrelevant for this lab. 

2. Read the PLY file vertices and faces. 

3. Calculate the bounding box on the vertices. This will include the following: 

(a) Minimum and maximum X, Y and Z (two vectors denoted hmini and hmaxi). 

(b) Center X, Y and Z (vector denoted hcenteri). 

(c) Maximum extent of bounding box E = scalar that is largest component of hmax− mini, i.e. largest extent of the three axes.

Instruction Files

Related Questions in computer science category