Math::...ndArms(3pm)

πŸ“¦
version 129 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’Ž NAME πŸ’Ž

Math::PlanePath::DiamondArms β€” four spiral arms, bestie. Four of them. Spiralling. It's giving geometry slay πŸ’…

(this is a User Contributed Perl Documentation page, aka Math::...ndArms(3pm), and yes the manual name got shortened to Math::...ndArms because apparently we ran out of room, iconic honestly)


✨ SYNOPSIS ✨

use Math::PlanePath::DiamondArms;
my $path = Math::PlanePath::DiamondArms->new;
my ($x, $y) = $path->n_to_xy (123);

πŸŒ€ DESCRIPTION πŸŒ€

okay so this path? it follows four spiral arms, and each one advances successively in a diamond pattern. no cap. here's the whole vibe:

                        25   ...                    4
                    29  14  21  36                  3
                33  18   7  10  17  32              2
            ... 22  11   4   3   6  13  28          1
            26  15   8   1   2   9  24 ...      <- Y=0
                30  19  12   5  20  35             -1
                    34  23  16  31                 -2
                      ...   27                     -3

                         ^
            -3  -2  -1  X=0  1   2   3   4

Each arm makes a spiral that widens out by 4 every time it goes around, so there's literally room for four of these arms. Each arm loop is 64 longer than the loop before it. for example N=13 to N=85 below is 84-13=72 points, and the next loop N=85 to N=221 is 221-85=136, which is an extra 64, ie. 72+64=136. math ate, fr fr πŸ“

                        25          ...
                       /  \           \
                     29  . 21  .  .  . 93
                    /        \           \
                  33  .  .  . 17  .  .  . 89
                 /              \           \
               37  .  .  .  .  . 13  .  .  . 85
              /                 /           /
            41  .  .  .  1  .  9  .  .  . 81
              \           \  /           /
               45  .  .  .  5  .  .  . 77
                 \                    /
                  49  .  .  .  .  . 73
                    \              /
                     53  .  .  . 69
                       \        /
                        57  . 65
                          \  /
                           61

Each arm is N=4*k+rem for a remainder rem=0,1,2,3, so sequences related to multiples of 4, or anything with a modulo 4 pattern, might land on particular arms. so if ur pattern is giving mod-4 energy, check which arm it's on πŸ‘‘

The starts of each arm N=1,2,3,4 are at X=0 or 1 and Y=0 or 1, like this:

                      ..
                        \
                    4    3  ..          Y=1
                  /        /
                ..  1    2           <- Y=0
                     \
                      ..
                    ^    ^
                   X=0  X=1

They could be centred around the origin by taking X-1/2,Y-1/2 so for example N=1 would be at -1/2,-1/2. But the it's done as N=1 at 0,0 to stay in integers. keeping it whole-number coded, as she should πŸ’–


🫢 FUNCTIONS 🫢

See "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes.

  • $path = Math::PlanePath::DiamondArms->new () β€” creates and returns a brand new path object. new path, new me, main character energy ✨
  • ($x,$y) = $path->n_to_xy ($n) β€” returns the X,Y coordinates of point number $n on the path. For $n < 1 the return is an empty list, because the path starts at 1 β€” no points before that, sorry bestie 😭

Fractional $n gives a point on the line between $n and $n+4, that $n+4 being the next point on the same spiralling arm. This is probably of limited use, but it arises fairly naturally from the calculation. so like, it's just there, doing its thing πŸ™ˆ

πŸŽ€ Descriptive Methods πŸŽ€

  • $arms = $path->arms_count() β€” returns 4. that's it. that's the whole method. four arms, periodt πŸ’…

πŸ‘€ SEE ALSO πŸ‘€

  • Math::PlanePath
  • Math::PlanePath::SquareArms
  • Math::PlanePath::DiamondSpiral

go read the whole squad, they're all iconic πŸ¦‹


🏠 HOME PAGE 🏠

http://user42.tuxfamily.org/math-planepath/index.html


πŸ“œ LICENSE πŸ“œ

Copyright 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/.

ok so real talk, that warranty disclaimer is not a joke, bestie β€” it literally means no promises, so don't come for anyone if it breaks πŸ’€

and that's the whole page!! this was perl v5.32.0, dated 2021-01-23, and it's the Math::...ndArms(3pm) manual β€” ty for coming to my TED talk, go spiral in a diamond pattern, ily πŸŽ€πŸ’–πŸŒˆ