++ed by:
Kevin Ryde
and 1 contributors

# NAME

Math::NumSeq::PlanePathN -- sequence of N values from PlanePath module

# SYNOPSIS

`````` use Math::NumSeq::PlanePathN;
my \$seq = Math::NumSeq::PlanePathN->new (planepath => 'SquareSpiral',
line_type => 'X_axis');
my (\$i, \$value) = \$seq->next;``````

# DESCRIPTION

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_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 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 `\$value=N` is

``````     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.

This means `\$value` is an integer N which is on the respective `line_type`, ie. that `(\$path->n_to_xy(\$value)` is on the line type.

http://user42.tuxfamily.org/math-planepath/index.html