phase 10:
modeling
cs40 assignment 10 web page
overview
in this assignment i extended the modeling capabilities of my system to handle a broader array of primitives and to handle surfaces derived from curves, such as extrusions, lathes, and lofts.
new primitives
in addition to triangles, squares, circles, cubes, cones, and cylinders, graphicsDeploy now supports spheres and toruses. below is a picture of a torus.
curves
for the moment, curves are just ordered sets of points connected by line segments (they can either be open or closed curves), and exist as nodes in the hierarchy. i won't go into all the details here, but there are a lot of issues which crop up when having both curves and surfaces derived from curves in the hierarchy, with different transformations applied to each; it generally works best to keep the curves in a completely separate branch of the hierarchy, and also best to keep them at the top level.
curves can be animated by morphing one curve to another with the same number of points and the same connectedness. below is an animated spiral-helix curve.
skinned surfaces
many types of surfaces can be created by generating 'skinned' surfaces from one or more curves. an extrusion involves using the curve as the cross-section of a surface and drawing that cross section along a path (typically a line, but more generally any arbitrary curved path) to generate a surface. a lathe is generated by revolving a curve around a fixed axis. a loft is generated by taking two or more curves of the same number of points and the same connectedness and effectively stretching a surface over the set of curves.
below are wireframe and shaded renderings of a cup-model, generated by partial-lathing a curve of the cup's profile.
the following is the animated curve which generates the ripple animation in my cs40 portfolio (using a lathe).
spline-based animation
in order to get smoother looking animation, it became clear that linear interpolation between keyframes was no longer adequate. after some experimentation, i decided to use spline-based interpolation using hermitian splines, which allow you to specify both the tangent and value for each key. if the user does not specify the tangent for a given key, then the tangent used is given by the line connecting the previous and next keys (ala cardinal splines).
the following graph is the animation spline for the y-translation of a single point on one of the curves which is lofted to generated a page in the book as seen in my cs40 portfolio.