For the coding portion of your first assignment, you will implement the discrete exterior calculus (DEC) operators $\star_0, \star_1, \star_2, d_0$ and $d_1$. Once implemented, you will be able to apply these operators to a scalar function (as depicted above) by pressing the “$\star$” and “$d$” button in the viewer. The diagram shown above will be updated to indicate what kind of differential *k*-form is currently displayed. These basic operations will be the starting point for many of the algorithms we will implement throughout the rest of the class; the visualization (and implementation!) should help you build further intuition about what these operators mean and how they work

**Getting Started**

- For this assignment, you need to implement the following routines:
- in
`core/geometry.js``cotan``barycentricDualArea`

- in
`core/discrete-exterior-calculus.js``buildHodgeStar0Form``buildHodgeStar1Form``buildHodgeStar2Form``buildExteriorDerivative0Form``buildExteriorDerivative1Form`

- in

In practice, a simple and efficient way to compute the cotangent of the angle $\theta$ between two vectors $u$ and $v$ is to use the cross product and the dot product rather than calling any trigonometric functions directly; we ask that you implement your solution this way. (**Hint**: how are the dot and cross product of two vectors related to the cosine and sine of the angle between them?)

In case we have not yet covered it in class, the *barycentric dual area* associated with a vertex $i$ is equal to one-third the area of all triangles $ijk$ touching $i$.

*EDIT: * You can compute the ratio of dual edge lengths to primal edge lengths using the *cotan formula*, which can be found on Slide 28 of the Discrete Exterior Calculus lecture, or in exercise 36 of the notes (you don’t have to do the exercise for this homework).

**Submission Instructions**

Please rename your `geometry.js` and `discrete-exterior-calculus.js` files to `geometry.txt` and `discrete-exterior-calculus.txt` (respectively) and submit them in a **single zip file** called `solution.zip` by email to Geometry.Collective@gmail.com.