Torus Rotation

A Torus is composed by a face list of traingles. The total number of vertices is (number of segments * number of cross sections) * 3. The vertices algorithm is:

for every i < # of segments (
for every j < # of cross sections (
rotate to get the new point location

v[counter] = new x location for (i,j);
v[counter+1] = new y location for (i,j);
v[counter+2] = new z location for (i,j);

counter+=3;
)
)

The number of faces is the number of segments * number of cross sections . The face list algorithm is:

for every i < # of cross sections
if (i == # of cross sections - 1)
face[counter+i] = face list of pts (counter+i, counter, 0, # of cross sections - 1);
else
face[counter+i] = face list of pts (cntr+i, cntr+i+1, i+1, i);
}