Since Problems 1 and 3 of Homework 7 have taken on their own identity as another homework, here is a post to parent discussion for this part. I’ll start with some questions and answers to get the ball rolling:
In the setup file, I first wanted to make sure I am understanding each component correctly. Matrix A is some matrix that when multiplied with x will yield the deformation, b, for each vertex.
Yes, this is true in the absence of pinned vertices. The basic starting point is a matrix A that is set up so that ||Ax|| is the deformation you want to minimize. (Note that this means that, without pins, x = 0 is a perfect solution!)
Vector x is composed of the coordinates of each vertex such that x = [x11,x12,x21,x22,x31,x32,...]‘. At the end of this part b = 0 because we haven’t computed the deformation yet (since we don’t have the new coordinates).
Right, b will have nonzero entries once there are some pins.
I am a little confused as to how to set up the matrix A. The definition of the deformation of an individual triangle, Ej(v1′,v2′,v3′), is easy to understand on paper but I don’t really see how to put that formula into A. I can write the formula in terms of individual coordinates and R, however I don’t see how you can put that into A so that when multiplied by x you get the deformation.
I think if you write out the deformation for a point in terms of the individual components of the three vertices involved, you will see that the two components of the deformation are linear combinations of the variables. (Expand it out all the way including expanding R.)
Also, I know we are supposed to minimize ||Ax|| in this problem, but how do we minimize this quantity? The new and old points are going to be fixed…
The pinned points play a role very much like the boundary pixels in the previous homework. They fit into the equations just like the variables do, except that they are constants, so you need to pull the appropriate terms out and put them on the right hand side.
Or are we minimizing it somehow because each vertex is a part of more than one triangle?
It is important that the vertices are part of multiple triangles. The vertices correspond to columns of A, and each column will have entries on rows that correspond to triangles that its vertex is involved in.
If so what part of the calculation are we minimizing?
One way to say it is that you are minimizing ||Ax||, but not all the entries of x are variables, because some are specified by the user. Instead the system we solve is ||A1 x1 – b|| where x1 consists of all the entries of x that are *not* pinned, and A1 is missing the columns that correspond to those no-longer-variable variables. If you like, you could rearrange the vector x to put all the pinned points at the end — then you are minimizing something that looks like:
||[A1 A2] [x1;x2]||
where x2 contains the known points and x1 has the unknown ones. (This rearrangement is mainly for on paper—in code you’d just use indexing to pull out the columns you want.)
Am I supposed to represent E^2, which I want to minimize, as a measure of the magnitude of some Ax-b?
Is the matrix X’ (containing all of the new locations of the vertices) what I am solving for?
Yes, except that you’ll find you need to treat it as one long 2n-vector, not an n-by-2 matrix, in the system. This problem doesn’t separate into decoupled problems for the components, the way some previous problems did.
That would mean that b is a two column matrix, correct?
No, it has to be a 2n-vector.
The constrained linear least squares work done in problem 2 isn’t necessary for this problem, right?
Not for problem 1, but yes for problem 3.
I’m having trouble seeing what the equations that I need to work with here—am I even on the right track?!
You are on the right track! I’d suggest starting with a single triangle, writing out the deformation of a single vertex in terms of the triangle’s three vertices so that you can see how the two components of the deformation are linear combinations of the vertices’ coordinates. Once you see how this works, make yourself a 6-by-6 matrix that computes the deformation of a single triangle from just the coordinates of its three vertices. Once that is working, you can use a bunch of these one-triangle matrices to assemble the matrix for the whole mesh.