# Assignment 2

Assignment 2 is now available! You can view the document here. This assignment will be due at 11:00 pm on Feb 4th. The submission guidelines are identical to the previous assignment. Electronic submissions are preferred (cc’ing both kmcrane@cs.cmu.edu and nsharp@cs.cmu.edu), but if you wish to submit a physical document, do so in class or at 215 Smith Hall. Smith Hall locks to the public at 5:00 pm, so plan accordingly.

The document linked above has several questions inline, numbered as Exercises 12-17. You DO NOT need to complete problems 13 and 16; they involve material we have not yet covered. Also, there are some sections of text that might not recognize yet, such as a discussion of the Laplace-Beltrami operator and some use of exterior calculus. Don’t worry about these for now — they are not necessary to solve the problems, and we will be covering them in class in the upcoming weeks.

To keep things simple, we will only be considering meshes without boundary for this assignment. There is a collection of such meshes in the Assignment2/Boundaryless_Meshes/ directory on which to test your code.

To investigate your code, run it as we did with the test assignment. Pressing ‘h’ will print (to your terminal) a list of commands supported by the program. Clicking on the mesh will print useful information about faces/edges/vertices.

Finally, on Tuesday (1/26) in class, I will be leading a workshop with a quick introduction to computing with meshes and a guide to using the course library. It is highly recommended that you attend! Please refrain from asking me any questions about the codebase until after that workshop.

## 9 thoughts on “Assignment 2”

1. One minor correction to the homework PDF: In the diagram directly above Exercise 17, for the object on the left, the normals should be facing in the opposite direction.

Thanks to the person who pointed this out!

2. Oliver says:

Where it has $A = \frac{1}{2}\sum_{i}{p_i \times p_j}$ is that supposed to be $A = \frac{1}{2}\sum_{i, j}{p_i \times p_j}$ ?

1. Keenan says:

Here j just denotes the vertex following i.

3. Keenan says:

Minor point of clarification: for a vertex, self.adjacentHalfEdges() returns only the halfedges sticking out of the vertex.

4. Slav Kirov says:

I have installed the modules from Assignment 0, but cannot import the euclid module in the Assignment2.py file. I am running python 3.4. Are some of the modules only compatible with 2.7? (I noticed 2.7 is the version listed under the github documentation, but I just wanted to make sure we need to use that version before re-installing.)

1. Unfortunately Python 2.7 and 3.4 are significantly different; this code was developed for 2.7 so it probably won’t work on 3.4 without some significant effort. Installing 2.7 sounds like a good idea, let me know if you have any trouble.

5. lotusword says:

One little trick: The result of acos(np.dot((a/norm(a)),(b/norm(b)))) and acos(np.dot(a,b)/(norm(a)*norm(b))) may be different in python, which may lead to different results when calculating the angle defect. The former one is correct! Thanks to @Khryl’s help:).

6. Ray Li says:

This is pretty late, but shouldn’t the sign on Exercise 15 be flipped?

Right now, if you position a regular tetrahedron with $p_i$ on ‘top’, then all the cotans are going to be positives, but all the $p_j-p_i$’s are pointing ‘down’, which would give the gradient pointing ‘down’, but it seems like the way to increase the area the fastest is to move $p_i$ ‘up’

1. Yep, you’re correct. This is one of those occasional “up to sign” errors that Keenan referenced in class. Sorry about that!