Assignment 1 (Coding): Exterior Calculus (Due 2/25)

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:
    1. in core/geometry.js
      1. cotan
      2. barycentricDualArea
    2. in core/discrete-exterior-calculus.js
      1. buildHodgeStar0Form
      2. buildHodgeStar1Form
      3. buildHodgeStar2Form
      4. buildExteriorDerivative0Form
      5. buildExteriorDerivative1Form

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 by email to

14 thoughts on “Assignment 1 (Coding): Exterior Calculus (Due 2/25)”

  1. For the exterior derivative functions, where do we get the orientations of the edges and the faces so that we know how to sum up the vertices/edges, respectively? Or am I just missing a function or parameter in the Geometry class that keeps track of this?

      1. Is this the corner stored in the half edge? Does the mesh contain only triangles? I’m confused about how to find the two edges forming the angle if the mesh contains polygons besides triangles.

          1. Thanks. I found that only the dual mesh is allowed to be a non-triangle polygon mesh and the Hodge star operator only applied to the primary mesh. It’s now clear.

    1. I believe the twin points to null and the value will be 0. If you just use the standard formula we provided, you will not run into any issue. Many meshes we use describing 3D data are without boundary, so this is not an issue there.

  2. Are we supposed to use barycentric dual or circumcentric dual for the Hodge star matrices? We write the barycentric functoin but Slide 28 is about the circumcentric dual.

Leave a Reply