CompSciWeek10

= Suggested Reading =
 * Linear Transformations and Their Representing Matrices by David Webb

= Class 1 = A motivating problem for vector mathematics.

The following problem appears in structure building for molecular modeling. The 20 common amino acids are joined into polypeptides by attaching the C-terminus of one amino acid to the N-terminus of the next. Each joint has a specific orientation in 3D space (determined by the amide plane).

Here, we tackle a smaller instance of this problem. You are building a series of 2D figures by joining together the edges of smaller 2D figures. At each joining point, an orientation is specified in terms of local x and y directions. When joining A and B, for example, the ending orientation of A must match the starting orientation of B. We choose to rotate and translate B to make this happen.

This phrasing is partially motivated by a fun little language for composing 2D figures. Its solution involves important concepts for determining relative positions and orientations using vectors, and should be generally useful for any problem involving geometric relationships.

The following code outlines a class structure for holding each object. Two basic functions to implement are figure visualization (vis, below) and the joining process. Before the next class, try and implement the joining operation yourself!

= Class 2 =
 * Linear transformations
 * Homogeneous coordinates
 * Composing linear transformations
 * Inverse operations, implicit solutions, and complexities

= Homework - Due Wed., Nov 5 =
 * 1) I have a linear transformation that maps vectors in $$R^m$$ to vectors in $$R^n$$.  It is represented by a matrix (an $$n \times m$$ array).  I want to specify it in terms of how it acts on a set of starting vectors (in $$R^m$$).  How many starting vectors do I need to transform for a complete specification?  Is there an easy way to choose them?
 * 2) Say that I wanted to have several "sticking points" for each object.  What modifications would have to be made to the Shape class?  What does this mean for the __add__ operation?
 * 3) I have two objects in 3D, each with a 3x3 orientation matrix, A for object A and B for object B.  What is the rotation matrix for rotating elements attached to A (specified in A's coordinate frame) to match elements attached to B (specified in B's coordinate frame)?
 * 4) Coordinate frames always should have the property that each vector is normalized ($$v_i \cdot v_i = 1$$) and orthogonal to all the others ($$v_i\cdot v_j = 0$$).  Matrix multiplication transforms objects in the coordinate frame to objects in the global frame.  What does matrix multiplication do if the "coordinate frame" has a vector that is not normalized? What if it has 2 vectors that are not orthogonal?
 * 5) The following function takes points in 2D space and fits them to a line of the form y = a*x + b.  Use it to write a function that takes points in 2D space and returns an orientation matrix describing the best fit direction as "x hat" and the other direction as "y hat".