Surfaces that are not flat

The horizon's shape belongs to the surface

The horizon is one great circle of directions whatever draws it, and at zero tilt all six named surfaces draw it straight. Tilt the camera and they separate — and the cylinder, not the equirectangular surface, is the one whose horizon is exactly a cosine, to 9e-16 against 8.3e-3.

Worth reading first: When the picture surface is not flat · The cylinder, and the price of going all the way round · The horizon is at eye level — if the picture plane is vertical.

The horizon of a level ground is not a line. It is a great circle of directions — the set of rays parallel to the ground, which is a circle on the sphere of directions and is the same circle whatever anybody draws it on.

Everything about its drawn shape is therefore a fact about the surface rather than about the world. The horizon at eye level already carries the qualification in its title: the statement is conditional on a vertical picture plane, and this essay is what happens when the surface stops being a plane at all.

And the folklore has the two most-cited cases the wrong way round. The surface whose horizon is exactly a cosine is the cylinder; the surface every account calls a sinusoid, the equirectangular one, is not.

One great circle, six drawn shapes, at 0° of tiltThe horizon of a level ground, which is one great circle of directions whatever surface it is drawn on, cast onto six picture surfaces from a camera tilted 0° up. At zero tilt every one of the six draws it as a straight line, to 0e+0 of the chord or better, because the horizon then passes through the optical axis and every surface here draws that line straight. Nothing distinguishes the six here, and that is the point of the frame: the shapes below are what tilting produces, not what the surfaces are. Move the tilt off zero and they separate at once.plane — line, 0e+0cylinder — line, 0e+0stereographic — line, 0e+0equidistant — line, 0e+0equal-area — line, 0e+0equirect. — line, 0e+0tilted 0°, sampled over 140° of azimuththe horizon swings ±0°
Fig. 1 The starting point, and it is a negative. With the camera level, every one of the six surfaces draws the horizon as a straight line, to the arithmetic floor — because the horizon then runs through the optical axis, and every surface here draws that one line straight. Nothing distinguishes them at all. Whatever the surfaces do to a horizon is something tilting produces, not something they are.

That figure is the control, and putting it first is deliberate. A reader shown six differently-curved horizons might reasonably conclude that a curved surface bends a horizon, full stop. It does not: at zero tilt there is nothing to see, and an essay that opened on the tilted case would be presenting a conditional result as an unconditional one.

Tilt, and the six separate at once

One great circle, six drawn shapes, at 10° of tiltThe horizon of a level ground, which is one great circle of directions whatever surface it is drawn on, cast onto six picture surfaces from a camera tilted 10° up. At zero tilt all six draw it straight, because the horizon then passes through the optical axis and every surface here draws that line straight; away from zero they separate. The flat plane keeps it straight at every tilt. The cylinder gives a cosine of amplitude 0.1763 with nothing left over — 6e-17 of the chord. Stereographic gives a circle to 6e-16. The equirectangular surface, the one every account calls a sinusoid, misses one by 1.3e-4, which is small and is not zero.plane — line, 5e-18cylinder — sinusoid, 6e-17stereographic — circle, 6e-16equidistant — circle, 9e-4equal-area — circle, 2e-3equirect. — sinusoid, 1e-4tilted 10°, sampled over 140° of azimuththe horizon swings ±10°
Fig. 2 The same horizon from a camera tilted 10° up, with the best of three candidate shapes — line, circle, sinusoid — dashed over each panel and its residual printed. The flat plane keeps it straight. The cylinder gives a cosine of amplitude 0.1763 with 6 × 10⁻¹⁷ of the chord left over. Stereographic gives a circle to 6 × 10⁻¹⁶. The equirectangular surface, the one every account calls a sinusoid, misses one by 1.3 × 10⁻⁴ — small, and not zero.

Three of those are exact and worth separating from the two that are not. “Exact” here means the residual sits where the arithmetic floor is and stays there as the tilt is swept — not that it is small at the setting drawn. A shape that is a theorem does not degrade; a shape that is a good fit does, and the sweep further down is what tells them apart.

It is also worth noticing what the six panels have in common, since it is easy to lose in the differences. Every one of them is a picture of the same set of directions, computed from one camera, and the six curves are six drawings of one object rather than six objects. Nothing about the ground changed between panels, nothing about the tilt changed, and no curve was fitted to marks — each horizon is where the surface puts the ground’s line at infinity, and the fitted shapes are laid over afterwards to ask what they resemble.

The plane keeps the horizon straight at every tilt, and for a reason that has nothing to do with horizons: a plane images every line as a line, so the image of a great circle through the eye is a straight line whatever the camera does. The horizon is not special to it.

The cylinder gives a cosine, exactly. A cylindrical panorama maps azimuth to horizontal position linearly and elevation to vertical position linearly, and the elevation of a level direction seen from a camera tilted by t is arcsin of something that works out to a pure cosine in azimuth with amplitude tan t. Nothing is left over.

Stereographic gives a circle, exactly, and that is the one property it is famous for: it takes every circle on the sphere to a circle on the page. The horizon is a circle on the sphere, so it is a circle on the page, and the residual is arithmetic.

What a straight horizon was ever a claim about

Before the curved surfaces, it is worth being exact about the flat one, because the rule everybody knows is stated about a picture and is actually about a surface.

On a plane the horizon is straight at every tilt. That is not because the horizon is level — it is because a plane images every straight line as a straight line, and the horizon is the image of a line at infinity. The horizon at eye level is the metric half of the same fact: on a vertical plane the straight horizon also sits at the height of the eye, so a reader can measure with it. Tilt the plane and the line stays straight and stops being at eye level, which is what the horizon and the fraction measures.

So the plane’s horizon carries two separate properties, and only one of them survives leaving the plane. Straightness is a property of the surface. Eye level is a property of the surface being vertical. On a cylinder the horizon is at eye level in the sense that it passes through the directions level with the eye, and it is not straight; on stereographic it is neither. A construction that uses the horizon as a straight ruler is using the first property, and it has no counterpart on any curved surface at all.

That is the practical loss, and it is larger than the shape question the rest of this essay is about. The lines a surface leaves alone settles which lines each surface keeps straight, and on every curved surface the horizon is straight only in the level case — the one case in which nothing needed measuring.

The two that only nearly have a shape, and why the gaps matter

The other three surfaces have a best fit rather than a shape, and reporting only which fit won would make the figure a caption.

Stereographic's horizon is a circle to 6e-16; the equidistant fisheye's misses one by 9e-4Every candidate shape fitted to every surface's horizon at 10° of tilt, as the worst departure from the fit in units of the arc's own chord. Reading only the smallest of the three would make this a caption; the gaps are the measurement. Stereographic's circle sits 12 decades below its own best sinusoid, which is the difference between a shape and a resemblance. The equidistant fisheye's best fit is also a circle, at 9.4e-4 — nine parts in ten thousand of its chord, close enough that no drawing would show it and far enough that the fit refuses to call it one.10⁻¹⁶10⁻¹²10⁻⁸10⁻⁴10⁰worst departure from the fitted shape, as a fraction of the chordthe three candidate shapes, fitted to each surface's horizon at 10° of tiltplanelinecylindersinusoidstereographiccircleequidistantcircleequal-areacircleequirect.sinusoidlinecirclesinusoidthree fits on each of six surfacesbest fit named at the right
Fig. 3 Every candidate shape fitted to every surface’s horizon at 10° of tilt, as the worst departure in units of the arc’s own chord, on one logarithmic scale. The gaps are the measurement. Stereographic’s circle sits twelve decades below its own best sinusoid — which is the difference between a shape and a resemblance. The equidistant fisheye’s best fit is also a circle, at 9.4 × 10⁻⁴: nine parts in ten thousand of its chord, close enough that no drawing would show it and far enough that the fit refuses to call it one.

Twelve decades is the number to carry. A residual of 6 × 10⁻¹⁶ and a residual of 9.4 × 10⁻⁴ are both, to a reader looking at a drawing, “a circle” — neither departure is visible at any printed size. The distinction between them is not perceptual and it is not a matter of degree. One surface takes circles to circles as a theorem; the other happens to produce something a circle fits well over this arc, and would not over a different one.

That is exactly why the three residuals are all plotted rather than the winner named. A single number per surface would say that five of the six have a horizon shape. The spread says that two of them do.

The inversion, swept

The single most repeated statement about wide-field horizons is that an equirectangular projection turns a tilted horizon into a sine wave. It is very nearly true and it is not true, and the surface it is exactly true of is a different one.

The cylinder's horizon stays a cosine to 9e-16; the equirectangular one's departure reaches 8.3e-3How far each surface's horizon is from the shape it is supposed to have, against the camera's tilt, on a logarithmic scale. The cylinder's departure from a cosine never leaves the arithmetic floor: 9.0e-16 at worst over the whole sweep. The equirectangular surface's grows as the cube of the tilt, reaching 8.3e-3 of the chord at 40°, because its drawn height is atan(tan t · cos u) and an arctangent of a cosine is a cosine only to first order. The flat plane is the control: its horizon is a horizontal line at every tilt, so both fits are exact and both readings sit on the floor.-15-10-5010203040how far the camera is tilted up, in degreesdeparture from the best sinusoid, as a fraction of the chord (log)cylinderequirect.stereographicplanetilt swept to 40°cylinder on the floor throughout
Fig. 4 How far each surface’s horizon is from the shape it is supposed to have, against the camera’s tilt, logarithmic. The cylinder’s departure from a cosine never leaves the arithmetic floor — 9.0 × 10⁻¹⁶ at worst over the whole sweep. The equirectangular surface’s grows as the cube of the tilt, reaching 8.3 × 10⁻³ of the chord at 40°. The flat plane is the control: straight at every tilt, so both fits are exact and both readings sit on the floor.

The mechanism is one line of trigonometry and it is worth writing down, because it says the departure is structural rather than a defect of the fit.

An equirectangular surface plots elevation directly as the vertical coordinate. The elevation of a level direction at azimuth u, seen from a camera tilted by t, is

atan(tantcosu).\text{atan}(\tan t \cdot \cos u).

The cylinder plots the tangent of the elevation, so the arctangent is undone and what is left is exactly tan t · cos u — a cosine, amplitude tan t, nothing over. The equirectangular surface keeps the arctangent, and an arctangent of a cosine is a cosine only to first order. Expand it and the leading correction is cubic in the tilt, which is precisely the growth the sweep measures.

The horizon's amplitude is tan of the tilt: 0.8391 at 40°The amplitude of the sinusoid fitted to each surface's horizon, against the camera's tilt. The cylinder's is tan of the tilt exactly — 0.83910 against 0.83910 at 40° — and the equirectangular surface's falls short of it because its own drawn height is an arctangent of that cosine. The flat plane is the control: its horizon is a horizontal line at every tilt, so both fits are exact and both readings sit on the floor.00.2000.4000.6000.800010203040how far the camera is tilted up, in degreesamplitude of the fitted sinusoid, in focal-length unitscylinderequirect.stereographicplanetilt swept to 40°cylinder = tan t exactly
Fig. 5 The amplitude of the fitted sinusoid against tilt. The cylinder’s is the tangent of the tilt exactly — 0.83910 against 0.83910 at 40° — and the equirectangular surface’s falls short of it, because its drawn height is the arctangent of that same cosine and an arctangent compresses. The plane’s horizon is a horizontal line at every tilt, so its amplitude is zero and both fits are exact.

So the folklore is a first-order truth that has attached itself to the wrong surface. At small tilts an equirectangular horizon does look like a sine wave, because everything looks like its own first-order approximation at small angles; the surface for which the description is a theorem is the cylinder, and the two are routinely confused because they differ only in how elevation is scaled.

The horizon separates two surfaces that nothing else here does

There is a reason to care about the cylinder-against-equirectangular result beyond correcting a piece of folklore, and it is that these two surfaces are otherwise remarkably hard to tell apart.

Both map azimuth to horizontal position linearly. Both reach the whole turn. Both bow every horizontal line that is not level. And this collection has already measured that their anisotropy is identically the same function — the ratio of tangential to radial scale is the secant of the elevation on both, agreeing to nine decimal places. On the shape-distortion comparison that separates the six surfaces, these two sit on top of each other.

They differ in two things only: how much area they give a patch of sky, and how they scale elevation. The horizon question is a direct reading of the second. The cylinder plots the tangent of the elevation and the equirectangular surface plots the elevation itself, and everything in this essay follows from that one difference — the exact cosine on one, the cubic departure on the other, the amplitude that reaches tan t on one and falls short on the other.

So the horizon is a discriminating instrument between two surfaces that a distortion measurement cannot separate at all. That is worth having, and it is the sort of thing that only turns up when a familiar object is measured on every surface rather than on the one it is usually drawn on.

It also explains why the confusion is so durable. Somebody working in equirectangular storage and thinking in cylindrical terms is working with two surfaces that agree about angles, agree about reach, agree about which lines bow, and disagree about exactly one thing — which happens to be the thing a levelling routine measures.

On a real picture, and the height matters as much as the shape

The panels above draw the horizon alone. A ground plane under it shows what a reader would actually be looking at.

On the cylinder, tilted 14°, the horizon comes out a sinusoid to 5e-17 of its chordA ground plane of rings at equal depressions and posts at equal azimuths, cast onto the cylinder from a camera tilted 14° up, 110° across. The heavier curve is the horizon — the image of the ground's line at infinity, computed from the camera rather than drawn where it looks right — and the faint one over it is the best sinusoid through it, which misses by 4.8e-17 of the chord. Over a whole turn this horizon rises and falls by 28°, which is twice the tilt and is a fact about the ground rather than about the surface; what the surface decides is the shape that swing is drawn as.sinusoid, 4.8e-17 of the chordcorrect from 6 cm, at 160 mm widecylinder · tilted 14°
Fig. 6 A ground plane of rings at equal depressions and posts at equal azimuths, cast onto the cylinder from a camera tilted 14° up, 110° across. The heavier curve is the horizon, computed from the camera rather than drawn where it looks right; the faint one over it is the best sinusoid, missing by 4.8 × 10⁻¹⁷ of the chord. Over a whole turn this horizon rises and falls by 28°, which is twice the tilt — a fact about the ground rather than about the surface. What the surface decides is the shape that swing is drawn as.

The twenty-eight degrees is worth separating from everything else in this essay. The amount the horizon swings is not a property of the surface; it is twice the tilt, on any surface that can hold the whole turn. What the surface chooses is the curve that swing is drawn as — cosine, arctangent-of-cosine, circle, or straight line.

And on the plane, where the horizon stays straight at every tilt, the swing has nowhere to go and shows up as a translation: the line slides down the frame as the camera tilts up. That is what the eye-level rule was always a statement about, and it is a rule about a plane rather than about horizons.

What it costs to read a photograph

There is a practical consequence and it is the reason any of this is worth measuring.

A great deal of software levels a panorama by fitting a sine wave to its horizon and rotating until the amplitude is zero. On a cylindrical panorama that is exact. On an equirectangular one — the format almost every panorama is stored in — it is wrong by a cubic term, and the sweep says how wrong: at 40° of tilt the horizon departs from any sinusoid by 8.3 × 10⁻³ of its chord, so a fit that assumes one is fitting the wrong function and its residual is not noise.

The size of that is modest and its shape is the problem. A rig is right on one surface makes the neighbouring point about stitching, where a choice of surface that is right for one step is wrong for the next. A cubic departure does not average away; it biases the fitted amplitude, and the amplitude is what the levelling uses. The honest procedure is to convert to the surface whose horizon really is a sinusoid, or to fit the arctangent form directly.

This is the same species of finding as where a surface spends its pixels: a property everybody attributes to a family of surfaces turns out to belong to exactly one of them, and the others are approximations good enough to have obscured the difference.

The great circle underneath all of it

The reason a single object can be drawn six ways is worth stating once more, because it is the premise the whole comparison rests on.

Five great circles, imaged on the stereographicEach is fitted as a general conic and comes back a circle: |A−C|+|B| is 1e-9 of the fit's own scale. Stereographic is the only surface here that does this.fitted conic: a circle to 1e-9stereographicdashed: the fit, not the samples
Fig. 7 Five great circles imaged on the stereographic surface, borrowed from the essay that measures it: each is fitted as a general conic and comes back a circle, to 1 × 10⁻⁹ of the fit’s own scale. Stereographic is the only one of the six that does this, and the horizon is one great circle among the five — which is why its horizon is a circle for a reason rather than by coincidence.

The horizon is not a distinguished object to any of these surfaces. It is one great circle among all of them, singled out only because a level ground is common and because a reader knows where it ought to be. Stereographic keeps every angle and takes every circle to a circle; the cylinder takes every great circle through the poles to a straight line and every other to a curve; the plane takes all of them to straight lines and can hold less than half of any one.

So a reader asking what shape is the horizon is asking a question with six answers, and the useful follow-up is which of the six is a theorem.

That follow-up is the one this collection keeps arriving at from different directions. A drawn property is worth relying on when it holds because of what the surface is, and worth nothing when it holds because the numbers happened to come out close over the arc somebody looked at. The twelve decades between stereographic’s circle and the equidistant fisheye’s is the whole of that distinction, expressed in the only units that can express it.

Where the horizon goes when the surface can hold the whole turn

A last consequence, and it is the one that separates a picture surface from a picture.

The plane can hold less than half a turn, so its horizon is an arc of a line with two ends that run off the paper. The cylinder holds the whole turn, so its horizon is a closed curve — a cosine that comes back to itself after 360° of azimuth, and a reader following it walks all the way round the room and returns. What a 360 photograph is is the essay about that closure, and the horizon is its cleanest instance: one curve, no ends, the entire set of level directions.

That changes what a horizon is for a reader rather than merely how it is drawn. On a flat picture the horizon is a boundary — the top of the ground, the edge of what the surface reaches, the line constructions run to. On a cylindrical panorama it is a circuit, and the phrase “beyond the horizon” has no referent on it at all, because there is no beyond: keep going up and the picture reaches the zenith, not another country.

And on the surfaces that reach past a half-turn there is a stranger case. The horizon’s image continues behind the camera, where a ground plane in front has nothing corresponding — the drawn curve keeps going through directions the scene does not occupy. That is the same fact the picture contains what is behind the camera measures on a flat picture, arriving here as a visible piece of curve rather than as a coincidence of marks.

What this does not settle

Three limits.

The horizon here is the horizon of a level ground of infinite extent, which is the image of the ground’s line at infinity and has nothing to do with what is visible. A real horizon is where the ground stops or the earth curves away, and neither is this object. The distinction matters on a wide picture: the drawn curve continues behind the camera on the surfaces that reach that far, where nothing is visible at all.

The fits are over a stated arc — 140° of azimuth — and a residual quoted as a fraction of the chord depends on that. The equidistant fisheye’s circle at 9.4 × 10⁻⁴ would fit better over a shorter arc and worse over a longer one, and its being a near-circle is a statement about this arc rather than about the surface. The two exact cases are exact over any arc, which is the difference the essay is about.

And nothing here says a curved horizon looks wrong, or that a reader notices. That is perception, which this collection does not answer. What it answers is which curve the geometry puts there, and which of the six surfaces put a curve that has a name.

One circle, six drawings

The object is a great circle of directions, and the finding is that it has no drawn shape of its own at all.

At zero tilt every surface makes it a straight line and nothing separates them. Away from zero there are exactly three exact answers — a line on the plane, a cosine on the cylinder, a circle on the stereographic — and three surfaces that merely come close, one of which has spent decades being credited with a shape that belongs to its neighbour.

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.

EquidistantEquirectangularfield of viewFisheyeGreat circleHorizonline at infinityPicture surfaceStereographicVanishing point