Perhaps the simplest equations for a torus are the parametric equations. We develop them as follows. The big circle of radius R inside the torus is:
xb = 0
yb = R cos(u)
zb = R sin(u)

Where u runs from 0 to 2π. A particular value for u determines a point P on the big circle; consider the tangent there. We consider the torus to be all those points at a distance of r from the big circle. We build a small circle of radius r and center P in the plane thru P and perpendicular to the tangent. Two perpendicular unit vectors in this plane are:
<0, cos(u), sin(u)>, and <1, 0, 0>. They span the plane and we use them to describe our small circle about our chosen point P on the big circle. We use the parameter v ranging, from 0 to 2π, to locate a point on the small circle.
x = r sin(v)
y = R cos(u) + (cos(u)) r cos(v) = cos(u) (R + r cos(v))
z = R sin(u) + (sin(u)) r cos(v) = sin(u) (R + r cos(v))

These small circles collectively form the torus and these equations locate a general point point <x, y, z> on the torus. The small circles are the crossection of the torus which notion we will need later. The crossection is the intersection of the torus and a plane thru the axis of the torus, here the X-axis.

The size of the torus, in the sense of a bounding box is given by the relations
|x| ≤ r, |y| ≤ R + r, |z| ≤ R + r

The diameter of the hole is 2(R − r).

### 2nd Life Toruses

Second Life has very nice built in tools for defining a large variety of geometric objects. They are effectively a wysiwyg editor for stuff that you can draw in OpenGL or at least within the confines of about 10 particular general geometric forms, of which one is the torus. Indeed there are many numerical knobs to turn which modify your torus. Naturally you can relocate and rotate it. But you can also do things that stretch the definition of torus beyond the conventional form we have above.

To create an object, such as a torus, click “build” at the bottom of the window. This opens a new window in which you can select the torus icon (first item second line of icons). Then click “create” at the top. Your cursor now becomes a wand and everywhere you click makes a new torus there until you close the build window or click something besides “create”. It is easier to create them than to delete them. Beware lest you become the sorcerer’s apprentice. (To delete something that you have created, left click it (splat click on Mac), select “more” and select “delete”.) There are ways to move, rotate and change the shape of bodies by direct manipulation but this note explores the numerical interface you see when you click “More »” at the bottom of the build window and then the “Object” tab. To edit an existing object, splat click object, then select “Edit...”. The Build window will open if not already open.

A new torus comes in a bounding box 1/2 meter in each of three dimensions; the Size properties are (0.5, 0.5, 0.5). This figure is inscribed in a cube and the crossection is an ellipse with diameters 0.5 in the X direction and 1/8 in the other direction.

The new torus comes with axes rotated by 90°. You may want to set the three “rotation” values each to 0 which makes the torus axes parallel to the world axes. Our coordinates are in the frame of the torus and the numeric fields of the torus object window uses these coordinates. Viewing this new torus from the x direction suggests that R = 3/16 and r = 1/16. The range of x, however is |x| ≤ 1/4. Indeed a cross section (small circle) has been distorted to an ellipse and our parametric equations would be:
x = 1/4 sin(v)
y = cos(u) (3/16 + 1/16 cos(v))
z = sin(u) (3/16 + 1/16 cos(v))
We have stretched the definition of a torus.

Notice that the r value is 1/4 for x but 1/16 for y and z. This is one of the knobs. The small circles become ellipses. We generalize our equations:
x = rx sin(v)
y = cos(u) (R + rp cos(v))
x = sin(u) (R + rp cos(v))
where R = 3/16, rx = 1/4, rp = 1/16 for a new torus.

The size of the bounding box here is (2rx, 2(R + rp), 2(R + rp)) and these three numbers can be directly set as the Size of the torus.

In the numerical controls for the new torus “Hole Size” is {X = 1, Y = 1/4}. The range of x seems to be proportional to both Size.X and (Hole Size).X . The user interface limits imposes 0 < (Hole Size).X ≦ 1. In our new torus Size.X = 1/2 and (Hole Size).X = 1. Perhaps
rx = Size.X * (Hole Size).X / 2
rp = 2 * Size.Y
At least when Size.Y = Size.Z.

Changing any of the three Size numbers seems to cause an affine transformation on the torus in the corresponding direction.

I extrapolate and try to guess at a more general case. The three Size parameters determine the bounding box shape for the torus. If we take the following parametric equations
x = sx sin(v)
y = sy cos(u) (R + rp cos(v))
z = sz sin(u) (R + rp cos(v))

then the bounding box dimensions are (2 sx, 2 sy(R + rp), 2 sz(R + rp)), and the hole is an ellipse with y diameter 2 sy (R − rp) and z diameter 2 sz (R − rp). Note that the plane of the small circle is no longer perpendicular to the tangent of the large circle. Indeed the circles are now ellipses. This is an affine transformation of the torus and I will call it the affine torus here, but it is not yet the most general affine torus. This is a four dimensional set of figures; if I double sy and sz, and the halve R and rp I have not changed the figure.

Here are four equations that relate these values with those of the numeric user interface:
sx = Size.X * (Hole Size).X
sy(R + rp) = Size.Y
sz(R + rp) = Size.Z
2 rp = (Hole Size).Y

“Hole Size” in the user interface would be better called “Thickness” or “Crosssection”.

The controls “Path Cut Begin and End” controls the range of parameter u. By default u ranges from 0 to 2π but more generally from (Begin)2π thru (End)2π. Unless Begin = 0 and End = 1 the stub ends of the truncated torus are depicted with opaque disks.

The Hollow field is a percentage, by radius, of the size of a hole about the big circle thru the torus. This hollow region is itself a torus about the same big circle. By default Hollow = 0 and there is no such void. This is visible when Path Cut parameters do not have their default values.

The Skew argument, by default 0, changes the big circle into a helix. Our equations become
x = sx sin(v) + Skew u / π
y = sy cos(u) (R + rp cos(v))
z = sz sin(u) (R + rp cos(v))

Skew = 1/2 causes the torus to be externally tangent to itself after u increases by 2π. This situation makes it useful to extend the range of u beyond the range 0 thru 2π. As Skew increases so does the range of x but there is logic to keep the range of x within the bounds set by Size.X . The effective value for (Hole Size).X is diminished thus diminishing the range of x. As we vary Hole.X