Assignment 4 (Written): Conformal Parameterization

The written part of your next assignment, on conformal surface flattening, is now available below. Conformal flattening is important for (among other things) making the connection between processing of 3D surfaces, and existing fast algorithms for 2D image processing. You’ll have the opportunity to implement one of these algorithms in the coding part of the assignment (to be announced soon).

Assignment 3 (Written): The Laplacian

These exercises will lead you through two different derivations for the cotan-Laplace operator. As we’ll discuss in class, this operator is basically the “Swiss army knife” of discrete differential geometry and digital geometry processing, opening the door to a huge number of interesting algorithms and applications. Note that this time the exercises all come from the course notes—you will need to read the accompanying notes in order to familiarize yourself with the necessary material (though actually we’ve covered much of this stuff in class already!)

Assignment 3 (Coding): The Laplacian and Curvature Flow

For the coding portion of this assignment, you will build the so-called “cotan-Laplace” matrix and start to see how it can be used for a broad range of surface processing tasks, including the Poisson equation and two kinds of curvature flow.

Getting Started

Please implement the following routines in

  1. core/geometry.js:
    • laplaceMatrix
    • massMatrix
  2. projects/poisson-problem/scalar-poisson-problem.js:
    • constructor
    • solve
  3. projects/geometric-flow/mean-curvature-flow.js:
    • buildFlowOperator
    • integrate
  4. projects/geometric-flow/modified-mean-curvature-flow.js:
    • constructor
    • buildFlowOperator

Notes 

  • Sections 6.4-6 of the course notes describe how to build the cotan-Laplace matrix and mass matrices, and outline how they can be used to solve equations on a mesh. In these applications you will be required to setup and solve a linear system of equations $Ax = b$ where $A$ is the Laplace matrix, or some slight modification thereof. Highly efficient numerical methods such as Cholesky Factorization can be used to solve such systems, but require $A$ to be symmetric positive definite. Notice that the cotan-Laplace matrix described in the notes is negative semi-definite. To make it compatible for use with numerical methods like the Cholesky Factorization, your implementation of laplaceMatrix should instead produce a positive definite matrix, i.e., it should represent the expression\[ (\Delta u)_i = \tfrac{1}{2}\sum_{ij} (\cot\alpha_{ij} + \cot\beta_{ij})(u_i – u_j). \]

    (Note that $u_i-u_j$ is reversed relative to the course notes.) To make this matrix strictly positive definite (rather than semidefinite), you should also add a small offset such as $10^{-8}$ to the diagonal of the matrix (which can be expressed in code as a floating point value 1e-8). This technique is known as Tikhonov regularization.

  • The mass matrix is a diagonal matrix containing the barycentric dual area of each vertex.
  • In the scalar Poisson problem, your goal is to discretize and solve the equation $\Delta \phi = \rho$ where $\rho$ is a scalar density on vertices and $\Delta$ is the Laplace operator. Be careful about appropriately incorporating dual areas into the discretization of this equation (i.e., think about where and how the mass matrix should appear); also remember that the right-hand side cannot have a constant component (since then there is no solution).
  • In your implementation of the implicit mean curvature flow algorithm, you can encode the surface $f : M \rightarrow \mathbb{R}^3$ as a single DenseMatrix of size $|V| x 3$, and solve with the same (scalar) cotan-Laplace matrix used for the previous part.
  • The modified mean curvature flow is nearly identical to standard mean curvature flow. The one and only difference is that you should not update the cotan-Laplace matrix each time step, i.e., you should always be using the cotans from the original input mesh. The mass matrix, however, must change on each iteration.

Submission Instructions

Please rename your geometry.js, scalar-poisson-problem.js, mean-curvature-flow.js and modified-mean-curvature-flow.js files to geometry.txt, scalar-poisson-problem.txt, mean-curvature-flow.txt and modified-mean-curvature-flow.txt (respectively) and put them in a single zip file called solution.zip. These files and your solution to the written exercises should be submitted together in a single email to Geometry.Collective@gmail.com with the subject line DDG17A3.

Implementing Curvature Flow

For anyone interested in learning more about the 1D curvature flows we saw today in class, there’s an assignment (and some notes) from a previous year’s class here:

Curvature Flow

In fact, it wouldn’t be hard to implement in the same code framework we’re using for the class, since you can think of a plane curve as a “mesh” consisting of a single flat polygon with many edges.

The paper I mentioned on discrete curve shortening with no crossings is:

Hass and Scott, “Shortening Curves on Surfaces”, Topology 33, (1994) 25-43.

It would be fun to see an implementation of something like this on a surface (I’ve never done it myself!).

Taking Gradients: Partial Derivatives vs. Geometric Reasoning

In your homework, you are asked to derive an expression for the gradient of the area of a triangle with respect to one of its vertices. In particular, if the triangle has vertices \(a,b,c \in \mathbb{R}^3\), then the gradient of its area \(A\) with respect to the vertex \(a\) can be expressed as
\[
\nabla_a A = \tfrac{1}{2} N \times (b-c).
\]
This formula can be obtained via a simple geometric argument, has a clear geometric meaning, and generally leads to a an efficient and error-free implementation.

In contrast, here’s the expression produced by taking partial derivatives via Mathematica (even after calling FullSimplify[]):

Longer expressions like these will of course produce the same values. But without further simplification (by hand) it will be less efficient, and could potentially exhibit poorer numerical behavior due to the use of a longer sequence of floating-point operations. Moreover, they are far less easy to understand/interpret, especially if this calculation is just one small piece of a much larger equation (as it often is).

In general, taking gradients the “geometric way” often provides greater simplicity and deeper insight than just grinding everything out in components. Your current assignment will give you some opportunity to see how this all works.

Update: As mentioned by Peter in the comments, here’s the expression for the gradient of angle via partial derivatives (as computed by Mathematica). Hopefully by the time you’re done with your homework, you’ll realize there’s a better way!

Reading Assignment: Introduction to Curves & Surfaces (Due 10/24)

For your next reading assignment, you will read a few pages about curves and surfaces from the course notes: Chapter 2, pages 7–23. This material should be enough to get you started on the written/coding exercises NOW, rather than waiting until we are done with the full set of lectures. We will cover these topics in greater depth during lecture (especially the topic of curvature).

Assignment: Read the pages above, and write 2–3 sentences summarizing what you read, plus at least one question about something you didn’t understand, or some thought/idea that occurred to you while reading the article.

Handin instructions can be found in the “Readings” section of the Assignments page.  Note that you must send your summary in no later than 10am Eastern on the date of the next lecture (October 24, 2017).

Enjoy!

Assignment 2 (Coding): Investigating Curvature

For the coding portion of this assignment, you will implement various expressions for discrete curvatures and surfaces normals that you will derive in the written assignment. (However, the final expressions are given below in case you want to do the coding first.) Once implemented, you will be able to visualize these geometric quantities on a mesh. For simplicity, you may assume that the mesh has no boundary.

Getting Started

Please implement the following routines in core/geometry.js:

  1. angle
  2. dihedralAngle
  3. vertexNormalAngleWeighted
  4. vertexNormalSphereInscribed
  5. vertexNormalAreaWeighted
  6. vertexNormalGaussianCurvature
  7. vertexNormalMeanCurvature
  8. angleDefect
  9. totalAngleDefect
  10. scalarMeanCurvature
  11. circumcentricDualArea
  12. principalCurvatures

Notes 

1. The dihedral angle between the normals $N_{ijk}$ and $N_{ijl}$ of two adjacent faces $ijk$ and $jil$ (respectively) is given by

$\theta_{ij} := \mathrm{atan2}( \frac{e_{ij}}{|e_{ij}|} \cdot (N_{ijk} \times N_{jil}), N_{ijk} \cdot N_{jil} )$

where $e_{ij}$ is the vector from vertex $i$ to vertex $j$.

2. The formulas for the angle weighted normal, sphere inscribed normal, area weighted normal, discrete Gaussian curvature normal and discrete mean curvature normal at vertex $i$ are

$N_i^{\phi} := \sum_{ijk \in F} \phi_i^{jk} N_{ijk}$

$N_i^S := \sum_{ijk \in F} \frac{e_{ij} \times e_{ik}}{|e_{ij}|^2 |e_{ik}|^2}$

$N_i^A := \sum_{ijk \in F} A_{ijk} N_{ijk}$

$KN_i = \frac{1}{2}\sum_{ij \in E} \frac{\theta_{ij}}{|e_{ij}|}e_{ij}$

$HN_i = \frac{1}{2}\sum_{ij \in E} (cot(\alpha_k^{ij}) + cot(\beta_l^{ij}))e_{ij}$

where $\phi_i^{jk}$ is the interior angle between edges $e_{ij}$  and $e_{ik}$, and $A_{ijk}$ is the area of face $ijk$. Note that sums are taken only over elements (edges or faces) containing vertex \(i\). Normalize the final value of all your normal vectors before returning them.

3. The circumcentric dual area at vertex $i$ is given by

$A_i := \frac{1}{8}\sum_{ijk \in F} |e_{ik}|^2 cot(\alpha_j^{ki}) + |e_{ij}|^2 cot(\beta_k^{ij})$

4. The discrete scalar Gaussian curvature (also known as angle defect) and discrete scalar mean curvature at vertex $i$ are given by

$K_i := 2\pi – \sum_{ijk \in F} \phi_i^{jk}$

$H_i := \frac{1}{2}\sum_{ij \in E} \theta_{ij} |e_{ij}|$

Note that these quantities are discrete 2-forms, i.e., they represent the total Gaussian and mean curvature integrated over a neighborhood of a vertex. They can be converted to pointwise quantities (i.e., discrete 0-forms at vertices) by dividing them by the  circumcentric dual area of the vertex (i.e., by applying the discrete Hodge star).

5. You are required to derive expressions for the principal curvatures $\kappa_1$ and $\kappa_2$ in exercise 4 of the written assignment. Your implementation of principalCurvatures should return the (pointwise) minimum and maximum principal curvature values at a vertex (in that order).

Submission Instructions

Please rename your geometry.js file to geometry.txt and put it in a single zip file called solution.zip. This file and your solution to the written exercises should be submitted together in a single email to Geometry.Collective@gmail.com with the subject line DDG17A2.

Slides—Exterior Calculus in \(R^n\)

Later this week we’ll start talking about exterior calculus, which is a modern language used across differential geometry, mathematical physics, geometric computation… and the rest of our class! :-). Initially this language can look a bit daunting, but by making some connections with familiar ideas from vector calculus (like grad, div, and curl), we’ll see that it’s actually not so bad once you get down to concrete calculations. Slides here:

Assignment 1 (Coding): Discrete Exterior Calculus

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 “*” 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

  • Please clone this repository. It contains a fast and flexible framework for 3D geometry processing implemented in Javascript. Over the course of the semester, you will implement all of your coding assignments here. Please note: If you already cloned the repository during recitation, clone again!
  • 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\).

The discrete Hodge star and discrete exterior derivatives are introduced in Section 3.8 of the course notes; the matrix representation of these operators (which you need to implement!) will be discussed in class. They were also basically covered already in our discussion of signed incidence matrices, in the lecture on the simplicial complex.

Notes

  • This assignment comes with a viewer (projects/discrete-exterior-calculus/index.html) which lets you apply your operators on random k-forms and visualize the results.
  • This assignment also comes with a grading script (tests/discrete-exterior-calculus/test.html) which you can use to verify the correctness of your operators.
  • The code framework is implemented in Javascript, which means no compilation or installation is necessary on any platform. You can simply get started by opening the index.html file in projects/discrete-exterior-calculus/ in a web browser. We recommend using Chrome or Firefox. Safari has poor WebGL performance.
  • If you do not have prior experience with Javascript, do not worry! You should be able to get a handle on Javascript syntax by reading through some of the code in the framework (a good place to start might be core/geometry.js). The framework also contains extensive documentation (see docs/index.html) with examples on how to use the halfedge data structure and the linear algebra classes.
  • All browsers come with tools for debugging (for instance the JavaScript Console in Chrome).

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.

Grading

This assignment is worth 6.5% of your grade.

Slides—Exterior Algebra

Our next lecture will cover one of the basic tools we’ll use throughout the rest of the course: exterior algebra. The basic idea is to add a couple new operations to our usual list of vector operations (dot product, cross product, etc.) that make it easy to talk about volumes rather than just vectors. If you felt ok working with things like the cross product and the determinant in your linear algebra/vector calculus courses, this shouldn’t be too big of a leap. (If not, could be a good moment for a review!)

These slides should also be helpful for those who have started on the homework. 🙂

Exterior Algebra Slides

Assignment 1 (Written): A First Look at Exterior Algebra and Exterior Calculus

The written portion of your first assignment is now available (below), which covers some of the fundamental tools we’ll be using in our class. Initially this assignment may look a bit intimidating but keep in mind a few things:

  • The homework is not as long as it might seem: all the text in the big gray blocks contains supplementary, formal definitions that you do not need to know in order to complete the assignments.
  • Moreover, note that you are required to complete only three problems from each section.
  • If the \(\wedge\) and \(\star\) symbols look alien to you, don’t sweat: this is not something you should know already! We’ll be talking about these objects in our lectures next week. Until then, you can (and should) get a jump on the lectures by reading the first few sections of Chapter 3 in our course notes.

Finally, don’t be shy about asking us questions here in the comments, via email, or during office hours.  We want to help you succeed on this first assignment, so that you can enjoy all the adventures yet to come…

A1Written

Here is a zip file with the $\LaTeX$ source.

Reading Assignment: Overview of DDG (Due 9/7)

Your first reading assignment will be to read an overview article on Discrete Differential Geometry. Since we know we have a diverse mix of participants in the class, you have several options (pick one):

  1. (pages 1–3) Crane & Wardetzky, “A Glimpse into Discrete Differential Geometry”.
    This article discusses the “no free lunch” story about curvature we looked at in class, plus a broader overview of the field.
  2. (pages 1–5) Pottman et al, “Architectural Geometry”.  
    This article discusses the beautiful tale of how discrete differential geometry is linked to modern approaches to computational design for architecture, as well as fabrication and “rationalization” of free-form designs.
  3. (pages 5–9) Bobenko & Suris, “Discrete Differential Geometry: Consistency As Integrability”.  
    This article provides another overview of discrete differential geometry, with an emphasis on nets and their connection to the notion of integrability in geometry and physics.

Though written for a broad audience, be warned that all of these articles are somewhat advanced—the goal here is not to understand every little detail, but rather just get a high-level sense of what DDG is all about.

Assignment: Pick one of the readings above, and write 2–3 sentences summarizing what you read, plus at least one question about something you didn’t understand, or some thought/idea that occurred to you while reading the article.  For this first assignment, we are also very interested to know a little bit about YOU! E.g., why are you taking this course?  What’s your background?  What do you hope to get out of this course?  What are your biggest fears about the course?  Etc.

Handin instructions can be found in the “Readings” section of the Assignments page.  Note that you must send your summary in no later than 10am Eastern on the day of the next lecture (September 7, 2017).

Enjoy!

Linear Algebra and Vector Calculus Review

The prerequisites for 15-458/858B include courses or other past experience in linear algebra and vector calculus. However, we realize that for many of you it may have been a while since you studied this material. The worksheets below provide optional practice for those who wish to brush up on their skills. To emphasize again: this material is purely for your own review; it is not a required assignment, nor will it be graded. You may also wish to review this material from time to time during the semester (e.g., when we study exterior calculus).

[Linear Algebra Review]
[Vector Calculus Review]

Please email us if you’d like to see the solutions! (We keep these solutions private so they can be re-used for other classes in future years.)

Welcome to 15-458 / 15-858B! (Fall 2017)

Welcome to the website for 15-458/858B.  Here you’ll find course notes, lecture slides, and homework (see links on the right).

If you are a student in the class, register now by clicking here!

We strongly prefer that you register using your CMU email, but in any case you must not register with an address at a free email service like gmail.com, yahoo.com, etc., as email from these domains will be filtered out by the web host.

A few things to note:

  • You will be subscribed to receive email notification about new posts, comments, etc.
  • You can ask questions by leaving a comment on a post.  If you’re apprehensive about asking questions in public, feel free to register under a pseudonym.
  • Otherwise, please associate a picture to your profile by registering your email address at Gravatar.com—doing so will help us better recognize you in class!
  • You can include mathematical notation in your questions using standard $\LaTeX$ syntax.  For instance, when enclosed in a pair of dollar signs, an expression like dollar\int_M K dA = 2\pi\chidollar gets typeset as $\int_M K dA = 2\pi\chi$.
If you encounter any problems while trying to use the website, please contact the TAs (listed under the course description).