Coffee Cup

This lab is another modelling exercise, this time with quadrics.

Download file quadrics.py3d which demonstrates how to create quadric surfaces.

1. In the Main program is a line

geo.tessellate(10, 10)
This controls how finely curved surfaces are subdivided into polygons. Try different values.

2. "Solid" quadrics are formed by rotating (or sweeping) a line or curve around an axis. The quadric primitives in Py3D are based on RenderMan and take optional parameters for the start and finish angles, with the defaults being 0 and 360. Remove the inward facing 90 degree quadrant of each segment.

3. Quadrics have additional control parameters depending on the type. You can truncate a sphere at the top or bottom, vary the radius at each end of a cylinder to create cones, create a hole inside a disk, or draw a torus that has been sliced open. Have a look at the documentation for quadrics and try some of the additional parameters out.

Coffee Cup

Now try to create a model of a coffee cup, with the cross section given below:

The cup has straight sides (cylinder). The bottom has a bevelled edge (tapered cylinder), a flat rim (disk with hole), and a flattened sphere in the centre. Exactly half way up is the handle (torus), and the top has a curved rim (torus section). (A real coffee cup has thickness, but for this exercise you don't need to model both the inner and outer surfaces.)

Two variables define the height (H) and radius (R) of the coffee cup. You cannot use any dimension in your model, whether geometry or transformation, which is not derived from the value of H and R. If either or both H/R change, everything else must change automatically to match.

In other words, you cannot write something like

matrix.translate(10, 0, 0)
but you can write
matrix.translate(H * 0.5, 0, 0)