OP-1474 Extract line and curve functions out to mathmisc.h, nan check and unit tests
OP-1474 Revert TPS debugging code