Space-Filling Curves ---~
Total Page:16
File Type:pdf, Size:1020Kb
GENERAL I ARTICLE Space-filling Curves ReMittal In this article some Peano curves are exhibited and some of their recent applications are dis cussed. A C++ program to draw the Hilbert curve approximately is given. 1. Introduction R C Mittal is an Associate A 'continuous curve' in the plane is usually defined as Professor at the Univer the path traced by a moving point (x (t), Y (t)) as t runs sity of Roorkee, Roorkee. He has been teaching over an interval of the real line, where x(-) and y(.) are mathematics and continuous functions. The impression that goes with computer applications for this notion is that such a curve is an one-dimensional the last 20 years. He has object in the plane. So it was an exciting event in the been a National Science history of mathematics when in 1890, the Italian math Talent awardee of NCERT in mathematics. ematician Peano constructed a continuous curve which passed through every point in the unit square. Examples of such 'space-filling' curves were later constructed by Hilbert (in 1891), Moore (in 1900), Lebesgue (in 1904), Sierpinski (in 1912) and Schoenberg (in 1938). These have come to be known as Peano curves. In this note, we exhibit some of these curves, give some recent ap plications and also give a C.++ program to draw one of these - the Hilbert curve - approximately. 2. Some Space-filling Curves Recall that two sets A and B have the same cardinality if there is a one-to-one map from A onto B. It is well known that when both A and B are infinite sets, A may be a proper subset of B and still have the same cardinality. In 1878, George Cantor exhibited a one-to one map from the unit interval I = [0,1] onto the unit square S = [0, 1] x [0, 1], thus proving that I and Shave the same cardinality. --------~-------- 26 RESONANCE I December 2000 GENERAL I ARTICLE Can we find such a map from I onto S which is also Using the triadic continuous? (If so, I and S will be topologically homeo expansion of the morphic, by their cOlnpactness.) E Netto answered this numbers in [0,1], question in the negative in 1879 (see [1]). It is not dif Peano gave n ficult to see this, using the fact that both I and S are explicit connected sets and the removal of a boulldary point from construction of a S does not make it disconnected whereas the removal of continuous map I I an interior point from makes disconnected. from [0,1] onto The next question that arises is whether a continuous [O,1J x [0,1]. map can be found which is not one-to-one but just onto. This was indeed what Peano achieved. Using the triadic expansion of the real nun1bers in I he gave an explicit construction of a continuous Inap from I onto S. For details, see [1]. An example given later by Lebesgue makes use of the standard Cantor set in I. Recall that any number t in I has a triadic expansion given by t = 00 . L ad3\ where each ai takes one of the values 0,1, or 2. i=1 The Cantor set C can be defined as 00 1 C = {t : t = L ad3 . with ai = °or 2}. i=1 C is now well known as a fractal. Another (geometric) way to arrive at C is the following: from I, first relnove the open middle one-third interval G I = (1/3,2/3) and call what remains as Fl. Thus FI = [0,1/3] U [2/3, 1J. from each of the two intervals in F I , remove their open middle one-third intervals (1/9,2/9) and (7/9,8/9) and call what is left as F2. From each of the four intervals in F2, remove their open middle one-third intervals and call what remains as F3. And so on ad infinitum. What 00 finally remains is the Cantor set C = n Fn. Lebesgue's n=l construction can now be given as follows: for tEe with 00 i t = L ad3 , define i=l x(t) = (~b2;~1) y(t) = (~~i) --------~--------RESONANCE I December 2000 27 GENERAL I ARTICLE The Cantor set and where bi = ai/2. Any t tJ. C is an interior point of one the Hilbert curve of the deleted open intervals. Define x ( .) and y ( .) as are examples of linear functions in such intervals. Lebesgue showed that t -t (x(t), y(t)) defines a Peano curve (see [1]). fractals, a topic of great interest in The Peano curve defined by Schoenberg in 1938 makes modern times. use of a periodic function on the real line. Let for o ::; t ::; 1/3 p(t) = { ~t - 1 for 1/3 ::; t ::; 2/3 for 2/3 ::; t ::; 1 and extend p ( .) to the entire real line by taking p( - t) = p(t) and p(t + 2) = p(t). Define 00 p(32k-2t) 00 p(32k-1t) x(t) = L 2k ' y(t) = L k k=l k=l 2, for each t E [0: 1]. These infinite series are uniformly convergent and hence x(·) and y(.) are continuous func tions. For a proof that the range of I under (x (.), yC)) is the' unit square, see [2]. This space-filling curve was shown to be nowhere differentiable by (3]. However, much of the popularity of space-filling curves is due to the geometric construction given by the great German mathematician David Hilbert in 1891. His ba sic idea was that if the unit interval should fill the whole of S, then one-fourth of I will fill a corresponding sub square of S of area 1/4 with continuity in neighbouring squares. Next, I and S can be replaced by an interval of length 1/4 and a subsquare of area 1/4, respectively, and the process can be repeated. Thus for each n ~ 1, I and S are subdivided into 4n closed subintervals and 4n closed subsquares, respectively. The first four stages are shown in F'igure 1. At each stage, the centres of the subsquares are joined by consecutive straight lines in the manner indicated in Figure 1. This procedure defines a sequence of continuous functions from I into S. Since the lengths of the sides of the subsquares tend to zero, -28---------------------------~--------------------------- RESONANCE I December 2000 GENERAL I ARTICLE Figure 1. Fourstages of the Hi/bert curve. zero, this sequence converges uniformly to a limit func tion which is therefore continuous. This limit function is the Hilbert curve. It is clear that the range of this curve It may seem that is the whole of the unit square. Can you locate some space-filling curves points in the unit which have more than one pre-image are mostly an in the unit interval? academic curiosity or have The idea contained in the above construction has be recreational come the basis for the generation of fractals, a topic of applications, as great interest in modern times. The Cantor set as well they produce as the Hilbert curve are fractals - see the Classroom pretty pictures. Article in Resonance, Vol. 2 , No.lO, 1997. For more ex However, they amples of space-filling curves using the idea of fractals, became important see [4]. roots in 3. Applications of Space-filling Curves Mandelbrot's development of It may seem that space-filling curves are mostly an acad fractals as models emic curiosity or have recreational applications, as they of nature. produce pretty pictures. However, they became impor- -RE-S-O-N-A-N-C-E--I-D-e-ce-m-b-e-r--20-0-0----------~-----------------------------2-9 GENERAL I ARTICLE In 1991, a novel tant roots in Mandelbrot's development of fractals as digital halftoning Inodels of nature (see [5]). technique with the In nature, the organization of space-filling structures is aid of space-filling one of the fundamental building blocks of living beings. curves was An organ must be supplied with the necessary support introduced to ing substances such as water and oxygen. In many cases render a grey these substances will be transported through vessel sys scale image <?n a tems that must reach every point in the volume of the bilevel graphic organ. For example, the kidney houses three interwoven device such as a tree-like vessel systems, the arterial, the venous and the laser printer. urinary systems. Each one of them has access to every part of the kidney. 110reover (and this may come as a surprise) space-filling curves are found to have technical applications almost 100 years after their discovery. In 1991, Velho and others [6] introduced a novel digital halftoning technique useful to render a grey scale inlage on a bilevel graphic device such as a laser printer. The problem lies in the fact that a printer renders a bitmap, an array of black and white pixels, while shades of grey cannot be represented at the pixel level. To cope with this difficulty, several so called dithering techniques have been used. They are based on scanning a given grey scale image line by line or in small square blocks. A black and white approximation of the inlage is produced with the object of minimizing an overall error. Usually, there are artifacts in the re sult, which make it obvious that a dithering process was involved. Here space-filling curves come to our rescue. Imagine a Hilbert curve that passes through all pixels of the given grey scale ilnage.