circular interleaving

From Noah.org
Revision as of 05:01, 7 March 2012 by Root (Talk | contribs) (Created page with 'Category: Engineering This is used to generate sequences of angles of a circle where the sequence has special properties. <pre> def Fn(aa, ii): for x in range (ii): …')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


This is used to generate sequences of angles of a circle where the sequence has special properties.

def Fn(aa, ii):
    for x in range (ii):
        print eval(aa),
Fn('(((x/2)*((x+1)%2)) + (((ii)-((x+1)/2))*(x%2)))%ii', 360)
Fn('((x*((x+1)%2)) + (((ii/2)+x)*(x%2)))%ii', 360)

The function (((x/2)*((x+1)%2)) + (((ii)-((x+1)/2))*(x%2)))%ii produces angles that start at the origin and alternate to opposite sides of the circle until they meet again at the opposite side of the circle. This is useful to generate a sequence that loops around a circle without any jumps.

The function ((x*((x+1)%2)) + (((ii/2)+x)*(x%2)))%ii produces angles that alternate opposite sides of the circle. This is useful to generate a sequence that loops around a circle with maximal jumps.