1Math::PlanePath::ColumnUss(e3r)Contributed Perl DocumentMaattiho:n:PlanePath::Columns(3)
2
3
4
6 Math::PlanePath::Columns -- points in fixed-height columns
7
9 use Math::PlanePath::Columns;
10 my $path = Math::PlanePath::Columns->new;
11 my ($x, $y) = $path->n_to_xy (123);
12
14 This path is columns of a given fixed height. For example height 5
15 would be
16
17 |
18 4 | 5 10 15 20 <--- height==5
19 3 | 4 9 14 19
20 2 | 3 8 13 18
21 1 | 2 7 12 17 ...
22 Y=0 | 1 6 11 16 21
23 ----------------------
24 X=0 1 2 3 4 ...
25
26 N Start
27 The default is to number points starting N=1 as shown above. An
28 optional "n_start" can give a different start, with the same shape.
29 For example to start at 0,
30
31 n_start => 0, height => 5
32
33 4 | 4 9 14 19
34 3 | 3 8 13 18
35 2 | 2 7 12 17
36 1 | 1 6 11 16 ...
37 Y=0 | 0 5 10 15 20
38 ----------------------
39 X=0 1 2 3 4 ...
40
41 The only effect is to push the N values around by a constant amount.
42 It might help match coordinates with something else zero-based.
43
45 See "FUNCTIONS" in Math::PlanePath for behaviour common to all path
46 classes.
47
48 "$path = Math::PlanePath::Columns->new (height => $h)"
49 "$path = Math::PlanePath::Columns->new (height => $h, n_start => $n)"
50 Create and return a new path object. A "height" parameter must be
51 supplied.
52
53 "($x,$y) = $path->n_to_xy ($n)"
54 Return the X,Y coordinates of point number $n in the path.
55
56 "$n = $path->xy_to_n ($x,$y)"
57 Return the point number for coordinates "$x,$y".
58
59 $x and $y are rounded to the nearest integers, which has the effect
60 of treating each point in the path as a square of side 1, so a
61 rectangle $x >= -0.5 and -0.5 <= y < height+0.5 is covered.
62
63 "($n_lo, $n_hi) = $path->rect_to_n_range ($x1,$y1, $x2,$y2)"
64 The returned range is exact, meaning $n_lo and $n_hi are the
65 smallest and biggest in the rectangle.
66
68 Math::PlanePath, Math::PlanePath::Rows, Math::PlanePath::CoprimeColumns
69
71 <http://user42.tuxfamily.org/math-planepath/index.html>
72
74 Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Kevin
75 Ryde
76
77 This file is part of Math-PlanePath.
78
79 Math-PlanePath is free software; you can redistribute it and/or modify
80 it under the terms of the GNU General Public License as published by
81 the Free Software Foundation; either version 3, or (at your option) any
82 later version.
83
84 Math-PlanePath is distributed in the hope that it will be useful, but
85 WITHOUT ANY WARRANTY; without even the implied warranty of
86 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87 General Public License for more details.
88
89 You should have received a copy of the GNU General Public License along
90 with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.
91
92
93
94perl v5.32.0 2020-07-28 Math::PlanePath::Columns(3)