Question: Problem 7 (20 points) Consider a simple graphics toolkit that works like OpenGL (that is, it has a matrix stack, and the transformation commands post-multiply

Problem 7 (20 points) Consider a simple graphics toolkit that works like OpenGL (that is, it has a matrix stack, and the transformation commands post-multiply themselves onto it): The toolkit has the following commands translate(x,y) - post-multiplies a translation matrix onto the top of the matrix stack scale(x,y) - scales by x and y from the origin. BOTH X and Y MUST BE POSITIVE . push() - pushes a copy of the top element on the matrix stack pop() - removes the top element from the matrix stack draw(triangle) - draws a triangle with unit base and unit height .draw(square) - draws a unit square Sample: translate(1,1) draw(square) translate(1,0) draw(triangle) Write down the sequence of commands to make the following drawing in a minimum number of steps. Assume the origin of triangle and square is bottom left.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!