Changed localToGlobal to use helper matrices, to avoid creating lots of matrix objects.