search.cpan.org is shutting down
For details read Perl NOC. After June 25th this page will redirect to MetaCPAN.org
Kevin Ryde > Math-PlanePath > Math::NumSeq::PlanePathN

Download:
Math-PlanePath-126.tar.gz

Dependencies

Annotate this POD

Website

# CPAN RT

 Open 0
View/Report Bugs
Module Version: 126

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

# HOME PAGE

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

# LICENSE

Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 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/>.

syntax highlighting: