NAME

Math::PlanePath::MathImageCornerReplicate -- replicating squares

SYNOPSIS

use Math::PlanePath::MathImageCornerReplicate;
my $path = Math::PlanePath::MathImageCornerReplicate->new;
my ($x, $y) = $path->n_to_xy (123);

DESCRIPTION

In progress.

This path is a self-similar replicating corner fill,

 7  | 21-22 25-26 37-38 41-42
    |  |  |  |  |  |  |  |  |
 6  | 20 23-24 27 36 39-40 43
    |
 5  | 17-18 29-30 33-34 45-46
    |  |  |  |  |  |  |  |  |
 4  | 16 19 28 31-32 35 44 47
    |
 3  |  5--6  9-10 53-54 57-58
    |  |  |  |  |  |  |  |  |
 2  |  4  7--8 11 52 55-56 59
    |
 1  |  1--2 13-14 49-50 61-62
    |  |  |  |  |  |  |  |  |
Y=0 |  0  3 12 15 48 51 60 63
    +-------------------------
      X=0 1  2  3  4  5  6  7

The pattern is the initial N=0 to N=3 section,

+-------+-------+
|       |       |
|   1   |   2   |
|       |       |
+-------+-------+
|       |       |
|   0   |   3   |
|       |       |
+-------+-------+

It then repeats as 2x2 blocks arranged in the same pattern, then 4x4 blocks, etc.

Level Ranges

A given replication extends to

Nlevel = 4^level - 1
- (2^level - 1) <= X <= (2^level - 1)
- (2^level - 1) <= Y <= (2^level - 1)

FUNCTIONS

See "FUNCTIONS" in Math::PlanePath for the behaviour common to all path classes.

$path = Math::PlanePath::MathImageCornerReplicate->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.

SEE ALSO

Math::PlanePath, Math::PlanePath::HilbertCurve