Much better line algorithm + edges for torus factory