Surfaces that are not flat

Six flat pictures of everything

There is one way to photograph the whole sphere and keep every straight line straight, and it is to stop using one surface. Six flat pictures at ninety degrees cover everything, each of them a perfect pinhole, and the price is paid entirely at the seams — where a straight line does not bend but kinks, by an angle that reaches 45 degrees and is exactly zero for the lines lying in the seam's own plane.

Worth reading first: When the picture surface is not flat · Every fisheye is a different rule.

Every surface in this site’s curved field is one surface, and every one of them bends some straight line — by Beltrami’s theorem, which says the only maps of the sphere sending great circles to straight lines are the gnomonic ones, and the gnomonic map is the flat picture plane, which cannot reach 180°.

There is a way around that, and it is a cheat in the exact sense that it changes the question. Stop insisting on one surface. Six flat pictures, each covering 90° and facing a different way, cover the whole sphere between them, and each of them is a perfect pinhole picture with every straight line straight.

The theorem is not violated. It is sidestepped, and the price is paid somewhere specific.

Six flat pictures, and what happens where two of them meetEach face is a flat picture at 90°, so a straight line inside one is drawn exactly straight — 1e-15 of its chord. Across a seam the two straight pieces meet at 1.80°. The shading is the area scale, which runs from 1 at a face's centre to 5.196 at its corner, with an anisotropy of 1.7321 there.leftfrontrightbackupdownacross the left/front seam: 1.80°, with each side straight to 7e-16corner area ×5.196anisotropy √3 = 1.7321 there
Fig. 1 The six faces laid out in the usual cross, with one straight world line drawn across them and the area scale shaded. Inside a face the line is exactly straight; across a seam it kinks. The shading runs from one at a face’s centre to 5.196 at its corner.

What the surface is

Each face is the plane z=1z = 1 in a rotated frame: the direction with the largest absolute component picks the face, and the other two components divided by it give the position on it. That is x/zx/z and y/zy/z — a pinhole, exactly, with a 90° field in each axis and about 127° across the diagonal.

Laid out as a picture the six faces make a cross four faces wide and three tall, with the four side faces in a row and the top and bottom above and below the front. That layout is a choice and it has one property that has to be got right: the faces that are adjacent in the net must be adjacent on the cube, with matching orientation, or the seams do not join.

Getting that wrong is instructive because nothing complains. A net whose top face is reflected still draws all six faces, in the right places, with the right shapes, and the picture looks like a cube net. Every gate this fleet has passes it — the drawing fits its viewBox, fills its canvas, contrasts, renders. What notices is asking whether the two faces agree along the edge they share, and a net with a reflected top leaves that seam open by a whole face width.

Straight, and then not

The straightness claim is exact and it has a scale attached, which no other surface in the family does.

A great circle whose image stays inside one face is drawn perfectly straight: the measurement over a small arc returns 1e-15 of the chord, which is the arithmetic floor. That is not “nearly straight” — a face is a plane and a plane is gnomonic.

A great circle crossing a seam is drawn as two exactly straight pieces meeting at an angle. Each side’s own bend is under 10−1510^{-15}; the angle between them, for a line crossing the left/up seam, is 45.36°.

That is a different failure from every other surface’s. A cylinder or a fisheye bends a line — the image is a smooth curve with a measurable departure from its own chord. A cube map does not bend anything. It kinks, and the two are told apart by fitting a line to each side and taking the angle between them rather than by measuring distance from a chord, which reports a large number for both.

Why bending and kinking need different measurements

The site’s straightness measure is the maximum distance of the sampled image from the chord joining its ends, divided by the chord’s length. It is the right measure for a smooth surface and it cannot tell these two failures apart.

A cylinder’s image of a straight line departs from its chord smoothly, reaching a maximum in the middle; a cube map’s departs from its chord because the two halves head off in different directions. Both produce a large number and the number means two different things.

So the kink needs its own measurement, and it is: split the samples by which face they landed on, fit a line to each group, report the angle between the two directions and each group’s own bend against its own chord. The second half is what makes the first meaningful. A kink of 45° with each side bending by 3% would be a surface doing both; a kink of 45° with each side bending by 10−1510^{-15} is a surface that is exactly two planes.

That is the same discipline the field applies everywhere: a claim about what a surface preserves is worth nothing without the quantity it does not preserve measured beside it, and a claim about how it fails is worth nothing without the alternative failure ruled out.

The seam that does not kink

There is a control, and it is not a formality — it is what stops the kink from being a fact about the probe.

A line lying in a seam’s own plane crosses it without kinking at all. The horizon crosses the left/front seam and is drawn as one straight line across both faces, at exactly 0°, because those two faces meet along a line the horizon lies in and the two half-images are collinear.

So the kink is a property of the pair — this line, that seam — rather than of the seam. Every seam is invisible to some lines and violent to others, and the whole family of lines that cross a given seam smoothly is a one-parameter family, the same shape of object as a curved surface’s straight family.

A scale below which everything is straight

The consequence of straightness holding inside a face and failing across a seam is that the cube map’s straightness depends on how long a line is drawn, and no other surface in this family has that property.

Sampling directions over the sphere and asking what fraction of great circles are drawn exactly straight over an arc of a given length gives a curve: 95.8% at a 5° arc, falling through 88.9% at 18°, 81.9% at 27°, 65.3% at 36°, and reaching 2.8% at 50°.

At the short end almost everything is straight, because a short arc rarely crosses a seam. At the long end almost nothing is, because a 50° arc crosses a seam from almost anywhere.

Every other surface here gives the same answer at every length. A cylinder bends a short line a little and a long line a lot, in proportion; the fraction of lines it draws straight is the same one-parameter family whatever arc is asked about. The cube map has a scale, and the scale is the face.

What the corners cost

A face is a flat picture with a 90° field, so it has a flat picture’s edge behaviour, and the numbers are the pinhole’s own.

At angle θ\theta off a face’s normal the Jacobian’s singular values are sec⁡2θ\sec^2\theta radially and sec⁡θ\sec\theta tangentially, so the area scale is sec⁡3θ\sec^3\theta and the anisotropy is sec⁡θ\sec\theta. A face’s corner is at the cube’s body diagonal, which makes an angle of arccos⁡(1/3)=54.7356°\arccos(1/\sqrt3) = 54.7356° with each face normal.

So the area scale at a corner is

sec⁡3(54.7356°)=33=5.196\sec^3(54.7356°) = 3\sqrt3 = 5.196

and the anisotropy there is sec⁡(54.7356°)=3=1.7321\sec(54.7356°) = \sqrt3 = 1.7321.

Those numbers are the whole cost of the surface, and they are modest. A little planet’s area scale runs over a factor of 255 across a 160° field; a cube map’s runs over 5.196 across everything. That is why the format is used for storing panoramas: it wastes less than a factor of six of its resolution anywhere on the sphere, and no continuous surface covering everything comes close.

The cost is a property of the solid, not of the cube

The 5.196 is derived above from the cube’s own geometry, and the derivation generalises in one step — which is worth taking, because it says whether the cube is the right choice or merely the obvious one.

Any convex polyhedron gives a panorama format the same way: project the sphere onto its faces from the centre, and each face is a gnomonic picture with every straight line straight inside it. The worst area scale on a face is sec⁡3θmax⁡\sec^{3}\theta_{\max}, where θmax⁡\theta_{\max} is the angle from the face’s normal to its furthest corner — and cos⁡θmax⁡\cos\theta_{\max} is exactly the inradius over the circumradius. So

worst area scale  =  (Rr)3,worst anisotropy  =  Rr.\text{worst area scale} \;=\; \left(\frac{R}{r}\right)^{3}, \qquad \text{worst anisotropy} \;=\; \frac{R}{r}.

One ratio, cubed, and it is tabulated for every regular solid:

solid faces R/rR/r worst area scale
tetrahedron 4 3.000 27.00
cube 6 1.7321 5.196
octahedron 8 1.7321 5.196
dodecahedron 12 1.2585 1.993
icosahedron 20 1.2585 1.993

Three things fall out of the table and none of them is what a reader would guess from the cube’s reputation.

Dual solids are tied, because R/rR/r is a self-dual quantity — the cube and the octahedron cost exactly the same, and so do the dodecahedron and the icosahedron, despite having eight and twelve faces against six and twenty. Faces are not the currency.

The cube is not the best. A dodecahedral panorama wastes a factor of 1.99 where a cube map wastes 5.20, which is a 2.6-fold improvement in worst-case resolution for the same total pixels — a large margin by the standards of what any single surface can keep, where the whole field is fighting over factors of two.

And the cube is chosen anyway, for reasons outside the geometry. Its faces are squares, so they tile a rectangular buffer with no waste; its face normals are the coordinate axes, so choosing a face is a comparison of three absolute values with no trigonometry; and its seams meet at right angles, so filtering across one is an ordinary two-dimensional operation. A dodecahedron’s pentagons pack a rectangle badly enough to give back most of the 2.6, and selecting a face means twelve dot products. The format is a compromise between the geometry and the memory, and the geometry is the half that loses.

That is the same trade an equirectangular file makes and loses much more badly, and it is why the comparison usually stops at those two: an equirectangular panorama’s area scale is unbounded at the poles, a cube’s is 5.196 everywhere, and the solid that would do better cannot be addressed with three comparisons. What the third column is area measures across the whole family is the same quantity this table computes for six special cases.

The number is the isometric drawing’s number

3=1.7321\sqrt3 = 1.7321 has appeared on this site before, in a field that has nothing to do with panoramas, and the coincidence is not one.

A ruler on an isometric drawing is wrong by up to a factor of 1.7321, because the anisotropy of every isometric coordinate plane is 3\sqrt3. Isometric projection looks at a cube down its body diagonal; a cube map’s corner is the direction of that same body diagonal, seen from inside.

Both numbers are sec⁡\sec of the same angle, arccos⁡(1/3)\arccos(1/\sqrt3), because both are asking how oblique a face is to the direction (1,1,1)(1,1,1). One is a drawing office’s scale error and the other is a texture format’s worst pixel, and the geometry underneath is a single arccosine.

The image of a circle in the xy plane, in 4 systemscavalier draws this plane isotropically — the circle stays a circle at 1.0000, so a length in it can be taken off the paper with a ruler whichever way it runs. The others draw it as an ellipse, and the ratio printed under each is the factor a ruler is wrong by between the best direction and the worst.isometric0.57741 : 1.732dimetric0.88191 : 1.134cavalier1.0000a circlemilitary0.57741 : 1.732the xy plane's drawn ellipseratio of the ellipse's axes, sampled
Fig. 2 Where the number comes from in the other field. A unit circle in a coordinate plane, drawn in four parallel systems; isometric’s ellipse has ratio 0.5774, and its reciprocal is 1.7321.

Where the format is honest and where it is not

Two things follow for anybody choosing this surface, and both are consequences rather than advice.

It is the right choice when lines matter and continuity does not. A rendering of an architectural interior stored as a cube map has every edge of every wall drawn straight in whichever face it falls, which no single curved surface can offer at any field of view. What it does not have is a picture: the six faces are six pictures, and reading them as one requires knowing the layout.

It is the wrong choice when a line has to be followed. Any operation that traces a curve across the sphere — fitting a straight edge, measuring an angle across a wide field, following a horizon — meets the seams, and the kink is a discontinuity in the derivative rather than in position. A fitting routine handed cube-map coordinates will fit two lines where there is one, and it will do so with small residuals on each, which is the failure that looks like success.

One room at 130° across, cast onto six picture surfacesEach panel holds the same angular width of the same scene. The flat plane keeps every straight line straight and pays for it at the edges; the five curved surfaces bend the ground lines by 3.5% to 6.0% of their own length.plane — bend 0.0%cylinder — bend 6.0%stereographic — bend 3.5%equidistant — bend 4.5%equal-area — bend 5.1%equirect. — bend 5.7%130° across in every panelsame scene, same angle, six surfaces
Fig. 3 The continuous six, for comparison. Each is one picture and each bends something; the cube map is six pictures and bends nothing, and the comparison is between two different kinds of answer rather than between seven surfaces.
Straight, or conformal — the corner that is emptySix picture surfaces plotted by how much they bend a straight line (across) against how far they are from preserving shape (up). The plane sits on the left edge and the top; stereographic on the bottom and the right. Nothing sits in the bottom-left corner, and by Beltrami's theorem nothing can.straight AND conformal — empty10⁻⁷10⁻⁶10⁻⁵10⁻⁴10⁻³10⁻²10⁻¹10⁰10⁻⁷10⁻⁶10⁻⁵10⁻⁴10⁻³10⁻²10⁻¹10⁰10¹10²bend of a straight line, as a fraction of its own chorddeparture from conformal (degrees, or % of anisotropy)planecylinderstereographicequidistantequal-areaequirect.sampled over a 130° fanlower left would be a surface with no cost
Fig. 4 The trade the continuous surfaces are subject to. A cube map sidesteps it by not being one surface, which is why it does not appear on this plot — a face would sit exactly where the plane does.

What a seam does to a measurement

The kink has a consequence for anything that measures rather than looks, and it is worth stating in the form a reader of this site will recognise.

Every recovery this site builds reads geometry off a picture: a vanishing point from two drawn edges, a focal length from three, a homography from four correspondences, a lamp’s position from three shadow lines. Each of those routines assumes that a straight world line is a straight image line, and on a cube map that assumption is true inside a face and false across a seam.

A vanishing point fitted from edges that cross a seam is fitted from two half-lines pointing in different directions, and the fit will return a point — with a residual small enough to look like noise, because each half is straight. Nothing in the routine can notice, because the routine’s own test is whether the lines are straight and they are.

The repair is not subtle: do the geometry per face. A cube map’s faces are pinholes, so every construction in this site’s foundations and metrology fields works on one unchanged, and none of them works across two. That is the same conclusion the vault essay reaches for a curved receiving surface, arriving here in its piecewise form: the projective machinery is available exactly where the surface is a plane, and a cube map is a surface that is a plane six times.

Six is not the only number

The construction generalises and the generalisation says what is actually being traded.

Any polyhedron whose faces are tangent to the sphere gives a piecewise-gnomonic map. More faces means each face covers less of the sphere, so the worst obliquity within a face falls and the area scale’s range falls with it — and there are more seams. Fewer faces means the opposite. A tetrahedron would be four faces with an area range of sec⁡3\sec^3 of a much larger angle; a many-faced polyhedron approaches a smooth surface with a very small area range and seams everywhere.

So the cube is a choice on a scale running from one flat picture, which has no seams and cannot cover the sphere, toward a smooth surface, which covers everything and bends every line. Six faces at 90° is a point on that scale and there is nothing distinguished about it geometrically; what distinguishes it is that a cube’s faces are square, its net is rectangular, and its axes are the coordinate axes.

How wide the picture gets as the field of view opensOn a flat plane the picture's half-width is tan(θ/2): it multiplies by 6.6 between 120° and 170° and is unbounded at 180°. On a cylinder it multiplies by 1.42 over the same range and keeps going past 180° without incident.0246850100150field of view across the picture (degrees)half-width of the picture, in focal lengthsplanecylinderstereographicequidistantcut off at eight focal lengthsthe plane crosses it at 166°
Fig. 5 The problem the whole family exists to solve, and the reason a single flat picture is not an option. Its half-width multiplies by more than four between 120° and 170°, and it is unbounded at 180°.
The lines each surface leaves aloneA curved picture surface does not bend everything. Each panel draws the family of world lines the surface images as straight lines: two-dimensional for the plane, and a one-parameter family for every other surface here — running through the picture's centre on an azimuthal surface, and parallel on a cylindrical one.planeevery line—cylinderone parameter · parallelno meeting pointstereographicone parameter · concurrentthey meet to 1e-12equirect.one parameter · parallelno meeting point3 of 4 keep a curvethe signature has three values, not eight
Fig. 6 The families of lines the continuous surfaces draw straight — one parameter each, against a cube map’s two-parameter family inside every face and nothing across a seam.

The pixels the corners waste

One more reading of the 333\sqrt3, because it is the number the format is actually chosen on.

A cube map stores each face as a square array of samples. A sample near a face’s centre covers a solid angle proportional to one; a sample near a corner covers sec⁡3\sec^3 of the corner angle less of the sphere, which is 1/5.1961/5.196 of it. So the surface spends 5.196 times as many samples per unit solid angle at a corner as at a face centre.

That is the waste, and it is small. An equirectangular picture spends sec⁡ϕ\sec\phi times as many samples per solid angle at elevation ϕ\phi, which is unbounded at the poles — the top row of an equirectangular panorama is a single point stored across the whole width of the image. A cube map’s worst case is 5.196 and it is reached only at eight points.

The comparison is the whole practical argument for the format, and it is a statement about area scale rather than about straightness. A surface’s sample efficiency is the reciprocal of its area-scale range, and the cube map’s is the best of anything covering the whole sphere with flat pieces.

Area scale across the picture, for six surfacesThe flat plane's area scale is sec³θ and leaves the frame before 70°. The equal-area fisheye is the flat line at 1, which is what its name asserts and what this measures.024680204060angle off the optical axis (degrees)area scale, relative to the centreplanecylinderstereographicequidistantequal-areaequirect.measured by differencing on the spherethe plane leaves the frame
Fig. 7 The area scale across the field for the continuous surfaces. The equal-area fisheye’s is flat by construction and every other one climbs; a cube map’s would be six copies of the flat plane’s first 55°, which is where the modest 5.196 comes from.

The short version

Six flat pictures at 90° cover the whole sphere and draw every straight line exactly straight — inside a face. Across a seam a line does not bend; it kinks, by up to 45.36°, with each piece straight to the arithmetic floor, and by exactly 0° for a line lying in the seam’s own plane.

That gives the surface a property no continuous one has: a scale below which everything is straight. At a 5° arc, 95.8% of world lines are drawn exactly straight; at 50°, 2.8%.

The cost is the pinhole’s own, at the cube’s body diagonal: an area scale of 33=5.1963\sqrt3 = 5.196 and an anisotropy of 3=1.7321\sqrt3 = 1.7321 at a corner — the same 1.7321 that makes a ruler wrong on an isometric drawing, for the same reason and from the same arccosine.

What links here

Computed from the collection, not written here: the essays that point at this one.

Reads more easily once this is understood

Essays that name this one as worth reading first.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

AnisotropyArea scaleBeltramiCube mapDemonstrationfield of viewGnomonicIsometricPanoramaPicture surfaceRectilinear projectionSampling gridSeamSpherical panoramaStraight family