Generating the torus and helitoroid
A parametric representation of a torus:
This torus is in a standard position, but we can move it to different positions or orientations in space by applying coordinate transformations.
I begin the construction of the helitoroid with the parametric definition of a directrix curve:
in which W is a positive integer, which I call the winding. This curve moves at constant distance r from the major circle, which is the circle of radius R in the plane z=0, centered at the origin, and it closes on its tail after winding around the major circle W times.
As for any smooth space curve, we get the tangent vector to the directrix curve at any point as the unit vector in the direction of the derivative of the position vector with respect to the parameter. The dots on top mean derivative. The hat on signifies unit vector. means length of vector.
The derivative of the tangent vector is perpendicular to it. (Exercise for the reader: convince yourself from elementary vector calculus definitions that the derivative of a unit vector function is perpendicular to it.)
So we let
The unit vector is called the normal vector to the curve. The plane through the point spanned by and is called the osculating plane. The projection of the space curve on the osculating plane is the plane curve that best approximates the space curve in a small neighborhood of .
So and are two perpendicular unit vectors. Their cross product
is called the curve binormal and form an orthonormal frame, which moves along the curve with the parameter , and is called the Frenet frame. This frame is the context for the beautiful theory of smooth space curves. See the books by Dirk Struik or Barrett O'Neill for good introductions (Chapter 1 in both).
The vectors span the plane through the point that's perpendicular to the tangent of the directrix curve . I generate my helitoroid surface by inflating the directrix curve to a tube of cross section radius . For any given point on the directrix curve, the points on the circle of radius about in the plane perpendicular to the directrix curve are parameterized by
Thus, letting vary over its full range, we get the (doubly) parametric representation of the helitoroid surface :
The tessellation of each of these surfaces is obtained by evaluating the position vectors on an integer lattice in the 2D parameter domain, and the quads thus formed are bisected to form triangles. The two surfaces in the current example comprise 12000 triangles.
Also, for the smooth shading I need normal vectors to the both surfaces at each vertex of the tessellations. Symmetry considerations show that the helitoroid surface normal at each point is
and the torus surface normal at each point is
which both are computed in the course of computing the vertex positions.