Cross Field Theory

Functional Representations & Smooth Frame Fields in 2D

Based on Ray et al. — On Smooth Frame Field Design

Outline

  1. What is a frame / cross field?
  2. Functional representation — from angles to Fourier coefficients
  3. Smoothness energy — why \(\|a^j - a^i\|^2\) beats \((\Delta\theta)^2\)
  4. Constraints — feasibility & boundary alignment
  5. Toy example — energy landscapes & local minima
  6. Implementation — linear system + projection + smoothing
  7. The parallelogram trap — why boundary constraints matter
  8. Interactive sandboxes — chain & grid with lock/drag

What is a Frame?

A frame (cross) is a set of 4 unit vectors with \(\pi/2\) rotational symmetry:

\[f_i = \bigl(\cos(\theta + i\pi/2),\; \sin(\theta + i\pi/2)\bigr), \quad i \in \{0,1,2,3\}\]

A frame field assigns one frame per vertex of a triangle mesh.

Goal: find a smooth frame field aligned with the domain boundary.

Figure 1

Key Definitions

Term Definition
Frame 4 unit vectors invariant under \(\pi/2\) rotation, parameterized by angle \(\theta\)
Frame field One frame per mesh vertex
Boundary constraint Boundary frames must align one vector with the boundary normal
Rotation angle \(\Delta\theta \pmod{\pi/2}\) between adjacent frames (minimum absolute value)
Field curvature \(\displaystyle\sum_{\text{edges}} (\Delta\theta_{ij})^2\)
Singular triangle Sum of rotation angles around triangle \(\neq 0\)

From Angles to Functions

Key insight: represent frames by functions, not angles.

Reference frame \(\tilde{f}\) (aligned with axes) \(\;\longrightarrow\;\) function \(\tilde{F}(\alpha) = \cos(4\alpha)\)

Any rotated frame: \(F(\alpha) = \cos\bigl(4(\alpha - \theta)\bigr)\)

Fourier decomposition via angle addition:

\[F(\alpha) = \underbrace{\cos(4\theta)}_{a_0} \cos(4\alpha) + \underbrace{\sin(4\theta)}_{a_1} \sin(4\alpha) = B(\alpha) \cdot a\]

A frame is fully described by a 2D coefficient vector:

\[a = \begin{pmatrix} \cos 4\theta \\ \sin 4\theta \end{pmatrix} \quad\text{on the unit circle } (a^\top a = 1)\]

Why frequency 4? Frame has 4-fold symmetry (\(\pi/2\) periodicity).

Three Views of a Frame

Figure 2

Polar “Clover” Visualization

The frame function plotted in polar coordinates: \(r(\alpha) = 1 + F(\alpha)\)

Lobes point where frame vectors point — rotating \(\theta\) rotates the whole clover.

Figure 3

Smoothness Energy

Difference between frames in function space:

\[E = \sum_{\text{edges}} \int_0^{2\pi} \bigl(F^j(\alpha) - F^i(\alpha)\bigr)^2 \, d\alpha\]

Since the Fourier basis is orthogonal (\(\int B^\top B\,d\alpha = \pi I\)):

\[\boxed{E = \pi \sum_{\text{edges}} \|a^j - a^i\|^2}\]

Tip

The smoothness energy is just Euclidean distance in coefficient space!

Arc vs. Chord: Why This is Better

(a)
(b)
Figure 4

Small rotations: arc \(\approx\) chord. Large rotations: chord is shorter \(\Rightarrow\) \(E\) is smoother near singularities.

Constraints

Feasibility

Each coefficient vector must be a valid frame:

\[a^\top a = 1 \quad \text{(unit circle)}\]

Boundary Alignment

Frames at boundary vertices align with the normal \(\theta^n\):

Eq. 2 (two equations — correct for init):

\[a_0 = \cos 4\theta^n, \quad a_1 = \sin 4\theta^n\]

Eq. 3 (one equation — sufficient with feasibility):

\[a_0 \cos 4\theta^n + a_1 \sin 4\theta^n = 1\]

Figure 5

Toy Example: 4-Vertex Chain

Two endpoints locked, two interior frames free. Drag to interpolate:

(a)
(b)
(c)
(d)
Figure 6

Energy Landscape

Both energies share the same minima, but the functional energy \(E\) is smooth (no creases).

(a)
(b)
Figure 7

Implementation: Relax, Solve, Project

Step 1 — Initialization (relax feasibility):

Minimize \(\|AX - b\|^2\) where:

  • Smoothness rows: \(\sqrt{\pi}(X_{2i} - X_{2j}) = 0\) per edge
  • Boundary rows: \(\lambda X_{2i} = \lambda \cos 4\theta^n\) per boundary vertex

Solve \(A^\top A X = A^\top b\) (linear least-squares)

Step 2 — Project onto feasibility:

\[a^i \leftarrow \frac{(X_{2i}, X_{2i+1})^\top}{\|(X_{2i}, X_{2i+1})\|}\]

Step 3 — Smooth (iterate):

Add feasibility penalty rows: \(\lambda(\tilde{a}_0 X_{2i} + \tilde{a}_1 X_{2i+1}) = \lambda\)

Re-solve and re-project each iteration.

(a)
(b)
(c)
Figure 8

The Parallelogram Trap

Eq. 3 (single constraint) fails during initialization on non-rectangular domains — it constrains each boundary vertex to a line, not a point. The optimizer slides along that line.

Fix: use Eq. 2 (both components) during initialization.

(a)
(b)
(c)
Figure 9

Sandbox: Variable-Length Chain

Click any frame to lock/unlock. Drag a locked frame to rotate it — the solver re-runs live.

(a)
(b)
(c)
Figure 10

Sandbox: Rectangle Grid

Same interaction on a 2D grid. Boundary frames start locked to outward normals.

(a)
(b)
(c)
(d)
Figure 11

Summary

Concept Angle approach Functional approach
Frame Angle \(\theta\) \(a = (\cos 4\theta, \sin 4\theta)^\top\)
Feasibility Always feasible \(a^\top a = 1\)
Energy \(\sum (\Delta\theta)^2\) — piecewise quadratic \(\pi\sum\|a^j - a^i\|^2\) — quadratic
Boundary \(\theta = \theta^n\) \(a = (\cos 4\theta^n, \sin 4\theta^n)^\top\)
Optimization Nonlinear (angle wrapping) Linear system + projection

Key takeaway

The functional approach converts a nonlinear optimization over angles into a sequence of linear least-squares problems followed by projection onto the unit circle.

References

  • N. Ray, B. Vallet, L. Alonso, B. Levy. N-Symmetry Direction Field Design. ACM TOG 27(2), 2008.
  • D. Panozzo, E. Puppo, M. Tarini, O. Sorkine-Hornung. Frame Fields: Anisotropic and Non-Orthogonal Cross Fields. ACM TOG, 2014.
  • M. Kowalski, F. Ledoux, P. Frey. A PDE Based Approach to Multi-Domain Partitioning and Quadrilateral Meshing. IMR, 2012.
  • N. Ray, B. Vallet, W. Li, B. Levy. N-Symmetry Direction Field Design. ACM Trans. Graphics, 2008.

Thank you!

All visualizations are interactive — drag the sliders to explore.

Built with Quarto + Observable JS + D3.js