Parametrisation of the surface a torus

Your formula is absolutely correct, just look here for verification.


A circle of radius $a$ centered at $(b,0)$ in the plane $xz$ has the parametric equation

$$x=a\cos(\theta)+b,z=a\sin(\theta),$$ with $\theta$ in the range $[0,2\pi]$ for a full circle.

Now you rotate the plane $xz$ around $z$ by $x\leftarrow x\cos(\phi),y\leftarrow x\sin(\phi)$, with $\phi$ in the range $[0,2\pi]$ for a full turn,

$$x=(a\cos(\theta)+b)\cos(\phi),\\ y=(a\cos(\theta)+b)\sin(\phi),\\ z=a\sin(\theta).$$

If you freeze $\theta$, you get a circle in a plane parallel to $xy$, of the form:

$$x=r\cos(\phi),y=r\sin(\phi).$$


You can plot this surface in WolframAlpha. The correct syntax to use is:

ParametricPlot3D[{(2 Cos[u]+3) Cos[v], (2 Cos[u]+3) Sin[v], 2 Sin[u]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}]

where I have chosen $a = 2$, $b = 3$. The output looks like this.