Math::...Rounded(3pm)

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

✨ Math::...Rounded πŸ’… (aka Math::PlanePath::TerdragonRounded)

okay bestie, so this is a page from the User Contributed Perl Documentation, and the manual name it's filed under is Math::...Rounded(3pm) β€” that's the abbreviated title, the real full name is the one right below, don't panic 🫢


🌸 NAME 🌸

Math::PlanePath::TerdragonRounded β€” the triangular dragon curve, but with rounded corners πŸ’–


✨ SYNOPSIS ✨

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

# or another radix digits ...
my $path5 = Math::PlanePath::TerdragonRounded->new (radix => 5);

πŸ¦‹ DESCRIPTION πŸ¦‹

This is a version of the terdragon curve with rounded-off corners, no cap:

   ...         44----43                                   14
     \        /        \
      46----45     .    42                                13
                       /
          .    40----41                                   12
              /
            39     .    24----23          20----19        11
              \        /        \        /        \
          .    38    25     .    22----21     .    18     10
              /        \                          /
      36----37     .    26----27     .    16----17         9
     /                          \        /
   35     .    32----31     .    28    15     .            8
     \        /        \        /        \
      34----33          30----29     .    14               7
                                         /
                            .    12----13     .            6
                                /
                              11     .     8-----7         5
                                \        /        \
                                 10-----9     .     6      4
                                                  /
                                     .     4-----5         3
                                         /
                                        3                  2
                                         \
                                     .     2               1
                                         /
                            .     0-----1     .       <- Y=0

    ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^
   -8 -7 -6 -5 -4 -3 -2 -1 X=0 1  2  3  4  5  6  7  8

The plain TerdragonCurve is tripled in size, and two points on each 3-long edge are visited by the TerdragonRounded here. like. it's the glow-up version of the same shape πŸ’…

πŸŽ€ Arms πŸŽ€

Multiple copies of the curve can be selected, each advancing successively. The curve is 1/6 of the plane (like the plain terdragon) and 6 arms rotated by 60, 120, 180, 240 and 300 degrees mesh together perfectly. the way that they just fit?? obsessed 😭

arms => 6 begins as follows. N=0,6,12,18,etc is the first arm (the curve shown above), then N=1,7,13,19 the second copy rotated 60 degrees, N=2,8,14,20 the third rotated 120, etc.

   arms=>6              43----37          72--...
                       /        \        /
              ...    49          31    66          48----42
              /        \        /        \        /        \
            73          55    25          60----54          36
              \        /        \                          /
               67----61          19----13          24----30
                                         \        /
      38----32          14-----8           7    18          71---...
     /        \        /        \        /        \        /
   44          26----20           2     1          12    65
     \                                            /        \
      50----56           9-----3     .     0-----6          59----53
              \        /                                            \
   ...         62    15           4     5          23----29          47
     \        /        \        /        \        /        \        /
      74----68          21    10          11----17          35----41
                       /        \
               33----27          16----22          64----70
              /                          \        /        \
            39          57----63          28    58          76
              \        /        \        /        \        /
               45----51          69    34          52    ...
                                /        \        /
                         ...--75          40----46

    ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^  ^
   -11-10-9 -8 -7 -6 -5 -4 -3 -2 -1 X=0 1  2  3  4  5  6  7  8  9 10 11

πŸ‘‘ FUNCTIONS πŸ‘‘

See "FUNCTIONS" in Math::PlanePath for the behaviour common to all path classes. that's the shared lore, iykyk πŸ’œ

  • $path = Math::PlanePath::TerdragonRounded->new ()
  • $path = Math::PlanePath::TerdragonRounded->new (arms => $count)

Create and return a new path object. fresh path, just dropped ✨

  • ($x,$y) = $path->n_to_xy ($n)

Return the X,Y coordinates of point number $n on the path. Points begin at 0 and if $n < 0 then the return is an empty list. (yes literally empty, nothing, nada, the void πŸ’€)

Fractional positions give an X,Y position along a straight line between the integer positions. so you can slide between them, cute πŸ“

🌈 Level Methods 🌈

  • ($n_lo, $n_hi) = $path->level_to_n_range($level)

Return (0, 2 * 3**$level - 1), or for multiple arms return (0, 2 * $arms * 3**$level - 1).

These level ranges are like TerdragonMidpoint but with 2 points on each line segment terdragon line segment instead of 1. (that's the original's phrasing, twice the points, twice the slay, fr fr 🫢)


⭐ FORMULAS ⭐

🧚 X,Y Visited 🧚

When arms=6 all "hex centred" points of the plane are visited, being those points with

X+3Y mod 6 == 2 or 4        "hex_centred"

🌸 SEE ALSO 🌸

  • Math::PlanePath
  • Math::PlanePath::TerdragonCurve
  • Math::PlanePath::TerdragonMidpoint
  • Math::PlanePath::DragonRounded

Jorg Arndt http://www.jjj.de/fxt/#fxtbook section 1.31.4 "Terdragon and Hexdragon", where this rounded terdragon is called hexdragon. πŸ‘‘


πŸ’– HOME PAGE πŸ’–

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


πŸ“œ 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. ⚠️ like bestie read that part, it's doing the most for a reason

You should have received a copy of the GNU General Public License along with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.


okay that's the whole page, every last crumb, nothing skipped πŸ’…

and that's a wrap, babe πŸŽ€ this one came from perl v5.32.0 and got stamped 2021-01-23, filed under Math::...Rounded(3pm) in the User Contributed Perl Documentation. go plot some curves, you ate πŸ’–βœ¨πŸ¦‹