Program Flow

Create a 4x4 matrix

Initialize it by calling the identity() member function

Create an array to store the vertices for a shape

Create an array to store the indices of each side of the shape

Create a new shape object, passing in the vertices and edges indices as arguments

Each time the canvas updates:

Invoke the identity() member function on the matrix to reset it

Multiply the matrix by the scale, rotation and translation matrices

Transform each vertex using the transform() member function of the matrix

Convert co-ordinates for each vertex from world space to canvas space

Iterate through the indices array and draw lines between each pair of vertices inside a for() loop