NAME
Math::PlanePath::MathImageHilbertMidpoint -- Hilbert curve midpoints
SYNOPSIS
use Math::PlanePath::MathImageHilbertMidpoint;
my $path = Math::PlanePath::MathImageHilbertMidpoint->new;
my ($x, $y) = $path->n_to_xy (123);
DESCRIPTION
In progress ...
This is the midpoints of each segment of the HilbertCurve.
\
14 62 48----- 47 43----- 42
\ / \ / \
13 61 49 46 44 41
/ \ \ / /
12 60 50 45 40
/ \ /
11 59 51 39
| | \
10 | 55 | 33 38
| / \ | / \ \
9 58 56 54 52 32 34 37
\ / \ / | \ /
8 57 53 | 35----- 36
|
7 31
|
6 5 9 | 27----- 26
/ \ / \ | / \
5 4 6 8 10 30 28 25
| \ / | \ / /
4 | 7 | 29 24
| | /
3 3 11 23
\ / \
2 2 12 17 22
\ / / \ \
1 1 13 16 18 21
/ \ / \ /
Y=0 -> 0 14----- 15 19----- 20
X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
The coordinates are 2*X and 2*Y so as to put the midpoints on integers, where in the HilbertCurve they would be 0.5 fractions.
*---5---* *---9---*
| | | |
4 6 8 10
| | | |
* *---7---* *
| |
3 11
| |
*---2---* *--12---*
| |
1 13
| |
*---0---* *--14---*--15--
The HilbertCurve doesn't traverse every edge and together with the scaling means these midpoints visit only 1 out of each 4 points of the first quadrant in a kind of lobed layout.
FUNCTIONS
See "FUNCTIONS" in Math::PlanePath for the behaviour common to all path classes.
$path = Math::PlanePath::MathImageHilbertMidpoint->new ()
-
Create and return a new path object.
($x,$y) = $path->n_to_xy ($n)
-
Return the X,Y coordinates of point number
$n
on the path. Points begin at 0 and if$n < 0
then the return is an empty list. $n = $path->n_start()
-
Return 0, the first N in the path.