As we saw in the lecture, we can parametrize the moduli space of discrete closed plane curves by angles and edge lengths, which encode how the tangent is moving along the curve. More explicit: up to rigid motion each discrete curve with \(n\) vertices and tangent winding number \(m\) is represented by a point in a submanifold \(\mathcal{M}_0\) of \((-\pi,\pi)^{n}\times (0,\infty)^{n}\), which is given by the zero set of the map \[ F:(-\pi,\pi)^{n}\times (0,\infty)^{n} \to \mathbb{R}^3 = \mathbb{R}\times \mathbb{C}\\\\ F(\ell,\kappa)=\left(\begin{array}{c} \kappa_1+\ldots +\kappa_n -2 \pi m \\ \ell_1 e^{i\alpha_1}+\ldots +\ell_{n}\, e^{i\alpha_{n}}\end{array}\right),\] where \[\alpha_j= \kappa_1+\ldots+\kappa_j.\]

In general, each function defined on \(\mathcal{M}\) splits the space into components. E.g. think of a height function of an embedded surface.

If the map is ‘nice’ enough, i.e. in our case smooth and of constant rank, then the level sets are submanifold. Moreover \(\mathcal{M}_0\) is the intersection of the submanifolds \(\mathcal{M}_1\) and \(\mathcal{M}_2\), which are given as zeros sets of the functions\[F_1(\ell,\kappa)=\kappa_1+\ldots +\kappa_n -2 \pi m, \quad F_2(\ell,\kappa)=\ell_1 e^{i\alpha_1}+\ldots +\ell_{n}\, e^{i\alpha_{n}}.\]

Now, we have given \(\mathcal{M}_0\) which parameterizes discrete closed plane curves. But what does the ambient space correspond to?

It is important to note that a closed curve is in fact rather a periodic sequence of points than just \(n\) points. With this in mind, let us assign to each point in \((-\pi,\pi)^{n}\times (0,\infty)^{n}\) periodic sequences, denoted again by \(\kappa\) and \(\ell\), to which corresponds a discrete curve \(\gamma \colon \mathbb{Z}\to \mathbb{C}\). The curve \(\gamma\) is obtain by ‘integration’, i.e. e.g. for positive \(k\) we have\[\gamma_{k+1}=\sum_{j=1}^k \ell_j e^{i\alpha_j}.\]

Now we can directly look at the effect of dropping conditions: Let us start outgoing from the case that \(\kappa,\ell\) lies on \(\mathcal{M}_0\), i.e. we have a discrete closed plane curve as shown below.

If we drop the second condition we just stay on \(\mathcal{M}_1\), i.e. the curves do not have to close up but the tangent winding number is still restricted to \(2\pi m\), such curves are know as *curves with translational period*. Examples are shown below.

These curves can also regarded as closed curves on a cylider.

Our task is now to navigate on the submanifold \(\mathcal{M_0}\), i.e. given a vector field \(X\) on \(\mathcal{M_0}\) and a point \(p \in\mathcal{M_0}\), then move along the integral curve of \(X\) starting at \(p\).

In our setup we are surrounded by a Euclidean space that means that tangent vector fields are just maps into \(\mathbb{R}^{2n}\). First, let us ignore all conditions for a moment. Then we can just use the Euler method to follow the vector field, i.e. we just go a bit in the direction of the vector field: If at time \(t\) we are at the position \(p(t)\), then \[ p(t+\varepsilon)= p(t)+\varepsilon X(p(t)),\] is the position at time \(t+\varepsilon\). Since this shall correspond to a discrete curve that was obtained by regular homotopy we have to ensure that we don’t leave the open subset \((-\pi,\pi)^{n}\times (0,\infty)^{n}\). But that’s easy.

It is also easy to stay in \(\mathcal{M}_1\) as it consists of open subsets of affine vector spaces, i.e. all one has to do is to project the given vector field \(X\) to the tangent space of \(\mathcal{M}_1\). If \(X^\top\) denotes the projection, the corresponding line \(p+\operatorname{span}\{X^\top(p)\}\) is then already contained in the affine vector space. Again all we have to ensure is that the point does not leave an open set.

The situation changes if we start at a closed curve \(p(t)\) and want to stay closed. First, the vector field then has to be tangential to \(\mathcal{M}_0\), i.e. we have to eliminate the normal components. Second, even if the field is tangential, we will leave \(\mathcal{M_0}\) Immediately if we move along a line. Our strategy will be to fix this by projecting back to \(\mathcal{M_0}\) after each Euler step.

Let us focus on the situation that all lengths shall stay fixed during the flow as it was presented in the lecture, i.e. all components of the vector field that correspond to lengths are just zero:\[X(p)=(X_1(p),\dots,X_{n}(p),0,\dots,0).\]

The normal space to \(\mathcal{M}_0\) at a point \(p=(\kappa_1,…,\kappa_{n},\ell_0,…,\ell_{n}) \in \mathcal{M}_0\) was spanned by \[V_0=(1,\dots,1,0,\dots,0)\] and the vertex coordinates of a curve \(\gamma\) corresponding to the point \(p\) \[ V_1=(x_1,\dots,x_j,0,\dots,0),\\ V_2=(y_1,\dots,y_j,0,\dots,0),\] where the \(x_j\) and \(y_j\) denotes the real and imaginary part of \(\gamma_j\) resp., i.e. \(\gamma_j=x_j+iy_j\).

We apply the Gram-Schmidt process starting with \(V_0\) and obtain an orthonormal basis \(N_0,N_1,N_2\) of the normal space of \(\mathcal{M}_0\). The projection of \(X\) on its tangential part \(X^T\) then takes the simple form\[X^\top=X-\sum_{j=0}^2\langle X,N_j\rangle N_j.\]

We perform the Euler step with respect to the field \(X^\top\) and obtain a new point \(\tilde p=(\tilde\kappa,\ell)\) which a priori not yields a closed curve. Now we have to get back to \(\mathcal{M}_0\), i.e. we have to change the \(\tilde\kappa\) slightly so that \(F(\tilde\kappa,\ell)=0\). Hence we have to search for a zero of a non-linear function in an \(n\)-dimensional space, which in general is slow and the speed moreover depends on the number of vertices.

We reduce this problem, as proposed, to a \(2\)-dimensional one by projecting \(\tilde p\) back along the normal space at the previous point \(p\):\[f(\lambda_1,\lambda_2)=F(\tilde\kappa+\lambda_1N_1+\lambda_2 N_2,\ell)=0.\]

This we solve by applying the Newton method and obtain a new closed curve.

**Homework (**due date 6 June**): **Your task is to implement the gradient flow of the bending energy on closed curves. In the repository you find under de.jtem.discreteCurves.tutorial a class called GradientFlowPlugin which provides a basic environment to start with. It shows the gradient flow of the bending energy\[E(\kappa,\ell)= \tfrac{1}{2}\sum_{j=1}^{n} \kappa_j^2.\] without any constraints, i.e. closed curves immediately open up and are deformed into straight lines.

Copy the GradientFlowPlugin into your project.

Your task is now to modify the flow so that closed curves stay closed, i.e. you have the following things to do:

- Project the gradient of the bending energy to the tangent space of \(\mathcal{M}_0\) to obtain a vector field \(X\) which is tangential.
- Implement the projection back to \(\mathcal{M}_0\) after the Euler step.

The Euler step just stays as it is. For the second item you can use the Newton method that is implemented in the jtem project numericalMethods (explicitly in de.jtem.numericalMethods.calculus.rootFinding).

Hint: Even if it is not an example for the usage of the Newton-class it may be helpful to look into ExampleNewtonRaphson, which you find at the same place.