Algorithms for Scientific Computing Space-Filling Curves Michael Bader Technical University of Munich Summer 2017 Start: Morton Order / Cantor’s Mapping 00 01 0000 0001 0100 0101 0010 0011 0110 0111 1000 1001 1100 1101 10 11 1010 1011 1110 1111 Questions: • Can this mapping lead to a contiguous “curve”? • i.e.: Can we find a continuous mapping? • and: Can this continuous mapping fill the entire square? Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 2 Morton Order and Cantor’s Mapping Georg Cantor (1877): 0:0110 ::: 0:01111001 ::: ! 0:1101 ::: • bijective mapping [0; 1] ! [0; 1]2 • proved identical cardinality of [0; 1] and [0; 1]2 • provoked the question: is there a continuous mapping? (i.e. a curve) Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 3 History of Space-Filling Curves 1877: Georg Cantor finds a bijective mapping from the unit interval [0; 1] into the unit square [0; 1]2. 1879: Eugen Netto proves that a bijective mapping f : I ! Q ⊂ Rn can not be continuous (i.e., a curve) at the same time (as long as Q has a smooth boundary). 1886: rigorous definition of curves introduced by Camille Jordan 1890: Giuseppe Peano constructs the first space-filling curves. 1890: Hilbert gives a geometric construction of Peano’s curve; and introduces a new example – the Hilbert curve 1904: Lebesgue curve 1912: Sierpinski curve Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 4 Part I Space-Filling Curves Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 5 What is a Curve? Definition (Curve) n As a curve, we define the image f∗(I) of a continuous mapping f : I! R . x = f (t); t 2 I, is called parameter representation of the curve. With: • I ⊂ R and I is compact, usually I = [0; 1]. • the image f∗(I) of the mapping f∗ is defined as n f∗(I) := ff (t) 2 R j t 2 Ig. • Rn may be replaced by any Euklidian vector space (norm & scalar product required). Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 6 What is a Space-filling Curve? Definition (Space-filling Curve) n Given a mapping f : I! R , then the corresponding curve f∗(I) is called a space-filling curve, if the Jordan content (area, volume, . ) of f∗(I) is larger than 0. Comments: • assume f : I ! Q ⊂ Rn to be surjective (i.e., every element in Q occurs as a value of f ); then, f∗(I) is a space-filling curve, if the area (volume) of Q is positive. • if the domain Q has a smooth boundary, then there can be no bijective n mapping f : I ! Q ⊂ R , such that f∗(I) is a space-filling curve (theorem: E. Netto, 1879). Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 7 Remember: Construction of the Hilbert Order Incremental construction of the Hilbert order: • start with the basic pattern on 4 subsquares • combine four numbering patterns to obtain a twice-as-large pattern • proceed with further iterations Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 8 Remember: Construction of the Hilbert Order Recursive construction of the Hilbert order: • start with the basic pattern on 4 subsquares • for an existing grid and Hilbert order: split each cell into 4 congruent subsquares • order 4 subsquares following the rotated basic pattern, such that a contiguous order is obtained Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 8 Definition of the Hilbert Curve’s Mapping Definition: (Hilbert curve) • each parameter t 2 I := [0; 1] is contained in a sequence of intervals I ⊃ [a1; b1] ⊃ ::: ⊃ [an; bn] ⊃ :::; where each interval results from a division-by-four of the previous interval. • each such sequence of intervals can be uniquely mapped to a corresponding sequence of 2D intervals (subsquares) ! “uniquely mapped” based on grammar for Hilbert order • the 2D sequence of intervals converges to a unique point q in q 2 Q := [0; 1] × [0; 1] – q is defined as h(t). Theorem h : I!Q defines a space-filling curve, the Hilbert curve. Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 9 Proof: h defines a Space-filling Curve We need to prove: • h is a mapping, i.e. each t 2 I has a unique function value h(t) ! OK, if h(t) is independent of the choice of the sequence of intervals (see next chapter) • h: I!Q is surjective: • for each point q 2 Q, we can construct an appropriate sequence of 2D-intervals • the 2D sequence corresponds in a unique way to a sequence of intervals in I – this sequence defines an original value of q ) every q 2 Q occurs as an image point. • h is continuous Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 10 Continuity of the Hilbert Curve A function f : I! Rn is uniformly continuous, if for each > 0 a δ > 0 exists, such that for all t1; t2 2 I with jt1 − t2j < δ, the following inequality holds: kf (t1) − f (t2)k2 < Strategy for the proof: For any given parameters t1; t2, we compute an estimate for the distance kh(t1) − h(t2)k2 (functional dependence on jt1 − t2j). ) for any given , we can then compute a suitable δ Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 11 Continuity of the Hilbert Curve (2) −n • given: t1; t2 2 I; choose an n, such that jt1 − t2j < 4 • in the n-th iteration of the interval sequence, all interval are of length 4−n ) [t1; t2] overlaps at most two neighbouring(!) intervals. • due to construction of the Hilbert curve, the values h(t1) and h(t2) will be in neighbouring subsquares with face length 2−n. • the two neighbouringp subsquares build a rectangle with a diagonal of −n length 2 · 5; p −n therefore: kh(t1) − h(t2)k2 ≤ 2 5 p For a given > 0, we choose an n, such that 2−n 5 < . −n Using that n, we choosep δ := 4 ; then, for all t1; t2 with jt1 − t2j < δ, we get: −n kh(t1) − h(t2)k2 ≤ 2 5 < . Which proves the continuity! Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 12 Part II Arithmetisation of Space-Filling Curves Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 13 Space-filling Orders – Required Algorithms Traversal of h-indexed objects: • given a set of objects with “positions” pi 2 Q • ¯−1 ¯−1 traverse all objects, such that h (pi0 ) < h (pi1 ) < : : : • solved by grammar representation Compute mapping: • for a given index t 2 I, compute the image h(t) Compute the index of a given point: • given p 2 Q, find a parameter t, such that h(t) = p • problem: inverse of h is not unique (h not bijective!) • define a “technically unique” inverse mapping h¯−1 Mapping and index computation required for random access to a data structure! Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 14 Arithmetic Formulation of the Hilbert Curve Idea: • interval sequence within the parameter interval I corresponds to a quaternary representation; e.g.: 1 2 3 4 ; 4 = [04:1; 04:2] ; 4 ; 1 = [04:3; 14:0] • self-similarity: every subsquare of the target domain contains a scaled, translated, and rotated/reflected Hilbert curve. ) Construction of the arithmetic representation: • find quaternary representation of the parameter • use quaternary coefficients to determine the required sequence of operations Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 15 Arithmetic Formulation of the Hilbert Curve (2) Recursive approach: h(04:q1q2q3q4 :::) = Hq1 ◦ h(04:q2q3q4 :::) • ~t = 04:q2q3q4 ::: is the relative parameter in the subinterval [04:q1; 04:(q1 + 1)] • h(~t) = h(04:q2q3q4 :::) is the relative position of the curve point in the subsquare ~ • Hq1 transforms h(t) to its correct position in the unit square: – rotation – translation • expanding the recursion equation leads to: h(04:q1q2q3q4 :::) = Hq1 ◦ Hq2 ◦ Hq3 ◦ Hq4 ◦ · · · Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 16 Arithmetic Formulation of the Hilbert Curve (3) If t is given in quaternary digits, i.e. t = 04:q1q2q3q4 :::, then h(t) may be represented as 0 h(0 :q q q q :::) = H ◦ H ◦ H ◦ H ◦ · · · 4 1 2 3 4 q1 q2 q3 q4 0 using the following operators: ! ! x 1 y x 1 x H := ! 2 H := ! 2 0 y 1 1 y 1 1 2 x 2 y + 2 ! ! x 1 x + 1 x − 1 y + 1 H := ! 2 2 H := ! 2 2 y 1 1 3 y 1 1 2 y + 2 − 2 x + 2 Michael Bader j Algorithms for Scientific Computing j Space-Filling Curves j Summer 2017 17 Matrix Form of the Operators H0;:::; H3 In matrix notation, the operators H0;:::; H3 are: 1 1 0 2 x 2 0 x 0 H0 := 1 H1 := 1 + 1 2 0 y 0 2 y 2 ! 1 0 x 1 0 − 1 x 1 H := 2 + 2 H := 2 + 2 0 1 y 1 3 − 1 0 y 1 2 2 2 2 Governing operations: • 1 scale with factor 2 0 • translate start of the curve, e.g.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages27 Page
-
File Size-