In this post I’ll cover an issue of making the *global lattice* in more details then it was in the very first posts. Moreover, the schematic representation of this lattice, which is there, is pretty not good enough. I’ll try to eliminate this shortcoming here, but I start with a reminder of the overall design.

## Twin Cones

The planetary relief is constructed in two stages. First, a rough relief is created on the so-called *global lattice*. This lattice resides in the surface of two cones with connected bases, as it pictured on the figure below*.

At the second stage, the rough shape of relief is refined to the final form on the finer grained lattice inside the separate divisions of the *global lattice* (which are known as *rombs*). In this post we will deal only with the first of the mentioned lattices.

To build it, we divide the surface of each cone into strips of an equal width. We cut sections of the cone with cylinders: the central axis of the cylinders are located in the same plane, all axes are parallel to each other and to cone axis, and the cylinder radii are selected so that the cylinders cut off stripes of the same width from the cone surface, as in the next figure.

In this configuration each cylinder and cone intersection is a second order 3d curve. I don’t know if such a curve has a special name (as, for example, Viviani’s curve), so I just call it *cc-curve* (*cylinder and cone intersection curve*). Such cone division is also carried out in the perpendicular direction. And the same division is made with the second cone.

As a result, separate quadrangular subdivisions are formed on the cones (*rombs*). They look like rhombuses, but in general they are not. In addition, they can vary in their shape, orientation, and size.

## Projection onto the sphere

The lattice built-up on the twin cones (together with the relief built on it) can be transferred to the planet sphere. There is a room for maneuvering here, since the mapping of the twin cones onto the sphere can be significantly different. Two reasonable requirements to this mapping are the monotony and the continuity of the mapping function.

The only currently implemented mapping in the project is one in which the cones’ meridians are isometrically mapped to the sphere’s meridians.

Here, the shape of the *rhombs* are gradually changes; but the larger the size of the lattice, the more gradual this changing, and more inconspicuous distortions. In the Mercator projection transitions between *rombs* are even less noticeable, since rhombuses differ mainly only in orientation, which changes gradually. You can see planet maps in the Mercator projection in the Leaflet windows on the site’s main page.

An interesting distinguishing feature of this mapping is that the *cc-curves* go into regular circles on the sphere. We could get the same result if we cut the sphere with planes.

Another practically useful mapping is when the heights of the cone points are preserved when transferred to the sphere.

Here, it is small distortions near the equator, but very large distortions closer to the poles. Such a mapping could be used for planets in which all the land is concentrated near the equator.

## The alternative approach

The method of lattice creating described in the first section can give satisfactory results, but it is difficult to implement. Since the *rombs* sizes vary in all directions, therefore, the local lattice inside the rombs varies too.

Instead, a different method is actually used (until the first method is implemented). First, we make a flat involute of the half of one cone as shown in the next figure.

The radius of the cone is chosen equal to 1, and the height of the cone is chosen so that its generatrix (meridian) is equal to a quarter of the directrix (the line of twin cones connection, or equator), that is π/2.

In the resulting flat figure the directrix is marked in green, and the main meridians are indicated in orange. This is a sector of the circle with a radius equal to the generatrix length (π/2).

Then, we draw thin black curves so that each starts on the central meridian and separates a part of any circle arc (green dashed lines) always of equal length, equal to the initial length at the start of the curve. Such curves are drawn at regular intervals; they differ little from straight lines and their explicit expression is as following:

*x = (r0+r) cos(t), y = (r0+r) cos(t),*

*t = (t1-2 r0/π)/t1, t1 = 2 (r0+r)/π.*

Here, *r0* is the *x* coordinate of the curve original point, *r* is radius increment, *t* is polar coordinates angle (the polar axis coincides with *x* axis). With the help of rotations we can also draw the ‘perpendicular’ family of curves (thin grey lines).

If we transfer the resulting lattice to the twin cones, we get

And after we transfer the lattice to the sphere, we get

As we can see, the *rombs* here are almost the same size, and their vertical size is always the same. Such a lattice is much simpler to implement, but in the meridian regions we get significant distortions, which cannot be completely suppressed.

If we make twin cones flat projection similar to Spherical Mercator projection, then our obtained curves are flat curves. On maps in this projection they can be approximated by straight line segments between nodes of the lattice. Then *rombs* become figures with straight sides and resemble flat rhombuses.

With the exception of several places *rhombs* are changing smoothly; gaps occur only along the main meridians (marked with white lines in the figures). But even there, the resulting relief seems satisfactory in the most cases, with the exception of places near the four points of the main meridians and equator intersections and the poles. But since the main method used to build the relief is based on the *noise functions*, we can always place the maximum distortion areas under the seas.

*You can click on any image to enlarge it.