I've attached a drawing how to calculate the coordinates of the points of the surface of a torus.

1. The black circle in the x-y-plane is the path of point R. In the picture of the torus I've choosen R=5

2. The red circle has the radius . I've taken r = 3.

With and the angle v you can calculate the x and y-coordinate of the points.

3. The z-coordinate of all points only depends on r and the angle u.