Math::...dRings(3pm)
π Math::PlanePath::FilledRings π
okay bestie, gather round, because this is a 3pm manual page and it's literally about drawing concentric filled lattice rings and I'm obsessed π
β¨ NAME β¨
Math::PlanePath::FilledRings β concentric filled lattice rings. that's it, that's the vibe π¦
β¨ SYNOPSIS β¨
use Math::PlanePath::FilledRings;
my $path = Math::PlanePath::FilledRings->new;
my ($x, $y) = $path->n_to_xy (123);
three lines. three. and you're already out here mapping integers to coordinates like the main character you are π
β¨ DESCRIPTION β¨
so this path drops points onto integer X,Y pixels, arranged in filled rings, and every single ring has radius 1 unit. one unit per ring, no cap π«Ά
110-109-108-107-106 6
/ \
112-111 79--78--77--76--75 105-104 5
| / \ |
114-113 80 48--47--46--45--44 74 103-102 4
| / | | \ |
115 81 50--49 27--26--25 43--42 73 101 3
/ / | / \ | \ \
116 82 52--51 28 14--13--12 24 41--40 72 100 2
| | | / / \ \ | | |
117 83 53 29 15 5-- 4-- 3 11 23 39 71 99 1
| | | | | | | | | | | |
118 84 54 30 16 6 1-- 2 10 22 38 70 98 <- Y=0
| | | | | | / / / / / /
119 85 55 31 17 7-- 8-- 9 21 37 69 97 137 -1
| | | \ \ / / | | |
120 86 56--57 32 18--19--20 36 67--68 96 136 -2
\ \ | \ / | / /
121 87 58--59 33--34--35 65--66 95 135 -3
| \ | | / |
122-123 88 60--61--62--63--64 94 133-134 -4
| \ / |
124-125 89--90--91--92--93 131-132 -5
\ /
126-127-128-129-130
^
-6 -5 -4 -3 -2 -1 X=0 1 2 3 4 5 6
look at her. the way she spirals outward ring by ring?? iconic. π
for example, the ring from N=22 to N=37 is literally all the points where
2.5 < hypot(X,Y) < 3.5
where hypot(X,Y) = sqrt(X^2+Y^2)
so it's a ring-shaped annulus, mathematically speaking, and it's giving geometry class but make it cute πΈ
π N Start π
by default, numbering starts at N=1 like in the picture up there ^^ but bestie, you can pass an optional "n_start" to kick things off somewhere else β same shape, different starting number, lowkey the same girl with a new haircut π
so for example, to start at 0:
26-25-24 n_start => 0
/ \
27 13-12-11 23
/ / \ \
28 14 4--3--2 10 22
| | | | | |
29 15 5 0--1 9 21
| | | / / /
30 16 6--7--8 20 36
\ \ / /
31 17-18-19 35
\ /
8 32-33-34
and the only effect is that it pushes all the N values by a constant amount. that's it, that's the whole thing. but it can help match N on the axes to counts of X,Y points < R or similar β so it's a little convenience queen, fr fr β¨
β¨ FUNCTIONS β¨
for the behaviour common to all path classes, go check "FUNCTIONS" in Math::PlanePath. we're just covering the local faves here π
$path = Math::PlanePath::FilledRings->new ()$path = Math::PlanePath::FilledRings->new (n_start => $n)β create and return a brand new path object. fresh out the box, no notes. π
β¨ OEIS β¨
entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include:
<http://oeis.org/A036704> (etc)
A036705 first diffs of N on X axis,
being count of X,Y points n-1/2 < norm <= n+1/2
A036706 1/4 of those diffs
n_start=1 (the default)
A036707 N/2+X-1 along X axis,
being count norm <= n+1/2 in half plane
A036708 (N(X,0)-N(X-1,0))/2+1,
first diffs of the half plane count
n_start=0
A036704 N on X axis, from X=1 onwards
count of X,Y points norm <= n+1/2
sequence numbers, bestie!! this path is literally published. we love a documented queen ππ
β¨ SEE ALSO β¨
Math::PlanePathMath::PlanePath::PixelRingsMath::PlanePath::HypotMath::PlanePath::MultipleRings
the whole friend group, all linked up π«Ά
β¨ HOME PAGE β¨
<http://user42.tuxfamily.org/math-planepath/index.html>
go say hi π
β¨ LICENSE β¨
Copyright 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 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/>.
ngl the all-caps warranty disclaimer is highkey the scariest part of any manpage and this one is no exception π no warranty bestie, we're all just out here redistributing software on a hope and a prayer π
and that's the page!! brought to you by perl v5.32.0, dated 2021-01-23 β slay, thanks for reading, go draw some rings π
β¨π
π¦ where this page comes from
- debian bookworm: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- debian trixie: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu jammy: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu noble: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu resolute: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu stonking: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms