NAME
Math::NumSeq::PlanePathTurn -- turn sequence from PlanePath module
SYNOPSIS
use Math::NumSeq::PlanePathTurn;
my $seq = Math::NumSeq::PlanePathTurn->new (planepath => 'DragonCurve',
turn_type => 'Left');
my ($i, $value) = $seq->next;
DESCRIPTION
This is a tie-in to present turns from a Math::PlanePath
module in the form of a NumSeq sequence.
The turn_type
choices are
"Left" 1=left 0=right or straight
"LSR" 1=left 0=straight -1=right
In each case the value at i is turn which occurs at N=i, ie. between the segments N=i-1 to N=i to N=i+1
i+1
|
|
i-1 ---- i turn at i
For multiple "arms" the turn follows that particular arm so it's i-arms, i, i+arms. i values start n_start()+arms_count()
so i-arms is the first N on the path. For example a single arm path beginning N=0 has its first turn at i=1.
FUNCTIONS
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::PlanePathTurn->new (key=>value,...)
-
Create and return a new sequence object. The options are
planepath string, name of a PlanePath module planepath_object PlanePath object turn_type string, as described above
planepath
can be just the module part such as "SquareSpiral" or a full class name "Math::PlanePath::SquareSpiral". $value = $seq->ith($i)
-
Return the turn at N=$i in the PlanePath.
$bool = $seq->pred($value)
-
Return true if
$value
occurs as a turn. Often this is merely the possible turn values 1,0,-1, etc, but some spiral paths for example only go left or straight in which case only 1 and 0 occur andpred()
reflects that. $i = $seq->i_start()
-
Return the first index
$i
in the sequence. This is the positionrewind()
returns to.This is
$path->n_start() - $path->arms_count()
from the PlanePath object.
SEE ALSO
Math::NumSeq, Math::NumSeq::PlanePathCoord, Math::NumSeq::PlanePathDelta, Math::NumSeq::PlanePathN