# sphere-filling curve

Let $S^2$ denote the $2$-dim sphere in $\mathbb R^3$. I am interested in finding a space-filling curve, i.e. a map $\varphi: [0,1]\to S^2$ that is continuous and onto.

We know that there is such a space-filling curve onto $[0,1]^2$ from Peano's and Hilbert's results.

Know my idea was to consider a unit cube in $\mathbb R^3$. Then I want to take a path that traverses enough edges of the cube (or just take a Hamiltonian path). From an edge I want to fill its face with Peano's curve and then go back to the edge after filling. This construction yields a cube-filling curve. Then I blow the cube up to the sphere and I am done.

However, this seems to simple to me. Does that work or do I miss something?

• This seems to work. Another option is to take a space-filling curve $[0, 1] \to [0, 1]^2$ and compose it with a suitable parametrization of the sphere. The usual latitude-longitude parameterization should work, if we pre-compose with suitable affine functions. Commented Apr 18, 2016 at 18:04
• What do you mean by "its face"? An edge is adjacent to two faces. You have to make sure you don't miss a face: maybe fill both faces adjacent to the edge. Commented Apr 18, 2016 at 18:09
• Actually I meant nodes and not edges but then your remark changes from 2 to 3 faces ;) I want to do it in a way that every face is filled. That's why I have said sufficiently many. Commented Apr 18, 2016 at 18:13
• Something even simpler works: start with any continuous surjective function $[0,1] \to [0,1]^2$, and compose with any continuous surjective function $[0,1]^2 \to S^2$. For example, the quotient space obtained from $[0,1]^2$ by collapsing to a single point its boundary $([0,1] \times \{0,1\}) \cup (\{0,1\} \times [0,1])$ is homeomorphic to $S^2$. Commented Apr 18, 2016 at 18:42
• Were you able to find the best solution for this? Commented Jun 6, 2022 at 8:11

Your construction seems doable. Here's an alternate rough sketch of a construction (I hope it's ok if I don't produce the details):

Choose space filling curves $f_{m, n} : [0, 1] \to [n, n+1] \times [m, m + 1]$ for each integer $m, n$ so that they glue to a continuous surjection $f : \Bbb R \to \Bbb R^2$ in the sense that for each unit interval $I_k = [k, k +1] \subset \Bbb R$ with $k$ an integer, $f|_{I_k}$ is $f_{m, n}$ for some choice of $m, n$ (depending on $k$). That is, glue a bunch of space filling curves on each $[n, n + 1] \times [m, m + 1]$ systematically so that the endpoints agree. Continuity of $f$ is guaranteed by gluing lemma since endpoints of $f_{m, n}$ agree.

Note that the above construction can be done because you can always choose a space filling curve $f : I \to I^2$ so that the endpoint $f(0)$ and $f(1)$ are whatever you want them to be (you can cook up a Peano or Hilbert like construction with endpoints given).

Staring a bit carefully tells you that you can actually choose the endpoints so that $f$ is proper (that is, glue $f_{m, n}$ in a way so that $\{f(k)\}$ heads off to infinity as $k \to +\infty$ or $k \to -\infty$). Once that is done, proper maps can be extended to one-point compactifications, so $f$ extends to a space filling curve $\tilde{f} : S^1\to S^2$. Now compose with the map $g : I \to S^1$, $g(x) = e^{2\pi ix}$ and you're done.

• I like this approach! In my opinion it is less picturesque than my suggestion (especially the extension part) but it is more rigid and shows how powerful the tools of topology can be used. Commented Apr 18, 2016 at 21:09
• @SebastianBechtel Thanks. Extending proper maps to one point compactifications is actually not that hard to see though: proper means preimage of compact sets is compact, so preimage of complement of compact sets is complement of compact sets, which precisely means by definition of the topologyo on one-point compactifications that a neighborhood of the point at infinite pulls back to a neighborhood of the point at infinity. That's continuity. Commented Apr 18, 2016 at 21:14
• But I agree that this uses more tools than needs to be done. Your idea is a nice and elementary way to construct one . Commented Apr 18, 2016 at 21:14
• You've misunderstood me ;) It is not hard to check that the extension of a proper map to its Alexandroff extension is continuous but doing this and then using the homeomorphism between Alexandroff extension and the surface in $\mathbb R^3$ is harder to imagine then having a cube and deform it. That is what I mean with "less picturesque". But as I have said, I like it. Tools are there to be used :) Commented Apr 18, 2016 at 21:23
• Fair enough. ${}$ Commented Apr 18, 2016 at 21:25

I would approach this by first trying to fill a 3D simplex with a space filling triangle like this: https://www.youtube.com/watch?v=pw_50szQfA0. Then subdivide the simplex to approximate a sphere.

We want to construct a function $$f: [0,1) \mapsto S^2$$ such that $$f$$ is bijective and preserves locality like Peano's and Hilbert's curves.

Let $$v_k$$ denote the vertices of a tetrahedron inscribed in a sphere of radius 1. That is $$||v_k|| = 1, \forall k \in \{0,1,2,3\}$$.

Define $$N(v) = \cfrac{v}{||v||}$$

Let's first define the inverse map:

Given a vector $$v$$

First, find out the closest 3 points of the tetrahedron in the sphere. Say they are $$v_a, v_b, v_c$$. The first digit of the answer will be the only one in $$\{0,1,2,3\} - \{a,b,c\}$$

Now we subdivide this section, adding the points $$N(v_a +v_b), N(v_b+v_c), N(v_c + v_a)$$ to form 4 new triangles in the sphere:

(0) $$N(v_c + v_a), v_a , N(v_a + v_b)$$;

(1) $$N(v_a + v_b), N(v_b + v_c), N(v_c + v_a)$$;

(2) $$N(v_a + v_b), v_b, N(v_b + v_c)$$;

(3) $$N(v_b + v_c), v_c , N(v_c + v_a)$$;

Then you find the 3 closest of these in the sphere and you know in what triangle you are, the next digit is given by the name of the triangle in brackets. Now rename the vertices of the inner triangle and repeat the process.

Define $$f$$ by:

Given $$x \in [0,1)$$

Let $$x_k = \cfrac{\lfloor x\cdot 4^{k} \rfloor}{4}$$ denote the k'th digit of x in base 4 after the radix.

Firstly, with $$x_1$$ we already know that we are in the only triangle that doesn't contain $$v_{x_1}$$, now we get the other vertices $$a,b,c$$ of the triangle and subdivide it like in the definition of the inverse, the next digit determines in which triangle we are, rename the vertices of the newly find triangle in the same order provided and continue with the next digit