Shifting Lattices

A flowing lattice shown at every moment at once, each screen column shifted along the flow by an amount growing with x, so the picture is a spacetime slice of the flow.

A geodesic or horocyclic flow on a lattice is usually shown as an animation: one lattice, changing over time. This picture instead shows every moment of the flow at once.

Each point of the plane is given its own lattice, built by applying a distortion formula to a single flowing base lattice. With the default formula each screen column is shifted along the flow by an amount growing with horizontal position, so reading left to right is reading forward in time: a single static image becomes a spacetime slice of the whole flow, an animation frozen into one picture. Dots are drawn at self-consistent centres, points that sit exactly where the lattice field at their own position puts them, which keeps the picture stable however wild the distortion becomes. The shape of each dot can display the drawing distortion: dots are round exactly where the lattice family is integrable, and shear into ellipses where it is not. The Stamp slider grows each dot into a circular stamp of the lattice at its centre: the circle grows, the image zooms with it, and the lattice inside is scaled down, every lattice point whose centre falls in the circle drawn whole.

The distortion box takes any GLSL expression in the screen position x,yx, y, the time tt, the flowed base lattice LL, and the strength slider aa, with the flow matrices gFlow(d), hFlow(d), hFlowH(d) and rot(d) available. Apply it and the shader recompiles live; a broken formula keeps the old picture and shows the compiler’s complaint.

The same shader can be pinned to a different field per placement. Here the distortion is a rotation growing with distance from the centre, twisting the lattice into rings:

The same machinery draws pictures from the theory of integral affine manifolds, where a family of lattices lives over the plane, one in the tangent space of each point. Around a singular point the family can pick up a monodromy: after a loop the basis returns sheared by an integer matrix, but the lattice itself returns to itself. The renderer only sees lattices, never bases, so the dots close up seamlessly around the loop. Here the shear grows with the angle around the centre, one full unit per turn. It multiplies LL on the right, acting on the lattice’s own integer coordinates: an integer shear applied on the left would only preserve the square lattice, not this one.

At strength 11 the monodromy is the integer shear and the field is continuous everywhere except the singular point itself, where the dots fade out because no dot can sit consistently in a field varying that fast. Slide the strength to a non-integer value and a seam tears open along the branch cut: the picture of why monodromy must be integral.

There is a subtlety in drawing a lattice field as dots: the picture shows the lattice mixed with the field’s first differential. Each dot sits exactly on its own lattice, but the spacing to its neighbours feels the gradient of the field contracted with the dot’s integer label. That correction acts on the drawn cell as a full matrix: its trace changes the cell’s area, its traceless part shears the cell’s shape, and left alone it would make the cells shrink with direction even though every lattice in this family has the same covolume. The formula pre-multiplies the field by the latticeFix matrix, which cancels the area error exactly and takes back part of the shape error; a pure rescaling (areaFix) can pin the area alone, but its own angular gradient feeds the shape error instead. The construction is best understood as a quadrature rule: the dot chart should integrate the field’s coframe along rays, and the visualiser does this for every formula, drawing the inverse of the ray-averaged coframe by two-point Gauss quadrature. That renders any field whose coframe varies along rays first-order exactly (machine-exact through cubic coframes), pushing all error into higher differentials. Some error must always remain: corrections only redistribute a rigid residue set by the anholonomy of the family, because a family whose monodromy is smeared smoothly around the loop is not the lattice field of any single affine chart. Summing the angle functions of several centres gives several singular points whose monodromies compose; twenty-four of them draped over a sphere is the K3 surface.

A compact example of a degenerating family is the moment triangle of the complex projective plane. Its Fubini-Study metric gives each point of the triangle a lattice, hexagonal at the barycenter and collapsing a different subtorus direction at each of the three edges, drawn here by the helper cp2Lattice with the view cropped inside the triangle, so the degenerations run along the borders of the picture (lower the strength to see the whole triangle):