Sale!

CSC 4140 Assignment II Transformation solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (7 votes)

1 From Model to Screen (80 points)
If we want to get a model to screen, we bacially need the following steps:
1. Model Translation T
2. Model Scaling S
3. Model Rotation R
4. View Translation
5. View Rotation
6. Project
Written in Matrix production:
ModelV iewP roject = P roject · V iewR · V iewT · ModelS · ModelR · ModelT (1)
For this assignment, your tasks are
1.1 Implement Model Matrix (40 Points)
Complete the given function.
1 get_model_matrix( f l o a t rotation_angle ,
2 Eigen:: Vector3f T,
3 Eigen:: Vector3f S,
4 Eigen:: Vector3f P0,
5 Eigen:: Vector3f P1):
Note: express the tranforms in each steps use homogeneous coordinates. For example use 4×
Matrix to express the translation Vector3f T. (You can also validate your results by using the
Eigen’s lib function.)
Follow the instructions in the give code structure.
2 CSC 4140
1.2 Implement perspective projection Matrix (40 Points)
1 get_projection_matrix( f l o a t eye_fov,
2 f l o a t aspect_rat io ,
3 f l o a t zNear,
4 f l o a t Zfar )
1.3 Implement main() function according to your needs (20 Points)
1 in t main( in t argc , const char ** argv)
2 {
3 \\your code
4 }
1.4 Useful information you need this time
1 \\Member Var iab les
2 \\ three trans format ion matrix
3 Matrix4f model, view, pro j e c t ion ;
4
5 \\frame bu f f er : cache what you want to draw on screen
6 vector frame_buf;
7
8 \\Member Functions
9 \\ t r an s f e r model matrix as
10 \\parameters to r a s t e r i z e r (g iven)
11 set_model( const Eigen::Matrix4f& m)
12
13 \\ s e t view trans format ion to view matrix
14 set_view( const Eigen::Matrix4f& v)
15
16 \\ t r an s f e r pro j e c t ion matrix to r a s t e r i z e r
17 set_pro ject ion( const Eigen::Matrix4f& p)
18
19 \\ s e t p i x e l ( i , j ) on screen with c o l or (r ,g,b)
3
20 \\ and wr ite to frame bu f f er
21 set_p ixe l (Vector2f point , Vector3f c o l or )
2 Your report (20 Points)
For this assignment, 10% is for the template using. Do submit your report using the given
template in the first assignment. 80% is listed in Section 1. 10% is for your completing you main()
function and make it easier to use (e.g., define a .xml file to record eye_position, rotation angle or
other parameters. This part is not limited)
In your report,
1) You need to define a proper eye position freely
2) define a proper triangle
3) define your eye_fov, aspect_ratio, zNear, zFar.
4) all other missing information
You need to think where you should define the object (triangle), your eye position and other
parameters. As if you cannot define a proper parameters, you might get nothing on your screen as
your “eye” cannot see it. So in your report, write down this parameters by either inside your code
or an extra parameter file (e.g. .xml which you do not always need compile the code), and show
the corresponding results on the screen.
In your report, I would like to see at least two corresponding results (at least see a triangle
on your screen, you can put more). Make it easier to run for TAs, just save the results images as
“results_1.png, results_2.png, …). Your report and your code result must match each other.
submission list
1) PDF report
2) codes
3) CMake file
all naming roles is given in last assignment, zip them together submit it.
4) Readme: describe how to run your code and some extra work you think I can give you more
grades.
5) a bash file that can compile the code, run the code(save the results). Direct run and see result.
4 CSC 4140