def torusF(x,y,z,rin,rout):
    """Return the Torus surface function over x,y,z
    with parameters rin and rout
    Equation taken from
    http://www.emeyex.com/site/projects/raytorus.pdf
    """
    return (x**2+y**z+z**2-rin**2-rout**2)**2 + \
           4*rout**2*(z**2-rin**2)