.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Math::PlanePath::StaircaseAlternating 3pm" .TH Math::PlanePath::StaircaseAlternating 3pm "2021-01-23" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Math::PlanePath::StaircaseAlternating \-\- stair\-step diagonals up and down .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Math::PlanePath::StaircaseAlternating; \& my $path = Math::PlanePath::StaircaseAlternating\->new; \& my ($x, $y) = $path\->n_to_xy (123); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This path makes a staircase pattern up from Y axis down to the X and then back up again. .PP .Vb 10 \& 10 46 \& | \& 9 47\-\-48 \& | \& 8 45 49\-\-50 \& | | \& 7 44\-\-43 51\-\-52 \& | | \& 6 16 42\-\-41 53\-\-54 \& | | | \& 5 17\-\-18 40\-\-39 55\-\-... \& | | \& 4 15 19\-\-20 38\-\-37 \& | | | \& 3 14\-\-13 21\-\-22 36\-\-35 \& | | | \& 2 2 12\-\-11 23\-\-24 34\-\-33 \& | | | | \& 1 3\-\- 4 10\-\- 9 25\-\-26 32\-\-31 \& | | | | \& Y=0 \-> 1 5\-\- 6 8\-\- 7 27\-\-28 30\-\-29 \& \& ^ \& X=0 1 2 3 4 5 6 7 8 .Ve .SS "Square Ends" .IX Subsection "Square Ends" Option \f(CW\*(C`end_type => "square"\*(C'\fR changes the path as follows, omitting one point at each end so as to square up the joins. .PP .Vb 10 \& 9 42\-\-43 \& | | \& 8 41 44\-\-45 \& | | \& 7 40\-\-39 46\-\-47 \& | | \& 6 . 38\-\-37 48\-\-49 \& | | \& 5 14\-\-15 36\-\-35 50\-\-... \& | | | \& 4 13 16\-\-17 34\-\-33 \& | | | \& 3 12\-\-11 18\-\-19 32\-\-31 \& | | | \& 2 . 10\-\- 9 20\-\-21 30\-\-29 \& | | | \& 1 2\-\- 3 8\-\- 7 22\-\-23 28\-\-27 \& | | | | | \& Y=0 \-> 1 4\-\- 5\-\- 6 . 24\-\-25\-\-26 \& \& ^ \& X=0 1 2 3 4 5 6 7 8 .Ve .PP The effect is to shorten each diagonal by a constant 1 each time. The lengths of each diagonal still grow by +4 each time (or by +16 up and back). .SS "N Start" .IX Subsection "N Start" The default is to number points starting N=1 as shown above. An optional \&\f(CW\*(C`n_start\*(C'\fR can give a different start, in the same pattern. For example to start at 0, .PP .Vb 1 \& n_start => 0 n_start => 0, end_type=>"square" \& \& 46 47 41 42 \& 44 48 49 40 43 44 \& 43 42 50 51 39 38 45 46 \& 15 41 40 52 53 37 36 47 48 \& 16 17 39 38 ... 13 14 35 34 ... \& 14 18 19 37 36 12 15 16 33 32 \& 13 12 20 21 35 34 11 10 17 18 31 30 \& 1 11 10 22 23 33 32 9 8 19 20 29 28 \& 2 3 9 8 24 25 31 30 1 2 7 6 21 22 27 26 \& 0 4 5 7 6 26 27 29 28 0 3 4 5 23 24 25 .Ve .SH "FUNCTIONS" .IX Header "FUNCTIONS" See \*(L"\s-1FUNCTIONS\*(R"\s0 in Math::PlanePath for behaviour common to all path classes. .ie n .IP """$path = Math::PlanePath::StaircaseAlternating\->new ()""" 4 .el .IP "\f(CW$path = Math::PlanePath::StaircaseAlternating\->new ()\fR" 4 .IX Item "$path = Math::PlanePath::StaircaseAlternating->new ()" .PD 0 .ie n .IP """$path = Math::PlanePath::StaircaseAlternating\->new (end_type => $str, n_start => $n)""" 4 .el .IP "\f(CW$path = Math::PlanePath::StaircaseAlternating\->new (end_type => $str, n_start => $n)\fR" 4 .IX Item "$path = Math::PlanePath::StaircaseAlternating->new (end_type => $str, n_start => $n)" .PD Create and return a new path object. The \f(CW\*(C`end_type\*(C'\fR choices are .Sp .Vb 2 \& "jump" (the default) \& "square" .Ve .ie n .IP """($x,$y) = $path\->n_to_xy ($n)""" 4 .el .IP "\f(CW($x,$y) = $path\->n_to_xy ($n)\fR" 4 .IX Item "($x,$y) = $path->n_to_xy ($n)" Return the X,Y coordinates of point number \f(CW$n\fR on the path. .SH "OEIS" .IX Header "OEIS" Entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include .Sp .RS 4 (etc) .RE .PP .Vb 6 \& end_type=jump, n_start=1 (the defaults) \& A084849 N on diagonal X=Y \& end_type=jump, n_start=0 \& A014105 N on diagonal X=Y, second hexagonal numbers \& end_type=jump, n_start=2 \& A096376 N on diagonal X=Y \& \& end_type=square, n_start=1 \& A058331 N on diagonal X=Y, 2*squares+1 \& end_type=square, n_start=0 \& A001105 N on diagonal X=Y, 2*squares .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Math::PlanePath, Math::PlanePath::Staircase, Math::PlanePath::DiagonalsAlternating .SH "HOME PAGE" .IX Header "HOME PAGE" .SH "LICENSE" .IX Header "LICENSE" Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Kevin Ryde .PP Math-PlanePath is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. .PP Math-PlanePath is distributed in the hope that it will be useful, but \&\s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 See the \s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with Math-PlanePath. If not, see .