Math::NumSeq::PlanePathN -- sequence of N values from PlanePath module
use Math::NumSeq::PlanePathN; my $seq = Math::NumSeq::PlanePathN->new (planepath => 'SquareSpiral', line_type => 'X_axis'); my ($i, $value) = $seq->next;
This module presents N values from a
Math::PlanePath as a sequence. The default is the X axis, or the
line_type parameter (a string) can choose among
"X_axis" X axis "Y_axis" Y axis "X_neg" X negative axis "Y_neg" Y negative axis "Diagonal" leading diagonal X=i, Y=i "Diagonal_NW" north-west diagonal X=-i, Y=i "Diagonal_SW" south-west diagonal X=-i, Y=-i "Diagonal_SE" south-east diagonal X=i, Y=-i "Depth_start" first N at depth=i "Depth_end" last N at depth=i
For example the
SquareSpiral X axis starts i=0 with values 1, 2, 11, 28, 53, 86, etc.
"X_neg", "Y_neg", "Diagonal_NW", etc, on paths which don't traverse negative X or Y have just a single value from X=0,Y=0.
The behaviour on paths which visit only some of the points on the respective axis is unspecified as yet, as is behaviour on paths with repeat points, such as the
See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.
$seq = Math::NumSeq::PlanePathN->new (key=>value,...)
Create and return a new sequence object. The options are
planepath string, name of a PlanePath module planepath_object PlanePath object line_type string, as described above
planepath can be either the module part such as "SquareSpiral" or a full class name "Math::PlanePath::SquareSpiral".
$value = $seq->ith($i)
Return the N value at
$i in the PlanePath.
$i gives a position on the respective
line_type, so the X,Y to lookup a
X,Y line_type ----- --------- $i, 0 "X_axis" 0, $i "Y_axis" -$i, 0 "X_neg" 0, -$i "Y_neg" $i, $i "Diagonal" $i, -$i "Diagonal_NW" -$i, -$i "Diagonal_SW" $i, -$i "Diagonal_SE"
$bool = $seq->pred($value)
Return true if
$value occurs in the sequence.
$value is an integer N which is on the respective
line_type, ie. that
($path->n_to_xy($value) is on the line type.
Copyright 2011, 2012, 2013, 2014 Kevin Ryde
This file is part of Math-PlanePath.
Math-PlanePath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Math-PlanePath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.