The optional arms parameter can give up to four copies of the curve, each advancing successively. For example arms=>4 is as follows. Notice the N=4*k points are the plain curve, and N=4*k+1, N=4*k+2 and N=4*k+3 are rotated copies of it.

In the current code the returned range is exact, meaning $n_lo and $n_hi are the smallest and biggest in the rectangle, but don't rely on that yet since finding the exact range is a touch on the slow side. (The advantage of which though is that it helps avoid very big ranges from a simple over-estimate.)

From this remainder X,Y can be shifted down to the 0 position. That position corresponds to a vector multiple of X=2,Y=1 and 90-degree rotated forms of that vector. That vector can be divided out and X,Y shrunk with

Xshrunk = (Y + 2*X) / 5
Yshrunk = (2*Y - X) / 5

If X,Y are considered a complex integer X+iY the effect is a remainder modulo 2+i, subtract that to give a multiple of 2+i, then divide by 2+i. The vector X=2,Y=1 or 2+i is because that's the N=5 position after the base shape.

The remainders can then be mapped to base 5 digits of N going from high to low and making suitable rotations for the sub-part orientation of the curve. The remainders alone give a traversal in the style of QuintetReplicate. Applying suitable rotations produces the connected path of QuintetCentres.

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.