Starting from:

$25

CSE4020 - Computer Graphics - Lab Assignment 2 - Solved

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 5x5 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()



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.

ii.         Hint2: Use GL_LINE_LOOP to draw clock, GL_LINES to draw hour hand(ݤ৚)

More products