Math::PlanePath::MathImagePyramidReplicate -- replicating squares
use Math::PlanePath::MathImagePyramidReplicate; my $path = Math::PlanePath::MathImagePyramidReplicate->new; my ($x, $y) = $path->n_to_xy (123);
This is a self-similar replicating pyramid shape made from 4 points each,
4 3 2 1 <- Y=0 -1 -2 -3 -4 ^ -4 -3 -2 -1 X=0 1 2 3 4
The base shape is the initial N=0 to N=8 section,
+---+ | 2 | +---+---+---+ | 3 | 0 | 1 | +---+---+---+
It then repeats inverted to make a similar shape but upside-down,
+---+---+---+---+---+---+---+ | 5 4 7 | 2 |13 12 15 | +---+ +---+ +---+ +---+ | 6 | 3 0 1 |14 | +---+---+---+---+---+ | 9 8 11 | +---+ +---+ |10 | +---+
A given replication extends to ...
Nlevel = 4^level - 1 - ... <= X <= ... - ... <= Y <= ...
This pattern corresponds to expressing a complex integer X+i*Y in base b=...
X+Yi = a[n]*b^n + ... + a[2]*b^2 + a[1]*b + a[0]
using complex digits a[i] encoded in N in integer base 4 ...
a[i] digit N digit ---------- ------- 0 0 1 1 i 2 -1 3
See "FUNCTIONS" in Math::PlanePath for the behaviour common to all path classes.
$path = Math::PlanePath::MathImagePyramidReplicate->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
$n < 0
Math::PlanePath, Math::PlanePath::CornerReplicate, Math::PlanePath::SquareReplicate, Math::PlanePath::LTiling, Math::PlanePath::GosperReplicate, Math::PlanePath::QuintetReplicate
To install App::MathImage::Image::Base::Caca, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::MathImage::Image::Base::Caca
CPAN shell
perl -MCPAN -e shell install App::MathImage::Image::Base::Caca
For more information on module installation, please visit the detailed CPAN module installation guide.