VRML MODEL
The Torus or donut is an example of rational surface The torus' surface is formed by sweeping a circle 360 degrees around the z-axis.
3 key values define the structure of the Torus:
R = Radius of the torus
r = Radius of the circles forming the torus' body
n = the number of points on the torus, where the circles will be located, and the number of points on the circles themselves.
The Torus surface is described by the parametric representation:
X = (r + R cos v) cos u
Y = (r + R cos v) sin u
Z = R sin v
Where u (angle of circles) and v (angle of torus body) = [0, 2PI), the angles u and v are set according to the angle the point being calculated lies on. As we have seen the torus surface is formed of n equidistant circles thus the angle between each circle is 2PI/n. Equally the angle between each point on the circles is 2PI/n. Thus to calculate the points on the surface involves visiting each of the n points on the torus (v = [0,n) * 2PI/n) and at each point calculating the points of the circle to be placed there (u = [0,n) * 2PI/n).
Source: http://www.btinternet.com/~krys1/gallery/vrml_geo1.html