1Math::PlanePath::Rows(3U)ser Contributed Perl DocumentatiMoanth::PlanePath::Rows(3)
2
3
4

NAME

6       Math::PlanePath::Rows -- points in fixed-width rows
7

SYNOPSIS

9        use Math::PlanePath::Rows;
10        my $path = Math::PlanePath::Rows->new (width => 20);
11        my ($x, $y) = $path->n_to_xy (123);
12

DESCRIPTION

14       This path is rows of a given fixed width.  For example width=7 is
15
16           width => 7
17
18             3  |  22  23  24 ...
19             2  |  15  16  17  18  19  20  21
20             1  |   8   9  10  11  12  13  14
21           Y=0  |   1   2   3   4   5   6   7
22                 -------------------------------
23                  X=0   1   2   3   4   5   6
24
25   N Start
26       The default is to number points starting N=1 as shown above.  An
27       optional "n_start" can give a different start, with the same shape.
28       For example to start at 0,
29
30           n_start => 0, width => 7
31
32             3  |  21  22  23  24 ...
33             2  |  14  15  16  17  18  19  20
34             1  |   7   8   9  10  11  12  13
35           Y=0  |   0   1   2   3   4   5   6
36                 -------------------------------
37                  X=0   1   2   3   4   5   6
38
39       The only effect is to push the N values around by a constant amount.
40       It might help match coordinates with something else zero-based.
41

FUNCTIONS

43       See "FUNCTIONS" in Math::PlanePath for behaviour common to all path
44       classes.
45
46       "$path = Math::PlanePath::Rows->new (width => $w)"
47       "$path = Math::PlanePath::Rows->new (width => $w, n_start => $n)"
48           Create and return a new path object.  A "width" parameter must be
49           supplied.
50
51       "($x,$y) = $path->n_to_xy ($n)"
52           Return the X,Y coordinates of point number $n in the path.
53
54       "$n = $path->xy_to_n ($x,$y)"
55           Return the point number for coordinates "$x,$y".
56
57           $x and $y are rounded to the nearest integers, which has the effect
58           of treating each point in the path as a square of side 1, so a
59           column -0.5 <= x < width+0.5 and y>=-0.5 is covered.
60
61       "($n_lo, $n_hi) = $path->rect_to_n_range ($x1,$y1, $x2,$y2)"
62           The returned range is exact, meaning $n_lo and $n_hi are the
63           smallest and biggest in the rectangle.
64

SEE ALSO

66       Math::PlanePath, Math::PlanePath::Columns
67

HOME PAGE

69       <http://user42.tuxfamily.org/math-planepath/index.html>
70

LICENSE

72       Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
73       2020 Kevin Ryde
74
75       This file is part of Math-PlanePath.
76
77       Math-PlanePath is free software; you can redistribute it and/or modify
78       it under the terms of the GNU General Public License as published by
79       the Free Software Foundation; either version 3, or (at your option) any
80       later version.
81
82       Math-PlanePath is distributed in the hope that it will be useful, but
83       WITHOUT ANY WARRANTY; without even the implied warranty of
84       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
85       General Public License for more details.
86
87       You should have received a copy of the GNU General Public License along
88       with Math-PlanePath.  If not, see <http://www.gnu.org/licenses/>.
89
90
91
92perl v5.36.0                      2022-07-22          Math::PlanePath::Rows(3)
Impressum