# circular interleaving

From Noah.org

Jump to navigationJump to 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.