A helix cylinder is constructed by finding the least squares linear fit along the coordinates of the helix's C atoms. If a given residue's C is selected, the small cylinder (found by linear interpolation along the line of best fit) is drawn with radius determined by the radius parameter. Because this method computes a best fit, a helix must have at least 3 residues before it is drawn (those helicies with one or two residues are drawn as a coil). It is possible to pick the C for each cylinder segment, but they are at the location of the C , which is not near the axis cylinder. Interesting results occur when the whole protein is defined to be a helix and drawn as a cartoon.
The solid beta ribbon is constructed by building a spline along the center points between each beta sheet residue. Again, the spline is linearly interpolated to find the start and end points for each residue. Those are extended to construct the corners for a ribbon with rectangular cross section (the amount of extension is determined with the thickness parameter). A ribbon segment is used if the corresponding C atom is selected. Note that since this method assumes the protein is in a beta conformation, it draws a much smoother ribbon than the standard `Ribbons' option, which draw the ribbon with an oscillation along the sheet.
The other conformations are drawn as a tube. Since the endpoints of the helix cylinder and cartoon sheet are not at the C coordinate, the tube method was slightly changed to make the tube go to the new locations. This does not always work, resulting in a tube which does not quite connect to a cylinder.