CSE4020 Computer Graphics, Lab Assignment 4

$30.00

Category: Tags: , , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

4.8/5 - (6 votes)

1. Write down a Python program to draw a transformed triangle in a 2D space.
A. Set the window title to your student ID and the window size to (480,480).
B. Complete the render() function below to draw a triangle in the manner described in C.
i. You have to use OpenGL transformation functions. Do not use numpy matrix
multiplication for composing transformations.C. If you press or repeat a key, the triangle should be transformed as shown in the Table:
Key Transformation
Q Translate by -0.1 in x direction
E Translate by 0.1 in x direction
A Rotate by 10 degrees counterclockwise
D Rotate by 10 degrees clockwise
1 Reset the triangle with identity matrix
D. 7UDQVIRUPDWLRQVVKRXOGEHDFFXPXODWHGFRPSRVHGZLWKSUHYLRXVRQHXQOHVV\RXSUHVVěĜ
i. You may need a global variable (like a python list object) to store key inputs.
E. Files to submit: A Python source file (Name the file whatever you want (in English).
Extension should be .py)
F. Expected result:2. Write down a Python program to draw rotating point p1=(0.5, 0), p2=(0, 0.5) and vector v1=(0.5,
0), v2=(0, 0.5) in a 2D space.
A. Set the window title to your student ID and the window size to (480,480).
B. Use the following render() and fill “# your implementation” parts to render p1,p2 and v1,v2.
i. Hint: Render the vector v1, v2 as a line segment starting from the origin (0,0).
ii. Hint2: You need different translation matrix for p1 and p2 to render them correctlyC. Expected result: Uploaded LabAssignment4-2.mp4
i. Do not mind the initial angle.
D. p1,p2 and v1,v2 should be -t rad rotated when t seconds have elapsed since the program
was executed.
E. You need to somehow combine a rotation matrix and a translation matrix to produce the
expected result.
F. Files to submit: A Python source file (Name the file whatever you want (in English).
Extension should be .py)