1Math::PlanePath::StaircUasseerAlCtoenrtnraitbiuntge(d3M)Paetrhl::DPolcaunmeePnattaht:i:oSntaircaseAlternating(3)
2
3
4

NAME

6       Math::PlanePath::StaircaseAlternating -- stair-step diagonals up and
7       down
8

SYNOPSIS

10        use Math::PlanePath::StaircaseAlternating;
11        my $path = Math::PlanePath::StaircaseAlternating->new;
12        my ($x, $y) = $path->n_to_xy (123);
13

DESCRIPTION

15       This path makes a staircase pattern up from Y axis down to the X and
16       then back up again.
17
18           10       46
19                     |
20            9       47--48
21                         |
22            8       45  49--50
23                     |       |
24            7       44--43  51--52
25                         |       |
26            6       16  42--41  53--54
27                     |       |       |
28            5       17--18  40--39  55--...
29                         |       |
30            4       15  19--20  38--37
31                     |       |       |
32            3       14--13  21--22  36--35
33                         |       |       |
34            2        2  12--11  23--24  34--33
35                     |       |       |       |
36            1        3-- 4  10-- 9  25--26  32--31
37                         |       |       |       |
38           Y=0 ->    1   5-- 6   8-- 7  27--28  30--29
39
40                     ^
41                    X=0  1   2   3   4   5   6   7   8
42
43   Square Ends
44       Option "end_type => "square"" changes the path as follows, omitting one
45       point at each end so as to square up the joins.
46
47            9       42--43
48                     |   |
49            8       41  44--45
50                     |       |
51            7       40--39  46--47
52                         |       |
53            6        .  38--37  48--49
54                             |       |
55            5       14--15  36--35  50--...
56                     |   |       |
57            4       13  16--17  34--33
58                     |       |       |
59            3       12--11  18--19  32--31
60                         |       |       |
61            2        .  10-- 9  20--21  30--29
62                             |       |       |
63            1        2-- 3   8-- 7  22--23  28--27
64                     |   |       |       |       |
65           Y=0 ->    1   4-- 5-- 6   .  24--25--26
66
67                     ^
68                    X=0  1   2   3   4   5   6   7   8
69
70       The effect is to shorten each diagonal by a constant 1 each time.  The
71       lengths of each diagonal still grow by +4 each time (or by +16 up and
72       back).
73
74   N Start
75       The default is to number points starting N=1 as shown above.  An
76       optional "n_start" can give a different start, in the same pattern.
77       For example to start at 0,
78
79           n_start => 0                  n_start => 0, end_type=>"square"
80
81           46 47                            41 42
82           44 48 49                         40 43 44
83           43 42 50 51                      39 38 45 46
84           15 41 40 52 53                      37 36 47 48
85           16 17 39 38 ...                  13 14 35 34 ...
86           14 18 19 37 36                   12 15 16 33 32
87           13 12 20 21 35 34                11 10 17 18 31 30
88            1 11 10 22 23 33 32                 9  8 19 20 29 28
89            2  3  9  8 24 25 31 30           1  2  7  6 21 22 27 26
90            0  4  5  7  6 26 27 29 28        0  3  4  5    23 24 25
91

FUNCTIONS

93       See "FUNCTIONS" in Math::PlanePath for behaviour common to all path
94       classes.
95
96       "$path = Math::PlanePath::StaircaseAlternating->new ()"
97       "$path = Math::PlanePath::StaircaseAlternating->new (end_type => $str,
98       n_start => $n)"
99           Create and return a new path object.  The "end_type" choices are
100
101               "jump"        (the default)
102               "square"
103
104       "($x,$y) = $path->n_to_xy ($n)"
105           Return the X,Y coordinates of point number $n on the path.
106

OEIS

108       Entries in Sloane's Online Encyclopedia of Integer Sequences related to
109       this path include
110
111           <http://oeis.org/A084849> (etc)
112
113           end_type=jump, n_start=1  (the defaults)
114             A084849    N on diagonal X=Y
115           end_type=jump, n_start=0
116             A014105    N on diagonal X=Y, second hexagonal numbers
117           end_type=jump, n_start=2
118             A096376    N on diagonal X=Y
119
120           end_type=square, n_start=1
121             A058331    N on diagonal X=Y, 2*squares+1
122           end_type=square, n_start=0
123             A001105    N on diagonal X=Y, 2*squares
124

SEE ALSO

126       Math::PlanePath, Math::PlanePath::Staircase,
127       Math::PlanePath::DiagonalsAlternating
128

HOME PAGE

130       <http://user42.tuxfamily.org/math-planepath/index.html>
131

LICENSE

133       Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Kevin Ryde
134
135       Math-PlanePath is free software; you can redistribute it and/or modify
136       it under the terms of the GNU General Public License as published by
137       the Free Software Foundation; either version 3, or (at your option) any
138       later version.
139
140       Math-PlanePath is distributed in the hope that it will be useful, but
141       WITHOUT ANY WARRANTY; without even the implied warranty of
142       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
143       General Public License for more details.
144
145       You should have received a copy of the GNU General Public License along
146       with Math-PlanePath.  If not, see <http://www.gnu.org/licenses/>.
147
148
149
150perl v5.32.0                      2020-M0a7t-h2:8:PlanePath::StaircaseAlternating(3)
Impressum