We're used to indicating positions on Earth (or on other planets or moons, or in the starry sky) with two coordinates: a longitude and a latitude. You first specify the one to the desired accuracy, and then the other. Until you have both of them, they are not of very much use.
In this document I show that we can indicate positions on Earth also with just one coordinate. That coordinate always indicates a compact region that is of about the same size in all horizontal directions. The more digits you get from that coordinate, the smaller the region becomes in which the location can lie, but it remains compact.
The ideas behind this coordinate come from the paper "Continuous Indexing of Hierarchical Subdivisions of the Globe" from 2000 by John J. Bartholdi, Ⅲ, and Paul Goldsman, which paper is available at http://www2.isye.gatech.edu/~jjb/mow/papers/hglobec.pdf.
A space-filling curve is a curve that passes roughly equally near every location in a space. Such a curve has a resolution, which is a measure of how close at least all locations are to the curve. In the limit of infinite resolution, the curve visits every location in the space.
Such a curve can be used to define a coordinate system in the space, in which only a single coordinate is needed to indicate a location, even if the space is an area or a volume for which usually two or three coordinates are used. The single coordinate is equal to the fraction of the length of the entire curve that must be traversed to get as near as possible to that location. That fraction gets ever closer to a fixed value as the resolution gets ever larger.
Space-filling curves are usually constructed from a template curve containing a small number of fairly equally distributed points connected by line segments. The curve must not intersect itself. You get the space-filling curve by scaling and rotating copies of the template curve and then connecting all of the copies in just the right way.
Each of the points is the center of an area of space for which that point is in some suitable sense the nearest one; We'll refer to that area as the point-related area. The point-related areas together cover the entire space, with no gaps and no overlap.
The template curve defines the space-filling curve at the first level. To get the next level of the curve, each of the line segments of the current curve is replaced by a suitably scaled and rotated copy of the template curve, in such a way that the curve as a whole remains connected and does not intersect itself. This corresponds to subdividing each point-related area.
Actually, for our purposes it is better to give the areas primacy over the points. To get to the next level, divide each of the areas into parts in such a way that a space-filling curve can be drawn through them with one point in each area.
Replacing ever smaller parts with copies of always the same template makes the space-filling curve self-similar. At infinite resolution, the space-filling curve is a fractal.
The Sierpiński curves are a particular family of space-filling curves. They form the basis of a coordinate system on the surface of a sphere (such as the Earth), which I call Sierpiński coordinates. The point-related areas are spherical triangles, and each next level corresponds to dividing each of the triangles into two nearly equal smaller triangles. At every next level, the number of triangles doubles.
As a example, look at a particular level-18 Sierpiński triangle on Earth covering part of the Netherlands.
At the next level (level 19), that triangle is divided into two nearly equal parts.
And at level 20, each of the smaller triangles has itself been divided into two.
And likewise at level 21.
The Sierpiński curve through the level-21 triangles inside the level-18 triangle is shown below. We enter the level-18 triangle on the left, pass through the level-21 triangles in the order indicated by the Sierpiński curve, and leave the level-18 triangle at the lower right. This is the general pattern for every triangle: enter at the entry vertex, cover the interior, passing the median vertex halfway through, and exit at the exit vertex. The exit vertex of the previous triangle is the entry vertex of the next triangle.
We can keep moving to higher levels and greater resolution. Here are the level-24 triangles inside the level-18 triangle, and the Sierpiński curve through them.
At level 27, the triangles get very small at this scale.
so we show the corresponding Sierpiński curve by itself. The curve still enters the level-18 triangle at the left, passes near every location inside that triangle without crossing itself, and then leaves the triangle at the lower right.
The surface of a globe is not a triangle, so at the first few levels the Sierpiński areas aren't (spherical) triangles but rather segments. For convenience, I refer to all of them as triangles.
At level 1, the globe is divided into an eastern half and a western half. At level 2, each hemisphere is divided from pole to pole into two segments. At level 3, each of the segments is divided in two at the equator. The 8 areas that then divide the surface of globe are spherical triangles. At higher levels, each triangle is divided further, according to the Sierpiński surface-filling curve.
These triangles are shown in green in the following map of the Earth (in Mollweide projection). The number in the middle of each triangle is the decimal Sierpiński coordinate of the triangle. These are explained later. (I created this image using QGIS, using map data from Natural Earth.)
The following table shows, for the first 50 levels \(n\), the approximate average area \(A\) of a triangle at that level on Earth, the approximate angular radius \(ρ\) of the inscribed circle in the triangle, and the approximate linear radius \(L\) of the inscribed circle. The units are: 1 Mm² = 1 million km² ≈ 621 thousand sq mi, 1 km² ≈ 0.39 sq mi, 1 m² ≈ 10.8 sq ft, 1° = 60′, 1′ = 60″, 1 Mm = 1000 km ≈ 621 mi, 1 km = 1000 m ≈ 0.621 mi, 1 m = 1000 mm = 3.3 ft.
\(n\) | \(A\) | \(ρ\) | \(L\) |
---|---|---|---|
1 | 511 Mm² | 90.0° | 10 Mm |
2 | 256 Mm² | 63.6° | 7.1 Mm |
3 | 128 Mm² | 45.0° | 5.0 Mm |
4 | 63.9 Mm² | 31.8° | 3.5 Mm |
5 | 31.9 Mm² | 22.5° | 2.5 Mm |
6 | 16.0 Mm² | 15.9° | 1.8 Mm |
7 | 7.99 Mm² | 11.3° | 1.3 Mm |
8 | 3.99 Mm² | 7.95° | 890 km |
9 | 2.00 Mm² | 5.63° | 630 km |
10 | 0.998 Mm² | 3.98° | 440 km |
11 | 0.499 Mm² | 2.81° | 310 km |
12 | 0.250 Mm² | 1.99° | 220 km |
13 | 0.125 Mm² | 1.41° | 160 km |
14 | 62400 km² | 59.7′ | 110 km |
15 | 31200 km² | 42.2′ | 78 km |
16 | 15600 km² | 29.8′ | 55 km |
17 | 7800 km² | 21.1′ | 39 km |
18 | 3900 km² | 14.9′ | 28 km |
19 | 1950 km² | 10.5′ | 20 km |
20 | 975 km² | 7.46′ | 14 km |
21 | 488 km² | 5.27′ | 9.8 km |
22 | 244 km² | 3.73′ | 6.9 km |
23 | 122 km² | 2.64′ | 4.9 km |
24 | 60.9 km² | 1.86′ | 3.5 km |
25 | 30.5 km² | 1.32′ | 2.4 km |
26 | 15.2 km² | 55.9″ | 1.7 km |
27 | 7.62 km² | 39.6″ | 1.2 km |
28 | 3.81 km² | 28.0″ | 860 m |
29 | 1.90 km² | 19.8″ | 610 m |
30 | 0.950 km² | 14.0″ | 430 m |
31 | 0.476 km² | 9.89″ | 310 m |
32 | 0.238 km² | 6.99″ | 220 m |
33 | 0.119 km² | 4.94″ | 150 m |
34 | 59500 m² | 3.50″ | 110 m |
35 | 29800 m² | 2.47″ | 76 m |
36 | 14900 m² | 1.75″ | 54 m |
37 | 7440 m² | 1.24″ | 38 m |
38 | 3720 m² | 0.87″ | 27 m |
39 | 1860 m² | 0.62″ | 19 m |
40 | 930 m² | 0.44″ | 14 m |
41 | 465 m² | 0.31″ | 9.6 m |
42 | 232 m² | 0.22″ | 6.8 m |
43 | 116 m² | 0.15″ | 4.8 m |
44 | 58.1 m² | 0.11″ | 3.4 m |
45 | 29.1 m² | 0.08″ | 2.4 m |
46 | 14.5 m² | 0.05″ | 1.7 m |
47 | 7.26 m² | 0.04″ | 1.2 m |
48 | 3.63 m² | 0.03″ | 840 mm |
49 | 1.82 m² | 0.02″ | 600 mm |
50 | 0.908 m² | 0.01″ | 420 mm |
So, at level 30 each triangle has an area of about 1 km2, and at level 40 each triangle has an area of about 930 m2 (the same as a circle of 8.6 m radius).
The Sierpiński coordinate ranges from 0 (at the North Pole) to 1 (back at the North Pole). If one traverses the triangles in the order of the coordinate, then one goes across the entire globe, without gaps and without overlap, until one ends up at the very first triangle again. Triangles with nearby coordinates tend to be nearby on the globe. A range of Sierpiński coordinate corresponds to a contiguous area on the globe.
Sierpiński coordinates are most precisely specified using binary numbers, because at each level the number of triangles doubles.
To make the distinction between binary fractional numbers and fractional numbers for other bases (e.g., decimal) more clear in the text below, we can prefix non-decimal fractionals with the base followed by a number sign "#", for example "2#" for binary numbers. If the base is clear from the context, then the prefix may be omitted.
At level 1, the areas are
Index | Binary | Area |
---|---|---|
0 | 2#0.0 | Eastern hemispher |
1 | 2#0.1 | Western hemisphere |
Any location with a binary Sierpiński coordinate beginning (after the decimal point) with 0 is in the eastern hemisphere, and any location with a Sierpiński binary coordinate beginning (after the decimal point) with 1 is in the western hemisphere.
At level 2, the areas are
Index | Binary | Area |
---|---|---|
0 | 2#0.00 | 0° to 90° east longitude |
1 | 2#0.01 | 90° to 180° east longitude |
2 | 2#0.10 | 180° to 90° west longitude |
3 | 2#0.11 | 90° to 0° west longitude |
At level 3, the spherical triangles are
Index | Binary | Area |
---|---|---|
0 | 2#0.000 | 0−90° east longitude, north latitude |
1 | 2#0.001 | 0−90° east longitude, south latitude |
2 | 2#0.010 | 90−180° east longitude, south latitude |
3 | 2#0.011 | 90−180° east longitude, north latitude |
4 | 2#0.100 | 180−90° west longitude, north latitude |
5 | 2#0.101 | 180−90° west longitude, south latitude |
6 | 2#0.110 | 90−0° west longitude, south latitude |
7 | 2#0.111 | 90−0° west longitude, north latitude |
My standard notation for a binary Sierpiński coordinate is to omit the
decimal point and anything before it, and to prefix a "b" to indicate
its binary nature. So, Australia (near 140° east longitude, 35° south
latitude) lies in the triangle designated
Leading and trailing zeros are significant! Triangle
If a namespace must be indicated, then use "ssfc:" for "Sierpiński
surface-filling coordinate". So,
For binary Sierpiński coordinates, the coordinate of a larger triangle
is the prefix of the coordinate of any of the smaller triangles that
it contains. So, triangle
Sierpiński coordinates in binary format are somewhat unwieldy, because
they get long rather quickly. Specifying a Sierpiński coordinate with
sufficient precision to denote a triangle on Earth with an area of
about 1 km² requires 30 binary digits, and a triangle of 1 m² requires
50 binary digits. For example, the binary Sierpiński coordinate of
the level-30 triangle of about 1 km² that contains the Natural History
Museum in Rotterdam is
For greater convenience, binary Sierpiński coordinates can be converted into octal (base 8), decimal (base 10), or hexadecimal (base 16) ones.
Each next group of three binary digits corresponds to one octal digit (0−7). The correspondence is as follows.
Binary | 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 |
Octal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
An octal Sierpiński coordinate is prefixed by an "o". So, Australia
lies in
An octal coordinate has roughly one third the number of digits that the corresponding binary coordinate has.
There is a problem with octal Sierpiński coordinates (and similarly
with coordinates to any base except 2). What is the octal version of
To solve this problem, add a colon and the level number to the
Sierpiński coordinate. We call that the level suffix.
Region
For octal Sierpiński coordinates, the coordinate of a larger triangle
is the prefix of the coordinate of any of the smaller triangles that
it contains, if the coordinates require no level to be specified. So,
triangle
Each group of four binary digits corresponds to one hexadecimal digit (0−9 and a-f). The correspondence is as follows.
Binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
Hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | f |
The letters a-f in a hexadecimal coordinate may be written in upper case or lower case as desired, without changing the meaning.
A hexadecimal Sierpiński coordinate is prefixed by an "x". For
example, the central and western USA fall in
A hexadecimal coordinate has roughly one quarter the number of digits that the corresponding binary coordinate has, and is roughly 3/4 times as long as the corresponding octal coordinate.
For hexadecimal Sierpiński coordinates, the coordinate of a larger
triangle is the prefix of the coordinate of any of the smaller
triangles that it contains, if the coordinates require no level to be
specified. So, triangle
The correspondence between binary and decimal Sierpiński coordinates is less clear-cut, because 10 is not a power of 2. Each next decimal digit on average corresponds to about 3.32 additional binary digits.
To convert a binary Sierpiński coordinate to a decimal one, convert the binary fraction to a decimal fraction and truncate it at the minimum number of decimal digits that is needed to be able to distinguish between coordinates at the given level. See below for details.
Decimal Sierpiński coordinates may be prefixed by a "d", but that prefix is not required. A Sierpiński coordinate without a prefix is assumed to be a decimal one. A level suffix is needed if the maximum number of binary digits that can correspond to the number of decimal digits is not equal to the level.
For example, a level-3 Sierpiński coordinate has 3 binary digits.
What decimal Sierpiński coordinate corresponds to
Likewise,
All in all, the corresponding binary and decimal fractions and Sierpiński coordinates for all level-3 coordinates are:
SSFC | Binary | Decimal | SSFC |
---|---|---|---|
2#0 | 0 | ||
2#0.001 | 0.125 | ||
2#0.01 | 0.25 | ||
2#0.011 | 0.375 | ||
2#0.1 | 0.5 | ||
2#0.101 | 0.625 | ||
2#0.11 | 0.75 | ||
2#0.111 | 0.875 |
so there is a different 1-digit decimal coordinate for every 3-digit binary coordinate, but some 3-digit binary coordinates have multiple possible 1-digit decimal coordinates.
The maximum number of binary digits that can be represented by the first couple of decimal digit counts are as follows:
Decimal | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
Binary | 3 | 6 | 9 | 13 | 16 | 19 | 23 | 26 | 29 | 33 |
So, a 33-digit binary coordinate can be represented by a 10-digit
decimal one. If the level equals one of these binary digit counts,
then the decimal Sierpiński coordinate needs no level indication. The
level-29 triangle of 2 km² that includes the Natural History Museum in
Rotterdam has decimal Sierpiński coordinate
A decimal coordinate has roughly 30% as many digits as the corresponding binary coordinate.
For decimal Sierpiński coordinates, the canonical coordinate of a
larger triangle is not necessarily the prefix of the canonical
coordinate of any of the smaller triangles that it contains, even if
the coordinates require no level to be specified. For example,
triangle
Traversing the triangles at a specific level via the Sierpiński curve corresponds to starting at Sierpiński coordinate with all zeros at that level, and then incrementing the number (interpreted as a whole number) by one for each next triangle. At level \( n \) there are \( 2^n \) triangles.
For example, at level 6, we follow the Sierpiński curve when we travel
through the triangles in the order
We can indicate each triangle by its binary, octal, decimal, or hexadecimal Sierpiński coordinate, or by counting triangles from the first one. The decimal coordinate based on the count of triangles is called the Sierpiński index of the triangle.
The first triangle gets index 0, the next one gets 1, and so on until
the last triangle (which leads back to triangle 0) which gets index
number \( 2^n - 1 \). The standard notation for indicating a triangle
by its index at a certain level is to prefix "i" to the index number.
A level suffix is required for a Sierpiński index, because every index
occurs at multiple levels. Triangle
For Sierpiński indexes the relationship between containing triangles
is different than it was for Sierpiński coordinates. Smaller triangle
\( i \) at level \( n \) is contained within larger triangle \( i/2 \)
at level \( n - 1 \), which is contained within even larger triangle
\( i/4 \) at level \( n - 2 \). Ignore the remainder from these
divisions. For example, triangle
The square kilometer containing the Natural History Museum in
Rotterdam has Sierpiński index
One can indicate a relative Sierpiński coordinate or index by appending a plus or minus sign and the integer offset to the base coordinate or index (after the level suffix, if any). The offset may be 0 and indicates how many triangles to advance (+) or retreat (−) along the Sierpiński curve from the one indicated by the base coordinate or index without the offset.
For example, the level-30 triangle including the Natural History
Museum in Rotterdam is at
Even decimal relative Sierpiński coordinates are not easy to convert
to the corresponding absolute (not relative) Sierpiński
coordinates.
Relative Sierpiński indexes are easy to reduce to absolute Sierpiński
indexes: just add the relative number to the index.
One can indicate a range of Sierpiński coordinates or indexes by
concatenating two such coordinates or indexes (including a level
suffix and an offset as needed or desired) separated by "..". The
type of coordinate (binary, octal, decimal, or index) of the beginning
and end of the range may differ. For example,
If the beginning and end of the range do not specify or imply the same
level, then the lesser of the two levels applies. So,
The type specifier of the end of the range may be omitted; It is then
assumed the same as that of the range beginning. So,
If the range end is equal to the range beginning, ignoring any offsets
on either, then the range end without the offset may be omitted. So,
Sierpiński coordinates wrap around to 0 when they reach their greatest
possible value. If the range end indicates an earlier triangle (in
the order of the Sierpiński curve) than the range beginning does, then
the range runs from the range beginning triangle to the very last
triangle, to the very first triangle, and then to the range ending
triangle. For example,
We've defined binary, octal, decimal, and hexadecimal Sierpiński coordinates, and the Sierpiński index. All of these indicate particular triangles on the globe, in a continuous sequence that cover the entire globe without gaps and without overlap. Two Sierpiński coordinates or indexes that are close together indicate triangles that are close together on the globe.
The various coordinates of the square kilometer containing the Natural History Museum in Rotterdam are:
Polar | E 4.474°, N 51.912° |
Binary | |
Octal | |
Decimal | |
Hexadecimal | |
Index |
The following sequence of images zooms in from the entire world to the Natural History Museum in Rotterdam, in steps of 3 levels, so that each triangle from the previous image is divided into 8 = 23 triangles in the current image. The triangles are identified by their decimal Sierpiński coordinate.
We begin at level 3, where there are 8 triangles, each covering approximately 511 million km².
The number near the center of each triangle is the level-3 decimal canonical Sierpiński coordinate that identifies the triangle.
The curve passing through all of the triangles is the level-6 Sierpiński curve passing through the centers of all of the level-6 triangles in ascending order of the Sierpiński coordinate. That curve shows which vertex of the level-3 triangle is the entry vertex (where the curve enters the triangle), which is the median vertex (which is passed midway through the triangle), and which is the exit vertex (where the curve exits the triangle).
The triangle that is drawn thicker is the one containing the Museum.
A similar setup is used for the pictures for higher levels.
The level-3 Sierpiński curve is approximately 63 000 km long, which is 1.6 times the circumference of the Earth. The level-6 Sierpiński curve is approximately 151 000 km long, which is 3.8 times the circumference of the Earth.
%ignore>
Notice that there are gaps in the coordinate: Not every possible coordinate has a triangle of its own, because there are 10 possible one-digit numbers, but only 8 triangles. Coordinates 2 and 7 do not occur at this level.
We zoom in to level-3 triangle
Then we zoom in to level-6 triangle
We zoom in to level-9 triangle
Then we zoom in to level-12 triangle
Now we zoom in to level-15 triangle
We zoom in to level-18 triangle
Then we zoom in to level-21 triangle
Then we zoom in to level-24 triangle
Then we zoom in to level-27 triangle
We zoom in to level-30 triangle
We zoom in to level-33 triangle
We zoom in to level-36 triangle
Converting an octal Sierpiński coordinate to a binary Sierpiński coordinate is simple: Replace every octal digit by the corresponding three binary digits, and truncate after the number of binary digits equal to the level of the coordinate.
For example, what is the binary equivalent of
Converting a hexadecimal Sierpiński coordinate to a binary Sierpiński coordinate is simple: Replace every hexadecimal digit by the corresponding four binary digits, and truncate after the number of binary digits equal to the level of the coordinate.
For example, what is the binary equivalent of
Converting from a Sierpiński index to a binary Sierpiński coordinate is simple: Convert the decimal index into the corresponding binary number, and prefix 0s until the number of binary digits is equal to the level of the index.
For example, what is the binary equivalent of
Converting from a decimal Sierpiński coordinate is more difficult than the other conversions described above, because unlike 8 and 16, 10 is not a power of 2.
The first step is to determine the number of binary digits corresponding to the decimal coordinate. If the decimal coordinate includes a level suffix, then that determines the number of binary digits. If the decimal coordinate has \( d \) decimal digits and does not include a level suffix, then the number \( b \) of binary digits is the largest whole number such that \( 2^b \le 10^d \), which is equivalent to \( b\log_{10}(2) \le d \), which means
\[ b = \left\lfloor \frac{d}{\log_{10}(2)} \right\rfloor = \left\lfloor d\log_{2}(10) \right\rfloor \]
where \( \log_{10}(2) ≈ 0.30103001 \) and \( \log_{2}(10) = 1/\log_{10}(2) ≈ 3.321928 \).
For example, if the decimal coordinate has 11 decimal digits, then \( d = 11 \). \(11\log_{2}(10) ≈ 36.54\) so \( b = 36 \). Let's check: \( 10^d = 10^{11} = 100 000 000 000 \) and \( 2^b = 2^{36} = 68 719 476 736 \) and \( 2^{b+1} = 2^{37} = 137 438 953 472 \) so \( 2^{36} \le 10^{11} \) and \( 2^{37} \gt 10^{11} \) so indeed 36 is the correct number.
If the decimal coordinate is \( D \), then it represents the fraction \( D/10^d \). We're looking for binary coordinate \( B \), which represents the fraction \( B/2^b \) that is nearest to \( D/10^d \). So
\[ B = \left[ \frac{D×2^b}{10^d} \right] = \left\lfloor \frac{D×2^b}{10^d} + \frac12 \right\rfloor = \left\lfloor \frac{D×2^b + \frac{1}{2}×10^d}{10^d} \right\rfloor \]
Now we have \( B \) but in base 10 (assuming we used a decimal calculator). To get the binary digits from left to right:
For each of the \( b \) binary digits,
That decimal Sierpiński coordinate has 2 digits, and corresponds to 6 binary digits. We calculate
\begin{align*} 2^b & = 2^{6} = 64 \\ 10^d & = 10^{2} = 100 \\ B & = \left\lfloor \frac{80×2^{6} + \frac{1}{2}×10^{2}}{10^{2}} \right\rfloor \\ & = \left\lfloor \frac{80×64 + 50}{100} \right\rfloor \\ & = \left\lfloor \frac{5170}{100} \right\rfloor \\ & = 51 \end{align*}
Now we convert 51 from a decimal number to a binary number.
For the first binary digit, we find \( B = 2×51 = 102 \), which is not less \( 2^b = 2^{6} = 64 \), so the first binary digit is 1 and we subtract 64 from \( B \) to find \( B = 102 - 64 = 38 \).
For the second binary digit, we find \( B = 2×38 = 76 \), which is not less than 64, so the second binary digit is 1 and we subtract 64 from \( B \) to find \( B = 76 - 64 = 12 \).
For the third binary digit, we find \( B = 2×12 = 24 \), which is less than 64, so the third binary digit is 0.
For the fourth binary digit, we find \( B = 2×24 = 48 \), which is less than 64, so the fourth binary digit is 0.
For the fifth binary digit, we find \( B = 2×48 = 96 \), which is not less than 64, so the fifth binary digit is 1 and we subtract 64 from \( B \) to find \( B = 96 - 64 = 32 \).
For the sixth and last binary digit, we find \( B = 2×32 = 64 \), which is not less than 64, so the sixth binary digit is 1.
All in all, the result is 2#110011, so the binary equivalent of
Note that this example was for a low-level coordinate, which means that the numbers remain small. For a level-40 coordinate, the numbers in these calculations involve 12-digit decimal numbers, which are too big to fit with full precision in a typical calculator. Use a software package that can handle whole numbers of arbitrary size, or else worry about round-off errors.
Given a Sierpiński coordinate, convert to latitude and longitude as follows:
Then, construct an initial triangle based on the first three binary digits, according to the following table.
Octal | A | B | C |
---|---|---|---|
000 | (0,0,+1) | (0,+1,0) | (+1,0,0) |
001 | (+1,0,0) | (0,+1,0) | (0,0,−1) |
010 | (0,0,−1) | (0,+1,0) | (−1,0,0) |
011 | (−1,0,0) | (0,+1,0) | (0,0,+1) |
100 | (0,0,+1) | (0,−1,0) | (−1,0,0) |
101 | (−1,0,0) | (0,−1,0) | (0,0,−1) |
110 | (0,0,−1) | (0,−1,0) | (+1,0,0) |
111 | (+1,0,0) | (0,−1,0) | (0,0,+1) |
The three numbers for each of the points A, B, and C are cartesian coordinates \(x, y, z\). Point (0,0,+1) is the north pole, point (+1,0,0) is at longitude 0 and latitude 0, and point (0,+1,0) is at longitude 90° east and latitude 0.
As an example, we'll determine the location corresponding to
The 4th binary digit is equal to 0. The sum of A and C is D = (+1, 0, +1). The length of D = \( r = \sqrt{1^2 + 0^2 + 1^2} = \sqrt{2} ≈ 1.414214 \), so we divide the coordinates of D by that number and find D = (+0.7071068, 0, +0.7071068). The binary digit is 0, so we set C equal to B, and then B equal to D, and find A = (0, 0, +1), B = (+0.7071068, 0, +0.7071068), C = (0, +1, 0).
The 5th binary digit is equal to 0. The sum of A and C is D = (0, +1, +1). The length of D = \( r = \sqrt{0^2 + 1^2 + 1^2} = \sqrt{2} ≈ 1.414214 \), so we divide the coordinates of D by that number and find D = (0, +0.7071068, +0.7071068). The binary digit is 0, so we set C equal to B, and then B equal to D, and find A = (0, 0, +1), B = (0, +0.7071068, +0.7071068), C = (+0.7071068, 0, +0.7071068).
The 6th and last binary digit is equal to 1. The sum of A and C is D = (0.7071068, 0, 1.7071068). The length of D = \( r = \sqrt{0.7071068^2 + 0^2 + 1.7071068^2} = \sqrt{3.14214} ≈ 1.847759 \), so we divide the coordinates of D by that number and find D = (+0.3826834, 0, +0.9238795). The binary digit is 1, so we set A equal to B, and then B equal to D, and find A = (0, +0.7071068, +0.7071068), B = (+0.3826834, 0, +0.9238795), C = (+0.7071068, 0, +0.7071068). These three points define the final triangle.
The sum of final points A, B, and C is E = (+1.08979, +0.7071068,
+2.338093). The length of E is \(r = \sqrt{1.08979^2 + 0.7071068^2
+ 2.338093^2} = \sqrt{7.154322} = 2.674756\). The latitude of the
center of the triangle is equal to \( φ =
\arcsin(+2.338093/2.674756) = +60.94°\). The longitude is at \(λ =
\arctan(+0.7071068,+1.08979) = +32.98°\). So, the center of
triangle
Converting a binary Sierpiński coordinate to an octal Sierpiński coordinate is simple: Append 0s until the number of binary digits is a multiple of 3, replace every three binary digits by the corresponding octal digit, and add a level suffix if the original number of binary digits wasn't a multiple of 3.
For example, what is the octal equivalent of
Converting a binary Sierpiński coordinate to a hexadecimal Sierpiński coordinate is simple: Append 0s until the number of binary digits is a multiple of 4, replace every four binary digits by the corresponding hexadecimal digit, and add a level suffix if the original number of binary digits wasn't a multiple of 4.
For example, what is the hexadecimal equivalent of
Converting from a binary Sierpiński coordinate to a Sierpiński index is simple: Convert the binary number into the corresponding decimal number, and add a level suffix.
For example, what is the Sierpiński index corresponding to
Converting to a decimal Sierpiński coordinate is more difficult than the other conversions described above, because unlike 8 and 16, 10 is not a power of 2.
The first step is to determine the number \( d \) of decimal digits corresponding to the \( b \) binary digits. That number \( d \) is the smallest whole number such that \( 2^b \le 10^d \), which is equivalent to \( b\log_{10}(2) \le d \), which means
\[ d = \left\lceil b \log_{10}(2) \right\rceil \]
where \( \log_{10}(2) ≈ 0.30103001 \).
However, the found number of decimal digits may correspond to more than \( b \) binary digits. The number \( b_2 \) of binary digits corresponding to \( d \) decimal digits is
\[ b_2 = \left\lfloor \frac{d}{\log_{10}(2)} \right\rfloor = \left\lfloor d\log_{2}(10) \right\rfloor \]
If \( b_2 \) differs from \( b \), then append 0s to the binary coordinate until it has \( b_2 \) binary digits, and add a level suffix (for level \( b \)) to the final decimal Sierpiński coordinate.
What number of binary digits corresponds to \( d = 4 \)? \( 4/\log_{10}(2) ≈ 13.29 \) so \( b_2 = 13 \). This is 3 more than \( b = 10 \), so we need to append 3 zeros to the binary coordinate, and the decimal Sierpiński coordinate requires a level suffix equal to ":10".
If the binary coordinate (with appended 0s as needed) is \( B \), then it represents the fraction \( B/2^{b_2} \). We're looking for decimal coordinate \( D \), which represents the fraction \( D/10^d \) that is nearest to \( B/2^{b_2} \). So
\[ D = \left[ \frac{B×10^d}{2^{b_2}} \right] = \left\lfloor \frac{B×10^d}{2^{b_2}} + \frac12 \right\rfloor = \left\lfloor \frac{B×10^d + \frac{1}{2}×2^{b_2}}{2^{b_2}} \right\rfloor \]
Now we have \( D \), except that it may be shorter than it should be because leading 0s are omitted. If \( D \) has fewer than \( d \) digits, then prefix sufficient 0s to make it have \( d \) digits.
And if \( b_2 ≠ b \), then a level suffix (for level \( b \)) must be added.
That decimal Sierpiński coordinate has 10 binary digits, which correspond to 4 decimal digits, which correspond to 13 binary digits, so we must append three 0s. The binary number to convert is therefore 2#0000110011000. The decimal number corresponding to that is 408, so B = 408. We calculate
\begin{align*} 2^{b_2} & = 2^{13} = 8192 \\ 10^d & = 10^{4} = 10000 \\ D & = \left\lfloor \frac{408×10^{4} + \frac{1}{2}×2^{13}}{2^{13}} \right\rfloor \\ & = \left\lfloor \frac{408×10000 + 512}{8192} \right\rfloor \\ & = \left\lfloor \frac{4080512}{8192} \right\rfloor \\ & = 498 \end{align*}
So, the result is 498, which has 3 digits but we expected 4 digits,
so we prefix a 0. We also need to append a level suffix for level
10, so the decimal equivalent of
Note that this example was for a low-level coordinate, which means that the numbers remain small. For a level-40 coordinate, the numbers in these calculations involve 12-digit decimal numbers, which are too big to fit with full precision in a typical calculator. Use a software package that can handle whole numbers of arbitrary size, or else worry about round-off errors.
Given latitude \( φ \) and longitude \( λ \) of a point P, convert to binary Sierpiński coordinate as follows:
\begin{align*} x & = \cos(λ) \cos(φ) \\ y & = \sin(λ) \cos(φ) \\ z & = \sin(φ) \end{align*}
\( x \) | \( y \) | \( z \) | Octant |
---|---|---|---|
<0 | <0 | <0 | 101 |
≥0 | <0 | <0 | 110 |
<0 | ≥0 | <0 | 010 |
≥0 | ≥0 | <0 | 001 |
<0 | <0 | ≥0 | 100 |
≥0 | <0 | ≥0 | 111 |
<0 | ≥0 | ≥0 | 011 |
≥0 | ≥0 | ≥0 | 000 |
The "octant" provides the first three binary digits.
The determinant \( Δ \) of a 3-by-3 matrix is
\begin{align*} Δ & = \det\left( \begin{matrix} a & d & g \\ b & e & h \\ c & f & i \end{matrix} \right) \\ & = a (ei - fh) - b (di - fg) + c (dh - eg) \end{align*}
For example, what is the binary Sierpiński coordinate of the location at 32.98° east longitude and 60.94° north latitude, to a precision of 5°?
For a precision of 5° we must calculate to level \( n = \left\lceil 2×\log_2(90°/5°) \right\rceil = \left\lceil 8.33985 \right\rceil = 9 \).
Then \( λ = 32.98° \) and \( φ = 60.94° \). The corresponding cartesian coordinates of point P are
\begin{align*} x & = \cos(32.98°) \cos(60.94°) = 0.4074558 \\ y & = \sin(32.98°) \cos(60.94°) = 0.2644027 \\ z & = \sin(60.94°) = 0.8741115 \end{align*}
Given that all three coordinates are positive, this location corresponds to octant 000, so those are the first three digits of the binary Sierpiński coordinate.
The points A, B, C corresponding to octant 000 are A = (0,0,+1), B = (0,+1,0), C = (+1,0,0).
For the fourth binary digit, we calculate sum D of points A and C: D = (+1,0,+1). The length of D is \( r = \sqrt{1^2 + 0^2 + 1^2} = \sqrt{2} ≈ 1.414214 \), so we divide the coordinates of D by that number and find D = (+0.7071068, 0, +0.7071068).
Then we calculate the determinant of the matrix formed from P, A, B. That matrix is
\[ \left( \begin{matrix} +0.4074558 & 0 & 0 \\ +0.2644027 & 0 & +1 \\ +0.8741115 & +1 & 0 \end{matrix} \right) \]
and its determinant is +0.4074558×(0×0 − +1×+1) − +0.2644027×(0×0 − +1×0) + +0.8741115×(0×+1 − 0×0) = −0.4074558.
Likewise, the matrix formed from P, B, and D is
\[ \left( \begin{matrix} +0.4074558 & 0 & +0.7071068 \\ +0.2644027 & +1 & 0 \\ +0.8741115 & 0 & +0.7071068 \end{matrix} \right) \]
and its determinant is +0.4074558×(+1×+0.7071068 − 0×0) − +0.2644027×(0×+0.7071068 − 0×+0.7071068) + +0.8741115×(0×0 − +1×+0.7071068) = −0.3299754, which has the same sign as the previous determinant.
And the matrix formed from P, D, and A is
\[ \left( \begin{matrix} +0.4074558 & +0.7071068 & 0 \\ +0.2644027 & 0 & 0 \\ +0.8741115 & +0.7071068 & +1 \end{matrix} \right) \]
and its determinant is +0.4074558×(0×+1 − +0.7071068×0) − +0.2644027×(+0.7071068×+1 − +0.7071068×0) + +0.8741115×(+0.7071068×0 − 0×0) = −0.186961, which has the same sign as the other two determinants, so point P is within triangle ABD. That means that the next binary digit is 0, and that we set C equal to B, and then B equal to D, to find A = (0, 0, +1), B = (+0.7071068, 0, +0.7071068), C = (0, +1, 0).
For the fifth binary digit, we find D = (0, +0.7071068, +0.7071068) and determinants +0.1869610, +0.1011265, and +0.2881148, which all have the same sign so point P is inside triangle ABD, so the binary digit is 0, and we set C equal to B, and then B equal to D, to find A = (0,0,+1), B = (0, +0.7071068, +0.7071068), C = (+0.7071068, 0, +0.7071068).
For the sixth binary digit, we find D = (+0.3826834, 0, +0.9238795) and determinants −0.2881148, +0.1011973, and −0.1011825, which do not all have the same sign so point P is not inside triangle ABD but instead inside triangle ADC. The binary digit is 1, and we set A equal to B, and then B equal to D, to find A = (0, +0.7071068, +0.7071068), B = (+0.3826834, 0, +0.9238795), C = (+0.7071068, 0, +0.7071068).
For the seventh binary digit, we find D = (+0.4082483, +0.4082483, +0.816497) and determinants +0.1011973, −0.0000085, and +0.0583854, which do not all have the same sign so point P is not inside the triangle ABD but instead inside triangle ADC. The binary digit is 1, and we set A equal to B, and then B equal to D, to find A = (+0.3826834, 0, +0.9238795), B = (+0.4082483, +0.4082483, +0.816497), C = (+0.7071068, 0, +0.7071068).
For the eighth binary digit, we find D = (+0.5555702, 0, +0.8314696) and determinants −0.0000085, −0.0297603, and −0.0515824, which all have the same sign so point P is inside triangle ABD. The binary digit is 0, and we set C equal to B, and then B equal to D, to find A = (+0.3826834, 0, +0.9238795), B = (+0.5555702, 0, +0.8314696), C = (+0.4082483, +0.4082483, +0.816497).
For the ninth and last binary digit, we find D = (+0.4046150, +0.2088466, +0.8903200) and determinants +0.0515824, −0.0111635, and +0.0000044, which do not all have the same sign so point P is not inside triangle ABD but instead in triangle ADC. The binary digit is 1, and we set A equal to B, and then B equal to D, to find A = (+0.5555702, 0, +0.8314696), B = (+0.4046150, +0.2088466, +0.8903200), C = (+0.4082483, +0.4082483, +0.816497).
The binary digits are 000001101, so the binary Sierpiński coordinate
is
© 2015 Louis Strous. I created the images in this paper using QGIS. I did all of the calculations that involve Sierpiński coordinates, using an application written by myself. The map data came from Natural Earth, OpenStreetMap, and Google Maps.