The interview today went really, really well! Thanks to all of you for your enthusiastic support and well wishes!!!

Here is the house applet we developed in class today. Your task, by the start of class next Wednesday, is to add to the Matrix3x3 class the two methods:

   rotate(double theta)
   scale(double sx, double sy)

and then use matrix transformations to make an applet that is much more interesting than my silly little house applet.

I suggest you use the same approach I used to implement

   translate(double dx, double dy)
That is, implement helper methods such as:
   makeRotation(double theta)
   doMakeRotation(double theta, double data[][])

   makeScale(double sx, double sy)
   doMakeScale(double sx, double sy, double data[][])

Remember that you can use such methods as:

   drawPolygon(int X[], int Y[], int n)
   fillPolygon(int X[], int Y[], int n)
to display really cool shapes.

In order to transform a polygon, you simply need to make a copy of its X and Y arrays, using method:

   transform(double x, double y, double dst[])

to transform each copied point, and then draw the transformed copy of your polygon.

If you are feeling ambitious, try using matrices to create animated scenes in which things move in different ways (eg: the hands/gears of a clock, the limbs/eyes of a creature, etc).


Source code: house1 extends BufferedApplet. using Matrix3x3.