Calculate the matrices only ones, rather than on each redraw