CSE 4020 Computer Graphics, Lab Assignment 2

$30.00

Download Details:

  • Name: LabAssignment2-bw3hgy.zip
  • Type: zip
  • Size: 159.42 KB

Category:

Description

5/5 - (1 vote)

1. Write down a Python program to: A. Create a 1d array M with values ranging from 2 to 26 and print M. B. Reshape M as a 5×5 matrix and print M. C. Set the value of ęLQQHUĚHOHPHQWVRIWKHPDWUL[0WRDQGSULQW0 D. Assign M2 to the M and print M. E. /HWĜVFDOOWKHILUVWURZRIWKHPDWUL[0DYHFWRUY&DOFXODWHWKHPDJQLWXGHRIWKHYHFWRUY and print it. i. Hint: ii. Hint: Use np.sqrt() + 2021_ITE0000_2019000001 + LabAssignment2/ + 1/ – 1.py + 2/ – 2.py + 3/ – 3.py F. Files to submit: A Python source file (Name the file whatever you want (in English). Extension should be .py) Expected output: 2. Write down a Python program to draw clock with a regular 12-sided polygon (ࢽ12ɽ୉). A. Set the window title to your student ID and the window size to (480,480). B. Use np.linspace() (or np.arrange()), np.cos(), np.sin() to compute the positions of vertices. C. Use a loop statement to set the positions of all vertices. Do not specify the position by calling glVertex() individually for each vertex. D. The 12 vertices should be specified counterclockwise starting from the vertex on the x-axis. E. (Hint) F. ,IWKHNH\Vđ, Q, W are entered, the time should be changed. i. Hint1: Use a global variable to store which keyboard button was pressed. [ 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26] [[ 2 3 4 5 6] [ 7 8 9 10 11] [12 13 14 15 16] [17 18 19 20 21] [22 23 24 25 26]] [[ 2 3 4 5 6] [ 7 0 0 0 11] [12 0 0 0 16] [17 0 0 0 21] [22 23 24 25 26]] [[ 290 144 152 160 370] [ 256 274 292 310 328] [ 376 404 432 460 488] [ 496 534 572 610 648] [1490 664 712 760 1970]] 538.924855615326 ii. Hint2: Use GL_LINE_LOOP to draw clock, GL_LINES to draw hour hand(ݤ(৚ G. Files to submit: A Python source file (Name the file whatever you want (in English). Extension should be .py) H. Expected result: When the program starts Press ě1Ĝ Press ě2Ĝ Press ě3Ĝ Press ě4Ĝ Press ě5Ĝ Press ě6Ĝ Press ě7Ĝ Press ě8Ĝ Press ě9Ĝ Press ě10Ĝ Press ěQĜ Press ěWĜ