NAME
Math::PlanePath::DragonArms -- four dragon curves
SYNOPSIS
use Math::PlanePath::DragonArms;
my $path = Math::PlanePath::DragonArms->new;
my ($x, $y) = $path->n_to_xy (123);
DESCRIPTION
This is four arms of the dragon or paper folding curve by Heighway, Harter and others.
60/76 --64/191
|
56/88 --52/187 183/40 --36/107
| | |
33/108 29/96 17/92 13/48 -- 44/28 -- 32/95
|
37/184 25/41 6/21 --- 2/9 5/24 -- 20/91 55/87
| |
49/188 14/45 --- 10/3 0 1/12 -- 16/47 51/186
| | |
53/85 18/89 --- 22/7 11/4 --- 8/23 27/43 39/182
|
30/93 -- 26/42 -- 15/46 19/90 31/94 35/106
| | |
34/105 --38/181 185/50 -- 54/86
|
62/189 -- 58/74
^ ^ ^ ^ ^ ^ ^
-3 -2 -1 X=0 1 2 3
The curve visits each X,Y point twice (except the origin 0,0). Each edge between X,Y points is traversed just once and each arm doesn't cross itself or other arms so it's just the vertexes which touch.
FUNCTIONS
$path = Math::PlanePath::DragonArms->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.Fractional positions give an X,Y position along a straight line between the integer positions.
$n = $path->n_start()
-
Return 0, the first N in the path.