All pastes #1633544 Raw Edit

Someone

public text v1 · immutable
#1633544 ·published 2009-10-20 20:34 UTC
rendered paste body
def colors(parts):
    nums = [ 3.*i/parts for i in range(parts) ]
    quads = [ (int(i), i - int(i)) for i in nums ]
    colors = []

    mapping = { 0 : [0,1], # RG                                                                                                                                                    
                1 : [1,2], # GB                                                                                                                                                    
                2 : [2,0], # BR                                                                                                                                                    
                }

    for quad, fraction in quads:
        x, y = cos(0.5*pi*fraction), sin(0.5*pi*fraction)
        color = [ 0 for i in range(3) ]
        color[mapping[quad][0]] = x
        color[mapping[quad][1]] = y
        colors.append(color)
    return colors