Refactor the tr_quad function in for easier reading.
The current tr_quad function is a big switch. This isn't a problem in itself, but maybe we can split it up and use macros to avoid writing the things over and over.
The current tr_quad function is a big switch. This isn't a problem in itself, but maybe we can split it up and use macros to avoid writing the things over and over.