Macro to calculate transformation matrix + tree looper class introduced