hilbertCurve: calculate finite approximations of the Hilbert curve

Description Usage Arguments Value Author(s) See Also Examples

View source: R/hilbert.R

Description

These functions calculate the Hilbert curve in its finite approximations. hilbertCurvePoint gives the coordinates of one point and hilbertCurve returns an array with the coordinates of all 4^lv points. The functions are not needed for hilbertImage and only provided for demonstration purposes. plotHilbertCurve makes use of them.

Usage

1
2

Arguments

lv

The iteration level. A Hilbert curve of level lv spans a square with side length 2^lv (coordinates ranging from 0 to 2^lv-1) and has 4^lv points.

t

The point index in the Hilbert curve. Must be an integer in 0:(4^lv-1).

Value

hilbertCurvePoint returns a vector of two integer numbers, both in the range 0:(2^lv-1), indicating the coordinates of point t. huilbertCurve returns a matrix with 4^lv rows and 2 columns, giving all points of the curve at level lv.

Author(s)

Simon Anders, EMBL-EBI, sanders@fs.tum.de

See Also

plotHilbertCurve

Examples

1
2

Example output

Loading required package: grid
Loading required package: lattice
[1] 1 8
     x  y
1    0  0
2    1  0
3    1  1
4    0  1
5    0  2
6    0  3
7    1  3
8    1  2
9    2  2
10   2  3
11   3  3
12   3  2
13   3  1
14   2  1
15   2  0
16   3  0
17   4  0
18   4  1
19   5  1
20   5  0
21   6  0
22   7  0
23   7  1
24   6  1
25   6  2
26   7  2
27   7  3
28   6  3
29   5  3
30   5  2
31   4  2
32   4  3
33   4  4
34   4  5
35   5  5
36   5  4
37   6  4
38   7  4
39   7  5
40   6  5
41   6  6
42   7  6
43   7  7
44   6  7
45   5  7
46   5  6
47   4  6
48   4  7
49   3  7
50   2  7
51   2  6
52   3  6
53   3  5
54   3  4
55   2  4
56   2  5
57   1  5
58   1  4
59   0  4
60   0  5
61   0  6
62   1  6
63   1  7
64   0  7
65   0  8
66   0  9
67   1  9
68   1  8
69   2  8
70   3  8
71   3  9
72   2  9
73   2 10
74   3 10
75   3 11
76   2 11
77   1 11
78   1 10
79   0 10
80   0 11
81   0 12
82   1 12
83   1 13
84   0 13
85   0 14
86   0 15
87   1 15
88   1 14
89   2 14
90   2 15
91   3 15
92   3 14
93   3 13
94   2 13
95   2 12
96   3 12
97   4 12
98   5 12
99   5 13
100  4 13
101  4 14
102  4 15
103  5 15
104  5 14
105  6 14
106  6 15
107  7 15
108  7 14
109  7 13
110  6 13
111  6 12
112  7 12
113  7 11
114  7 10
115  6 10
116  6 11
117  5 11
118  4 11
119  4 10
120  5 10
121  5  9
122  4  9
123  4  8
124  5  8
125  6  8
126  6  9
127  7  9
128  7  8
129  8  8
130  8  9
131  9  9
132  9  8
133 10  8
134 11  8
135 11  9
136 10  9
137 10 10
138 11 10
139 11 11
140 10 11
141  9 11
142  9 10
143  8 10
144  8 11
145  8 12
146  9 12
147  9 13
148  8 13
149  8 14
150  8 15
151  9 15
152  9 14
153 10 14
154 10 15
155 11 15
156 11 14
157 11 13
158 10 13
159 10 12
160 11 12
161 12 12
162 13 12
163 13 13
164 12 13
165 12 14
166 12 15
167 13 15
168 13 14
169 14 14
170 14 15
171 15 15
172 15 14
173 15 13
174 14 13
175 14 12
176 15 12
177 15 11
178 15 10
179 14 10
180 14 11
181 13 11
182 12 11
183 12 10
184 13 10
185 13  9
186 12  9
187 12  8
188 13  8
189 14  8
190 14  9
191 15  9
192 15  8
193 15  7
194 14  7
195 14  6
196 15  6
197 15  5
198 15  4
199 14  4
200 14  5
201 13  5
202 13  4
203 12  4
204 12  5
205 12  6
206 13  6
207 13  7
208 12  7
209 11  7
210 11  6
211 10  6
212 10  7
213  9  7
214  8  7
215  8  6
216  9  6
217  9  5
218  8  5
219  8  4
220  9  4
221 10  4
222 10  5
223 11  5
224 11  4
225 11  3
226 11  2
227 10  2
228 10  3
229  9  3
230  8  3
231  8  2
232  9  2
233  9  1
234  8  1
235  8  0
236  9  0
237 10  0
238 10  1
239 11  1
240 11  0
241 12  0
242 13  0
243 13  1
244 12  1
245 12  2
246 12  3
247 13  3
248 13  2
249 14  2
250 14  3
251 15  3
252 15  2
253 15  1
254 14  1
255 14  0
256 15  0

HilbertVis documentation built on Nov. 8, 2020, 6:50 p.m.