
from __future__ import division

import numpy as np
from fractions import gcd

from pyknotid.spacecurves.knot import Knot
from pyknotid.spacecurves.link import Link


def torus_knot_num_components(p, q):
    '''Returns the number of components of the p-q torus knot. If p and q
    are coprime, there will always be a single component, otherwise
    multiple linked components.
    '''
    return gcd(p, q)


def torus_knot(p=3, q=4, num=100):
    '''
    Returns points in the p, q torus knot. If p and q are not coprime,
