Notes for March 10 -- Building and demonstrating the Matrix class

Completing the Matrix class

During class we implemented part of the Matrix class. The code we wrote in class (slightly cleaned up), is here.

You need to implement the methods that we didn't implement in class, including rotateX(), rotateY(), rotateZ() and scale(), and optionally perspective(), as well as any helpful internal support methods, such as _makeScale().



Homework (due before class on Tuesday March 22)

  1. First, implement the other methods needed to complete the Matrix class.

  2. After you have done that, create a cool scene to show your use of the matrix object. Remember that you can use both the stroke() and fill() methods, as well as any of the other methods in the canvas context.

    You should make use of both the this.cursor and time variables, so that your scene will be both interactive and animated.

    Remember that after you have transformed any 3D point in your model via:

    matrix.transform(vec1, vec2);
    you then need to do a viewport transform so that you will know at which pixel to draw that point on your canvas:
    vec2.viewportTransform(canvas.width, canvas.height, pixelVec);

Try to have fun with this assignment. Make something crazy and exciting, or beautiful and moving, or funny, or personal.

Surprise me. :-)