The pipe is described by three cubic Bezier functions, and the drawing is made using Frenet Frames  .
The main pipeshape is described with an axis in YZ-plane, and the ovals describing the thickness along the main outline is described with two Beziers, one for X and one for Y.
v3d is a simple utility class for handling vectors, crossproduct, matrixmultiplication etc.
The bezierfunctions are handled with a simple class:
The points and the normals on the pipebody is calculated as Frenet Frames. The method that generates the pipeshape is:
We use the buffered data to draw the shape