Math::NumSeq::PlanePathN3pm
Usage
use Math::NumSeq::PlanePathN;my $seq = Math::NumSeq::PlanePathN->new (planepath => 'SquareSpiral',line_type => 'X_axis');my ($i, $value) = $seq->next;
Overview
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 (positive part)"Y_axis" Y axis (positive part)"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 "DragonCurve".
Functions
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 moduleplanepath_object PlanePath objectline_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
$iin the PlanePath.$igives a position on the respective"line_type", so the X,Y to lookup a"$value=N"isX,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
$valueoccurs in the sequence.This means
$valueis an integer N which is on the respective"line_type", ie. that"($path->n_to_xy($value)"is on the line type.
Home page
<http://user42.tuxfamily.org/math-planepath/index.html>
Releases
6 releases since Debian 8 (Jessie); the text changed 3 times.