Math::...elRings(3pm)
π Math::PlanePath::PixelRings π
okay bestie, welcome to the User Contributed Perl Documentation for Math::PlanePath::PixelRings(3pm) β it's a Perl module and it makes pixellated concentric circles and honestly? iconic behavior. β¨
πΈ NAME πΈ
Math::PlanePath::PixelRings β pixellated concentric circles π
β¨ SYNOPSIS β¨
use Math::PlanePath::PixelRings;
my $path = Math::PlanePath::PixelRings->new;
my ($x, $y) = $path->n_to_xy (123);
that's it. three lines. you're already slaying. π
π¦ DESCRIPTION π¦
so what this path does is it drops points onto the pixels of concentric circles, using the midpoint ellipse drawing algorithm. it's giving geometry, it's giving rasterization, it's giving art. π¨
63--62--61--60--59 5
/ \
64 . 40--39--38 . 58 4
/ / \ \
65 . 41 23--22--21 37 . 57 3
/ / / \ \ \
66 . 42 24 10-- 9-- 8 20 36 . 56 2
| / / / \ \ \ |
67 43 25 11 . 3 . 7 19 35 55 1
| | | | / \ | | | |
67 44 26 12 4 1 2 6 18 34 54 Y=0
| | | | \ /
68 45 27 13 . 5 . 17 33 53 80 -1
| \ \ \ / / / |
69 . 46 28 14--15--16 32 52 . 79 -2
\ \ \ / / /
70 . 47 29--30--31 51 . 78 -3
\ \ / /
71 . 48--49--50 . 77 -4
\ /
72--73--74--75--76 -5
-5 -4 -3 -2 -1 X=0 1 2 3 4 5
the way this algorithm works means the rings don't overlap. periodt. each ring is 4 or 8 pixels longer than the one before it. if the ring follows the preceding one super tightly then it's 4 longer β for example N=18 to N=33. if it goes wider then it's 8 longer β for example the N=54 to N=80 ring. the average extra is approximately 4*sqrt(2). math is mathing fr fr. π
you can think of the rings as being part-way between the diagonals like "DiamondSpiral" and the corners like "SquareSpiral".
* ** *****
* * *
* * *
* * *
* * *
diagonal ring corner
5 points 6 points 9 points
for example the N=54 to N=80 ring has a vertical part N=54,55,56 like a corner, then a diagonal part N=56,57,58,59. in bigger rings the verticals are all intermingled with the diagonals but the principle stays the same, no cap. the number of vertical steps determines where it crosses the 45-degree line, which is at R*sqrt(2) but rounded according to the midpoint algorithm. π§
π FUNCTIONS π
go read "FUNCTIONS" in Math::PlanePath for the behavior that's common to all the path classes, bestie β that's the shared lore. π
$path = Math::PlanePath::PixelRings->new ()β make a new path object and hand it back to you. fresh out the box. π($x,$y) = $path->n_to_xy ($n)β for"$n < 1"the return is an empty list, because it's considered there are no negative points. π« the behaviour for fractional$nis unspecified as yet β so like, don't count on it, it's still figuring itself out. π$n = $path->xy_to_n ($x,$y)β returns an integer point number for coordinates"$x,$y". every integer N is considered the centre of a unit square, and an"$x,$y"inside that square returns N. π― not every point of the plane is covered (like those ones marked with a"."in the sample above). if"$x,$y"is not reached then the return is"undef". π
π SEE ALSO π
Math::PlanePathMath::PlanePath::HypotMath::PlanePath::MultipleRings
π HOME PAGE π
<http://user42.tuxfamily.org/math-planepath/index.html>
π LICENSE π
Copyright 2010, 2011, 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/>.
fr fr, that warranty disclaimer is not a vibe, it's a legal document, and it means what it says. π
and that's the whole page, bestie!! this one's from perl v5.32.0, dated 2021-01-23 β go forth and draw your little circles, you absolute main character. πβ¨π¦πΈπ π«Ά
π¦ 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