Assignment due Wednesday October 12

For next week I want you to do two things:

You will want to implement a matrix stack to do this, which is just an array of matrices Matrix stack[];, initialized to stack[0].identity();, as well as a top pointer int top initialized to top = 0.

All your translate, rotate, scale, and transform methods should access the matrix stack[top] currently at the top of the matrix stack, and you'll need to implement two additional methods:

As we discussed on Monday, an example of using push and pop methods can be seen on-line at:

A note about perspective:

As we discussed in class today, you can implement perspective (assuming that the camera is at the origin (0,0,0)) by the transformation:

(x,y,z) → ( fx/z , fy/z, 1/z )

where f is the negative value of z representing the distance from the camera at which objects will appear neither magnified nor reduced in size. A larger magnitude of f results in a telephoto view; A smaller magnitude of f results in a wide angle view.

After you have applied the perspective transformation, then you can apply the viewport transformation to convert x and y into pixels.

There's always room for JelloTM:

The little interactive example that we worked through in class is available on-line at: