Torus knot fix

I created a refactor for https://github.com/mrdoob/three.js/issues/3547
I verified that the TorusKnot still works in the examples and that there is no performance regression.